Commit graph

10801 commits

Author SHA1 Message Date
Derek Foreman
838d6d92be drm: Don't use weston_view in drm_output_find_plane_for_view
We can get what we need via the paint node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
c1fcfd288d drm/state-propose: remove output asserts in z_order_list walks
We already validate the paint node list in weston_output_repaint,
immediately after we conditionally rebuild the z_order_list.

These asserts are thus completely redundant, as we've already
performed them in the front end.

My reason for removing this now is to drop weston_view usage
from the backend.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
96676d114c drm: Don't use weston_view in drm_fb_get_from_paint_node
We have no need for a weston_view here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
3c53883d78 drm: Use is_fully_opaque from paint node in drm_fb_get_from_paint_node
The paint node early update has already checked this value for us, we
should use that instead of interacting with the view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
9022976412 drm: Log paint node internal names instead of view internal names
Backends work on paint nodes, not views - and the paint node internal
name is a superset of the view internal name anyway, so it's not hard to
figure out which view a paint node belongs to when reading debug text.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
ef5164aa06 drm: Pass a paint node to dmabuf_feedback_maybe_update
The failure reason is already part of the paint node, so passing the view
here just makes things a little bit more complicated.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:04 -05:00
Derek Foreman
300c41858c drm: Use surface from paint node in drm_fb_get_from_paint_node
One fewer reasons to keep use the weston_view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:04 -05:00
Derek Foreman
6169657e24 vnc: Don't use weston_view
We've got a pnode, use that instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:03 -05:00
Derek Foreman
b3d18455dd drm: Change node to pnode in drm_output_prepare_cursor_paint_node
Cosmetic meddling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:03 -05:00
Derek Foreman
dd88c1fddd drm: rename node to pnode in drm_output_try_paint_node_on_plane
Cosmetic meddling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:02 -05:00
Derek Foreman
febd93e4da compositor: Replace view_has_valid_buffer with paint_node_had_valid_buffer
Backends should be relying on paint nodes for their information, not
views.

Since we always have a paint node when we want to pass a buffer, we can
pass that instead of a view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:39:58 -05:00
Derek Foreman
f4a56f057f drm: Pass paint node to drm_fb_compatible_with_plane
The backends shouldn't care about views as much as they do,
so pass the paint node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:38:03 -05:00
Derek Foreman
69efa21e08 drm: Pass paint node to cursor_bo_update
This doesn't need anything view related, and we already have the node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:38:03 -05:00
Pekka Paalanen
22db719484 frontend: default color-profile to auto:
Now that ICC<->parametric image description interoperability is
implemented, and the stock sRGB profile is parametric, we can change the
default to what it should be.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
a5ffb96d23 color-lcms: adjust supported TF mask
TF_SRGB will be deprecated, best to never advertise it. The test can
simply use gamma22 instead.

TF_EXT_LINEAR has an implementation and should be usable nowadays.
TF_ST2084_PQ, GAMMA22 and GAMMA28 likewise.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
e9c388b5a1 color-lcms: do not advertise saturation intent
Weston does not support the saturation rendering intent for parametric
image descriptions yet. Not really, Weston would just do the same as
media-relative with BPC does.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
63e58c47e4 color-lcms: switch default sRGB profile to parametric
This avoids ICC paths when no ICC profiles are explicitly used.

We can simplify the profile information sending and use the generic path
for the stock profile as well, no longer hard-coding the stock profile
in two places.

Since the stock profile creation cannot fail, we can streamline
cmlcms_init() a little, too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
54b60ad51a color-lcms: optimize linear TRCs
The icc<->parametric color transformation code uses "optical ICC
profiles" as part of the ICC pipeline. These profiles use a linear TRC
to encode the black point. When such TRC survives all optimizations, it
will cause the 3D LUT fallback path to be taken.

Detect such curve sets on the ICC pipeline optimizer, and convert them
to matrix stages. The matrix stages will then be optimized as usual,
often eliminating the stage completely.

The results can be seen in color-icc-output test after the stock sRGB
profile has been changed into a parametric one, causing all cases in the
test to hit the parametric-to-icc path. Some tests fail when they
suddenly start using the 3D LUT path which causes the errors to rise.
This patch fixes those (future) cases, and the errors remain the same as
before changing the stock profile.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
0e474b763f color-lcms: recognize single bounded curve segment
I don't have a specific use case in my mind for this, but it is
something we can easily handle.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
df2c7bb370 color-lcms: refactor into get_defining_curve_segment()
I need the new function for another purpose later, and this makes
get_parametric_curveset_params() easier to read.

Pure refactoring: no change in behavior.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
2aca058b69 color: add weston_cm_send_parametric_info()
Implementation of sending the protocol info events for an arbitrary
parametric image description.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
03cad2e46b color: weston_cm_send_tf() handles power-law
The power-law TF uses a different protocol event than others. Adding
support for it requires passing in the parameters.

Now we have a single send function that handles all protocol TFs, not
just those without parameters.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Pekka Paalanen
0dcae1a963 color-lcms: move code into cmlcms_send_icc_info()
Pure refactoring to clean up cmlcms_send_image_desc_info() ahead of
implementing generic parametric information sending.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 13:00:26 +00:00
Derek Foreman
be1e58beec clients: Fix crash when removing and reinserting outputs
If we don't receive a surface_leave before an output_destroy, the window
output lists can hold a stale reference to the destroyed output.

Call surface_leave for the output on all windows to make sure it's not on
any lists.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 15:29:03 +03:00
Pekka Paalanen
a879fff2ec gl-renderer: skip test when fb-fetch missing
Rather than fail the tests that require fb-fetch GL ES feature and it's
missing, mark them as skipped instead. This helps people who run the
test suite manually.

In CI, a skip is marked as failure anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-09 14:21:54 +03:00
Daniel Stone
ccefe3ef45 tests: Don't leak test idle source on full-skip
If the compositor fails to initialise in such a way that we want to
skip, don't leak the idle source.

This fixes the ASan failure, but still results in a TAP-parsing failure.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-04-09 00:20:11 +01:00
Pekka Paalanen
6f709a43b9 frontend: skip main loop on failure
If some initialization code somewhere calls
weston_compositor_exit_with_code() to set an error, don't bother running
at all.

This is useful for alpha-blending test when it tries to force different
blending implementations on the GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
b8b8daacf2 gl-renderer, tests: use both blending implementations
This ensures that both blending implementations will be tested. The AUTO
mode, which was the only mode before this patch, would not test the
fixed-function blending a.k.a GL-renderer shadow framebuffer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
528566527e libweston: allow calling weston_compositor_exit() early
Assertions are the usual way of failing tests in the compositor code,
but it means the test program cannot continue further. It would be
better to save an error exit code and run the compositor to the finish,
and then continue with the next test fixture.

I want to force some paths in GL-renderer output initialization for a
test, and fail otherwise. Calling weston_compositor_exit_with_code()
crashes there though, because the frontend has not installed the exit
handler yet.

Skip the exit handler if it's not there. The error exit code is still
saved, and will eventually bubble out of the compositor.

While at it, let's document these.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
599adea6df renderer-gl: create shader blender state and use it
This creates the fragment shader state needed for in-shader blending.
In-shader blending is always enabled if supported:
- GL supports the necessary features, and
- the blend-to-output color curve is exactly invertible.

The exact inverse is required, because the compositor will do repeated
decode-encode cycles per destination pixel, one for each non-opaque
source. Roundtrip errors through decode-encode might accumulate
otherwise. For now, identity, enumerated, and parametric curves are
deemed invertible while LUT is rejected without inspection.

Therefore to make use of this feature, outputs need to be configured with
a non-LUT type EOTF/TRC.

In-shader blending is always enabled, because it should be universally
more efficient than the use of a shadow buffer.

This feature was originally drafted for Weston by Sebastian Wick.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
f639731c87 renderer-gl: refactor gl_renderer_color_transform_create_steps()
This is tidier.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
d3f7a3be8f gl-renderer: refactor into gl_color_curve_init()
This will be needed for framebuffer decoder and encoder for in-shader
blending.

Pure refactoring in gl_renderer_color_transform_create_steps().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
fd8a71b311 renderer-gl: make resize_output() logging more accurate
Discriminate between renderbuffer discard and shadow allocation
failures. While at it, let's pring the shadow pixel format rather than
hardcoding it in a string.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
9d2fbd5455 renderer-gl: compress shader descriptions
Make the shader description strings easier to read. Before they looked
like this:

  Compiling shader program for: SHADER_TEXCOORD_INPUT_ATTRIB
  SHADER_VARIANT_SOLID SHADER_COLOR_EFFECT_NONE SHADER_COLOR_CURVE_LINPOW
  SHADER_COLOR_MAPPING_IDENTITY SHADER_COLOR_CURVE_IDENTITY
  +input_is_premult -tint -shader_blending (SHADER_COLOR_CURVE_IDENTITY,
  SHADER_COLOR_CURVE_IDENTITY)

Now they look like this:

  Compiling shader program for: attr tc, solid tex, no effect, CP{
  linpow, I, I }, +premult_in -tint -shader_blending (I, I)

Turn the switches into arrays for easier handling.

This is different from weston_enum_map, because we need two different
strings for each value: a symbol for the shader code, and a description
for the debug logs.

Unknown enum values will abort(), but they should be asserted anyway.
Unfortunately getting a weston_compositor here would be inconvenient for
using weston-assert macros.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Pekka Paalanen
aaed41798f renderer-gl: implement blend shader
This prepares the fragment shader for blending in-shader instead of
using the fixed-function blending.

This is not yet used, but it will allow avoiding the 16F shadow
framebuffer in the future.

TEX_UNIT_LAST is actually a count rather than the index of the last
unit. Fix the off-by-one in the check.

The FB fetch/store curves push our potential texture count beyond 8, so
implement a runtime check.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-08 21:55:45 +00:00
Derek Foreman
4b7586ea15 drm: Don't test reused states
We shouldn't need to test state, because the state that worked previously
should work again. However, to be completely safe against unpredictable
edge cases, we've kept a state check.

Remove that check and instead force a state rebuild in the case of an
application failure.

Keep track of how often this happens so we can fall back to checking
instead of consistently failing state application.

fixes #1081

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-08 08:27:02 -05:00
Daniel Stone
fcb195cbd0 drm-backend: Reuse prior state where possible
If we're in a steady state, doing nothing but flipping buffers, we can
try to avoid going through our full routine of brute-forcing an
acceptable plane state, by instead just reusing the old state and
changing only the FB it refers to.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-08 08:27:02 -05:00
Derek Foreman
67172d6f8f surface-state: Flag buffer params as dirty if replacing deleted buffer
This makes replacing an invalid/deleted buffer distinguishable from
a regular buffer update. This will be important when we try to reuse
plane states in a later commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-08 08:27:02 -05:00
Derek Foreman
dd74ed6db0 surface-state: Only walk the paint node list once in surface_attach
We have to walk it once for the dirty buffer, but we can accumulate our
changes along the way and walk it only once.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-08 08:27:02 -05:00
gpotter2
501fdea28d backend-rdp: Add --vmconnect mode for RDP (Hyper-V)
When running inside a Hyper-V vm, a special mode needs to be enabled
so that the RDP server is accessible through vmconnect.exe from the
host.

For instance:
```
weston --backend rdp --vmconnect  --address=vsock://1
```

Signed-off-by: gpotter2 <10530980+gpotter2@users.noreply.github.com>
2026-04-07 18:07:45 +03:00
Marius Vlad
d59e58bb79 compositor: Pass the length to opem_stream for one shot scene-graph
Rather than passing a NULL use sizeloc to pass the size. Otherwise
fflush(3) and fclose(3) would die out crashing in libc.

Use size also when printing out to a subscriber.

Fixes: e9665ef36

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-04-04 08:11:04 +03:00
Pekka Paalanen
f324d30024 doc: Doxygen group for client
Fix the following error:

Generating doc/sphinx/weston-doc-breathe with a custom command
FAILED: [code=1] doc/sphinx/weston
doc/sphinx/run_doxygen_sphinx.sh
/home/pq/git/weston/libweston/compositor.c:10001: error:
Found non-existing group 'client' for the command '@ingroup',
ignoring command (warning treated as error, aborting now)

Fixes: df622cbb20

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-03 09:05:42 +03:00
Leandro Ribeiro
61c7ed7ceb tests: add tests to ensure GL dma-buf screenshot correctness
This tests our dma-buf buffer support for GL screenshots. We use two
backends that have outputs with different y origin in order to exercise
the implementation.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Leandro Ribeiro
f32c6a474f tests: add dma-buf GL screenshot to output capture smoke tests
This ensures that output capture implementation is behaving accordingly,
but not that the screenshot result is correct. In the next commit we
add tests for checking that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Leandro Ribeiro
b4c4dfb7e4 clients: screenshot: allow dma-buf screenshots for framebuffer source
In the last commit we've added support for dma-buf screenshots in our
GL-renderer. So let's enable the screenshot client to use it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Leandro Ribeiro
c092f500e0 gl-renderer: add support for dma-buf screenshots
This adds support for dma-buf screenshots in our GL-renderer.

For now it only supports GLES >= 3.0, as it depends on
glBlitFramebuffer(). In the future we'll add support for older GLES
versions as well, using a shader to do the blit.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Leandro Ribeiro
366e045b54 gl-renderer: split create_capture_task() for sync fence and timer
For now this doesn't bring any benefits besides making
gl_renderer_do_read_pixels_async() easier to read. But in the next
commits this will be important.

This allows callers to decide if they want to use a timer when they fail
to get a sync fence for a capture task. For SHM tasks we always fallback
to a timer, but for dma-buf we will not allow the fallback path.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Leandro Ribeiro
25bb9d32b1 gl-renderer: allow to create gl_capture_task of dma-buf type
For now we support creating gl_capture_task only for SHM buffers. This
is used when the GL renderer pulls an output capture task from the
queue and its buffer type is SHM.

In the next commits we'll add support to allow output capture tasks to
be created with dma-buf buffers, so we need to extend gl_capture_task to
support that as well.

Differently from the SHM case, for dma-buf we don't have to do any copy.
The gl_capture_task is created just to wait for the blit to finish, and
then retire the output capture task.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Leandro Ribeiro
c0e129946e libweston: move enum weston_buffer_type out of struct
This will be helpful in the next commits, in which we pass the buffer
type as parameter to a few functions. Adding the enum alow us to avoid
passing as unsigned int.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-04-02 14:34:19 +00:00
Derek Foreman
2598073d99 input: Remove a bunch of explicit transform updates
All of these precede calls to weston_coord functions that now
do the transform update implicitly.

Some of them precede it immediately, and others through
functions like weston_pointer_set_focus and weston_pointer_send_motion
which use weston_coord_global_to_surface.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-02 15:29:55 +03:00