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

Add framework that will help in loading LUT to Pre/Post CSC color
blocks.

v2: Add dsb support

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c       | 16 ++++++++++++++++
 .../gpu/drm/i915/display/intel_display_types.h   |  2 +-
 drivers/gpu/drm/i915/display/intel_plane.c       |  4 ++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_color.c 
b/drivers/gpu/drm/i915/display/intel_color.c
index 25b992939e42..c7378af8fbdf 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -96,6 +96,10 @@ struct intel_color_funcs {
        /* Plane CSC*/
        void (*load_plane_csc_matrix)(struct intel_dsb *dsb,
                                      const struct intel_plane_state 
*plane_state);
+
+       /* Plane Pre/Post CSC */
+       void (*load_plane_luts)(struct intel_dsb *dsb,
+                               const struct intel_plane_state *plane_state);
 };
 
 #define CTM_COEFF_SIGN (1ULL << 63)
@@ -4091,11 +4095,23 @@ intel_color_load_plane_csc_matrix(struct intel_dsb *dsb,
                display->funcs.color->load_plane_csc_matrix(dsb, plane_state);
 }
 
+static void
+intel_color_load_plane_luts(struct intel_dsb *dsb,
+                           const struct intel_plane_state *plane_state)
+{
+       struct intel_display *display = to_intel_display(plane_state);
+
+       if (display->funcs.color->load_plane_luts)
+               display->funcs.color->load_plane_luts(dsb, plane_state);
+}
+
 void intel_color_plane_program_pipeline(struct intel_dsb *dsb,
                                        const struct intel_plane_state 
*plane_state)
 {
        if (plane_state->hw.ctm)
                intel_color_load_plane_csc_matrix(dsb, plane_state);
+       if (plane_state->hw.degamma_lut || plane_state->hw.gamma_lut)
+               intel_color_load_plane_luts(dsb, plane_state);
 }
 
 struct intel_plane_colorop *intel_colorop_alloc(void)
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index c709df0cea9e..54b9680aa6f6 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -634,7 +634,7 @@ struct intel_plane_state {
                enum drm_color_encoding color_encoding;
                enum drm_color_range color_range;
                enum drm_scaling_filter scaling_filter;
-               struct drm_property_blob *ctm;
+               struct drm_property_blob *ctm, *degamma_lut, *gamma_lut;
        } hw;
 
        struct i915_vma *ggtt_vma;
diff --git a/drivers/gpu/drm/i915/display/intel_plane.c 
b/drivers/gpu/drm/i915/display/intel_plane.c
index cc8f3e15c82e..e6411fbfd613 100644
--- a/drivers/gpu/drm/i915/display/intel_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_plane.c
@@ -387,6 +387,10 @@ intel_plane_colorop_replace_blob(struct intel_plane_state 
*plane_state,
 {
        if (intel_colorop->id == CB_PLANE_CSC)
                drm_property_replace_blob(&plane_state->hw.ctm, blob);
+       else if (intel_colorop->id == CB_PLANE_PRE_CSC_LUT)
+               drm_property_replace_blob(&plane_state->hw.degamma_lut, blob);
+       else if (intel_colorop->id == CB_PLANE_POST_CSC_LUT)
+               drm_property_replace_blob(&plane_state->hw.gamma_lut, blob);
 }
 
 static void
-- 
2.42.0

Reply via email to