Commit graph

921 commits

Author SHA1 Message Date
Pekka Paalanen
88863cf7f1 tests: fix RUNNER_TEST UBSan error
GCC 14.2 UBSan complained:

../../git/weston/tests/ivi-layout-test-plugin.c:73:15: runtime error:
load of address 0x7fbfd8d70ec0 with insufficient space for an object of
type 'const struct runner_test'

By printing the addresses, I concluded that the mentioned address is the
second element in the plugin_test_section. I guess UBSan believes that
only the first element exists. Why not, what's to tell what data
actually is inside the section or where it actually ends.

Strangely though, we use the exact same section trick in
weston-test-runner.c to iterate through all tests, and that one is
apparently fine. One difference is that weston-test-runner is built as a
static_library() while ivi-layout-test-plugin.c is a shared_library().

Anyway, ivi-layout-test-plugin is unlikely to see any development, so
let's just fix the problem in an ugly way, and get rid of the section
trickery. If someone were to add a new RUNNER_TEST() instance and forget
to add the magic into the index, the compiler would greet them with a
defined-but-not-used error.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-22 16:51:31 +02:00
Pekka Paalanen
30e7575096 tests: fix "%s" argument is null warnings
../../git/weston/tests/iterate-debug-scopes-test.c: In function ‘wrapiterate_default_debug_scopes’:
../../git/weston/tests/iterate-debug-scopes-test.c:70:53: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   70 |                 weston_log("\tscope name: %s, desc: %s\n", scope_name, desc_name);
      |                                                     ^~
../../git/weston/tests/iterate-debug-scopes-test.c:70:43: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   70 |                 weston_log("\tscope name: %s, desc: %s\n", scope_name, desc_name);
      |                                           ^~
../../git/weston/tests/iterate-debug-scopes-test.c:70:53: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   70 |                 weston_log("\tscope name: %s, desc: %s\n", scope_name, desc_name);

test_assert_*() do not abort, so we cannot rely on them sanitizing
program state.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-22 15:56:56 +02:00
Michael Olbrich
063a9a0240 surface: correctly apply scale/tranform changes when committed without buffer
{width,height}_from_buffer include the transformations from set_buffer_transform
and set_buffer_scale.
Currently {width,height}_from_buffer are only updated when a commit contains a
new buffer but not for commits with only transformation changes.

If a transform/scale change is commited without new buffer, the old values
remain, which results in incorrect rendering or the client is disconnected
because weston_surface_is_pending_viewport_source_valid() fails.

Make sure to update {width,height}_from_buffer for transformation changes only
to avoid this.

Add a test to verify that the transformations are handled correctly. It is
identical to previous test, except that is spits the buffer attachment and
transformation changes into two commits. So it can reuse the existing images for
validation.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2026-01-22 10:12:33 +00:00
Leandro Ribeiro
82a832ef38 tests: improvements to color effects tests
This fixes a huge bug: we were ignoring the return value from
verify_screen_content(), which meant that tests were always passing.

Also, this adds tests for single-pixel solid color buffers, which are
useful to verify that color effects are actually applied in such cases.
Renderers (as the GL-renderer) may simply use glClear() instead of going
through the full rendering pipeline when drawing solid colors, and we
need to ensure that color effects are applied in those cases as well.

Besides that, some refactoring was done to improve the code.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-01-12 12:55:49 +00:00
Marius Vlad
4b8e10cf66 tests: Return RESULT_OK for color-representation-drm-test
This seems to cause a lot of stir in CI as it was failing for half of the
time.

Mark the test as succeeding for now and include the Mesa assert crash to
follow-up. We use that instead of SKIP to we have
WESTON_TEST_SKIP_IS_FAILURE.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-01-06 13:27:17 +02:00
Robert Mader
609dc4baa3 xdg-shell: Gate all configure events behind first commit
The protocol requires clients to perform an initial commit before they
receive configure events:
> After creating a role-specific object and setting it up (e.g. by sending
> the title, app ID, size constraints, parent, etc), the client must
> perform an initial commit without any buffer attached. The compositor
> will reply with initial wl_surface state such as
> wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
> event. The client must acknowledge it and is then allowed to attach a
> buffer to map the surface.

Previous to this patch various calls such as set_fullscreen() or
set_maximized() would schedule configure events, resulting in clients
being able skip the initial commit. This again made it possible to write
clients that only work on Weston, in violation of the protocol.

For xdg-popups we already tracked the initial commit status. Move it
to xdg-surface, guard schedule_configure() on it and ensure to run the
later on the initial commit.

Incorporate tests that checks if we get configure events when calling
set_fullscreen/set_maximized and tests that uses the main xdg_surface as
a parent to a sub-surface (which initially triggered this issue).

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2026-01-06 12:21:29 +02:00
Robert Mader
6389c1ce55 tests: color-representation: Skip dmabuf test if not supported
For systems where udmabuf is not available.

Fixes: 75d75ac6c (tests: Add color-representation tests for DRM and GL)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 19:00:25 +01:00
Robert Mader
af59ce4058 tests: Add color-representation protocol test
Ensuring that important errors are raised correctly.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:39 +01:00
Robert Mader
75d75ac6cd tests: Add color-representation tests for DRM and GL
Test the various combinations of:
1. Renderer backends - currently GL only.
2. Renderer modes - plane-offloading/vkms, shaders in Mesa, internal
   shaders.
3. Buffer-types - SHM and DMABuf.
4. Coefficient/range combinations.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:39 +01:00
Robert Mader
f709b8a798 tests: client-helper: Add color-representation protocol support
In order to test coefficients and ranges.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:39 +01:00
Derek Foreman
a3f0e97a71 compositor: Support the commit-timing protocol
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.

We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Derek Foreman
37256645d6 tests: Listen for the presentation clock id
Add a listener and a roundtrip so test clients using presentation have
access to the presentation clock id.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Derek Foreman
fc2e365c1d compositor: Update to presentation-timing version 2
This fixes a bug in version 1 where we should've been giving a 0 refresh
for VRR, and introduces version 2 where we're allowed to give a compositor
chosen rate for VRR.

We currently chose the mode's native refresh rate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:21:43 -06:00
Pekka Paalanen
2e66195546 tests/string: fix false-positive uninitialized val
GCC 14.2 with debugoptimized build complained:

In file included from ../../git/weston/tests/weston-test-assert.h:32,
                 from ../../git/weston/tests/string-test.c:36:
In function ‘strtof_conversions’,
    inlined from ‘wrapstrtof_conversions’ at ../../git/weston/tests/string-test.c:92:1:
../../git/weston/shared/weston-assert.h:60:12: error: ‘val’ may be used uninitialized [-Werror=maybe-uninitialized]
   60 |         if (!cond)                                                              \
      |            ^
../../git/weston/tests/weston-test-assert.h:153:34: note: in expansion of macro ‘weston_assert_’
  153 | #define test_assert_f32_eq(a, b) weston_assert_(NULL, a, b, float, "%.10g", ==)
      |                                  ^~~~~~~~~~~~~~
../../git/weston/tests/string-test.c:97:9: note: in expansion of macro ‘test_assert_f32_eq’
   97 |         test_assert_f32_eq(val, 0.0);
      |         ^~~~~~~~~~~~~~~~~~
../../git/weston/tests/string-test.c: In function ‘wrapstrtof_conversions’:
../../git/weston/tests/string-test.c:94:15: note: ‘val’ was declared here
   94 |         float val;
      |               ^~~

The debug build did not complain.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-12-16 15:19:02 +00:00
Pekka Paalanen
6af97ec150 tests/paint-node: fix false-positive uninitialized variable
GCC 14.2 with debugoptimized build complained:

../../git/weston/tests/paint-node-test.c: In function ‘get_paint_node_status’:
../../git/weston/tests/paint-node-test.c:105:16: error: ‘changes’ may be used uninitialized [-Werror=maybe-uninitialized]
  105 |         return changes;
      |                ^~~~~~~
../../git/weston/tests/paint-node-test.c:87:39: note: ‘changes’ was declared here
   87 |         enum weston_paint_node_status changes;
      |                                       ^~~~~~~

The debug build did not complain.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-12-16 15:19:02 +00:00
Pekka Paalanen
66eaeb0c3f tests/fifo: fix false-positive uninitialized width
GCC 14.2 with debugoptimized build complained:

../../git/weston/tests/fifo-test.c: In function ‘get_surface_width’:
../../git/weston/tests/fifo-test.c:493:16: error: ‘width’ may be used uninitialized [-Werror=maybe-uninitialized]
  493 |         return width;
      |                ^~~~~
../../git/weston/tests/fifo-test.c:477:13: note: ‘width’ was declared here
  477 |         int width;
      |             ^~~~~

The debug build did not complain.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-12-16 15:19:02 +00:00
Pekka Paalanen
92c15464aa tests/client-buffer: fix false-positive uninitialized variables
GCC 14.2 with debugoptimized build complained:

../../git/weston/tests/client-buffer-test.c: In function ‘y_u_v_create_buffer’:
../../git/weston/tests/client-buffer-test.c:1045:33: error: ‘u_row’ may be used uninitialized [-Werror=maybe-uninitialized]
 1045 |                                 x8r8g8b8_to_ycbcr8_bt709(argb, y_row + x,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1046 |                                                          u_row + x / pixel_format_hsub(buf->fmt, 1),
      |                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1047 |                                                          v_row + x / pixel_format_hsub(buf->fmt, 1));
      |                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/weston/tests/client-buffer-test.c:986:18: note: ‘u_row’ was declared here
  986 |         uint8_t *u_row;
      |                  ^~~~~
../../git/weston/tests/client-buffer-test.c:1045:33: error: ‘v_row’ may be used uninitialized [-Werror=maybe-uninitialized]
 1045 |                                 x8r8g8b8_to_ycbcr8_bt709(argb, y_row + x,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1046 |                                                          u_row + x / pixel_format_hsub(buf->fmt, 1),
      |                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1047 |                                                          v_row + x / pixel_format_hsub(buf->fmt, 1));
      |                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/weston/tests/client-buffer-test.c:987:18: note: ‘v_row’ was declared here
  987 |         uint8_t *v_row;
      |                  ^~~~~

The debug build did not complain.

Even though only u_row and v_row were reported, I don't understand why
there is no warning about u_base and v_base, as they are initialized
with a similar switch. So initialize them too, just in case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-12-16 15:19:02 +00:00
Marius Vlad
1e55fd2449 gitlab-ci: Bump CI to Trixie and LTS to bookworm
This includes a few changes, but given that we still want to bisect
things when they break I'm pulling some of the changes into a bigger change.

Here's a list of most noticeable that I had to address in order to make
this switch:

- added a PACKAGES_SPECIFIC env variable to able to pass different
  packages to each version. Some packages basically changed their names
  and need to pass a different name
- added USE_DEBIAN_BACKPORTS and use it when adding -backport apt
  sources for each Debian version
- llvm-19 now requires some additional packages for trixie
- add imghdr for sphinx for trixie
- had to keep use_tls=0 and modified the notes to point now to Trixie
  instead of Bookworm

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-12-16 11:46:39 +00:00
Derek Foreman
cb97abd4f7 compositor: Add the fifo-v1 protocol
Add support for the fifo protocol, which allows an application to submit
a content update that can only be applied after the previous content
update has been active for a display refresh.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:13 -06:00
Derek Foreman
23204eca75 tests: Bind the fifo protocol
Add the fifo protocol to the helper framework.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:13 -06:00
Derek Foreman
08f9d791b5 tests: Refactor get_presentation
In the future more than one test group will want to use presentation
feedback, so let's pull the basics into weston-test-client-helper

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
5eb5c4991d tests: Refactor get_subcompositor
We open code this in several tests. Move a single implementation to
weston-test-client-helper instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
e4be014f93 compositor: Add an explicit latch point
Latch is the moment when the compositor considers updates for an upcoming
redraw. Nothing that takes place after an output latches for repaint can
change what will be repainted.

This needs a more explicit treatment now that upcoming transactional
protocols require things to happen immediately after the latch (ie:
when it's too late to change the upcoming render).

Add an explicit latch point, a signal to tap for testing, and some asserts
to make sure nothing can violate the inevitability of the current render
state.

Note that currently latch is tied to repaint such that we only claim to
have latched when a repaint will happen. In a future commit this will lead
to forcing the repaint loop to fire without damage when the fifo protocol
needs something to happen after a latch. This could be an area for
future improvement.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Pekka Paalanen
015d73cb54 tests: bail on dispatch failure
Originally the test-asserts were abort()'ing. Then they were changed to
record the failure but not abort() anymore. These loops were missed,
accidentally turning them into endless loops on Wayland connection
failure, e.g. a protocol error.

When then loops become endless, they will repeatedly print the assertion
failure message. When run as part of the test suite via Meson, Meson
will collect all printouts in memory. Therefore the meson process will
use memory rapidly without bounds.

Break all these loops.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-12-04 18:20:27 +02:00
Marius Vlad
a691dc51d2 tests: Address compilation warns/error on arm32 (format)
Switch to using inttypes for addressing compliation errors on other
platforms (arm32).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-12-02 18:27:12 +02:00
Pekka Paalanen
12334b3e75 tests: break out on client_capture_output() error
If the Wayland connection died, this code path ended up in an endless
loop, because test-asserts do not abort. Break out to fix this. The
test-assert records the failure, so not need to do more.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-11-06 16:02:37 +02:00
Derek Foreman
0bfcb700b9 compositor/shells: Require shells to flag outputs as ready to allow repaint
We've added a curtain to the shells so at startup we have something to
render, but this causes a flicker if someone is trying to have a seamless
transition from boot to weston.

Add a ready flag that allows the shell to indicate repaints are safe, so
we can remove the curtains and have no wasted frames at startup.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-27 05:55:51 +00:00
Robert Mader
b688767680 backend-drm: Allow plane-less DRM background for opaque black solid buffers
The DRM documentation states:
> Unless explicitly specified (via CRTC property or otherwise), the active
> area of a CRTC will be black by default. This means portions of the active
> area which are not covered by a plane will be black, and alpha blending of
> any planes with the CRTC background will blend with black at the lowest zpos.

See https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#plane-abstraction

This means the view for the primary plane does not need to cover the
whole output and black areas of the scene-graph can be left out.
Doing so has various benefits - most importantly it:
1. allows us to use the plane-only path in more situations and with one
less plane, reducing memory bandwidth usage.
2. opens the path to offload arbitrary background colors in the future.

Iterate over the all visible paint nodes, remove solid-opaque-black
views so they are not considered for plane assignment and aggregate a
region that is later used to assign the primary plane.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-23 12:40:37 +02:00
Robert Mader
fcb4c2a85b tests/drm-offload: Add additional tests
For changes in the next commit.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-22 10:52:14 +02:00
Derek Foreman
21f1c575b3 tests: Add a semi-transparent single pixel buffer test
Now that we have a glClear() region optimization for opaque solid surfaces,
we should make sure we test transparent solid surfaces as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:53:34 -05:00
Derek Foreman
2abd161023 tests: Add tests for scaled single pixel buffers
Now that we're validating that buffer size must be an integer multiple of
scale, add some tests to make sure it's happening.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-18 11:51:05 -05:00
Daniel Stone
0664d5bdc1 output: Record paint_node_changes during repaint
When we're going through assign_planes and repaint, give the backend an
opportunity to see what's changed during this repaint.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:51:05 -05:00
Daniel Stone
4ebb06a94f tests: Add helper to create solid-filled buffer
At the moment this is only replacing two clear calls with one. However,
when client_buffer starts using properly-bracketed CPU access, this will
become much more tedious. Introduce a helper now to make it easier.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
2259ac4e93 tests: Remove impossible condition
We always have the name of a reference image to compare to; comparison
is kind of impossible without one.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
4843199479 tests: Fix screenshot assert
We need to check the each screenshot once, not one twice.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
c00997979c tests: Support decoration capture for screenshots
It's pretty trivial to make verify_screen_content() and
capture_screenshot_from_output() support decorations, so we can reuse
those in output-decorations tests rather than open-coding.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
fe4cb8a546 tests: Remove open-coded verify_screen_content()
We already have a helper which does exactly this!

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
4d98190a98 tests: Remove open-coded fill_image_with_color()
This did exactly that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
087315e242 tests: Use buffer for width/height in color-effects
We don't need a pixman_image to get the buffer width and height, so
don't use it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
2c5dd92533 tests: Use pixman_image_t for get_middle_row()
get_middle_row() is a pure CPU accessor which only needs to operate on a
pixman_image_t. Pass this directly instead of struct buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
42a9a54665 tests: Remove struct buffer len
Unused.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
e2b3ab38bd tests: Set optimal refresh rate for tests
A very marginal benefit, but why not. Any tests using screen capture are
now using a refresh rate of 0 (redraw immediately on capture request),
whilst others are using HIGHEST_OUTPUT_REFRESH.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Daniel Stone
ef6747a951 tests: Document default refresh-rate value
Document what the magic refresh-rate values are, and which is set by
default.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-16 11:36:33 +03:00
Robert Mader
79ade4c165 backend-drm: Ignore views with fully transparent solid buffers
Some client use subsurfaces with fully transparent single-pixel buffers
for various reasons, such as making it easier to order trees of
subsurfaces. As they are invisible we can simply ignore them in the
scene graph.

This allows us to use direct-scanout/plane-only in more circumstances,
as ensured in the test.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 16:39:40 +02:00
Robert Mader
e5cbd8536a tests: Add drm offloading test
Recent improvements to llvmpipe made it possible to test dmabuf import
and offloading on vkms. Use our new client-buffer helper and the
presentation protocol to implement tests for simple offloading
scenarios.

Right now this is limited to the vkms default config, only providing us
with one primary and one cursor plane. In the future we can extend the
test to include more advanced scenarios.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 12:53:44 +02:00
Robert Mader
8c4e3b7de5 weston-test-desktop-shell: Use output size for the background
The hardcoded size of 2000x2000 may cause unexpected issues.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 12:47:04 +02:00
Robert Mader
3ae7a7b457 weston-test-desktop-shell: Implement desktop_surface_fullscreen_requested()
Add a minimal implementation to allow client to use xdg_toplevel_set_fullscreen().

Note that desktest_shell does not yet properly handle various changes of the surface
state once mapped. Thus we don't handle such cases here either and just
assert on the expected behavior where appropriate.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 12:42:49 +02:00
Robert Mader
18076228d3 tests: xdg-client-helper: Add maybe_ack_configure() helper
So users are not forced to use xdg_surface_commit_solid().

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 11:47:08 +02:00
Robert Mader
a1c0d33700 tests: client-helper: Add various globals by default
To make them more easily available for tests.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 11:47:08 +02:00
Pekka Paalanen
a60169e239 tests: add parametric_color_profile_parsing_errors
This test goes through all the errors one can do in weston.ini
color-profile section, and ensures they give the proper error logging.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00