Commit graph

10517 commits

Author SHA1 Message Date
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
Daniel Stone
47f1c1e694 ci: Retry on spurious failures
When we fail out because we couldn't even start a container or bring the
runner environment up, just retry the job.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-14 19:14:28 +01:00
Daniel Stone
ec6c67780e ci: Quieten seatd output
seatd is working well, so the debug spew serves only to annoy people
trying to read the logs.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-14 19:10:27 +01: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
Derek Foreman
1465362e9f compositor: Move paint node censor into early update
Previously I didn't think we needed this set up before assign_planes, but
certainly in the near future we'll want access to these bits for plane
assignment. It should be harmless to move them all now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-10 09:15:07 -05: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
Pekka Paalanen
a06ef0f8aa tests: add color-output-parsing
This tests the [output] section key 'color-profile', which is meant for
setting up parametric color profiles. It tests the special names, and
fetching values from EDID. There are also tests for all accepted keys in
a [color-profile] section.

These tests are all positive. Error messages are tested in another
patch.

The test client helper changes are needed for loading the EDID file.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Pekka Paalanen
d00b758cee tests/color-metadata-error: use weston_color_profile_init()
No reason to open-code this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Leandro Ribeiro
854457524c frontend: allow creating custom param color profiles from .ini
This allow users to specify a fully custom parametric color profile in
weston.ini for a certain output.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Pekka Paalanen
360eef9663 color: add weston_color_profile_param_builder_set_target_primaries_named()
The protocol does not carry target primaries by enumeration, but in
weston.ini I want to be able to use a name rather than raw values.
Adding this API makes that possible.

main.c cannot look up the enumeration itself, because color-properties.h
is private. As it should be.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Pekka Paalanen
9b68277b77 libweston: export weston_color_profile_param_builder_set_primary_luminance()
All the others were already exported, this was forgotten.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Pekka Paalanen
c0f79189dd shared: add safe_strtofloat()
This is for parsing multiple numbers from one weston.ini key, which
means I cannot use weston_config_section_get_double(). Also going to use
float type, which has less range than double.

Ironically, the tests fill likely fail on locales that do not use
period as the radix character.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Daniel Stone
f0be8d94a5 gl-renderer: Use glClear for solid opaque regions
If we have a solid region which is opaque, we don't need to go through
blending: we can simply emit a glClear, which has a pretty big benefit
on tilers in particular.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
af5f2370af gl-renderer: Move pixman_region_to_egl() up
We'll want to use this from earlier code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
1377fdf20d gl-renderer: Ignore transparent paint nodes
Skip these completely during repaint, since they by definition won't
have any effect.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
30a807b86f renderer-gl: Move checks into ensure_surface_buffer_is_ready
Instead of predicating the call to ensure_surface_buffer_is_ready() on
various conditions, move those into early exits from there.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
452f148b6c gl-renderer: Remove copy of buffer colour data
We can just get this directly from the paint node.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
6ffb4358e1 renderer-gl: Merge solid-buffer and placeholder paths
Now that paint nodes handle solid buffers properly, we can use the same
codepath through gl-renderer for all solid buffers, regardless of
whether they're a single-pixel buffer from clients, or a weston_curtain,
or a temporary placeholder due to content-protection or direct-display.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
c6b519ab12 paint-node: Set draw_solid for single-pixel buffers
Single-pixel buffers are, by definition, a single-colour fill across the
entire paint node. Use the draw_solid path for these where we can.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
e96a970e56 buffer: Don't lose direct-display when censoring output
When we're censoring output due to a content-protection mismatch, we
were setting draw_solid for the placeholder, but losing is_direct for
the original buffer.

There's no real effect with the current renderers, but best to be
consistent and make pnode->is_direct always accurate.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
8fc62e9ab8 gl-renderer: Rename prepare_placeholder to generic solid
This is, in fact, the path we'll take for all solid draws.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
b9e31d03ba gl-renderer: Use buffer colour for readback
When we're calling weston_surface_copy_content() from a solid buffer,
use the buffer's solid colour directly instead of our local copy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Daniel Stone
11d721e748 gl-renderer: Resolve open question
The answer is that no, we do not need to be using the view's opaque
region. If the paint node is marked as fully opaque, that's because the
view itself is also opaque, and as we are dealing with surface
co-ordinates we don't need to be handling the transform here.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 14:01:12 +01:00
Ray Smith
930f768bdb backend-drm: Fix double-free of pending state in error path
drm_pending_state_apply_atomic is supposed to leave pending_state
untouched if called as a test-only and that test fails, as per the docs
for drm_pending_state_test. If it gets as far as doing the atomic test
and it fails, it doesn't free pending_state. However if it fails to even
compile the state for the atomic test (for example, if a particular
property is not implemented in the driver for a particular plane), it
frees pending_state. In this case, drm_output_propose_state will free
the contained drm_output_state again, typically leading to a segfault.

Treat failing to compile the state for the atomic test in the same way
as successfully running the atomic test but it failing.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2025-10-09 13:39:23 +01:00
Philipp Zabel
847952b711 compositor: Fix warning on 32-bit architectures
On 32-bit ARM, tv_sec is of type long long int. Cast to int64_t and
use PRId64 from inttypes.h instead of %ld to silence these format
warnings:

  .../libweston/compositor.c: In function 'weston_compositor_print_scene_graph':
  .../libweston/compositor.c:9297:14: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=]
  .../libweston/compositor.c:9322:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=]

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2025-10-09 13:29:01 +01:00
Philipp Zabel
200f4cf461 weston-log: Fix warning on 32-bit architectures
On 32-bit ARM, tv_usec is of type long long int. Cast to int64_t and
use PRId64 from inttypes.h instead of %ld/%li to silence these format
warnings:

  .../libweston/weston-log.c: In function 'weston_log_scope_timestamp':
  .../libweston/weston-log.c:961:22: warning: format '%ld' expects argument of type 'long int', but argument 5 has type '__suseconds64_t' {aka 'long long int'} [-Wformat=]
  .../libweston/weston-log.c: In function 'weston_log_timestamp':
  .../libweston/weston-log.c:1015:27: warning: format '%li' expects argument of type 'long int', but argument 6 has type '__suseconds64_t' {aka 'long long int'} [-Wformat=]

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2025-10-09 13:29:01 +01:00
Philipp Zabel
de3a3fca1b shell.lua: Fix layer link assertions
Replace two always-true assertions:

        weston_assert_true(wc, &other_shview->view->layer_link.layer);

with what seems to have been the intended check:

        weston_assert_ptr_not_null(wc, other_shview->view->layer_link.layer);

This fixes a build warning:

  .../lua-shell/lua-shell.c: In function 'lua_shell_env_view_move_behind_other_view':
  .../lua-shell/lua-shell.c:1466:1: warning: the comparison will always evaluate as 'true' for the address of 'layer' will never be NULL [-Waddress]
  In file included from .../include/libweston/desktop.h:27,
                   from .../lua-shell/lua-shell.h:27,
                   from .../lua-shell/lua-shell.c:33:
  .../include/libweston/libweston.h:1112:23: note: 'layer' declared here
  .../lua-shell/lua-shell.c: In function 'lua_shell_env_view_move_in_front_of_other_view':
  .../lua-shell/lua-shell.c:1482:1: warning: the comparison will always evaluate as 'true' for the address of 'layer' will never be NULL [-Waddress]
  .../include/libweston/libweston.h:1112:23: note: 'layer' declared here

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2025-10-09 13:45:47 +02:00
Daniel Stone
dc473a4131 tests/color: Increase sRGB->BT2020 matrix tolerance
The average tolerance was very very close on my AMD machine, but not
enough; the maximum tolerance certainly needed to be increased.

Observed on an AMD Radeon 780M with radeonsi from an October 2025 Mesa
build.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-09 10:39:31 +01:00
Pekka Paalanen
516f4b9b2f color-lcms: fix transform destroy on error
The error path in cmlcms_color_transform_create() uses
cmlcms_color_transform_destroy() to clean up. cmap_lut3d can be NULL in
that case, and cmsDeleteTransform() chokes on it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
4890cd6a3d frontend: create automatic color profiles from .ini
This introduces a new key for outputs in weston.ini, "color-profile".
For starters, implement a pre-defined sRGB profile and an automatic
profile.

Automatic color profiles are created based on the colorimetry-mode and
the eotf-mode of the output. EDID can also be taken into account, but it
is opt-in due to its potential unreliability.

This feature is documented as not fully implemented, because color-lcms
does not yet handle parametric color profiles together with ICC
profiles. Specifically, the stock sRGB profile is still an ICC profile,
and would not be able to be used together with a parametric output
profile.

Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
fe85ed48fc shared: implement weston_parse_space_separated_list()
This will be useful for parsing config file entries that have several
items on key, like x,y coordinates or a list of flags. Code reading
custom color profiles from weston.ini will use this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
6ec30279f7 color: weston_color_profile_params_to_str() const
As it should have been. Found, when I temporarily needed to print
'static const struct weston_color_profile_params'.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
e76da2ccd0 color-lcms: shorten parametric profile description
Details are printed separately for logs and debugs, we don't need to
clutter the (short) description with these. The name_part is already
long enough for frontend-created automatic profiles.

Client-created parametric profiles will be indistinguishable from each
other, but we also don't log them anywhere. In debug prints, they are
identified by id numbers and printed in detail.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
e75873d376 color: improve primaries-named builder error
This error gets sent to clients or into the Weston log. Print the name
rather than the meaningless number.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
b8ac69eef1 color: check maxCLL and maxFALL against target lum always
The target luminance range is implied when not explicitly set, so maxCLL
and maxFALL should be checked against target luminances regardless of
whether target luminances are explicit.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00