Commit graph

718 commits

Author SHA1 Message Date
Daniel Stone 43cc77d4e9 tests: Check that test-surface unmaps on NULL
Make sure that committing a NULL buffer to a test-surface results in a
paint node disappearing.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-11 15:27:28 +00:00
Daniel Stone caac97be6a tests: Don't remap surfaces with NULL buffer
On attaching a NULL wl_buffer, weston_surface_attach() will unmap the
surface. Don't immediately remap it within committed() if we don't have
a buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-11 15:27:28 +00:00
Daniel Stone 5b14a094e7 tests: Use weston_view_move_to_layer()
Use the helper, don't mark stuff as mapped ourselves. Set the position
before the view, so when it's marked as mapped, it's already in
position.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-11 15:27:28 +00:00
Daniel Stone e61d15dd76 tests: Move surface mapping earlier in surface-shell
The surface needs to mapped before a view can be mapped. Fix this.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-11 15:27:28 +00:00
Derek Foreman 4def21c196 tests: prevent tests from breaking when they use invalid weston_compositor
The color-metadata-errors test inits outputs with a NULL compositor, and
makes a compositor that's entirely 0s except for the bits it's interested
in.

This makes a mess in a future where the primary_plane is split up per
output, as initializing the primary plane tries to add it to the
compositor's plane_list.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:43 -05:00
Daniel Stone 0189bfac9f surface: Add test for recursive subsurface unmapping
Make sure that in a 1 -> 2 -> 3 -> 4 parent->child subsurface nesting,
destroying surface 2 also immediately unmaps 3 and 4.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone 17e4a77831 tests: Initialise breakpoint list for all test types
The list of client breakpoints was used for both client tests and plugin
tests - anything that uses the weston-test module - but was only
initialised in the client-test path. Make it unconditional.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: efde2fa0b1 ("tests: Add client<->compositor breakpoint support")
2023-07-03 22:39:38 +01:00
Daniel Stone ce113969e3 tests: Add paint-node test
This is a very simple test, mostly intended as a demonstration of the
new client<->compositor breakpoint infrastructure. It ensures that for a
simple test surface, a paint node has been created in the output's
paint-node list, reflecting the properties of the attached buffer.

This is an example of properties which are not observable by regular
clients.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Daniel Stone efde2fa0b1 tests: Add client<->compositor breakpoint support
Add support for clients to request the server insert breakpoints at
various points in its processing. These breakpoints are handled
internally by semaphores (visible to tests through helpers): when the
server reaches the specified point, it will pause execution until the
client allows it to restart.

A weston_compositor pointer returned at each breakpoint allows the
client to reach across the thread boundary and access the server's
internal data structures. This can be used to, for example, inspect
paint nodes, internal damage, or any other work which is not necessarily
client-visible.

The majority of tests will not need to use this infrastructure; it is
only intended for tightly-coupled tests which can very specifically
dictate and anticipate the server's execution flow.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Daniel Stone 68cfc121dc tests: Track weston_outputs in weston-test plugin
Keep a tracking set of every weston_output created by the compositor,
and use this to listen to the repaint signal.

This currently does nothing, but will later be used to listen to repaint
signals as a client breakpoint type.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Daniel Stone fec581ab7a tests: Pass wet_testsuite_data to test runs
Make sure every test handler now gets a copy of wet_testsuite_data,
which we'll later use for client<->compositor synchronisation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Daniel Stone ae2c47045f tests: Remove single case for device destroy test
Currently we have some device tests which run in a single iteration
once, then in lots of iterations after that.

The single-iteration case is useless, so remove it, which has the happy
side effect of not breaking when we change the test signature.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Leandro Ribeiro 9486740d21 tests: add color pipeline optimizer tests
This will help us to debug our color pipeline optimizer without the
need to craft special ICC profiles for that. In this initial patch,
we are able to add matrices and curve sets to the pipeline and assure
that the optimizer is doing the right thing.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +00:00
Derek Foreman 14220a5f80 tests: Don't wait for frame callbacks when a surface is on no outputs
The event-test moves a client off of all the outputs to check for an
output leave event, but our move_client() code waits on a frame callback
to continue.

The fact that weston currently generates this frame callback is not
something we should enforce in a test, as it could (should) change in
the future.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-28 11:30:07 -05:00
Daniel Stone 0a4d74c60d weston-test-desktop-shell: Use weston_view_move_to_layer()
Simple patch, negative LoC, cleanliness win, correctness win.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 249f68adb0 build: Run tests with leak-sanitizer suppressions
cf. the never-ending saga of how we can't neuter the fontconfig leaks,
also pass our CI leak-sanitizer suppression file when running tests
locally. This makes it easier to run with ASan enabled in your local
environment.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-22 14:31:57 +01:00
Daniel Stone 42f071e881 tests/drm: Fix leaks in drm-writeback-screenshot-test
We were leaking a couple of buffers (both input and output), and also a
couple of filenames.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone f360818960 tests/xwayland: Ensure $DISPLAY is correctly set
We rely on the Xwayland launcher setting $DISPLAY to connect to our own
X server. Make very sure in the tests that we're actually getting that
set properly.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Sergio Gómez 65740ca9a7 tests: Add basic testing for pointer constraints protocol
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 10:27:14 +03:00
Sergio Gómez 34269c4708 tests: Add a button binding to weston-test-desktop-shell
We need this so that Weston can update the "click to activate" serial, so
that we can then use the constraints protocol (see
maybe_enable_pointer_constraint() in libweston/input.c).

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 10:27:14 +03:00
Derek Foreman e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Derek Foreman 244dc963b9 libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:19 -05:00
Loïc Molinari 49053a2aa2 gl-renderer: Store clipped vertices directly into the vertex buffer
Move vertex clipper back to single-precision floating point
intermediates. Since positions are sent down the graphics hardware as
single-precision values, this prevents useless conversions between
single and double precision values and lets compilers fit twice as
much data into vector registers. It also removes a copy by letting the
clipper store vertices directly into the vertex buffer.

This is mostly reverting the conversion to double-precision that
happened along with the switch to the weston_coord struct for vertex
coordinates (commit 10e70bf23c).

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Leandro Ribeiro cf64fbe784 tests: assert that capture info was received before trying screenshot
If the source is not supported, we won't receive the capture
information. So the capture info (size/format) will be zeroed, and we
fail while trying to create a buffer for the screenshot with size/format
zeroed.

With this patch we fail if we don't receive the capture info, what makes
the failure reason more explicit.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-05 07:51:27 +00:00
Marius Vlad 4bc7bd73d7 libweston/weston-log: Add a iterator helper for debug scope
This adds three new helpers: one to iterate over all debug scopes
created/added and other two are for simpler getters for the scope name
and the description.

Included with this change is also a simple test to retrieve them.

This is an alternative to using the debug scope list advertised when
using the weston-debug private extension. libweston users can use this
directly to know which scopes they can subscribe to, and there's no need
to have a client implementation for the weston-debug protocol.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-05-30 11:05:14 +00:00
Marius Vlad 9e1c2056cf tests/meson.build: Add missing dependency for xcb-client-helper
This fixes the following build issue:

[    6s] cc -Itests/libtest-xwayland-client.a.p -Itests -I../tests -I. -I.. -Iinclude -I../include -Iprotocol -I/usr/include/pixman-1 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Wextra -Wpedantic -std=gnu99 -Wmissing-prototypes -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers -Wno-pedantic -Wundef -fvisibility=hidden -O2
-Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -MD -MQ
tests/libtest-xwayland-client.a.p/xcb-client-helper.c.o -MF tests/libtest-xwayland-client.a.p/xcb-client-helper.c.o.d -o tests/libtest-xwayland-client.a.p/xcb-client-helper.c.o -c
../tests/xcb-client-helper.c
[    6s] ../tests/xcb-client-helper.c:39:10: fatal error: wayland-client.h: No such file or directory

Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-05-18 19:23:58 +03:00
Leandro Ribeiro 8c9dd4febb tests/color-icc-output: add ICC VCGT tests
There are some ICC profiles that contain something named VCGT tag. These
are usually power curves (y = x ^ exp) that were loaded in the video
card when the ICC profile was created. So the compositor should mimic
that in order to use the profile.

Weston already has support for that, but our ICC profile tests were
missing this case. This adds such tests.

For testing purposes, we have added tests with different exponents per
color channel.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-27 10:37:38 +00:00
Leandro Ribeiro 722d7f8c3f tests/color-icc-output: assert that dimension is not zero when creating clut
Without that we may crash when trying to create a PTYPE_CLUT ICC profile
with dimension zeroed. This would be wrong, so with this change we are
basically validating the test case arguments.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-27 10:37:38 +00:00
Leandro Ribeiro 7ea4075d77 tests/color-icc-output: differentiate test name based on ICC profile type
For now we have some tests with the same name. Differentiate them based
on the ICC profile type that they build: CLUT vs matrix shaper.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-27 10:37:38 +00:00
Daniel Stone d0301c9a82 tests/xwayland: Don't leak XCB reply
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 10:17:19 +01:00
Michael Olbrich c30da2aa32 tests: ivi-shell: prepare for API simplification
The return values for most of the API functions will be removed and replaced by
asserts. So checking return values will no longer work and passing invalid
arguments will trigger asserts. Modify and remove the tests accordingly.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-04-19 09:38:09 +03:00
Daniel Stone c7a29b5196 tests: Allow DRM fixture setup to cleanly skip
Move our DRM test fixture setup later, where we already have a bunch of
per-backend splits, so we can choose to skip our tests at the right
time.

Doing this allows us to skip DRM tests with no memory leaks.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-12 10:52:57 +00:00
Daniel Stone 3ae62c208c tests: Move prog_args_save() later
This allows us to append to the arguments later on.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-12 10:52:57 +00:00
Leandro Ribeiro a62cb45b6e tests/color-icc-output: make use of color debug scopes
Now that we have color profile, transformation and optimizer debug
scopes, make use them in this test.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-12 10:03:32 +00:00
Pekka Paalanen 21f2fb99d5 tests: do not leak renderer argument
Noticed by ASan. The strdup() is not necessary, str_printf() returns an
allocated string.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-04-11 17:43:14 +03:00
Marius Vlad 06b57e1dda tests/xwayland-test: Also print out Weston log messages
We don't accumulate log scopes with was previous set internally so
enable the "log" scope (explicitly) for the xwayland-test to see what
Weston prints out.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-31 09:06:24 +03:00
Marius Vlad 14ca04609a tests/xwayland: Enable xwayland XWM debug log scope and more debug
We're still timing out with our basic xwayland test in CI, so this
enables the XWM logging scope, and enables some further print debugs we
have available in our helper library, in an attempt to further
investigate and determine why we're still timing out.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-28 12:45:13 +03:00
Leandro Ribeiro 89d05db0b7 tests: add writeback sreenshooter test
This adds a test to ensure that the DRM-backend writeback screenshooter
is working properly.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Marius Vlad 640a3c7165 xcb-client-helper: Add a XCB client helper for tests
This patch introduces a small library wrapper around XCB to be used in
Xwayland tests.

It's being designed such that we do not advance without accounting for
all X11 events when changing the window state.  It adds a fence that
waits for all events to be processed, and only after all the events have
been accounted for, to proceed further, resuming execution of the
tests.

This works by keeping a tentative_state list for the client and a
window state that gets applied when the event we waited for has been
received.

This is useful in test clients, which could verify at the end after
receiving all events that the correct state has been applied. Acts as a
way to verify that the we never get or have a different state than the
one we expect.

With it, this converts test-xwayland to using libxcb (together with
xcb-cursor-dev) rather than using Xlib, and with it it removes any Xlib
dependency we might have in the tests.

This only adds support for map/unmap/create/destroy/property notify.
A follow-up would be to expand this library to track window movement
and resizing.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-03 08:30:46 +00:00
Derek Foreman 59a0bd99bd libweston: Use weston_coord in surface committed handler
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 69908000e3 input: Convert weston_pointer_motion_event to weston_coord
This struct has a lot of members that can be converted to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 8031b9d57f backend: Make input notification functions use weston_coord
Push weston_coord into the notification functions instead of passing
two doubles.

The touch handlers are passed a pointer to a weston_coord, which is
unusual. This is done so we can pass a NULL pointer instead of a
fabricated invalid coordinate when the touch type is TOUCH_UP.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 3ef8bb9935 tests: Don't send real coordinates with WL_TOUCH_UP events
Wayland protocol can't do this, but the way our test protocol handles
touch through a single event can - ensure that we don't by accident.

This will matter more shortly when we add assert()s to prevent having
coordinates with WL_TOUCH_UP events internally later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 10e70bf23c clipping: Use struct weston_coord in vertex clipping code
Remove the independent x, y floats from the clipping code and replace them
with struct weston_cord. This includes the polygon8 structure as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman da3d3c7e95 compositor: Add dirty bits to paint nodes
We're pushing more and more mutable state into paint nodes, but this state
has a non-zero cost to rebuild every render.

Let's take care to track when we need to rebuild the state.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 13:49:39 +00:00
Derek Foreman 64d9270804 libweston: Use weston_coord space conversion functions
Update users of the old coordinate space conversion functions that take
x, y pairs to the new weston_coord versions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Marius Vlad a67f434f59 drm-smoke-test: Explicitly set-up the output name DRM test
In case we have multiple outputs let's us choose the first output,
rather use the last one, which would happen when multiple are present in
the system.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-25 17:55:39 +00:00
Marius Vlad 1e16a5eb2d tests: Add the ability the specify the output name
In preparation of having multiple outputs available we should be able to
specify by its name. We just use the default one if none was set-up at all.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-25 17:55:39 +00:00
Philipp Zabel e3b64b6e76 tests: use enum weston_renderer_type
Now that enum weston_renderer_type is public, there is no need for a
local enum renderer_type in the tests.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-18 14:16:41 +01:00