]> www.infradead.org Git - users/willy/xarray.git/commitdiff
drm/i915: Pass the whole atomic state to intel_color_prepare_commit()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 11 Jun 2024 13:33:38 +0000 (16:33 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 20 Jun 2024 12:37:59 +0000 (15:37 +0300)
We'll have need to examine both the old and new crtc states in
intel_color_prepare_commit(), so let's just pass in the whole
atomic state.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240611133344.30673-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/display/intel_color.h
drivers/gpu/drm/i915/display/intel_display.c

index 98553e8a51490863791e3c5e6a2ace71939e9245..8cfd497c2a9262245ad80c7f9e600cbb0585a877 100644 (file)
@@ -1902,15 +1902,20 @@ void intel_color_post_update(const struct intel_crtc_state *crtc_state)
                i915->display.funcs.color->color_post_update(crtc_state);
 }
 
-void intel_color_prepare_commit(struct intel_crtc_state *crtc_state)
+void intel_color_prepare_commit(struct intel_atomic_state *state,
+                               struct intel_crtc *crtc)
 {
-       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-       struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+       struct drm_i915_private *i915 = to_i915(state->base.dev);
+       struct intel_crtc_state *crtc_state =
+               intel_atomic_get_new_crtc_state(state, crtc);
 
        if (!crtc_state->hw.active ||
            intel_crtc_needs_modeset(crtc_state))
                return;
 
+       if (!intel_crtc_needs_color_update(crtc_state))
+               return;
+
        if (!crtc_state->pre_csc_lut && !crtc_state->post_csc_lut)
                return;
 
index 21ba4aa02e7bce3f4c8a2e4e5b969178e0f2f417..79f230a1709ad1d836cc29ac8c240a7887fe677a 100644 (file)
@@ -19,7 +19,8 @@ int intel_color_init(struct drm_i915_private *i915);
 void intel_color_crtc_init(struct intel_crtc *crtc);
 int intel_color_check(struct intel_atomic_state *state,
                      struct intel_crtc *crtc);
-void intel_color_prepare_commit(struct intel_crtc_state *crtc_state);
+void intel_color_prepare_commit(struct intel_atomic_state *state,
+                               struct intel_crtc *crtc);
 void intel_color_cleanup_commit(struct intel_crtc_state *crtc_state);
 bool intel_color_uses_dsb(const struct intel_crtc_state *crtc_state);
 void intel_color_wait_commit(const struct intel_crtc_state *crtc_state);
index 9041dd3181ee8a12fd3457d86464f14e3663dd0c..c782e65a7123bef881cb9f9aeb487ec78db6c8bb 100644 (file)
@@ -6718,7 +6718,7 @@ int intel_atomic_check(struct drm_device *dev,
 
 static int intel_atomic_prepare_commit(struct intel_atomic_state *state)
 {
-       struct intel_crtc_state *crtc_state;
+       struct intel_crtc_state __maybe_unused *crtc_state;
        struct intel_crtc *crtc;
        int i, ret;
 
@@ -6726,10 +6726,8 @@ static int intel_atomic_prepare_commit(struct intel_atomic_state *state)
        if (ret < 0)
                return ret;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
-               if (intel_crtc_needs_color_update(crtc_state))
-                       intel_color_prepare_commit(crtc_state);
-       }
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i)
+               intel_color_prepare_commit(state, crtc);
 
        return 0;
 }