mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 10:14:52 +00:00
xwayland/present: Skip queued flip when a new one becomes ready
If multiple flips become ready for the same MSC, we would previously
execute them all sequentially, one per MSC for sync flips. This could
result in an unbounded flip queue and corresponding memory consumption.
With implicit sync, leave the mailbox handling to the compositor for
async flips though.
v2:
* Use present_vblank_rec::sync_flip.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1664
Fixes: e1f16fb1ac ("xwayland: don't scrap pending present requests")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1511>
This commit is contained in:
@@ -1053,6 +1053,25 @@ retry:
|
||||
}
|
||||
|
||||
if (flip_pending && vblank->flip && !notify_only) {
|
||||
present_vblank_ptr flip_queued_last;
|
||||
|
||||
flip_queued_last = xorg_list_last_entry(&xwl_present_window->flip_queue,
|
||||
present_vblank_rec, event_queue);
|
||||
|
||||
/* Do mailbox handling for queued flips, to prevent the flip queue from
|
||||
* growing unbounded.
|
||||
*/
|
||||
if (flip_queued_last != flip_pending &&
|
||||
(flip_queued_last->sync_flip
|
||||
#ifdef DRI3
|
||||
|| vblank->acquire_syncobj
|
||||
#endif
|
||||
)) {
|
||||
xorg_list_del(&flip_queued_last->event_queue);
|
||||
present_vblank_scrap(flip_queued_last);
|
||||
xwl_present_re_execute(flip_queued_last);
|
||||
}
|
||||
|
||||
DebugPresent(("\tr %" PRIu64 " %p (pending %p)\n",
|
||||
vblank->event_id, vblank, flip_pending));
|
||||
xorg_list_append(&vblank->event_queue, &xwl_present_window->flip_queue);
|
||||
|
||||
Reference in New Issue
Block a user