From: Leo Li <sunpeng.li@amd.com>
To: Michele Palazzi <sysdadmin@m1k.cloud>, <amd-gfx@lists.freedesktop.org>
Cc: harry.wentland@amd.com, alexander.deucher@amd.com,
christian.koenig@amd.com, siqueira@igalia.com,
"Michel Dänzer" <michel.daenzer@mailbox.org>
Subject: Re: [PATCH 1/1] drm/amd/display: complete cursor vblank events immediately
Date: Mon, 2 Mar 2026 17:13:11 -0500 [thread overview]
Message-ID: <2be6dc58-e2dc-4733-aa25-26329cd1d2d3@amd.com> (raw)
In-Reply-To: <bc9b30d6-3ca9-44f0-825f-82b1142c8b48@m1k.cloud>
On 2026-02-27 03:58, Michele Palazzi wrote:
> On 2/27/26 09:53, Michele Palazzi wrote:
>> On 2/23/26 16:27, Leo Li wrote:
>>>
>>> Really nice debuging work, thanks for catching this!
>>>
>>> Ideally, the cursor event should be delivered when hardware latches onto the new
>>> cursor info and starts scanning it out. The latching event fires an interrupt
>>> that should be handled by dm_crtc_high_irq().
>>>
>>> dm_pflip_high_irq() handles an interrupt specifically for when hardware latches
>>> onto a new fb address; I don't think it actually fires when there's a
>>> cursor-only update. I think if we really want to do it right, we can have
>>> another "acrtc_attach->cursor_event" just for cusror-only updates, and deliver
>>> the event in crtc_high_irq().
>>>
>>> In any case, I don't foresee any major issues with delivering the event early.
>>> And since it fixes an ongoing issue:
>>>
>>> Reviewed-by: Leo Li <sunpeng.li@amd.com>
>>>
>>> Thanks!
>>> Leo
>>
>> Thanks for the review. Further testing confirms that both this patch and increasing the dGPU vblank offdelay (from 2 frames to ~50 frames) independently eliminate the flip timeouts in my testing. Both work by reducing the frequency of vblank disable/re-enable cycles, basically either could be an interim fix.
>>
>> Your deferred vblank enable/disable series https://lore.kernel.org/amd- gfx/20260224212639.390768-1-sunpeng.li@amd.com/T/#t looks like it could be the proper solution going forward instead (haven't tested it).
>>
Looking at this a bit more, I'm not sure if we're understanding the trace
correctly.
Let's first assume the cursor update is not an legacy_cursor_update: In both
non-blocking and blocking atomic commits, there should be mechanisms in place
that limits the number of in-flight atomic_commit_tail()s per crtc to 1 (see
drm_atomic_helper_wait_for_dependencies()). IOW, After each independent cursor
**or** fb update, there should be one flip_done completion from
drm_crtc_send_vblank_event(), before the next update is allowed to continue.
Since the event is "armed" as part of atomic_commit_tail(), and "completed" in
either pflip_high_irq or crtc_high_irq, racing "arms" of acrtc->event should not
be possible.
A combined cursor **and** flip update should use a single event and flip_done
completion, since it's one atomic_commit_tail to update both.
Now if it is a legacy_cursor_update, DRM core first checks if the driver can
commit it asynchronously, and set state->async_update=true if it can. If
async_update==true, drm_atomic_helper_commit() skips setting up the event
entirely. Otherwise, drm_atomic_helper_setup_commit() will check if
legacy_cursor_update==true. If it is, it completes flip_done early *and* skips
setting up the event. So either way, there's no event to send, nor flip_done to
wait on.
But evidently in the trace, something awry is going on. Though I'm not sure if
it's because of the race condition as described. It would be interesting to
trace the events at the point that they're created, armed, then completed, and
see if there's some mismatch going on.
Here's a patch that inserts a few trace events.
https://pastebin.com/dpLnVSbu
Could you try to reproduce the hang again while recording these trace events?
Using trace-cmd (with stack trace enabled '-T'):
trace-cmd record -e amdgpu_dm_event_arm -e drm_vblank_dbg* -T
trace-cmd report trace.dat
The timeout can be found by searching 'remaining_wait_ms=0'.
Regarding the deferred vblank patchset, if the issue is indeed racing writes of
amdgpu_crtc->event, then I don't imagine that patchset would help. It's
intended to solve a different race.
Thanks,
Leo
>
> fixed siqueira@igalia.com cc
next prev parent reply other threads:[~2026-03-02 22:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 19:16 [PATCH 1/1] drm/amd/display: complete cursor vblank events immediately Michele Palazzi
2026-02-23 15:27 ` Leo Li
2026-02-27 8:53 ` Michele Palazzi
2026-02-27 8:58 ` Michele Palazzi
2026-03-02 22:13 ` Leo Li [this message]
2026-03-03 8:17 ` Shengyu Qu
2026-03-03 19:07 ` Leo Li
2026-03-04 14:00 ` Michele Palazzi
2026-03-04 14:20 ` Leo Li
2026-03-05 22:30 ` Leo Li
2026-03-06 8:37 ` Michele Palazzi
2026-03-09 16:49 ` Michele Palazzi
2026-03-10 23:50 ` Leo Li
2026-03-11 10:16 ` Shengyu Qu
2026-03-11 10:38 ` Michele Palazzi
2026-03-11 17:56 ` Leo Li
2026-03-16 14:55 ` Michele Palazzi
2026-03-16 15:17 ` Michele Palazzi
2026-03-16 18:39 ` Leo Li
2026-03-16 18:48 ` Leo Li
2026-03-18 11:36 ` Michele Palazzi
2026-03-20 0:52 ` Leo Li
2026-03-20 1:33 ` Michele Palazzi
2026-03-31 12:57 ` Michele Palazzi
2026-02-27 19:43 ` Alex Deucher
2026-03-02 8:53 ` Michel Dänzer
2026-03-02 22:14 ` Leo Li
-- strict thread matches above, loose matches on Subject: below --
2026-02-18 0:31 Michele Palazzi
2026-02-18 9:41 ` Michel Dänzer
2026-02-18 10:09 ` Michele Palazzi
2026-02-19 11:09 ` Michel Dänzer
2026-02-19 13:08 ` Michele Palazzi
2026-02-19 13:59 ` Michel Dänzer
2026-02-19 15:56 ` Michele Palazzi
2026-02-19 16:02 ` Michel Dänzer
2026-02-20 11:10 ` Michele Palazzi
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=2be6dc58-e2dc-4733-aa25-26329cd1d2d3@amd.com \
--to=sunpeng.li@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=harry.wentland@amd.com \
--cc=michel.daenzer@mailbox.org \
--cc=siqueira@igalia.com \
--cc=sysdadmin@m1k.cloud \
/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