Extract the input CSC and YUV range correction logic from
glk_plane_color_ctl() into a dedicated glk_plane_color_ctl_input_csc()
helper. No functional change.

Signed-off-by: Chaitanya Kumar Borah <[email protected]>
---
 .../drm/i915/display/skl_universal_plane.c    | 32 +++++++++++--------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index ad4bfff6903d..50c6ceef9b9a 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -1240,37 +1240,43 @@ static u32 glk_plane_color_ctl_crtc(const struct 
intel_crtc_state *crtc_state)
        return plane_color_ctl;
 }
 
-static u32 glk_plane_color_ctl(const struct intel_plane_state *plane_state)
+static u32 glk_plane_color_ctl_input_csc(const struct intel_plane_state 
*plane_state)
 {
        struct intel_display *display = to_intel_display(plane_state);
        const struct drm_framebuffer *fb = plane_state->hw.fb;
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
-       u32 plane_color_ctl = 0;
-
-       plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
-       plane_color_ctl |= glk_plane_color_ctl_alpha(plane_state);
+       u32 ctl = 0;
 
        if (fb->format->is_yuv && !icl_is_hdr_plane(display, plane->id)) {
                switch (plane_state->hw.color_encoding) {
                case DRM_COLOR_YCBCR_BT709:
-                       plane_color_ctl |= 
PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
+                       ctl |= PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
                        break;
                case DRM_COLOR_YCBCR_BT2020:
-                       plane_color_ctl |=
-                               PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020;
+                       ctl |= PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020;
                        break;
                default:
-                       plane_color_ctl |=
-                               PLANE_COLOR_CSC_MODE_YUV601_TO_RGB601;
+                       ctl |= PLANE_COLOR_CSC_MODE_YUV601_TO_RGB601;
                }
                if (plane_state->hw.color_range == DRM_COLOR_YCBCR_FULL_RANGE)
-                       plane_color_ctl |= 
PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
+                       ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
        } else if (fb->format->is_yuv) {
-               plane_color_ctl |= PLANE_COLOR_INPUT_CSC_ENABLE;
+               ctl |= PLANE_COLOR_INPUT_CSC_ENABLE;
                if (plane_state->hw.color_range == DRM_COLOR_YCBCR_FULL_RANGE)
-                       plane_color_ctl |= 
PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
+                       ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
        }
 
+       return ctl;
+}
+
+static u32 glk_plane_color_ctl(const struct intel_plane_state *plane_state)
+{
+       u32 plane_color_ctl = 0;
+
+       plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
+       plane_color_ctl |= glk_plane_color_ctl_alpha(plane_state);
+       plane_color_ctl |= glk_plane_color_ctl_input_csc(plane_state);
+
        if (plane_state->force_black)
                plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
 
-- 
2.25.1

Reply via email to