Skip to content

(release/25.1) modesetting: fix PRESENT_FLIP_REASON_BUFFER_FORMAT gets overwritten#2285

Open
metux wants to merge 1 commit intorelease/25.1from
pr/modesetting-fix-present-flip-reason-buffer-format-gets-overwritten-_2026-04-18_19-51-02
Open

(release/25.1) modesetting: fix PRESENT_FLIP_REASON_BUFFER_FORMAT gets overwritten#2285
metux wants to merge 1 commit intorelease/25.1from
pr/modesetting-fix-present-flip-reason-buffer-format-gets-overwritten-_2026-04-18_19-51-02

Conversation

@metux
Copy link
Copy Markdown
Contributor

@metux metux commented Apr 18, 2026

When dmabuf_capable is enabled, ms_present_check_unflip may return
with reason PRESENT_FLIP_REASON_BUFFER_FORMAT to be reported back
to client by PresentCompleteModeSuboptimalCopy. We should not
overwrite it by page flip reasons anyway when exit.

This fix also avoid changing vblank->exec_msc in present_scmd_pixmap()
which caused by page flip reasons to prevent a present to be executed
immediatly. So that we can cancel pending vblanks when new vblanks with
same msc arrive. This happens when application just starts.

This problem can be observed at least using radeonsi OGL driver, start
xserver with dmabuf_capable enabled, no window manager, glxgears will
stuck for the first several seconds. If using a composite window manager
like Mutter, we can't observe the glxgears stuck, but the prensent
complete event still shows unexpected Copy mode instead of
PresentCompleteModeSuboptimalCopy or Skip mode.

glxgears window msc is 0 at the beginning, it will send present request
with target msc = 1, 2, 3, ... N before server send back the complete
event for target msc = 1. But server side window msc is way bigger than N,
so it will think all these present requests are outdated and just show the
Nth request at the next vblank. [1 .. N-1] requests should be skipped.
But without this fix, all [1 .. N] presents will be executed with Copy
mode which causes stuck.

Fixes: a94dd95 ("modesetting: add support for TearFree page flips")
Reviewed-by: Sultan Alsawaf sultan@kerneltoast.com
Part-of: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2091

@metux metux self-assigned this Apr 18, 2026
@metux metux requested a review from a team April 18, 2026 17:50
metux pushed a commit that referenced this pull request Apr 18, 2026
When dmabuf_capable is enabled, ms_present_check_unflip may return
with reason PRESENT_FLIP_REASON_BUFFER_FORMAT to be reported back
to client by PresentCompleteModeSuboptimalCopy. We should not
overwrite it by page flip reasons anyway when exit.

This fix also avoid changing vblank->exec_msc in present_scmd_pixmap()
which caused by page flip reasons to prevent a present to be executed
immediatly. So that we can cancel pending vblanks when new vblanks with
same msc arrive. This happens when application just starts.

This problem can be observed at least using radeonsi OGL driver, start
xserver with dmabuf_capable enabled, no window manager, glxgears will
stuck for the first several seconds. If using a composite window manager
like Mutter, we can't observe the glxgears stuck, but the prensent
complete event still shows unexpected Copy mode instead of
PresentCompleteModeSuboptimalCopy or Skip mode.

glxgears window msc is 0 at the beginning, it will send present request
with target msc = 1, 2, 3, ... N before server send back the complete
event for target msc = 1. But server side window msc is way bigger than N,
so it will think all these present requests are outdated and just show the
Nth request at the next vblank. [1 .. N-1] requests should be skipped.
But without this fix, all [1 .. N] presents will be executed with Copy
mode which causes stuck.

Fixes: a94dd95 ("modesetting: add support for TearFree page flips")
Reviewed-by: Sultan Alsawaf <sultan@kerneltoast.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2091>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
@metux metux force-pushed the pr/modesetting-fix-present-flip-reason-buffer-format-gets-overwritten-_2026-04-18_19-51-02 branch from e4e6544 to 8871846 Compare April 19, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants