All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Sharma <rahul.sharma@samsung.com>
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 <rahul.sharma@samsung.com>
Subject: [RFC 3/4] drm: add generic blob properties for image enhancement
Date: Thu, 06 Mar 2014 11:42:13 +0530	[thread overview]
Message-ID: <1394086334-20967-4-git-send-email-rahul.sharma@samsung.com> (raw)
In-Reply-To: <1394086334-20967-1-git-send-email-rahul.sharma@samsung.com>

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 <rahul.sharma@samsung.com>
---
 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
-- 
1.7.9.5

  parent reply	other threads:[~2014-03-06  6:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06  6:12 [RFC 0/4] drm: add generic KMS blob properties for image enhancement Rahul Sharma
2014-03-06  6:12 ` [RFC 1/4] drm: allow to create blank writable blob properties Rahul Sharma
2014-03-06  6:12 ` [RFC 2/4] drm: add ioctl to write into binary blob KMS properties Rahul Sharma
2014-03-06  6:12 ` Rahul Sharma [this message]
2014-03-07  8:36   ` [RFC 3/4] drm: add generic blob properties for image enhancement Daniel Vetter
2014-03-07 10:20     ` Rahul Sharma
2014-03-08  0:46       ` Matt Roper
2014-03-10  4:20         ` Rahul Sharma
2014-03-10  5:16           ` Daniel Vetter
2014-03-06  6:12 ` [RFC 4/4] drm: export create and destroy function for blob properties Rahul Sharma
2014-03-06  8:02 [RFC 0/4] drm: add generic KMS blob properties for image enhancement Rahul Sharma
2014-03-06  8:02 ` [RFC 3/4] drm: add generic " Rahul Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394086334-20967-4-git-send-email-rahul.sharma@samsung.com \
    --to=rahul.sharma@samsung.com \
    --cc=airlied@gmail.com \
    --cc=ajaykumar.rs@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=joshi@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=prashanth.g@samsung.com \
    --cc=r.sh.open@google.com \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.