Simplify clip_transformed() by replacing its context parameter with a
clipping box parameter. The context struct is still used internally to
pass data around.
Since clip_transformed() doesn't take a context anymore, the clipping
boxes are now declared per test and stored along with the other vertex
data. That prepares the ground to add new tests using different boxes.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Carry on the common vertex representation front by making boxes use
the clip_vertex struct.
A new function clip_quad_box32() is added to clearly separate the main
function taking a clip_vertex struct from the utility function taking
a pixman_box32 struct.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Pass a clip_vertex struct and a size to clip_transformed() instead of
a polygon8 struct to simplify the clipper API by sticking to a common
vertex representation.
Simmplify vertex-clip test since clip_transformed() now works on a
copy of the polygon (commit edd5d1cc09).
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
In the following commits, we'll create the stock sRGB color profile for
outputs in weston_output_init(), and destroy it in
weston_output_release().
We already have a mock color manager in the tests, but we still need
to add the functions to create/destroy a mock stock sRGB color profile.
This should avoid crashes in the following commits.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Add yet another flavor of assertion macros.
Unlike libc assert.h assert(), these cannot be easily disabled by the
build. They also print both the implied expression and the compared
values.
Unlike ZUC macros, there is much less framework code and it can handle
also floating-point types.
The function custom_assert_fail_ can be redefined, meaning that
different compilation units can do different things on failure.
Also the 'compositor' parameter was added to the new macros because we
plan to use these asserts in our log infrastructure, and we want to
print the "failure" messages in the right log scopes. Having the
compositor already in the macros will avoid double work.
Another future possibility is to write specific asserts for the test
suite. So we would be able to write a test suite failure function that
just print what "failed" without aborting.
There is also limited support for custom types.
These are actually pretty similar to libinput's litest macros.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
There are many times when we want to set a global position with a surface
offset added.
It's a fairly nasty operation, and most places in the code currently do
it naively, ignoring the painful existence of freeform window rotations
and other complex transforms that could be in play (but probably aren't)
Add a helper for this and convert existing usage.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
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>
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>
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>
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>
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")
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This adds a test to ensure that the DRM-backend writeback screenshooter
is working properly.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
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>