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

Add callback to intel color functions for setting plane CTM.

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/intel_color.c | 22 ++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_color.h |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_color.c 
b/drivers/gpu/drm/i915/display/intel_color.c
index 06268e89125e..8dc72ad25700 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -81,6 +81,10 @@ struct intel_color_funcs {
         * Read config other than LUTs and CSCs, before them. Optional.
         */
        void (*get_config)(struct intel_crtc_state *crtc_state);
+
+       /* Plane CSC*/
+       void (*load_plane_csc_matrix)(const struct drm_plane_state *plane_state,
+                                     const struct drm_property_blob *blob);
 };
 
 #define CTM_COEFF_SIGN (1ULL << 63)
@@ -3684,6 +3688,15 @@ static void icl_read_luts(struct intel_crtc_state 
*crtc_state)
        }
 }
 
+void intel_color_load_plane_csc_matrix(const struct drm_plane_state 
*plane_state,
+                                      const struct drm_property_blob *blob)
+{
+       struct drm_i915_private *i915 = to_i915(plane_state->plane->dev);
+
+       if (i915->display.funcs.color->load_plane_csc_matrix)
+               i915->display.funcs.color->load_plane_csc_matrix(plane_state, 
blob);
+}
+
 static const struct intel_color_funcs chv_color_funcs = {
        .color_check = chv_color_check,
        .color_commit_arm = i9xx_color_commit_arm,
@@ -3953,6 +3966,15 @@ static void apply_colorop(const struct drm_plane_state 
*plane_state,
                          struct drm_colorop *colorop,
                          u32 *plane_color_ctl)
 {
+       struct drm_colorop_state *state = colorop->state;
+       struct intel_plane_colorop *intel_colorop = 
to_intel_plane_colorop(colorop);
+
+       if (colorop->type == DRM_COLOROP_CTM_3X3) {
+               /* TODO: use intel_color_op state data */
+               (*plane_color_ctl) |= PLANE_COLOR_PLANE_CSC_ENABLE;
+               if (state->data && intel_colorop->id == CB_PLANE_CSC)
+                       intel_color_load_plane_csc_matrix(plane_state, 
state->data);
+       }
 }
 
 void intel_program_pipeline(const struct drm_plane_state *plane_state, u32 
*plane_color_ctl)
diff --git a/drivers/gpu/drm/i915/display/intel_color.h 
b/drivers/gpu/drm/i915/display/intel_color.h
index bde880370ecc..3f1466f88c11 100644
--- a/drivers/gpu/drm/i915/display/intel_color.h
+++ b/drivers/gpu/drm/i915/display/intel_color.h
@@ -43,5 +43,7 @@ int intel_plane_tf_pipeline_init(struct drm_plane *plane, 
struct drm_prop_enum_l
 int intel_plane_color_init(struct drm_plane *plane);
 void intel_program_pipeline(const struct drm_plane_state *plane_state,
                            u32 *plane_color_ctl);
+void intel_color_load_plane_csc_matrix(const struct drm_plane_state 
*plane_state,
+                                      const struct drm_property_blob *blob);
 
 #endif /* __INTEL_COLOR_H__ */
-- 
2.42.0

Reply via email to