drm/i915/color: Add framework to program PRE/POST CSC LUT

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

v2: Add dsb support
v3: Align enum names
v4: Propagate change in lut data to crtc_state

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Link: https://patch.msgid.link/20251203085211.3663374-11-uma.shankar@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Uma Shankar 2025-12-03 14:22:06 +05:30 committed by Jani Nikula
parent 05df71544c
commit 3b7476e786
3 changed files with 21 additions and 1 deletions

View File

@ -93,6 +93,10 @@ struct intel_color_funcs {
/* Plane CSC*/ /* Plane CSC*/
void (*load_plane_csc_matrix)(struct intel_dsb *dsb, void (*load_plane_csc_matrix)(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state); 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) #define CTM_COEFF_SIGN (1ULL << 63)
@ -4077,11 +4081,23 @@ intel_color_load_plane_csc_matrix(struct intel_dsb *dsb,
display->funcs.color->load_plane_csc_matrix(dsb, plane_state); 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, void intel_color_plane_program_pipeline(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
if (plane_state->hw.ctm) if (plane_state->hw.ctm)
intel_color_load_plane_csc_matrix(dsb, plane_state); 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);
} }
void intel_color_crtc_init(struct intel_crtc *crtc) void intel_color_crtc_init(struct intel_crtc *crtc)

View File

@ -646,7 +646,7 @@ struct intel_plane_state {
enum drm_color_encoding color_encoding; enum drm_color_encoding color_encoding;
enum drm_color_range color_range; enum drm_color_range color_range;
enum drm_scaling_filter scaling_filter; enum drm_scaling_filter scaling_filter;
struct drm_property_blob *ctm; struct drm_property_blob *ctm, *degamma_lut, *gamma_lut;
} hw; } hw;
struct i915_vma *ggtt_vma; struct i915_vma *ggtt_vma;

View File

@ -344,6 +344,10 @@ intel_plane_colorop_replace_blob(struct intel_plane_state *plane_state,
{ {
if (intel_colorop->id == INTEL_PLANE_CB_CSC) if (intel_colorop->id == INTEL_PLANE_CB_CSC)
return drm_property_replace_blob(&plane_state->hw.ctm, blob); return drm_property_replace_blob(&plane_state->hw.ctm, blob);
else if (intel_colorop->id == INTEL_PLANE_CB_PRE_CSC_LUT)
return drm_property_replace_blob(&plane_state->hw.degamma_lut, blob);
else if (intel_colorop->id == INTEL_PLANE_CB_POST_CSC_LUT)
return drm_property_replace_blob(&plane_state->hw.gamma_lut, blob);
return false; return false;
} }