Very rarely we can see a deadlock between import_commit and destroy_buffer where:
- destroy_buffer is waiting on `wlr_buffer_map_lock` and has `wlserver_lock` (from up the chain)
- import_commit has `wlr_buffer_map_lock` and is waiting on `wlserver_lock`
To avoid this, we simply replace the lock_guard in import_commit with a unique_lock and manually unlock this before going into the section where we need to lock the wl_server.
This is safe for a few reasons:
- 1: All accesses to wlr_buffer_map are done before this lock.
- 2: destroy_buffer cannot be called from this buffer before now
as it only happens because of the signal added below.
- 3: "References to elements in the unordered_map container remain
valid in all cases, even after a rehash."
The PNG spec says that alpha is not premultiplied, so we need to do that.
(Although there are some things that do use PNG with premultiplied alpha... but let's just ignore that for now and go with the PNG spec and what we are getting exported to us to use on Deck.)
Cursor in X must have premultiplied alpha, our blending setup breaks a lot if this is not true.
Otherwise the double access on destruction could be very messy. The
default for all these operations is the cst memory order which is
certainly good enough though technically not the most optimal.
(Could do acq_rel for all of them).
Super rarely we see bugs when the zposes differ from these values.
For now, let's workaround that and have a define to enable the behaviour so we can fix this in kernel later.
If our input focus is ever a child window, we need to account for its X/Y offset in the check for warping it.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Adds a --composite-debug flag for displaying frame markers on alternating corners of the screen or rotating in a localized square when compositing.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Helps with launchers like FO:NV and other games where we end up having the visuals disjoint from what we actually want to input to.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
We need to keep the screneshot textures around if they are still
ref'ed when we re-make the swapchain. std::unique_ptr makes this
impossible. Switch to std::shared_ptr, and get rid of the nLockRefs
field.
Otherwise we get this warning:
WARNING: Project specifies a minimum meson_version '>=0.54.0' but uses features which were added in newer versions:
* 0.55.0: {'Wrap files with patch_directory'}
Otherwise if all of the windows in the new situation never redraw
we never update to show the new focus configuration.
This change avoids things like stuck overlays and notification
windows if the underlying game is stuck.
We'll implement some more features on top of input-method, so let's
incubate our own protocol for now. We'll give feedback upstream
once we've experimented a bit with this approach.
The protocol is minimal: it just includes the features needed for
gamescope. It's always easier to add new requests/events than to
change existing ones.