[PATCH v2 12/13] drm/i915/color: Program plane YUV range correction colorop

Chaitanya Kumar Borah
2026-04-08T05:40:50Z

Hook up the INTEL_PLANE_CB_YUV_RANGE_CORRECT colorop to plane state and
program the corresponding plane color control bits. Track the colorop
state in intel_plane_state and enable/disable YUV range correction
based on the colorop bypass state.

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
---
drivers/gpu/drm/i915/display/intel_display_types.h | 1 +
drivers/gpu/drm/i915/display/intel_plane.c | 3 +++
drivers/gpu/drm/i915/display/skl_universal_plane.c | 5 ++++-
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 3347bba598d9..8f942683fc5c 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -681,6 +681,7 @@ struct intel_plane_state {
struct drm_property_blob *ctm, *degamma_lut, *gamma_lut, *lut_3d;
enum drm_colorop_fixed_matrix_type csc_ff_type; /* For SDR plane */
bool csc_ff_enable;
+ bool yuv_range_correct;
} 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 3ef43db8d5d7..0ef06a42f2ac 100644
--- a/drivers/gpu/drm/i915/display/intel_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_plane.c
@@ -384,6 +384,9 @@ intel_plane_color_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
!new_colorop_state->bypass;
plane_state->hw.csc_ff_type =
new_colorop_state->fixed_matrix_type;
+ } else if (intel_colorop->id == INTEL_PLANE_CB_YUV_RANGE_CORRECT) {
+ plane_state->hw.yuv_range_correct =
+ !new_colorop_state->bypass;
} else {
blob = new_colorop_state->bypass ?
NULL : new_colorop_state->data;
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 2234abcd1b03..560093940ae3 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -1297,9 +1297,12 @@ static u32 glk_plane_color_ctl(const struct intel_plane_state *plane_state)
plane_color_ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
}

- if (!icl_is_hdr_plane(display, plane->id))
+ if (!icl_is_hdr_plane(display, plane->id)) {
plane_color_ctl |= intel_csc_ff_type_to_csc_mode(plane_state->hw.csc_ff_type,
plane_state->hw.csc_ff_enable);
+ plane_color_ctl |= plane_state->hw.yuv_range_correct ? 0 :
+ PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
+ }

if (plane_state->force_black)
plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
--
2.25.1