Commit graph

967 commits

Author SHA1 Message Date
Derek Foreman
fc7bb13bbb tests: Skip udmabuf tests before initializing client
We currently leak resources and hit asserts if dmabuf is unavailable.

Move the check to before we initialize anything.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-16 21:17:10 -05:00
Pekka Paalanen
35527e6eed frontend,libweston: remove color_characteristics
Since the commit "color-lcms: extract HDR static metadata from profile"
this was all dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-16 13:46:22 +00:00
Pekka Paalanen
dbdb5f92f2 color-lcms: extract HDR static metadata from profile
Extract the HDR static metadata type 1 from the output color profile
directly, instead of relying on a separate weston.ini section to provide
the metadata separately.

Weston should tell the monitor what target color volume it is rendering
for. I don't see a reason to be able to control the metadata separately,
and it would add complexity.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-16 13:46:22 +00:00
Pekka Paalanen
2a7288e70e tests/buffer-transforms: reduce split cases
The point of buffer_transform_split is to ensure that committing only
transform and scale changes gets reflected on screen, without explicit
damage. There is no need to go through the big set of parameter
combinations, it only needs to test that changing each triggers the
damage.

Test setting only scale and only transform separately, so that one
cannot mask bugs with the other.

This brings the screenshot count for buffer_transform_split from 12 down
to 2, which is good for CI running time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-10 12:03:43 +03:00
Pekka Paalanen
3ce5a2e774 tests/output-damage: doc renderer testing
This test was originally written to ensure Weston does not repaint too
much, but it does also test that renderers transform the damage
correctly into the framebuffer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-04-10 11:51:05 +03:00
Derek Foreman
77eb13f499 drm,renderers: Remove some unnecessary indirection
pnode->view->surface is the same as pnode->surface, always.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05: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
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
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
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
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
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
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
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
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
liupeng
4f963b68e0 tests: add newline to test-harness-plugin description
Signed-off-by: liupeng <liupeng01@kylinos.cn>
2026-03-06 14:07:18 +02:00
Leandro Ribeiro
becbd36b61 tests: ensure image description done event received
We may break out of the loop if wl_display_dispatch(client->wl_display)
fails and returns -1. So we need to assert that info->done is true after
the loop.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-05 13:17:25 +02:00
Leandro Ribeiro
672402c2c0 tests: add tests for grayscale color effect
We've just added support for grayscale output color effect. This adds
test cases for that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-03-04 13:12:07 -03:00
Pekka Paalanen
d40af215a3 tests: do not call weston_surface::get_label()
Part of migration away from get_label().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-04 07:28:49 +00:00
Pekka Paalanen
63e27f3af5 tests: use new label in test plugin
Part of migration away from get_label().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-04 07:28:49 +00:00
Marius Vlad
128a88d1a8 shell-utils: Add labels for curtain created surfaces
struct weston_curtain_params is changed to match the new
weston_surface_set_label() API. For now, I did not bother hooking up the
static label flavor.

Part of migration away from get_label().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-04 07:28:49 +00:00
Pekka Paalanen
03a081f2c8 libweston: ensure weston_surface::get_label is non-NULL
On the quest to delete the get_label() vfunc completely, a temporary
default get_label implementation needs to be plugged in. This would
affect all the code that checks whether the get_label vfunc is NULL.

Let's make get_label vfunc non-NULL always intentionally first. We can
delete all the code that checked for NULL, and the bespoke label
replacements in that case. Now all those different "no label" cases are
unified.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-04 07:28:49 +00:00
Marius Vlad
9b0ac55880 tests/client-buffer: Add gl-renderer-paint-nodes scope
Smoke test to make sure we're actually executing those paths.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-03-03 13:24:22 +02:00
Pekka Paalanen
bf513a362a libweston: add weston_color_gamut_from_protocol()
Reduce 4 copies of a piece of code into one. Usable for both client and
server side.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-03 07:41:27 +00:00
Pekka Paalanen
71594a97f8 tests/color-management: commit the image description
Just for completeness sake, let's commit the image description. This
should poke at the surface state machinery with the image description.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-03 07:41:27 +00:00
Pekka Paalanen
1b05eddb75 tests/color-management: drop smoke_test
Every other test here does the same, and more.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-03 07:41:27 +00:00
Pekka Paalanen
18f6592c83 tests: rewrite more color-manager handling into client library
Enhancing the color-manager machinery in the client library to suffice
for color-management-test.c as well, we can remove a copy of the
boilerplate code.

The changes include renaming things, moving parameters from
image_description to image_description_info, deleting the list of image
descriptions and cleaning them up explicitly, and creating the
color-management surface and output objects on-demand.

image_description_get_information() explicitly waits for the done event
instead of relying on a ropund-trip.

Bit operations got helper functions. Gamut parameter printing was
re-written.

In spite of the massive changes, the tests themselves still work exactly
the same.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-03 07:41:27 +00:00
Pekka Paalanen
094499cf8c tests: consolidate create_parametric_image_description
Turns out that the fail-case code does everything the good-case code
does and more, so we can reduce the code duplication.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-03 07:41:27 +00:00
Pekka Paalanen
7cf39e41ff tests: move color-manager handling to client library
There are two partial implementations of the color-manager
protocol boilerplate, in color-management-test.c and
color-management-parametric-test.c. This patch moves the implementation
from the latter into the client library, and uses the helper bit().

This paves way for moving the other partial implementation as well,
de-duplicating the overlapping code, and allowing new test programs to
poke at color-manager.

The color-manager is initialized on-demand, because mosts tests in the
suite do not need it. This avoids a little of unnecessary work.

In anticipation of wp_color_management_v1 version 2, the interface
version is explicit and ensured.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-03-03 07:41:27 +00:00
Pekka Paalanen
fb0cf120a6 tests: weston-test-assert needs is_pow2_64()
Make sure the definition is available.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:53 +02:00
Pekka Paalanen
caf5a9b423 build: list generated headers as in weston-test-client-helper.h
weston-test-client-helper.h includes all these generated header files. I
could not figure out what might guarantee that these headers are
generated before compiling anything that includes
weston-test-client-helper.h, maybe we are simply lucky. I could not make
the build fail by building a single test program from a clean builddir.

Yet, this seems like the right thing to do.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:53 +02:00
Pekka Paalanen
682c2a5859 build: libxwayland_test_client needs no weston_test_client_protocol_h
Would be strange if it did.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:53 +02:00
Pekka Paalanen
1bd9b07985 tests: drop unused includes from xcb-client-helper
Just bumped into these when looking at dependencies.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:53 +02:00
Pekka Paalanen
6c352da9fa tests: drop libweston-internal.h from assert
There does not seem to be any reason for this to be here.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:53 +02:00
Pekka Paalanen
a044dfe1a6 build: move weston_test_client_protocol_h use
There is no need to special-case this generated header in foreach-tests
if we list it as an order-only dependency implied by dep_test_client.
The viewporter header is already there.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:53 +02:00
Pekka Paalanen
4a322fd76c tests: drop unnecessary protocol sources - xdg
xdg-client-helper is already built into the dep_test_client library,
there is no need to add the sources again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:55:49 +02:00
Pekka Paalanen
b55a0f9fcf build: use disabler for xwayland test
A minor simplification to tests/meson.build. The disabler object
prevents the test from being built or run.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:53:18 +02:00
Pekka Paalanen
859153bada tests: move the harness into subdir
It was getting difficult to see which files were part of the test
harness and which were actual tests. Moving the harness sources into a
subdirectory helps to see at a glance what is what, and will allow using
shorter file names in the future.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-23 13:53:18 +02:00
Leandro Ribeiro
96f51b72d3 tests: add xdg-shell defunct surfaces test
Since commit "xdg-shell: handle xdg_wm_base being destroyed before its
children", we raise a protocol error DEFUNCT_SURFACES for misbehaved
clients.

This adds a test to ensure that DEFUNCT_SURFACES is being posted for
such clients.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-02-23 09:15:31 +00:00
Leandro Ribeiro
ddb1f1973a tests: rename xdg-shell-initial-commit to xdg-shell-test
In the next commit we add more tests to this, so let's rename.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-02-23 09:15:31 +00:00
Leandro Ribeiro
e7d300f79e tests: use SHELL_TEST_DESKTOP in xdg-shell-initial-commit
There's no need to use the desktop-shell if the purpose of these tests
is to test our xdg-shell implementation.

In the next commits it will be important to have a simpler shell to
work with, as we'll introduce additional tests for xdg-shell that
trigger leaks that are hard to fix with the desktop-shell.

So let's change this test file to use SHELL_TEST_DESKTOP.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-02-23 09:15:31 +00:00
Pekka Paalanen
a209e13526 libweston: give weston_surfaces a simple name
So far we have had two ways of identifying a weston_surface: by its
memory address "%p", and by its get_label function. The memory address
is not human-friendly and can get recycled. get_label() is not unique,
and in some cases it is client-controllable.

Oh, we also have the protocol object ID, but that does not exist for
internally created weston_surfaces.

We also have weston_surface::s_id, damage_track_id and flow_id. These
are used by some Perfetto instrumentation. s_id comes from a
compositor-wide counter rather than per-client counter, the others are
probably not what I'm looking for.

None of these are really nice for trace and debug prints for identifying
surfaces for human reading. Therefore, let's add one more ID, and with
it, a nice name for each surface.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-19 16:21:19 +02:00
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