]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/{i915, xe}: move xe_display_flush_cleanup_work() to i915 display
authorJani Nikula <jani.nikula@intel.com>
Mon, 25 May 2026 11:05:53 +0000 (14:05 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 26 May 2026 22:07:19 +0000 (01:07 +0300)
xe_display_flush_cleanup_work() is a bit of an oddball function in xe
display code. There shouldn't be anything this specific or xe
specific. While I'm not sure what the correct refactor for the function
should be, move it to shared display code for starters, next to the
eerily similar but slightly different intel_has_pending_fb_unpin() that
is only called from i915 core.

The main goal here is to unblock some refactors on
for_each_intel_crtc().

v2: Add FIXME comment (Ville)

Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260525110553.651208-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/xe/display/xe_display.c

index 6c8935f69db18e2cf1760359d0a1abb575e8f560..648155296fd2f0806b7add5dbaf2da1bb9795149 100644 (file)
@@ -737,6 +737,28 @@ bool intel_has_pending_fb_unpin(struct intel_display *display)
        return false;
 }
 
+/* FIXME: remove this and just flush the cleanup wq where appropriate */
+void intel_display_flush_cleanup_work(struct intel_display *display)
+{
+       struct intel_crtc *crtc;
+
+       for_each_intel_crtc(display->drm, crtc) {
+               struct drm_crtc_commit *commit;
+
+               spin_lock(&crtc->base.commit_lock);
+               commit = list_first_entry_or_null(&crtc->base.commit_list,
+                                                 struct drm_crtc_commit, commit_entry);
+               if (commit)
+                       drm_crtc_commit_get(commit);
+               spin_unlock(&crtc->base.commit_lock);
+
+               if (commit) {
+                       wait_for_completion(&commit->cleanup_done);
+                       drm_crtc_commit_put(commit);
+               }
+       }
+}
+
 /*
  * Finds the encoder associated with the given CRTC. This can only be
  * used when we know that the CRTC isn't feeding multiple encoders!
index 45a90d2fe6ec5de250bf15de1366d113237df8dc..72f33113a5a3ee1cc7f42b90f637e25ccef4be84 100644 (file)
@@ -402,6 +402,7 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state);
 void i830_enable_pipe(struct intel_display *display, enum pipe pipe);
 void i830_disable_pipe(struct intel_display *display, enum pipe pipe);
 bool intel_has_pending_fb_unpin(struct intel_display *display);
+void intel_display_flush_cleanup_work(struct intel_display *display);
 void intel_encoder_destroy(struct drm_encoder *encoder);
 struct drm_display_mode *
 intel_encoder_current_mode(struct intel_encoder *encoder);
index 75324aa8263122d509dc2b733ff1880d173ebcb3..766811cea07d48ed82d8cbc4f6928fb21b74c0d6 100644 (file)
@@ -265,27 +265,6 @@ static bool suspend_to_idle(void)
        return false;
 }
 
-static void xe_display_flush_cleanup_work(struct xe_device *xe)
-{
-       struct intel_crtc *crtc;
-
-       for_each_intel_crtc(&xe->drm, crtc) {
-               struct drm_crtc_commit *commit;
-
-               spin_lock(&crtc->base.commit_lock);
-               commit = list_first_entry_or_null(&crtc->base.commit_list,
-                                                 struct drm_crtc_commit, commit_entry);
-               if (commit)
-                       drm_crtc_commit_get(commit);
-               spin_unlock(&crtc->base.commit_lock);
-
-               if (commit) {
-                       wait_for_completion(&commit->cleanup_done);
-                       drm_crtc_commit_put(commit);
-               }
-       }
-}
-
 static void xe_display_enable_d3cold(struct xe_device *xe)
 {
        struct intel_display *display = xe->display;
@@ -299,7 +278,7 @@ static void xe_display_enable_d3cold(struct xe_device *xe)
         */
        intel_power_domains_disable(display);
 
-       xe_display_flush_cleanup_work(xe);
+       intel_display_flush_cleanup_work(display);
 
        intel_opregion_suspend(display, PCI_D3cold);
 
@@ -354,7 +333,7 @@ void xe_display_pm_suspend(struct xe_device *xe)
                intel_display_driver_suspend(display);
        }
 
-       xe_display_flush_cleanup_work(xe);
+       intel_display_flush_cleanup_work(display);
 
        intel_encoder_block_all_hpds(display);
 
@@ -386,7 +365,7 @@ void xe_display_pm_shutdown(struct xe_device *xe)
                intel_display_driver_suspend(display);
        }
 
-       xe_display_flush_cleanup_work(xe);
+       intel_display_flush_cleanup_work(display);
        intel_dp_mst_suspend(display);
        intel_encoder_block_all_hpds(display);
        intel_hpd_cancel_work(display);