Commit graph

10746 commits

Author SHA1 Message Date
Robert Mader
2d15bf0567 gitlab-ci: Bump mesa to 26.0.4
Notably including fixes for
1. in-shader blending in llvmpipe
2. ycbcr support in lavapipe

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-04-02 08:01:12 +01:00
Derek Foreman
96e9f4e4ba drm: Remove switch in state-propose
Now that only overlay planes are on the handle list, we can simplify this
code a little bit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:59:54 -05:00
Derek Foreman
bf16894809 drm: Remove cursor and scanout handles from the plane handle list
Just put the "normal" planes on that list. This will allow for
some simplification later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:59:54 -05:00
Derek Foreman
8b7e72d8fa drm: Allow building a planes-only state with no primary
Some drivers allow a planes-only state as long as something covers
the entire CRTC, and some allow planes-only state even with only
partial coverage.

If we have an fb that we'd like to put on the primary plane, but can't,
we might as well try it on an overlay anyway and see if we can build a
planes-only state without a primary.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:59:52 -05:00
Derek Foreman
d665061f4d drm: special case the primary plane
While not as weird as the cursor plane, the primary plane's case is
pretty weird. Pull it out of the loop and handle it early.

This is really intended to be a step torwards building a planes-only
output state without a primary plane in it at all.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:58:51 -05:00
Derek Foreman
fe686c9646 drm: Check the cursor plane outside of the plane loop
The cursor code is weird, so let it be weird before the loop
that tests normal planes.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:13:51 -05:00
Derek Foreman
a7e35ddac1 drm: refactor plane tests
Pull out a bunch of the plane check code into a function so we can use it
later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
b7844bc8dd drm: Move fence check before underlay check
There's no need to evaluate these in any particular order, but I'm
going to refactor all the check unrelated to underlays into a single
place shortly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
1f900aa553 drm: Check if underlays are present before trying to use them
Trying to use an underlay will always fail if the output doesn't support
them, so add a quick check here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
7833a01b4d drm: Reword comment in find_plane_for_view
The text can be a bit confusing, so try to clarify it a little bit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
2f460b513f drm: Change the renderer skip logic
There's only one mode where we can skip the renderer, let's base the check
on that instead of checking for an existing scanout fb.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:37 -05:00
Derek Foreman
0dd1d390be state-helpers: use shared xmalloc
Just use the shared xmalloc() instead of malloc+assert

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:30:47 -05:00
Derek Foreman
1f7bdea5c4 compositor: Fix rotated opaque surfaces
When a paint node is drawing rotated content, it's treated like its axis
aligned bounding box. Even if it only contains fully opaque content,
the parts of the axis aligned bounding box outside of that content
are not opaque.

We need to ensure we don't claim a paint node that isn't axis aligned
is fully opaque, or we'll improperly update regions outside of the
really opaque content.

Fixes 485e1796af

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 08:07:35 +03:00
Derek Foreman
bec568f002 compositor: Update transforms before opacity checks
It makes more sense to update the transform than to bail.

These functions are sort of hints - they have to be correct when true, so
the previous code isn't really buggy. But they make more sense at a glance
this way.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 08:07:35 +03:00
Daniel Stone
d67f204388 tests: Don't free-run refresh in client-buffer test
The client-buffer test was setting the desired output refresh rate to
the highest possible, posting a new buffer to the screen, waiting for
the frame callback, then requesting a screenshot be taken.

This was not necessary (we already have a mode for tests which only want
screenshots and not a free-running refresh), and also harmful in that it
setting up a potential race.

When gl-renderer gets asked to repaint with nothing to show, it tries to
read back the GL fence status after the dmabuf has signalled. On drivers
with the threaded context enabled, the GL fence would not be readable,
even if the attached dmabuf was.

The easy fix to this is to just not free-run refresh.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-04-01 08:01:44 +03:00
Daniel Stone
d532ac0452 surface: Mark surface as dirty from attach_solid()
As weston_surface_attach_solid() can change quite a lot about a surface,
we need to mark it as dirty.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-04-01 08:01:44 +03:00
Daniel Stone
d46135705e gl-renderer: Fix memory leak for mixed opaque/blended views
transform_damage() returns an allocated set of quads; if a surface had
both opaque and blended regions, we were overwriting the
previously-allocated set of quads for the blended region.

Luckily, transform_damage() doesn't need to be called twice anyway, so
we can fix this by only calling it once in the first case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-04-01 08:01:44 +03:00
Leandro Ribeiro
04a85ab71c drm: use output capture task destroy listener for writeback
No behavior changes; this is a follow-up of "drm: handle client buffer
destroyed while writeback scheduled".

That commit protects against clients disconnecting while a writeback job
is scheduled, which could otherwise lead to crashes if the buffer is
destroyed before the wb job completes. However, output capture provides
the same functionality: it listens to the client buffer destroy event to
retire the capture task.

Instead of listening to the wl_buffer destroy event, simply listen to
the capture task destroy event. GL renderer already follows this
pattern, and now DRM aligns with it.

See also:
weston_capture_task_buffer_destroy_handler()
weston_capture_task_add_destroy_listener()

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-31 15:48:51 -03:00
Leandro Ribeiro
7444c29fd2 drm: assert writeback state is freed after capture task retirement
No behavior change, just a refactor to make it more clear that the state
is freed after the capture task is retired.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-31 15:47:13 -03:00
Daniel Stone
16a40edadc pixel-formats: Add support for compressed YUV
YUV420_8BIT and YUV420_10BIT are special DRM formats, which exist to
allow for NV12/P010-alike formats having combined storage for luma &
chroma, rather than split planes.

This is notably used to support AFBC compression for YUV buffers, as
seen with at least Hantro codec engines and Mali GPUs.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-03-30 20:33:55 +01:00
Derek Foreman
0c99e53fe9 clients: Add an unmanaged mode to weston-color
Add a way for weston-color to disable color-management, so we have a
simple single-pixel-buffer test.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-03-27 11:02:12 -05:00
Leandro Ribeiro
a222e4c44b drm: retire writeback capture task if another is in progress
Before "drm: make writeback format negotiation more robust", pulling a
writeback capture task while another writeback was in progress could
lead to a crash.

That commit avoids the crash, but it relies on
drm_output_find_compatible_writeback() to fail if a writeback task is
already in progress, as the majority of hardware probably support a
single writeback connector compatible with the CRTC.

Although unlikely, hardware may support more than one writeback
compatible with the CRTC. That would break our code, as our writeback
implementation does not support simultaneous writeback tasks per output.

This adds an explicit check and retires the writeback task if there's
already another writeback in progress.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-26 14:17:14 -03:00
Leandro Ribeiro
35d35f31ff drm: make writeback format negotiation more robust
Currently drm_output_get_writeback_formats() returns the formats
supported by a single writeback connector compatible with output->crtc.
This list is used to populate struct weston_output_capture_source_info
through weston_output_update_capture_info().

Later, when pulling writeback capture tasks, we call
drm_output_get_writeback_formats() again. However, as
drm_output_find_compatible_writeback() skips writeback connectors in
use, the returned format list may now differ.

Also, when selecting a writeback connector we implicitly rely on
drm_output_find_compatible_writeback() returning the same connector as
before, without verifying that the chosen connector supports the format
of the buffer provided by the client.

Make drm_output_get_writeback_formats() return the union of formats
supported by all writeback connectors compatible with output->crtc. This
makes the returned format list deterministic, regardless of whether a
writeback connector is currently in use. Although most hardware probably
supports a single writeback compatible with the CRTC, this is a good
change as it makes the code more generic and robust.

Also, add a new format param to drm_output_find_compatible_writeback(),
so now the the selected writeback can be validated against the requested
format.

The main benefit of this patch (and the reason why I wrote) is enabling
us to fix an issue when a writeback task is already in progress and
additional ones are requested:

1. weston_output_pull_capture_task() depends on the writeback format
   list

2. if a writeback is already in progress,
   drm_output_get_writeback_formats() returns NULL (assuming there's a
   single writeback connector).

3. weston_output_pull_capture_task() crashes Weston, as the list of
   writeback formats we pass does not match the one stored in struct
   weston_output_capture_source_info.

With the format list now deterministic, we'll be able to safely pull the
capture task and retire it. The next commit implements this behavior.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-26 14:17:10 -03:00
Leandro Ribeiro
b71b347ac6 drm: rename drm_writeback_should_wait_completion() to try_complete()
This function does more than just checking if it should wait for
completion: it completes the screenshot if possible. So rename to avoid
confusion.

This also adds documentation to the function.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-26 14:16:22 -03:00
Leandro Ribeiro
1152c53e58 drm: handle client buffer destroyed while writeback scheduled
Currently when a client buffer gets destroyed, the output capture task
gets destroyed with weston_capture_task_buffer_destroy_handler().

The problem is that we may have a writeback task scheduled, so
wb_state->ct would be pointing to a ct that has already been retired
and destroyed.

In this commit we start handling this case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-26 14:16:22 -03:00
Robert Mader
944ae353dd drm-backend: Implement offloading of solid-color backgrounds
Using the new BACKGROUND_COLOR CRTC property.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-03-26 17:20:11 +01:00
Robert Mader
77b1d4af96 backend-drm: Add support for the BACKGROUND_COLOR CRTC property
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-03-26 13:22:33 +01:00
Robert Mader
e96d00b012 gitlab-ci: Bump kernel to drm-misc-next with background-color
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-03-26 10:19:43 +01:00
Robert Mader
75c0ba4314 tests: color-representation: Use writeback screenshots for DRM tests
Otherwise we would end up checking the output of the GL renderer, not
verifying that we set the DRM properties correctly.

Coincidentally this also seems to work around CI flakiness of the test.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-03-24 15:25:30 +01:00
Robert Mader
de5fb11111 Revert "tests: Return RESULT_OK for color-representation-drm-test"
This reverts commit 4b8e10cf66.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-03-24 15:16:04 +01:00
Robert Mader
27fd323478 gl-renderer: Assume all YUV formats are external-only
On drivers without explicit modifier support we can't use
eglQueryDmaBufModifiersEXT() to check the correct texture target. We
already hardcode GL_TEXTURE_EXTERNAL_OES for various YUV/YCbCr formats -
let's assume it applies to all of them.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-03-19 17:54:46 +01:00
Pekka Paalanen
e0066a8038 libweston: remove weston_renderer::read_pixels
Unused.

Nowdays renderers use weston_output_pull_capture_task().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-17 17:31:48 +02:00
Marius Vlad
c66d0ea09a backend-drm: Rename sprites with hardware planes
Perhaps this would make things a bit more obvious to newcomers not
being familiar with historical 2D bitmap hardware sprite.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-03-17 16:39:34 +02:00
Marius Vlad
dde648a25f man/weston-keybindings: Use generic hardware planes
This disables all of the hardware planes not just overlay (primary and
underlays as well). Change also the debug message.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-03-17 16:39:34 +02:00
Pekka Paalanen
ec74bd0403 Deprecate remoting and pipewire plugins
The intention is that you should be able to replace these with the
pipewire-backend that you can load together with the DRM-backend. The
functionality should be equivalent, but the libweston software
architecture becomes more maintainable for upstream. Also the
pipewire-backend is not tied to the DRM-backend, and can work with any
other backend and even alone.

Once the remoting and pipewire plugins are gone, we can remove the
virtual output API from DRM-backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-17 16:10:38 +02:00
Pekka Paalanen
3bb38c0d17 man: fix screenshooting interface name
This was the old interface that was removed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-17 15:14:17 +02:00
Pekka Paalanen
8e5bd610c9 Remove WCAP
This was the original video recorder completely in software and with a
custom file format. It is no longer useful to keep. It used the old way
of getting screenshots: hooking to weston_output::frame_signal and
calling weston_renderer::read_pixels().  This old way stalled Weston
until the GPU work was complete, and supported only wl_shm buffers.

Nowadays video recording should be arranged with the pipewire-backend
which supports dmabuf delivery.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-17 15:07:24 +02:00
Pekka Paalanen
6f6a5dd2c8 libweston: remove weston_screenshooter_shoot()
Unused.

This was using the old way of getting screenshots: hooking to
weston_output::frame_signal and calling weston_renderer::read_pixels().
This old way stalled Weston until the GPU work was complete, and
supported only wl_shm buffers.

At this time there is no libweston API for frontends/plugins to ask for
a screenshot, but there is a protocol interface in
weston-output-capture.xml.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-17 14:53:38 +02:00
Derek Foreman
29b740ffee fullscreen-shell: Remove fullscreen-shell
It was deprecated, and now it is gone.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-03-16 16:00:20 +02:00
Derek Foreman
3bd77f7817 frontend: Remove screen-share module
It was deprecated, and now it is gone.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-03-16 16:00:20 +02:00
Derek Foreman
7c3e3d7544 drm: Remove VAAPI recorder
This was deprecated, and now it is gone.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-03-16 16:00:20 +02:00
Marius Vlad
f454723d4f backend-drm: Move out comments in else branch
No functional change, just move the comments in the else branch.

Added with 5429302e, ("backend-drm: add KMS plane's formats to
per-surface dma-buf feedback").

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-03-16 13:06:24 +02:00
Pekka Paalanen
a2f6eb4fe2 build: add manual gcovr coverage report
Meson's 'coverage-html' target defaults to using the Perl script LCOV.
LCOV has problems with newer GCCs like 14 in Debian Trixie, leading to
many consistency errors about function end lines. Gcovr OTOH runs just
fine.

Create a new target

  $ meson compile gcovr-report

that creates a coverage report in HTML and Cobertura using gcovr.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-13 15:25:31 +02:00
Pekka Paalanen
cddebbf5d5 tests: ensure constraints-test has the header
I was doing
$ mseon setup --wipe
$ meson test

and hit

../../git/weston/tests/constraints-test.c:31:10:
fatal error: pointer-constraints-unstable-v1-client-protocol.h:
No such file or directory
   31 | #include "pointer-constraints-unstable-v1-client-protocol.h"

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-13 15:25:31 +02:00
Pekka Paalanen
3534c77b66 tests: fix desc[] left-over
In function ‘encode_PAM_comment_line’,
    inlined from ‘write_PAM_image_rgba’ at ../../git/weston/tests/surface-screenshot-test.c:85:9,
    inlined from ‘trigger_binding’ at ../../git/weston/tests/surface-screenshot-test.c:202:8:
../../git/weston/tests/surface-screenshot-test.c:44:22: error: ‘desc’ may be used uninitialized [-Werror=maybe-uninitialized]
   44 |         size_t len = strlen(comment);

Fixes: d40af215a3

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-12 17:47:47 +02:00
Leandro Ribeiro
8ea328471b clients: fix build issue with simple-im
Since glibc version 2.43, bsearch may return const void * instead of
void * when the input array is const:

"For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
pointers into their input arrays now have definitions as macros that
return a pointer to a const-qualified type when the input argument is a
pointer to a const-qualified type."

So change variable that receives the return value from bsearch to const,
as the input array has the const qualifier. This fixes a "discards const
qualifier from pointer" error.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-11 08:29:05 +02:00
Pekka Paalanen
6077ba5fec backend-drm: use bits_to_str_stream() in state-propose
Before, these pieces of code were allocating, formatting and freeing the
bit flags string regardless of whether debug logging was used or not.

Now, the bit flags string is formatted only when debug logging is
active, and it does not involve malloc+free.

This should improve performance a bit.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-10 16:40:40 +02:00
Pekka Paalanen
c5dcdacdc0 backend-drm: refactor open-coded connector_add_prop()
The only difference is a small one in the debug print, otherwise this is
completely identical.

Makes drm_pending_state_apply_atomic() slightly more maintainable.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-10 16:40:40 +02:00
Pekka Paalanen
9b177e381a libweston: store format modifier name in weston_buffer
This should cut the cost of debug_scene_view_print_buffer() in half on
ARM A55 CPU. Debug printing is quite expensive on such platform.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-10 16:40:40 +02:00
Pekka Paalanen
d993f783b0 libweston: add internal weston_buffer_destroy()
Two lines open-coded in two places was not much a problem, but I'm going
to add a new member to weston_buffer that needs freeing, and I want to
do it in just one place.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-10 16:40:40 +02:00