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: dcastagna@chromium.org, alexandru-cosmin.gheorghe@arm.com,
	seanpaul@chromium.org, ville.syrjala@intel.com,
	harry.wentland@amd.com, maarten.lankhorst@intel.com
Subject: [RFC v5 5/8] drm: Define helper function for plane color enabling
Date: Sun, 16 Sep 2018 13:45:28 +0530	[thread overview]
Message-ID: <1537085731-6355-6-git-send-email-uma.shankar@intel.com> (raw)
In-Reply-To: <1537085731-6355-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

v3: Modiefied the function to use updated property names.

v4: Rebase

v5: Moved helper function to drm_color_mgmt.c file to have all
color operations consolidated at one place. No logical change.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
---
 drivers/gpu/drm/drm_color_mgmt.c | 42 ++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_color_mgmt.h     |  5 +++++
 2 files changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index 5155add..82e0bd1 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -493,6 +493,48 @@ int drm_plane_create_color_properties(struct drm_plane *plane,
 EXPORT_SYMBOL(drm_plane_create_color_properties);
 
 /**
+ * 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)
+{
+	if (plane_degamma_lut_size) {
+		drm_object_attach_property(&plane->base,
+				plane->degamma_lut_property, 0);
+		drm_object_attach_property(&plane->base,
+				plane->degamma_lut_size_property,
+				plane_degamma_lut_size);
+	}
+
+	if (plane_has_ctm)
+		drm_object_attach_property(&plane->base,
+				plane->ctm_property, 0);
+
+	if (plane_gamma_lut_size) {
+		drm_object_attach_property(&plane->base,
+				plane->gamma_lut_property, 0);
+		drm_object_attach_property(&plane->base,
+				plane->gamma_lut_size_property,
+				plane_gamma_lut_size);
+	}
+}
+EXPORT_SYMBOL(drm_plane_enable_color_mgmt);
+
+/**
  * DOC: Plane Color Properties
  *
  * Plane Color management or color space adjustments is supported
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index 78b5a37..ce5969a 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -69,4 +69,9 @@ int drm_plane_create_color_properties(struct drm_plane *plane,
 				      u32 supported_ranges,
 				      enum drm_color_encoding default_encoding,
 				      enum drm_color_range default_range);
+
+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.9.1

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

  parent reply	other threads:[~2018-09-16  8:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-16  8:15 [RFC v5 0/8] Add Plane Color Properties Uma Shankar
2018-09-16  8:15 ` [RFC v5 1/8] drm: Add Enhanced Gamma LUT precision structure Uma Shankar
2018-11-05 18:17   ` [Intel-gfx] " Matt Roper
2018-11-06  9:03   ` Daniel Vetter
2018-09-16  8:15 ` [RFC v5 2/8] drm: Add Plane Degamma properties Uma Shankar
2018-09-18 16:08   ` Alexandru-Cosmin Gheorghe
2018-11-14  1:08   ` Matt Roper
2018-11-14 13:59     ` Shankar, Uma
2018-09-16  8:15 ` [RFC v5 3/8] drm: Add Plane CTM property Uma Shankar
2018-09-16  8:15 ` [RFC v5 4/8] drm: Add Plane Gamma properties Uma Shankar
2018-09-16  8:15 ` Uma Shankar [this message]
2018-09-16  8:15 ` [RFC v5 6/8] drm/i915: Enable plane color features Uma Shankar
2018-09-16  8:15 ` [RFC v5 7/8] drm/i915: Implement Plane Gamma for Bdw and Gen9 platforms Uma Shankar
2018-09-16  8:15 ` [RFC v5 8/8] drm/i915: Load plane color luts from atomic flip Uma Shankar
2018-09-18 15:53 ` [RFC v5 0/8] Add Plane Color Properties Alexandru-Cosmin Gheorghe
2018-09-26  7:35 ` Lankhorst, Maarten
2018-09-26  8:59   ` Shankar, Uma

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=1537085731-6355-6-git-send-email-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=alexandru-cosmin.gheorghe@arm.com \
    --cc=dcastagna@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@intel.com \
    --cc=seanpaul@chromium.org \
    --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).