Skip to content

Draft: render,types/wlr_shm: Offload slow cleanup ops

Kurt Kartaltepe requested to merge kkartaltepe/wlroots:async-master into master

Defers close()/munmap() calls into a cleanup thread in to avoid blocking when they are slow. This is most noticable on low end hardware with large screens where large surfaces can spend considerable time invalidating mmus on the gpu or clearing shmem pages.

This is based on my experience with running a 4k monitor on one of those AMD Phoenix chips, where these operations can often cause frame misses during resizing windows or opening new windows.

Some examples of cases where this helps out:

Resizing a Sway workspace with 2x2 foot terminals image image

Resizing a Sway workspace with 1x2 opengl windows (blue segments are dmabuf closure) image

An example of the back-pressure occurring when a client performs many rapid shm operations: image

!4454 includes a similar queue but with a socket instead of a static array. If that is preferred I tested it and it also works fine, though reading and writing the socket boilerplate is about the same as managing the array.

This is marked as a draft since its mostly for discussion if folks want it, but i've been using it for my machine and havnt noticed anything terribly broken. I also wasn't sure if there was a good place to put the cleanup code so its just kind of sitting there unused for now, but the queue is static anyway.

Edited by Kurt Kartaltepe

Merge request reports