Commit graph

10942 commits

Author SHA1 Message Date
Pekka Paalanen
e810728a59 tests/color-math-test: migrate to DECLARE_TEST_LIST API
Replace TEST() and TEST_P() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
a35a46acc7 tests/color-management-protocol-test: migrate to DECLARE_TEST_LIST API
Replace TEST() and TEST_P() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
9fadbf159b tests/color-lcms-optimizer-test: migrate to DECLARE_TEST_LIST API
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
cf102ae649 tests/color-icc-output-test: migrate to DECLARE_TEST_LIST API
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
47410163b0 tests/color-effects-test: migrate to DECLARE_TEST_LIST API
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
aaec5247ef tests/client-buffer-test: migrate to DECLARE_TEST_LIST API
Replace TEST_P() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
99fc36f210 tests/buffer-transforms-test: migrate to DECLARE_TEST_LIST API
Replace TEST_P() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
f4d7ff3c20 tests/bad-buffer-test: migrate to DECLARE_TEST_LIST API
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
ab00769756 tests/assert-test: migrate to DECLARE_TEST_LIST API
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
b5b6e4da3e tests/alpha-blending-test: migrate to DECLARE_TEST_LIST API
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
d47ae7351a tests: new test listing macros
This is a step towards getting rid of the __start_test_section and
__stop_test_section usage. The old macros assumed that all individual
variables assigned to the test section would be packed there as if in an
array. Mostly this seemed to work, too, with some magical alignment
fixes in the past. It was not guaranteed to work.

With the new test listing macros, we collect an actual array. The
drawback is that we need to mention all the test entry points explicitly
and they look like normal functions in the code - which they now are.
Their argument typing is safe, and their arguments are explicitly
visible. We rely on the compiler to complain about unused functions if
any entry point is forgotten from the array.

The array is still put into the test section, because this seems to be
the only feasible way of letting the harness code support both the old
and new test listing macros at the same time. This allows converting
each test program individually.

TESTFN_ARG() needs an explicit cast on the function pointer type,
because the data argument pointer type will not match const void*.

As an example of using the new macros, linalg-test.c is converted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 16:29:56 +03:00
Pekka Paalanen
e34a2157d1 tests: use union instead of wrapper function
This simplifies our test declaration macros a little bit. The aim is to
modify struct weston_test_entry to be more suitable for a future where
__attribute__((section)) is no longer used. The test functions will be
plain functions and not something baked with macros, so wrappers have
to go.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 15:12:59 +03:00
Pekka Paalanen
39caecee61 tests/vertex-clip: add const
When I make the test harness more type-safe, this would fail to build.
Add the missing const.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 15:12:59 +03:00
Pekka Paalanen
d2565d4c25 tests/custom-env: add const
When I make the test harness more type-safe, this would fail to build.
Add the missing const.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-28 15:12:59 +03:00
Marius Vlad
6588352937 compositor: Annotate surface enter/leave events
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-27 13:28:51 -05:00
Detlev Casanova
4de2655f08 renderer-gl: Also set dmabuf.rb when creating render buffer
gl_fbo_image_init() allocates and returns a renderbuffer through its rb
argument.
If it is not set in the dmabuf.rb field, gl_fbo_fini() will not be able to
release it and DMA buffers can start leaking.

This is usually not an issue because the DMA buffers are released when
Weston closes, but in the case of the pipewire output, the buffers are
allocated when a pipewire client connects and freed when the client
disconnects.
In that situation, dangling DMA buffers can be observed because of the
unfreed render buffer (rb).

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
2026-05-26 14:43:57 -04:00
Pekka Paalanen
37860bace5 tests/color-management-protocol: add inert_get_preferred_image_description
Extend test coverage.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:12:33 +03:00
Pekka Paalanen
08af0811cb tests/color-management-protocol: add set_bad_rendering_intent
Extend test coverage.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:12:33 +03:00
Pekka Paalanen
22f6b4ecc7 tests/color-management-protocol: add set_inert_surface_image_description
Extend test coverage.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:12:33 +03:00
Pekka Paalanen
8e7e882b67 tests/color-management-protocol: add set_failed_image_description
Extend test coverage.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:12:33 +03:00
Pekka Paalanen
5776cbb063 tests/color-management-protocol: add soft-fail image description
We need to be able to test cases where a client tries to use a not-ready
image description. Turns out passing an fd for a directory fails just
the right way without triggering protocol errors.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:12:13 +03:00
Pekka Paalanen
1ffa089f7f tests/color-management-protocol: move parametric_cases
Move all the parametric_cases definitions just above the TEST_P() using
them, to be close to the code that needs them.

While the diff might look odd, this is really just moving the one big
block of code verbatim.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:05:14 +03:00
Pekka Paalanen
ad3fbd3823 tests/color-management-protocol: rename case array
There may or may not be more case arrays, so rename these to hint
towards which test is using this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:05:14 +03:00
Pekka Paalanen
a41eac42ce tests/color-management-protocol: trigger error_surface_exists
Cover a new failure case, but also make sure the re-creation is still
accepted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:05:14 +03:00
Pekka Paalanen
00e9842a1b tests: rename -parametric to color-management-protocol
This is the program's new scope.

Also drop unnecessary dependencies, these were consolidated when color
management protocol helpers moved into the harness.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:05:14 +03:00
Pekka Paalanen
e593d9142d tests: rename color-management to image-description-query
This is the program's new scope.

Also drop unnecessary dependencies, these were consolidated when color
management protocol helpers moved into the harness.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:05:14 +03:00
Pekka Paalanen
55337ac35a tests: move non-repeated test into parametric
color-management-test will turn into image-description-query test, which
runs with an array of fixtures setting up different output image
descriptions, and checks the preferred and output image
description information.

The param test will test everything else non-screenshots that does not
need to iterate over different output image descriptions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-26 15:02:43 +03:00
liang zhou
0f3df6f168 libweston: add new API weston_compositor_bind_touch
Allow weston plugins to implement custom touch binding logic by using
this API.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2026-05-26 09:01:37 +00:00
liang zhou
751a5a5f74 libweston: add set_output param for weston_touch_create_touch_device
Add the set_output function to weston_touch_device to allow touch binding
interfaces to re-assign the touch-to-output mapping.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2026-05-26 09:01:37 +00:00
liang zhou
3427788c40 libweston: add API to find weston output by head serial
Add new API weston_compositor_find_output_by_head_serial for touch
binding.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2026-05-26 09:01:37 +00:00
liang zhou
edce1fea4b libweston: add API to get serial number from weston head
Plugins need to get the serial number of the weston_head to match the
touch devices.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2026-05-26 09:01:37 +00:00
liang zhou
d774dba68a libweston: add API to get touch device list
Add API for plugins to retrieve touch device list for initializing touch
devices at startup.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2026-05-26 09:01:37 +00:00
liang zhou
1269a908d5 libweston: add touch device creation signal
Add a signal for touch device creation to allow plugins to detect and
respond to touch device changes.

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
2026-05-26 09:01:37 +00:00
Elliot Chen
615f6c0322 backend-pipewire: fix dmabuf memory leak on renderbuffer creation failure
When create_renderbuffer_dmabuf() fails and returns NULL, the previously
allocated linux_dmabuf_memory was leaked because pipewire_output_setup_dmabuf()
had already been called with no cleanup path.

Reorder the calls so that create_renderbuffer_dmabuf() is invoked first.
If it fails, explicitly destroy linux_dmabuf_memory and return early to
avoid the leak.

Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
2026-05-26 09:10:58 +01:00
Pekka Paalanen
d36596b25c color: dissolve cm_image_desc_destroy()
The only legal way to destroy a cm_image_desc is to go through the
wl_resource destruction. Calling the function otherwise would have left
a dangling pointer in the resource. Let's not have the temptation to
"fix" that dangling pointer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-25 13:38:57 +00:00
Pekka Paalanen
bc554e537b color: remove unnecessary cm_image_desc->cprof checks
Since "color: refactor cm_image_desc_create()" if cm_image_desc exists
then the cprof exists as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-25 13:38:57 +00:00
Pekka Paalanen
209afd400d color: refactor cm_image_desc_create()
Previously, cm_image_desc_create() created the wl_resource, the
compositor object, and linked them together. Call sites that do not have
a ready-made color profile to use for it, had to call
cm_image_desc_create() with a NULL cprof. Then they would attempt to
create the cprof, and:
- if it succeeded, patch it into struct cm_image_desc;
- if it failed, release the cm_image desc and reset resource user data
  to NULL.

Let's make this more straightforward by refactoring.

create_image_description_resource() creates the wl_resource and sets up
the implementation, but user data remains NULL. This is a common
operation done at all cm_image_desc_create() call sites.

link_image_description_resource() creates struct cm_image_desc and links
it to the resource via user data. This can only be called with a valid
cprof.

If anything fails, there is no need to back things out like before. The
sending of errors and 'ready' events is consolidated.
cm_image_desc->cprof is guaranteed to be non-NULL.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-05-25 13:38:57 +00:00
Derek Foreman
1edb3a6fe2 trace: Convert fixed to double for prettier display of pointer events
Convert the pointer surface coordinates to doubles so we can more readily
see what they mean.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
abccfe3b5c trace: drop the explicit flow from COMMIT_ANNOTATION
Replace this with flow annotations, allowing us to burn down even more
copy pasta.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
df36535499 commit-timing: Remove unused flow_id
We never hooked this up, so let's remove it for now and worry
about it later, if at all.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
5f3bfc0d2f trace: Remove old flow macros and functions
Now that flows are mostly annotations, we can burn down all the old
unused flow macros.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
41fd97e0ea trace: Update input to use flow annotation
Use the new method of adding flows for input.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
8f6a824c48 trace: Update transaction to use annotated flows
Use the new annotation flows for this as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
bc41a11c3b trace: Use flow annotation for weston_surface and surface_state
Use the new method of adding flows for these.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
cc2a85cb59 trace: Add flow as an annotation and use it for paint nodes
Annotations give us a more generic way to incorporate flows into our
perfetto traces.

This will eventually let us remove some _FLOW() variants of our trace
macros.

It also lets us have multiple flows through the same function/annotation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
3796267cfc trace: Fix WESTON_TRACE_ANNOTATE_FUNC() when not building perfetto
This should be variadic. Nothing uses it, so it hasn't broken yet,
but we're about to use it, so clean it up.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
dc9ce8dd20 trace: update annotations even when not tracing
This hopefully isn't ridiculously heavy. The heavy part is committing the
flow array later, which is already gated by perfetto internally, so we
don't have to protect anything here ourselves.

This makes it easier to put flows in annotation arrays, because flows need
to be kept up to date even when not tracing.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
d35259e3b2 trace: Fix typo in double annotations
They're setting the float value instead of the double value, which leads
to corrupt output.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:45:31 -05:00
Derek Foreman
dee08a8a32 trace: Fix buffer annotator
This was supposed to early return after logging the NULL buffer, not
foolishly carry on and attempt to dereference it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:11:26 -05:00
Derek Foreman
6adef7fa06 trace: Don't try to show details when there's no focus client
This can turn into a NULL pointer dereference, and the values
aren't meaningful in this state anyway.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-21 16:10:04 -05:00