Extended glk_plane_color_ctl to have plane color checks. This helps
enabling the csc, degamma or gamma block based on user inputs.

Co-developed-by: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>
Signed-off-by: Uma Shankar <uma.shan...@intel.com>
---
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 13 ++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h                    |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index ce7c367fe2da..c08875fa965e 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -965,7 +965,18 @@ static u32 glk_plane_color_ctl(const struct 
intel_crtc_state *crtc_state,
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
        u32 plane_color_ctl = 0;
 
-       plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
+       /* FIXME needs hw.gamma_lut */
+       if (!plane_state->uapi.color.pre_csc_lut)
+               plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
+
+       /* FIXME needs hw.degamma_lut */
+       if (plane_state->uapi.color.post_csc_lut)
+               plane_color_ctl |= PLANE_COLOR_PRE_CSC_GAMMA_ENABLE;
+
+       /* FIXME needs hw.ctm */
+       if (plane_state->uapi.color.ctm)
+               plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
+
        plane_color_ctl |= glk_plane_color_ctl_alpha(plane_state);
 
        if (fb->format->is_yuv && !icl_is_hdr_plane(dev_priv, plane->id)) {
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index e00e4d569ba9..d50bfe1000d3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3730,6 +3730,7 @@
 #define   PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709                
REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 2)
 #define   PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020      
REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 3)
 #define   PLANE_COLOR_CSC_MODE_RGB709_TO_RGB2020       
REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 4)
+#define   PLANE_COLOR_PRE_CSC_GAMMA_ENABLE             REG_BIT(14)
 #define   PLANE_COLOR_PLANE_GAMMA_DISABLE              REG_BIT(13)
 #define   PLANE_COLOR_ALPHA_MASK                       REG_GENMASK(5, 4)
 #define   PLANE_COLOR_ALPHA_DISABLE                    
REG_FIELD_PREP(PLANE_COLOR_ALPHA_MASK, 0)
-- 
2.38.1

Reply via email to