From patchwork Thu Mar 6 06:12:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 3781801 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A07799F35F for ; Thu, 6 Mar 2014 06:13:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A43CE201DD for ; Thu, 6 Mar 2014 06:13:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79682201E4 for ; Thu, 6 Mar 2014 06:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751822AbaCFGNG (ORCPT ); Thu, 6 Mar 2014 01:13:06 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:26169 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbaCFGNF (ORCPT ); Thu, 6 Mar 2014 01:13:05 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N20005573XRA680@mailout2.samsung.com> for linux-samsung-soc@vger.kernel.org; Thu, 06 Mar 2014 15:13:04 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 3F.70.12635.FE118135; Thu, 06 Mar 2014 15:13:03 +0900 (KST) X-AuditID: cbfee68d-b7fcd6d00000315b-9e-531811ef3e03 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F1.4E.28157.FE118135; Thu, 06 Mar 2014 15:13:03 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N2000AL63X9JW40@mmp1.samsung.com>; Thu, 06 Mar 2014 15:13:03 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Cc: airlied@gmail.com, inki.dae@samsung.com, prashanth.g@samsung.com, seanpaul@chromium.org, marcheu@chromium.org, joshi@samsung.com, linux-samsung-soc@vger.kernel.org, r.sh.open@google.com, ajaykumar.rs@samsung.com, Rahul Sharma Subject: [RFC 3/4] drm: add generic blob properties for image enhancement Date: Thu, 06 Mar 2014 11:42:13 +0530 Message-id: <1394086334-20967-4-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1394086334-20967-1-git-send-email-rahul.sharma@samsung.com> References: <1394086334-20967-1-git-send-email-rahul.sharma@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeLIzCtJLcpLzFFi42JZI2JSo/teUCLYoGGvkcWJ64uYLA68P8hi ceXrezaLSfcnsFh83/WF3WLG+X1MFvMO/Wa0WHV4A7vFxglbGS2mLDrManF3w1lGB26P2Q0X WTx2zrrL7rFgU6nH/e7jTB59W1YxenzeJBfAFsVlk5Kak1mWWqRvl8CVceHXUqaC22YVDc2L GRsY1+h1MXJySAiYSEzvmMUGYYtJXLi3Hsjm4hASWMooMeNhAxtM0aRvC1ghEosYJfob57JA OO1MEhOWnWMHqWIT0JWYffAZI4gtIqAs8XfiKkaQImaBNiaJ3b29TCAJYQFPiWNzu1hAbBYB VYl7V5+DxXkFPCR6l98BWsEBtE5BYs4kG5AwJ1B595+JYCVCQCVz+9czgcyUEDjELnFg6RR2 iDkCEt8mH2KB6JWV2HSAGeJqSYmDK26wTGAUXsDIsIpRNLUguaA4Kb3IUK84Mbe4NC9dLzk/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2Ke2UEws+O+kg0Vpa2w8vZm3K3h3PLC8dsH4VpJGeavIfb4H fsFFG5i+tX7Ka9yso8n0vGXR7zexZ5TzTzxd93SJqP4HxoKpEnPt7P8U+knuWzJRwjPmV/3T L5nNiV0CE8WUWIozEg21mIuKEwEJfn+B/wIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add generic KMS blob properties to core drm framework. These are writable blob properties which can be used to set Image Enhancement parameters. The properties which are added here are meant for color reproduction, color saturation and edge enhancement. Signed-off-by: Rahul Sharma --- drivers/gpu/drm/drm_crtc.c | 115 +++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 13 +++++ include/uapi/drm/drm_mode.h | 41 +++++++++++++++ 3 files changed, 169 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index a2b87a5..8771abf 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1260,6 +1260,121 @@ int drm_mode_create_dirty_info_property(struct drm_device *dev) } EXPORT_SYMBOL(drm_mode_create_dirty_info_property); +/** + * drm_mode_create_color_saturation_property - create property for color saturation + * @dev: DRM device + * + */ +int drm_mode_create_color_saturation_property( + struct drm_device *dev) +{ + struct drm_mode_color_saturation *params; + struct drm_property *prop; + char prop_name[] = "color saturation"; + + if (dev->mode_config.color_saturation_property || + dev->mode_config.color_saturation_blob_ptr) + return -EEXIST; + + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + prop_name, 0); + if (!prop) { + DRM_ERROR("fail to create %s property.\n", prop_name); + return -ENOMEM; + } + + dev->mode_config.color_saturation_blob_ptr = + drm_property_create_blob(dev, sizeof(*params), + NULL); + if (!dev->mode_config.color_saturation_blob_ptr) { + DRM_ERROR("failed to allocate blob for %s.\n", prop_name); + drm_property_destroy(dev, prop); + return -ENOMEM; + } + + dev->mode_config.color_saturation_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_mode_create_color_saturation_property); + +/** + * drm_mode_create_color_reproduction_property - create property for color reproduction + * @dev: DRM device + * + */ +int drm_mode_create_color_reproduction_property( + struct drm_device *dev) +{ + struct drm_mode_color_reproduction *params; + struct drm_property *prop; + char prop_name[] = "color reproduction"; + + if (dev->mode_config.color_reproduction_property || + dev->mode_config.color_reproduction_blob_ptr) + return -EEXIST; + + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + prop_name, 0); + if (!prop) { + DRM_ERROR("fail to create %s property.\n", prop_name); + return -ENOMEM; + } + + dev->mode_config.color_reproduction_blob_ptr = + drm_property_create_blob(dev, sizeof(*params), + NULL); + if (!dev->mode_config.color_reproduction_blob_ptr) { + DRM_ERROR("failed to allocate blob for %s\n", prop_name); + drm_property_destroy(dev, prop); + return -ENOMEM; + } + + dev->mode_config.color_reproduction_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_mode_create_color_reproduction_property); + + +/** + * drm_mode_create_edge_enhancement_property - create property for edge enhancement + * @dev: DRM device + * + */ +int drm_mode_create_edge_enhancement_property( + struct drm_device *dev) +{ + struct drm_mode_edge_enhancement *params; + struct drm_property *prop; + char prop_name[] = "edge enhancement"; + + if (dev->mode_config.edge_enhancement_property || + dev->mode_config.edge_enhancement_blob_ptr) + return -EEXIST; + + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + prop_name, 0); + if (!prop) { + DRM_ERROR("fail to create %s property.\n", prop_name); + return -ENOMEM; + } + + dev->mode_config.edge_enhancement_blob_ptr = + drm_property_create_blob(dev, sizeof(*params), + NULL); + if (!dev->mode_config.edge_enhancement_blob_ptr) { + DRM_ERROR("failed to allocate blob for %s\n", prop_name); + drm_property_destroy(dev, prop); + return -ENOMEM; + } + + dev->mode_config.edge_enhancement_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_mode_create_edge_enhancement_property); + static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group) { uint32_t total_objects = 0; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 82f2016..df7b178 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -901,6 +901,13 @@ struct drm_mode_config { /* Optional properties */ struct drm_property *scaling_mode_property; struct drm_property *dirty_info_property; + struct drm_property *color_saturation_property; + struct drm_property *color_reproduction_property; + struct drm_property *edge_enhancement_property; + + struct drm_property_blob *color_saturation_blob_ptr; + struct drm_property_blob *color_reproduction_blob_ptr; + struct drm_property_blob *edge_enhancement_blob_ptr; /* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow; @@ -1079,6 +1086,12 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); extern int drm_mode_create_dirty_info_property(struct drm_device *dev); extern const char *drm_get_encoder_name(const struct drm_encoder *encoder); +extern int drm_mode_create_color_saturation_property( + struct drm_device *dev); +extern int drm_mode_create_color_reproduction_property( + struct drm_device *dev); +extern int drm_mode_create_edge_enhancement_property( + struct drm_device *dev); extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, struct drm_encoder *encoder); diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 1d8216d..d28f82d 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -504,4 +504,45 @@ struct drm_mode_destroy_dumb { uint32_t handle; }; +/* set up parameters for finer color saturation */ +struct drm_mode_color_saturation { + /* hue gain for individual colors */ + uint16_t hue_gain_red; + uint16_t hue_gain_green; + uint16_t hue_gain_blue; + uint16_t hue_gain_cyan; + uint16_t hue_gain_magenta; + uint16_t hue_gain_yellow; + /* hue gain for overall display */ + uint16_t hue_gain_overall; +}; + +/* set up parameters for standard color reproduction */ +struct drm_mode_color_reproduction { + /* 16 bit rgb value for primary colors */ + uint16_t red_rgb[3]; + uint16_t green_rgb[3]; + uint16_t blue_rgb[3]; + uint16_t cyan_rgb[3]; + uint16_t magenta_rgb[3]; + uint16_t yellow_rgb[3]; + uint16_t white_rgb[3]; + uint16_t black_rgb[3]; +}; + +/* set up parameters for edge enhancement */ +struct drm_mode_edge_enhancement { + /* threshold values for edge and background*/ + uint16_t edge_th; + uint16_t background_th; + /* postive gain */ + uint16_t pg_edge; + uint16_t pg_flat; + uint16_t pg_background; + /* negative gain */ + uint16_t ng_edge; + uint16_t ng_flat; + uint16_t ng_background; +}; + #endif