Check if DC3CO is allowed before calling CMTG
functions in intel_atomic_commit_tail() as CMTG is only used
by DC3CO DC state.

Signed-off-by: Dibin Moolakadan Subrahmanian 
<[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 24 ++++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 109efb36ef21..7ddd0ebb1bcb 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7569,20 +7569,20 @@ static void intel_atomic_commit_tail(struct 
intel_atomic_state *state)
        /* FIXME probably need to sequence this properly */
        intel_program_dpkgc_latency(state);
 
-       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state) {
-               bool modeset = intel_crtc_needs_modeset(new_crtc_state);
-               bool dc3co_to_dc6 = 
intel_display_power_get_and_reset_dc3co_to_dc6(display);
+       if (intel_display_power_dc3co_allowed(display)) {
 
-               /*
-                * TODO: DC3co entry condition need to be checked before 
calling CMTG functions.
-                */
-               if ((modeset || dc3co_to_dc6) &&
-                   new_crtc_state->hw.active && !crtc->cmtg.enabled) {
-                       if (dc3co_to_dc6)
-                               intel_cmtg_restore(new_crtc_state);
+               for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state) {
+                       bool modeset = intel_crtc_needs_modeset(new_crtc_state);
+                       bool dc3co_to_dc6 = 
intel_display_power_get_and_reset_dc3co_to_dc6(display);
+
+                       if ((modeset || dc3co_to_dc6) &&
+                           new_crtc_state->hw.active && !crtc->cmtg.enabled) {
+                               if (dc3co_to_dc6)
+                                       intel_cmtg_restore(new_crtc_state);
 
-                       intel_cmtg_program(new_crtc_state);
-                       intel_cmtg_enable_interrupt(new_crtc_state);
+                               intel_cmtg_program(new_crtc_state);
+                               intel_cmtg_enable_interrupt(new_crtc_state);
+                       }
                }
        }
 
-- 
2.43.0

Reply via email to