From: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>

Expose color pipeline and add ability to program it.

v2: Set bit to enable multisegmented lut

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>
Signed-off-by: Uma Shankar <uma.shan...@intel.com>
---
 .../gpu/drm/i915/display/skl_universal_plane.c  | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index e20972ddfa09..f3ae80471d73 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -11,6 +11,7 @@
 #include "pxp/intel_pxp.h"
 #include "i915_drv.h"
 #include "intel_bo.h"
+#include "intel_color.h"
 #include "intel_de.h"
 #include "intel_display_irq.h"
 #include "intel_display_regs.h"
@@ -1260,6 +1261,18 @@ static u32 glk_plane_color_ctl(const struct 
intel_crtc_state *crtc_state,
        if (plane_state->force_black)
                plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
 
+       if (plane_state->hw.degamma_lut)
+               plane_color_ctl |= PLANE_COLOR_PRE_CSC_GAMMA_ENABLE;
+
+       if (plane_state->hw.ctm)
+               plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
+
+       if (plane_state->hw.gamma_lut) {
+               plane_color_ctl &= ~PLANE_COLOR_PLANE_GAMMA_DISABLE;
+               if (drm_color_lut_32_size(plane_state->hw.gamma_lut) != 32)
+                       plane_color_ctl |= 
PLANE_COLOR_POST_CSC_GAMMA_MULTSEG_ENABLE;
+       }
+
        return plane_color_ctl;
 }
 
@@ -1548,6 +1561,8 @@ icl_plane_update_noarm(struct intel_dsb *dsb,
        plane_color_ctl = plane_state->color_ctl |
                glk_plane_color_ctl_crtc(crtc_state);
 
+       intel_color_plane_program_pipeline(crtc_state->dsb_color, plane_state);
+
        /* The scaler will handle the output position */
        if (plane_state->scaler_id >= 0) {
                crtc_x = 0;
@@ -2982,6 +2997,8 @@ skl_universal_plane_create(struct intel_display *display,
                                          DRM_COLOR_YCBCR_BT709,
                                          DRM_COLOR_YCBCR_LIMITED_RANGE);
 
+       intel_plane_color_init(&plane->base);
+
        drm_plane_create_alpha_property(&plane->base);
        drm_plane_create_blend_mode_property(&plane->base,
                                             BIT(DRM_MODE_BLEND_PIXEL_NONE) |
-- 
2.42.0

Reply via email to