drm/i915: Reject YCbCr output with degamma+gamma on pre-icl
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 26 Oct 2022 11:39:04 +0000 (14:39 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 3 Nov 2022 16:16:18 +0000 (18:16 +0200)
Since the pipe CSC sits between the degamma and gamma LUTs there
is no way to make us it for RGB->YCbCr conversion when both LUTs
are also active. Simply reject such combos.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026113906.10551-10-ville.syrjala@linux.intel.com
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
drivers/gpu/drm/i915/display/intel_color.c

index 435394cad359ed6b9296e3a6c6261121e57f6d7d..926784f266f239cb83b847e8a871ec5fb18b41e1 100644 (file)
@@ -1556,7 +1556,14 @@ static int ivb_color_check(struct intel_crtc_state *crtc_state)
        if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB &&
            crtc_state->hw.ctm) {
                drm_dbg_kms(&i915->drm,
-                           "YCBCR and CTM together are not possible\n");
+                           "YCbCr and CTM together are not possible\n");
+               return -EINVAL;
+       }
+
+       if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB &&
+           crtc_state->hw.degamma_lut && crtc_state->hw.gamma_lut) {
+               drm_dbg_kms(&i915->drm,
+                           "YCbCr and degamma+gamma together are not possible\n");
                return -EINVAL;
        }
 
@@ -1622,7 +1629,14 @@ static int glk_color_check(struct intel_crtc_state *crtc_state)
        if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB &&
            crtc_state->hw.ctm) {
                drm_dbg_kms(&i915->drm,
-                           "YCBCR and CTM together are not possible\n");
+                           "YCbCr and CTM together are not possible\n");
+               return -EINVAL;
+       }
+
+       if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB &&
+           crtc_state->hw.degamma_lut && crtc_state->hw.gamma_lut) {
+               drm_dbg_kms(&i915->drm,
+                           "YCbCr and degamma+gamma together are not possible\n");
                return -EINVAL;
        }