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: [v7 05/16] drm: Define helper function for plane color enabling
Date: Fri, 29 Mar 2019 01:46:03 +0530 [thread overview]
Message-ID: <1553804174-2651-6-git-send-email-uma.shankar@intel.com> (raw)
In-Reply-To: <1553804174-2651-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 f168609..9cedd27 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -484,6 +484,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,
+ u32 plane_degamma_lut_size,
+ bool plane_has_ctm,
+ u32 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 c9d2746..8726cee 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -71,6 +71,11 @@ int drm_plane_create_color_properties(struct drm_plane *plane,
enum drm_color_encoding default_encoding,
enum drm_color_range default_range);
+void drm_plane_enable_color_mgmt(struct drm_plane *plane,
+ u32 plane_degamma_lut_size,
+ bool plane_has_ctm,
+ u32 plane_gamma_lut_size);
+
/**
* enum drm_color_lut_tests - hw-specific LUT tests to perform
*
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-03-28 20:16 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 20:15 [v7 00/16] Add Plane Color Properties Uma Shankar
2019-03-28 20:15 ` ✗ Fi.CI.BAT: failure for Add Plane Color Properties (rev7) Patchwork
2019-03-28 20:15 ` [v7 01/16] drm: Add Enhanced Gamma LUT precision structure Uma Shankar
2019-08-13 9:41 ` [v7, " james qian wang (Arm Technology China)
2019-08-14 14:29 ` Shankar, Uma
2019-08-19 7:59 ` james qian wang (Arm Technology China)
2019-03-28 20:16 ` [v7 02/16] drm: Add Plane Degamma properties Uma Shankar
2019-03-28 20:16 ` [v7 03/16] drm: Add Plane CTM property Uma Shankar
2019-03-28 20:16 ` [v7 04/16] drm: Add Plane Gamma properties Uma Shankar
2019-03-28 20:16 ` Uma Shankar [this message]
2019-03-28 20:16 ` [v7 06/16] drm/i915: Enable plane color features Uma Shankar
2019-03-28 20:16 ` [v7 07/16] drm/i915: Implement Plane Gamma for Bdw and Gen9 platforms Uma Shankar
2019-03-28 20:16 ` [v7 08/16] drm/i915: Load plane color luts from atomic flip Uma Shankar
2019-03-28 20:16 ` [v7 09/16] drm/i915: Add plane color capabilities Uma Shankar
2019-03-28 20:16 ` [v7 10/16] drm/i915/icl: Add ICL Plane Degamma Register definition Uma Shankar
2019-03-28 20:16 ` [v7 11/16] drm/i915/icl: Enable Plane Degamma Uma Shankar
2019-03-28 20:16 ` [v7 12/16] drm/i915/icl: Add Plane Gamma Register Definitions Uma Shankar
2019-03-28 20:16 ` [v7 13/16] drm/i915/icl: Implement Plane Gamma Uma Shankar
2019-03-28 20:16 ` [v7 14/16] drm/i915: Enable Plane Gamma/Degamma Uma Shankar
2019-03-28 20:16 ` [v7 15/16] drm/i915: Define Plane CSC Registers Uma Shankar
2019-03-28 20:16 ` [v7 16/16] drm/i915: Enable Plane CSC Uma Shankar
2019-06-14 16:17 ` [v7 00/16] Add Plane Color Properties Ezequiel Garcia
2019-06-14 21:22 ` Ezequiel Garcia
2019-06-19 6:20 ` Shankar, Uma
2019-06-19 13:18 ` Ezequiel Garcia
2019-06-19 15:03 ` Ville Syrjälä
2019-06-19 15:33 ` Ezequiel Garcia
2019-06-19 16:29 ` Ville Syrjälä
2019-06-20 13:42 ` 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=1553804174-2651-6-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