We'd attempt to parse an EDID even when the connector has no EDID,
printing "Failed to parse EDID" in logs. Instead, don't attempt to
parse the EDID and print a more appropriate log message.
It can be a bit confusing to understand why a compositor is shutting
down on its own. Log a message when we get disconnected from the
parent compositor to explain the cause.
We were iterating over involved outputs, applying the new state and
sending the commit event for each one. This resulted in commit
events being fired while we weren't done applying the new state for
all outputs.
Fix this by first applying all of the states, then firing all of
the events.
Closes: https://github.com/swaywm/sway/issues/8829
With labwc and WLR_DRM_FORCE_LIBLIFTOFF=1, a segfault is seen on startup
because we call output_state_get_buffer_src_box() when there is no
buffer set in the output state. Fix this by getting the src/dst box
from state->primary_viewport instead.
The kernel performs some additional checks when
DRM_MODE_ATOMIC_NONBLOCK is supplied: it requires that none of the
planes are still busy with a previous page-flip.
Pass the flag during test-only commits so that we don't end up
performing a commit which will fail.
This avoids processing events which we're not interested in.
Specifically, this fixes a case where output_commit() could be
indirectly called from itself either from import_dmabuf() or while
waiting for a configure event when enabling the output.
Creating a renderer results in lots of logs. Make it clear that
the logs belong to a multi-GPU renderer (as opposed to a primary
renderer created by the compositor).
The old approach of using a signal is fundamentally broken for a common
usecase: When the waiter is ready, it's common to immediately finish and
free any resources associated with it.
Because of the semantics of wl_signal_emit_mutable() this is UB.
wl_signal_emit_mutable() always excepts that the waiter hasn't been freed
until the signal has finished being emitted.
Instead of over engineering the solution, let's just add a callback required
by wlr_drm_syncobj_timeline_waiter_init(). In this callback, the implementation
is free to finish() or free() any resource it likes.
Up until now only the DRM backend required an output commit after
updating the cursor. Unify this for all backends, because:
- Screen capture can now catch cursor updates listening for output
commits
- In the future we want to make the cursor a regular wlr_output_layer,
which would need an output commit to be updated anyways
Fixes on-screen corruption when displaying a fullscreen client
with an implicit modifier on the secondary GPU.
What happens here:
- Client allocates a buffer with an INVALID modifier on primary GPU.
- Compositor attempts to scan-out this buffer on an output connected
to secondary GPU.
- Buffer is imported to secondary GPU, and is interpreted as if it had
the secondary GPU's implicit tiling, even though it has the primary
GPU's implicit tiling.
We need to forbid cross-device imports with implicit modifiers.
The mgpu_formats list is stripped from any INVALID modifier so
checking that fixes the bug.
Using the mgpu_formats list has an additional benefit: the buffer
is rejected in the test commit if it doesn't have a format supported
by the multi-GPU renderer.
Requires this Mesa bugfix:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31725
drmModePageFlip() will fail with EBUSY on a disabled CRTC.
We can't fix this by clearing the DRM_MODE_PAGE_FLIP_EVENT when
performing a commit which disables CRTCs, because some device-wide
commits might also page-flip other enabled CRTCs (and skipping the
page-flip event would mess up our buffer tracking).
Fix this by immediately completing page-flips which disable a CRTC
on the legacy uAPI.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3918
wl_buffer.release event delivery becomes undefined when using the
linux-drm-syncobj-v1 protocol, so we need to wait for buffer
release via a timeline point instead.
The protocol requires both wait and signal timelines to be set, so
we need to create one when the compositor only supplies a wait
timeline.
wlr_renderer and wlr_allocator will print out errors as they go, and end
with a final error if they fail to create anything. The caller of this
function will also log when it fails.
Skip the redundant errors emitted here.
If an mgpu device does not have a renderer, continue without one rather
than ignoring it entirely. It is not guaranteed that we will be able to
scan out to it in any particular configuration, but that is true for any
output regardless, and having the output visible is not harmful even if
it cannot light up.
To proceed safely, we strip implicit modifier support from all planes,
while avoiding duplication of the same logic for mdgpu_formats.
This helps GUD and DisplayLink scenarios.
We create a renderer for the sole purpose of blitting buffers from a
primary renderer that we might not be able to scan-out from. If we end
up with the pixman renderer, it either won't work becuase it cannot
import dmabufs from the primary renderer, or won't have any effect
because the primary renderer already uses dumb buffers.
We test for DMA-BUF capabilities specifically to make it clear what our
interest is, rather than focusing too much on the pixman renderer.
If init_drm_renderer failed, it would destroy the renderer but would not
set it to NULL, leading to use-after-free.
NULL the renderer after destroying it.