drm/i915: Make ilk_read_luts() capable of degamma readout
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 14 Nov 2022 15:37:24 +0000 (17:37 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 22 Nov 2022 12:44:47 +0000 (14:44 +0200)
Just like ivb+, ilk/snb can select whether the hw lut acts as
gamma or degamma. Make the readout cognizant of that fact.

v2: deal with pre_csc_lut
v3: use ilk_has_post_csc_lut() helper

Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221114153732.11773-13-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_color.c

index 583a933..ef17183 100644 (file)
@@ -2176,19 +2176,19 @@ static struct drm_property_blob *ilk_read_lut_10(struct intel_crtc *crtc)
 static void ilk_read_luts(struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+       struct drm_property_blob **blob =
+               ilk_has_post_csc_lut(crtc_state) ?
+               &crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
 
        if (!crtc_state->gamma_enable)
                return;
 
-       if ((crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) == 0)
-               return;
-
        switch (crtc_state->gamma_mode) {
        case GAMMA_MODE_MODE_8BIT:
-               crtc_state->post_csc_lut = ilk_read_lut_8(crtc);
+               *blob = ilk_read_lut_8(crtc);
                break;
        case GAMMA_MODE_MODE_10BIT:
-               crtc_state->post_csc_lut = ilk_read_lut_10(crtc);
+               *blob = ilk_read_lut_10(crtc);
                break;
        default:
                MISSING_CASE(crtc_state->gamma_mode);