]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/color: move CHV CGM pipe mode read to intel_color
authorJani Nikula <jani.nikula@intel.com>
Thu, 17 Aug 2023 15:53:04 +0000 (18:53 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 25 Aug 2023 10:12:17 +0000 (13:12 +0300)
Add color .get_config hook to read config other than LUTs and CSCs, and
start off with CHV CGM pipe mode to abstract the platform specific
register access better.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1444200931ae61b6360e3dcad8cbea206ad62e2f.1692287501.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/display/intel_display.c

index d4407228c8a7357cfb8eb48cd69235af892985da..73110bf1dbc2ee15b7976cea2098e7cabb52f2a9 100644 (file)
@@ -76,6 +76,10 @@ struct intel_color_funcs {
         * software state. Used by eg. the hardware state checker.
         */
        void (*read_csc)(struct intel_crtc_state *crtc_state);
+       /*
+        * Read config other than LUTs and CSCs, before them. Optional.
+        */
+       void (*get_config)(struct intel_crtc_state *crtc_state);
 };
 
 #define CTM_COEFF_SIGN (1ULL << 63)
@@ -1892,6 +1896,9 @@ void intel_color_get_config(struct intel_crtc_state *crtc_state)
 {
        struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
 
+       if (i915->display.funcs.color->get_config)
+               i915->display.funcs.color->get_config(crtc_state);
+
        i915->display.funcs.color->read_luts(crtc_state);
 
        if (i915->display.funcs.color->read_csc)
@@ -3205,6 +3212,14 @@ static struct drm_property_blob *chv_read_cgm_gamma(struct intel_crtc *crtc)
        return blob;
 }
 
+static void chv_get_config(struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+       struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+
+       crtc_state->cgm_mode = intel_de_read(i915, CGM_PIPE_MODE(crtc->pipe));
+}
+
 static void chv_read_luts(struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -3574,6 +3589,7 @@ static const struct intel_color_funcs chv_color_funcs = {
        .read_luts = chv_read_luts,
        .lut_equal = chv_lut_equal,
        .read_csc = chv_read_csc,
+       .get_config = chv_get_config,
 };
 
 static const struct intel_color_funcs vlv_color_funcs = {
index ac08054707aab8abd70bc93fb23b44606ebb1a12..c7d8eb4d6cacd1e5a7014f9fafecc77fc762591f 100644 (file)
@@ -2943,10 +2943,6 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
            (tmp & TRANSCONF_WGC_ENABLE))
                pipe_config->wgc_enable = true;
 
-       if (IS_CHERRYVIEW(dev_priv))
-               pipe_config->cgm_mode = intel_de_read(dev_priv,
-                                                     CGM_PIPE_MODE(crtc->pipe));
-
        i9xx_get_pipe_color_config(pipe_config);
        intel_color_get_config(pipe_config);