dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: ville.syrjala@intel.com, maarten.lankhorst@intel.com
Subject: [RFC 4/7] drm: Define helper function for plane color enabling
Date: Tue,  7 Nov 2017 17:36:28 +0530	[thread overview]
Message-ID: <1510056391-9684-5-git-send-email-uma.shankar@intel.com> (raw)
In-Reply-To: <1510056391-9684-1-git-send-email-uma.shankar@intel.com>

Define helper function to enable Plane color features
to attach plane color properties to plane structure.

v2: Rebase

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_plane.c  |   45 ++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_color_mgmt.h |    5 +++++
 2 files changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 19404e3..e9f2dab 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -144,6 +144,51 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 }
 
 /**
+ * drm_plane_enable_color_mgmt - enable color management properties
+ * @plane: DRM Plane
+ * @plane_degamma_lut_size: the size of the degamma lut (before CSC)
+ * @plane_has_ctm: whether to attach ctm_property for CSC matrix
+ * @plane_gamma_lut_size: the size of the gamma lut (after CSC)
+ *
+ * This function lets the driver enable the color correction
+ * properties on a plane. This includes 3 degamma, csc and gamma
+ * properties that userspace can set and 2 size properties to inform
+ * the userspace of the lut sizes. Each of the properties are
+ * optional. The gamma and degamma properties are only attached if
+ * their size is not 0 and ctm_property is only attached if has_ctm is
+ * true.
+ */
+void drm_plane_enable_color_mgmt(struct drm_plane *plane,
+				uint plane_degamma_lut_size,
+				bool plane_has_ctm,
+				uint plane_gamma_lut_size)
+{
+	struct drm_device *dev = plane->dev;
+	struct drm_mode_config *config = &dev->mode_config;
+
+	if (plane_degamma_lut_size) {
+		drm_object_attach_property(&plane->base,
+				config->plane_degamma_lut_property, 0);
+		drm_object_attach_property(&plane->base,
+				config->plane_degamma_lut_size_property,
+				plane_degamma_lut_size);
+	}
+
+	if (plane_has_ctm)
+		drm_object_attach_property(&plane->base,
+				config->plane_ctm_property, 0);
+
+	if (plane_gamma_lut_size) {
+		drm_object_attach_property(&plane->base,
+				config->plane_gamma_lut_property, 0);
+		drm_object_attach_property(&plane->base,
+				config->plane_gamma_lut_size_property,
+				plane_gamma_lut_size);
+	}
+}
+EXPORT_SYMBOL(drm_plane_enable_color_mgmt);
+
+/**
  * drm_universal_plane_init - Initialize a new universal plane object
  * @dev: DRM device
  * @plane: plane object to init
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index 03a59cb..155a9ba 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -37,4 +37,9 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
 int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 				 int gamma_size);
 
+void drm_plane_enable_color_mgmt(struct drm_plane *plane,
+				 uint plane_degamma_lut_size,
+				 bool plane_has_ctm,
+				 uint plane_gamma_lut_size);
+
 #endif
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-11-07 12:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 12:06 [PATCH 0/7] Add Plane Color Properties Uma Shankar
2017-11-07 12:06 ` [RFC 1/7] drm: Add Plane Degamma properties Uma Shankar
2017-11-07 15:43   ` [Intel-gfx] " Emil Velikov
2017-11-07 17:49   ` Brian Starkey
2017-11-07 18:09     ` Brian Starkey
2017-11-09 12:55       ` Shankar, Uma
2017-11-07 12:06 ` [RFC 2/7] drm: Add Plane CTM property Uma Shankar
2017-11-07 17:39   ` Brian Starkey
2017-11-08  9:08     ` Shankar, Uma
2017-11-07 12:06 ` [RFC 3/7] drm: Add Plane Gamma properties Uma Shankar
2017-11-07 12:06 ` Uma Shankar [this message]
2017-11-07 12:06 ` [RFC 5/7] drm/i915: Enable plane color features Uma Shankar
2017-11-07 12:06 ` [RFC 6/7] drm/i915: Implement Plane Gamma for Bdw and Gen9 platforms Uma Shankar
2017-11-07 12:06 ` [RFC 7/7] drm/i915: Load plane color luts from atomic flip Uma Shankar
2017-11-07 16:13 ` [Intel-gfx] [PATCH 0/7] Add Plane Color Properties Daniel Stone
2017-11-10  8:37   ` Shankar, Uma
2017-11-13 10:30     ` [Intel-gfx] " Daniel Stone

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=1510056391-9684-5-git-send-email-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@intel.com \
    --cc=ville.syrjala@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).