From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: imre.deak@intel.com, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org
Subject: Re: [RESEND 1/6] drm/{i915, xe}: move xe_display_flush_cleanup_work() to i915 display
Date: Fri, 22 May 2026 15:20:39 +0300 [thread overview]
Message-ID: <ahBKF-AH-mKmZ-0e@intel.com> (raw)
In-Reply-To: <6c89542bba35b03826d5c9237e33383c7ba9f489@intel.com>
On Fri, May 22, 2026 at 11:34:14AM +0300, Jani Nikula wrote:
> On Wed, 13 May 2026, Imre Deak <imre.deak@intel.com> wrote:
> > On Wed, May 13, 2026 at 05:19:19PM +0300, Jani Nikula wrote:
> >> On Wed, 13 May 2026, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> >> > On Wed, May 13, 2026 at 10:58:35AM +0300, Jani Nikula wrote:
> >> >> 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().
> >> >>
> >> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> >> ---
> >> >> drivers/gpu/drm/i915/display/intel_display.c | 21 +++++++++++++++
> >> >> drivers/gpu/drm/i915/display/intel_display.h | 1 +
> >> >> drivers/gpu/drm/xe/display/xe_display.c | 27 +++-----------------
> >> >> 3 files changed, 25 insertions(+), 24 deletions(-)
> >> >>
> >> >> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> >> >> index d5cf1476c7b9..50feca52b962 100644
> >> >> --- a/drivers/gpu/drm/i915/display/intel_display.c
> >> >> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> >> >> @@ -737,6 +737,27 @@ bool intel_has_pending_fb_unpin(struct intel_display *display)
> >> >> return false;
> >> >> }
> >> >>
> >> >> +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!
> >> >> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> >> >> index a43ada0c0502..65f8c81a7bae 100644
> >> >> --- a/drivers/gpu/drm/i915/display/intel_display.h
> >> >> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> >> >> @@ -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);
> >> >> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> >> >> index aa73023b7398..ef27fdfdbab2 100644
> >> >> --- a/drivers/gpu/drm/xe/display/xe_display.c
> >> >> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> >> >> @@ -258,27 +258,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;
> >> >> @@ -292,7 +271,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);
> >> >>
> >> >> @@ -347,7 +326,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_display_driver_suspend() already flushes the cleanup wq. So I
> >> > think this is doing nothing. The correct answer seems to be to nuke
> >> > the whole thing. We are missing the wq flush from the shutdown() path
> >> > in i915 however, so I suppose we should add it there.
> >> >
> >> >>
> >> >> intel_encoder_block_all_hpds(display);
> >> >>
> >> >> @@ -379,7 +358,7 @@ void xe_display_pm_shutdown(struct xe_device *xe)
> >> >> intel_display_driver_suspend(display);
> >> >
> >> > This should rather be the same atomic helper shutdown that i915 uses.
> >> > I guess what we want is a intel_display_driver_shutdown() to pair
> >> > up with intel_display_driver_suspend().
> >>
> >> Yeah, well, another "Hal fixes a light bulb" moment. I just wanted to
> >> clean up the iterators, but I can't do that with xe having crtc
> >> iteration, which it never should have had in the first place.
> >>
> >> I think all of the i915/xe/display probe/cleanup/suspend/resume paths
> >> are a gigantic mess. It was a mess with just i915, and xe added another,
> >> *different* mess. They both do things differently, but *neither* should
> >> be calling low-level display stuff directly.
> >>
> >> I'll try to cook something up for this.
> >
> > Fwiw, this came up already earlier [1] and then I came up with
> > https://github.com/ideak/linux/commits/suspend-shutdown-refactor
> >
> > but haven't followed up with it. For reference I rebased it now on
> > drm-tip.
> >
> > [1] https://lore.kernel.org/all/aIjizdet9ZUXB-yx@ideak-desk
>
> I've started on this, but I'm planning on taking a slightly different
> route from what Imre has there. The direction is the same, move more of
> this detailed stuff to display.
>
> But Imre also has a change similar to the patch at hand as the first
> thing.
>
> And that's the thing. I feel like starting to fix this one in xe code
> blocks the remainder of this series, and blocks the straighforward
> refactors of the probe/remove/suspend/remove parts. IMO it's easier to
> unify with all this code moved to display first.
>
> Ville, as I wrote in the commit message, can we just move this out of
> the way to unblock further changes? It's a non-functional change,
> doesn't make anything better or worse, apart from removing CRTC
> iteration from xe code, and unblocks further work.
I guess. Maybe just toss in a FIXME to delete this later.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-05-22 12:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 7:58 [RESEND 0/6] drm/i915: crtc iteration cleanups Jani Nikula
2026-05-13 7:58 ` [RESEND 1/6] drm/{i915, xe}: move xe_display_flush_cleanup_work() to i915 display Jani Nikula
2026-05-13 12:09 ` Ville Syrjälä
2026-05-13 14:19 ` Jani Nikula
2026-05-13 14:56 ` Imre Deak
2026-05-22 8:34 ` Jani Nikula
2026-05-22 12:20 ` Ville Syrjälä [this message]
2026-05-25 11:05 ` [PATCH v2] " Jani Nikula
2026-05-26 12:08 ` [PATCH v2] drm/{i915,xe}: " Jani Nikula
2026-05-26 17:37 ` Ville Syrjälä
2026-05-26 18:09 ` Jani Nikula
2026-05-26 19:26 ` Ville Syrjälä
2026-05-13 7:58 ` [RESEND 2/6] drm/i915/display: switch from drm_for_each_crtc() to for_each_intel_crtc() Jani Nikula
2026-05-22 12:22 ` Ville Syrjälä
2026-05-13 7:58 ` [RESEND 3/6] drm/i915/display: always pass display->drm to for_each_intel_crtc*() Jani Nikula
2026-05-13 12:22 ` Ville Syrjälä
2026-05-13 7:58 ` [RESEND 4/6] drm/i915/display: pass struct intel_display to all for_each_intel_crtc*() macros Jani Nikula
2026-05-13 12:22 ` Ville Syrjälä
2026-05-13 7:58 ` [RESEND 5/6] drm/i915/display: stop passing i to for_each_*_intel_crtc_in_state() macros Jani Nikula
2026-05-13 12:22 ` Ville Syrjälä
2026-05-13 7:58 ` [RESEND 6/6] drm/i915/display: stop passing i to for_each_pipe_crtc_modeset_{enable, disable}() Jani Nikula
2026-05-13 12:23 ` Ville Syrjälä
2026-05-13 8:05 ` ✗ CI.checkpatch: warning for drm/i915: crtc iteration cleanups (rev2) Patchwork
2026-05-13 8:07 ` ✓ CI.KUnit: success " Patchwork
2026-05-13 9:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-14 7:33 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-25 12:24 ` ✗ CI.checkpatch: warning for drm/i915: crtc iteration cleanups (rev3) Patchwork
2026-05-25 12:25 ` ✓ CI.KUnit: success " Patchwork
2026-05-25 13:11 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-25 15:39 ` ✓ Xe.CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ahBKF-AH-mKmZ-0e@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox