From f4a41051c370987cabff3504ff9c1f6e0e66fe53 Mon Sep 17 00:00:00 2001 From: Chaitanya Kumar Borah Date: Wed, 2 Sep 2026 13:24:11 +0530 Subject: [PATCH] drm/i915/display: simplify glk_plane_color_ctl_input_csc Add early return for non-YUV formats and hoist the duplicated color_range check out of the if/else branches. No functional change. Signed-off-by: Chaitanya Kumar Borah Reviewed-by: Uma Shankar Link: https://patch.msgid.link/20260902075417.656673-4-chaitanya.kumar.borah@intel.com --- drivers/gpu/drm/i915/display/skl_universal_plane.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c index e5384d2e5e8e..4aafd9ff3ac6 100644 --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c @@ -1248,7 +1248,10 @@ static u32 glk_plane_color_ctl_input_csc(const struct intel_plane_state *plane_s struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); u32 ctl = 0; - if (fb->format->is_yuv && !icl_is_hdr_plane(display, plane->id)) { + if (!fb->format->is_yuv) + return 0; + + if (!icl_is_hdr_plane(display, plane->id)) { switch (plane_state->hw.color_encoding) { case DRM_COLOR_YCBCR_BT709: ctl |= PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709; @@ -1259,14 +1262,13 @@ static u32 glk_plane_color_ctl_input_csc(const struct intel_plane_state *plane_s default: ctl |= PLANE_COLOR_CSC_MODE_YUV601_TO_RGB601; } - if (plane_state->hw.color_range == DRM_COLOR_YCBCR_FULL_RANGE) - ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE; - } else if (fb->format->is_yuv) { + } else { ctl |= PLANE_COLOR_INPUT_CSC_ENABLE; - if (plane_state->hw.color_range == DRM_COLOR_YCBCR_FULL_RANGE) - ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE; } + if (plane_state->hw.color_range == DRM_COLOR_YCBCR_FULL_RANGE) + ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE; + return ctl; }