drm/i915: Do plane/etc. updates more atomically across pipes
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 7 Sep 2023 12:25:41 +0000 (15:25 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 8 Nov 2023 17:20:20 +0000 (19:20 +0200)
Perform all the intel_pre_update_crtc() stuff for all pipes first,
and only then do the intel_update_crtc() vblank evasion stuff for
every pipe back to back. This should make it more likely that
the plane updates from multiple pipes happen on the same frame
(assuming the pipes are running in sync, eg. due to bigjoiner
or port sync).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230907122541.32261-4-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
drivers/gpu/drm/i915/display/intel_display.c

index bedd338ee9be147c7b3e55dd81418e20e52e655f..3effafcbb411acb894a866ce783a9fee8413f6ea 100644 (file)
@@ -6936,6 +6936,12 @@ static void intel_commit_modeset_enables(struct intel_atomic_state *state)
 
                intel_enable_crtc(state, crtc);
                intel_pre_update_crtc(state, crtc);
+       }
+
+       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
+               if (!new_crtc_state->hw.active)
+                       continue;
+
                intel_update_crtc(state, crtc);
        }
 }
@@ -6973,6 +6979,15 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
         * So first lets enable all pipes that do not need a fullmodeset as
         * those don't have any external dependency.
         */
+       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
+               enum pipe pipe = crtc->pipe;
+
+               if ((update_pipes & BIT(pipe)) == 0)
+                       continue;
+
+               intel_pre_update_crtc(state, crtc);
+       }
+
        while (update_pipes) {
                for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
                                                    new_crtc_state, i) {
@@ -6988,7 +7003,6 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
                        entries[pipe] = new_crtc_state->wm.skl.ddb;
                        update_pipes &= ~BIT(pipe);
 
-                       intel_pre_update_crtc(state, crtc);
                        intel_update_crtc(state, crtc);
 
                        /*
@@ -7044,6 +7058,15 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
        /*
         * Finally we do the plane updates/etc. for all pipes that got enabled.
         */
+       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
+               enum pipe pipe = crtc->pipe;
+
+               if ((update_pipes & BIT(pipe)) == 0)
+                       continue;
+
+               intel_pre_update_crtc(state, crtc);
+       }
+
        for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
                enum pipe pipe = crtc->pipe;
 
@@ -7056,7 +7079,6 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
                entries[pipe] = new_crtc_state->wm.skl.ddb;
                update_pipes &= ~BIT(pipe);
 
-               intel_pre_update_crtc(state, crtc);
                intel_update_crtc(state, crtc);
        }