Since headless and wayland-without-presentation-feedback were firing
present inside their commit impls, present was getting fired before
commit, which is cursed. Defer this with an idle timer so that commit
handlers can run before present handlers.
Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
When integrating wlroots with another toolkit, wlroots may receive
wl_pointer.enter events for surfaces not backed by a wlr_output.
Ignore such surfaces by tagging the ones we're aware of with
wl_proxy_set_tag().
This changes the semantics of wlr_output_state. Instead of having
fields with uninitialized memory when missing from the committed
bitflag, all fields are always initialized (and maybe NULL/empty),
just like we do in wlr_surface_state. This reduces the chances of
footguns when reading a field, and removes the need to check for
the committed bitfield everywhere.
A new wlr_output_state_init() function takes care of initializing
the Pixman region.
Add a src_box state field. Use the SRC_* KMS props in the DRM
backend, reject the layers in the Wayland backend (for now, we can
support it later via viewporter).
This allows callers to set a destination size different from the
buffer size to scale them.
The DRM backend supports this. The Wayland backend doesn't yet
(we'd need to wire up viewporter).
- Simplifies the backends
- Avoids having two ways to do the same thing: previously one could
disable a layer by either omitting it from wlr_output_state.layers,
or by passing a NULL buffer
- We can change our mind in the future: we can allow users to omit
some layers and define a meaning without breaking the API.
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4017#note_1783997
We've had this struct for a while. It'd be useful for compositors
if they want to manage the swap chains themselves instead of being
forced to use wlr_output's. Some compositors might also want to use
a swapchain without an output.
During a modeset, the core wlr_output logic will allocate a buffer
with a new size and commit it. However if we still have a frame
callback pending we'd refuse to perform the commit. This is
inconsistent with the DRM backend, which performs a blocking
modeset.
This is visible when resizing the Wayland toplevel. The logs are
filled with "Skipping buffer swap", and the wlr_damage_ring's
bounds are not properly updated.
Fix this by destroying the pending frame wl_callback.
destroy_wl_buffer() is called from backend_destroy(). We need to
ensure the wlr_buffer is unlocked when we're waiting for a
wl_buffer.release event from the parent compositor.
Adaptive sync is effectively always enabled when using the Wayland
backend. This is not something we have control over, so we set the
state to enabled on creating the output and never allow changing it.
This allows the make/model/serial to be NULL when unset, and allows
them to be longer than the hardcoded array length.
This is a breaking change: compositors need to handle the new NULL
case, and we stop setting make/model to useless "headless" or
"wayland" strings.
All the code logic related to the pointer has been moved to its own file.
The seat is responsible for the lifetime of its wlr_wl_pointer(s), and assigning
them to the relevant wlr_wl_output. The wlr_wl_pointer becomes a simple helper
to manager the wlr_pointer associated to the seat's wl_pointer and its lifetime.
wlroots picks names for all outputs, but it might be desirable for
compositor to override it.
For instance, Sway will use a headless output as a fallback in
case no outputs are connected. Sway wants to clearly label the
fallback output as such and label "real" headless outputs starting
from HEADLESS-1.
They are never used in practice, which makes all of our flag
handling effectively dead code. Also, APIs such as KMS don't
provide a good way to deal with the flags. Let's just fail the
DMA-BUF import when clients provide flags.