Skip to content

xwayland: eliminate use of present flip queue

Erik Kurzinger requested to merge ekurzinger/xserver:master into master

Xwayland's present code only executes one flip per msc. If the flips are synchronous, this means one per vblank for visible windows or, even worse, one per second for non-visible windows. If requests arrive at a rate faster then this they will accumulate in the window's flip queue, which can eventually lead to resource exhaustion since each request holds a reference to its source pixmap.

To fix this, we replace the flip queue with a pair of pointers, flip_pending and flip_ready.

The flip_pending pointer will contain the most recently executed flip, the one that would have formerly been returned by xwl_present_get_pending_flip. It will become the new flip_active on the next msc bump.

The flip_ready pointer will contain the next flip waiting to be executed, to be updated mailbox-style. When xwl_present_execute is called for a new flip, if there is already a pending flip and a ready flip, the old ready flip will be scrapped and replaced with the new flip. The ready flip will be executed on the next call to xwl_present_flip_try_ready, either after flip_pending completes or flipping is disabled.

Merge request reports