Commit Graph

8989 Commits

Author SHA1 Message Date
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
Daniel Stone b510f4a9cb build: Avoid Meson warning for run_command() without check
Apparently the old behaviour was to silently succeed if program execution
failed. Setting check: true not only avoids a Meson deprecation warning
for not passing it, but gives us a more clear indication what goes on
when, e.g. breathe doesn't run.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Philipp Zabel d46b491c83 backend-x11: Prepare for more renderers, reject no-op
Turn the Pixman/GL if/else conditionals into switch cases to make it
easier to add support for others renderer in the future.

Also makes sure that weston --backend=x11 --renderer=noop fails
with an error message instead of starting with the GL renderer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-30 11:02:28 +00:00
Leandro Ribeiro c61719e9e9 color-lcms: increase float precision to print segment breaks
There are some cases in which we are seeing segment breaks like this in
the debug scopes: (0.00, 0.00]. A segment whose domain goes from 0 to 0
makes no sense.

This happens because we are printing the breaks with only two decimal
places. Increase that to four, in order to have more accurate
information in the debug scopes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 17:05:06 -03:00
Leandro Ribeiro 625a74d369 color-lcms: properly print 16-bit sampled curves
There's a case we were missing when printing the tone curves: the ones
with zero segments.

These are 16-bit sampled curves. Start taking them into account.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 17:04:15 -03:00
Philipp Zabel 4a40ae7718 libweston: deduplicate compositor shutdown in backend_init failure path
If backend initialization fails, weston_compositor_shutdown() is called
twice, once right away in weston_compositor_load_backend(), and once in
weston_compositor_destroy().
Remove the first and fix a segfault when trying to weston_plane_remove()
the primary plane a second time.

Fixes: 90c11cf40e ("libweston: move weston_compositor_shutdown call out of backends")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-29 19:16:01 +00:00
Philipp Zabel 789e474ddb doc: Add systemd-notify.so module to systemd unit example
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/767

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-29 16:11:33 +02:00
Leandro Ribeiro 25ffc4ae92 color-lcms: rename curve_set_print() to curveset_print()
Just to be consistent with the other functions in the code.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +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
Leandro Ribeiro 884579bc3c color-lcms: merge power-law curve sets
At the moment, when we merge two curve sets it becomes a sampled one.
With this change, we start merging power-law curve sets and keeping them
as parametric, as we'd rather have a parametric curve than a sampled
one.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +00:00
Leandro Ribeiro e4baf5ba09 color-lcms: drop inverse curve sets in sequence
At the moment, when we merge curves we transform them into sampled
curves, even if they were parametric before.

If we have two inverse parametric curve sets in sequence in the color
pipeline, we can drop them both, as merging them would result in the
identity curve. If we don't do that and merge the resulting identity
with another curve set, we'll end up with a sampled curve.

Start dropping inverse curve sets in sequence. This change help us in
the following scenarios:

pipeline:
curve set A, curve set B (inverse of A), curve set C (parametric)

Merging A and B results in identity, and merging that with C results in
a sampled curve. With our changes, we end up with curve set C intact,
and we'd rather end up with a parametric curve than with a sampled one.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +00:00
Leandro Ribeiro c54220f09d color-lcms: move code that depend on cmsGetToneCurveSegment() to new file
Move code that depend on cmsGetToneCurveSegment() to a new file:
color-curve-segments.c

This help us to eliminate #if HAVE_CMS_GET_TONE_CURVE_SEGMENT scattered
around color-transform.c, making the code clearer and helping to avoid
mistakes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +00:00
Leandro Ribeiro fe1e171e1b color-lcms: minor indentation fix to pipeline optimizer debug scope
Print empty pipeline with the proper indentation.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +00:00
Max Ihlenfeldt cccff21538 initialize fourcc with DRM_FORMAT_INVALID
Signed-off-by: Max Ihlenfeldt <max@igalia.com>
2023-06-29 12:36:56 +02:00
Max Ihlenfeldt a5f3bece5a gl-renderer: Always initialize variable
clang 17 complains that `fourcc` in `gl_renderer_fill_buffer_info()` is
uninitialized in the default case, because it fails to recognize that
if hit, that case will `assert(0)`. To get rid of this complaint, we can
just apply clang's suggestion and initialize the variable with 0 when
declaring it.

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
2023-06-29 11:31:26 +02:00
Derek Foreman 815a560dd4 data-device: Don't make a weston_coord with no valid space
We already only conditionally use base.offset when an icon exists. We
should also avoid trying to create a coordinate with a NULL icon, as it
will fire an assert().

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-28 14:37:34 -05: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
Derek Foreman f0196739ae toy-toolkit: Fix rotations
Ever since commit 3012934 some rotations have been broken. This is because
I transposed xy and yx in the cairo_matrix_init() call.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-27 11:41:35 +00:00
Philipp Zabel 90c11cf40e libweston: move weston_compositor_shutdown call out of backends
If we want to support multiple backends, the compositor must take care
to call this once, at the appropriate moment, so stop letting the
backends handle compositor shutdown themselves.

Move the weston_compositor_shutdown() calls from the backend::destroy
callbacks into weston_compositor_destroy() and the calls in the backend
creation error paths into weston_compositor_load_backend().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-27 12:09:47 +01:00
Philipp Zabel fcde7fae66 backend-wayland: use to_wayland_backend
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-27 12:09:47 +01:00
Philipp Zabel 6d699c3f54 libweston: add weston_backend::shutdown callback
Add a weston_backend::shutdown callback to split out the part of
weston_backend::destroy that needs to be done before compositor
shutdown.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-27 12:09:45 +01:00
Leandro Ribeiro f9ef4e64ea backend-drm: fix possible leak of struct drm_output
Before this patch, we would leak the drm_output if there was a pending
flip during shutdown.

Now we destroy the drm_output even if there's a pending flip (only
during shutdown, as we don't want to wait until flip completion to
destroy the output).

Also, it fixes a problem where weston_output_enable() is called right
after weston_output_enable() or weston_output_disable() and it could
fail to find available DRM objects (as they are only released after
the flip completion).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-27 10:57:12 +00: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 38e1523bdc fullscreen-shell: Use weston_view_move_to_layer()
Use the new helper, instead of open-coding a small part of it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone e743d56327 kiosk-shell: Use weston_view_move_to_layer() for view activation
When a new view gets activated, use weston_view_move_to_layer() for our
dance of moving views to the front.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone a822d20701 kiosk-shell: Use weston_view_move_to_layer() for background
Use the new layer-move helper for our background.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 8255c49a1f kiosk-shell: Use weston_view_move_to_layer() for activation
When we're switching between different active surfaces, use the new
weston_view_move_to_layer() helper.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 785af26007 desktop-shell: Be more precise with rotation damage
When we're rotating a surface, only mark the geometry as dirty after
we've actually updated the transformations. Then we can restrict our
repaint to just the view itself, not the full compositor.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 1da1d860fe desktop-shell: Use weston_view_to_layer() for lock surface
Use the new helper instead of open-coding part of it. This removes a
comment about not marking a surface as mapped until it has a buffer: the
surface->width == 0 check already guarantees that we have a buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 5c9231b116 desktop-shell: Use weston_view_move_to_layer() for static views
Use our new helper instead of open-coding part of it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 1c2edaac6b desktop-shell: Use weston_view_move_to_layer() for fullscreen background
Use the new helper for placing the fullscreen background view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone c1bbcba6e8 desktop-shell: Create fade-out views at destroy time
Instead of pre-creating a fade-out view that's sort of left half-mapped
around in the scene graph, create the view only when we need it, and use
the helpers to make sure that the damage is correctly handled.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone fd620717b3 desktop-shell: Use weston_view_move_to_layer() for per-view unfade
This is kind of immaterial since the view is going to be destroyed, but
it's a step.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 179d4513d0 desktop-shell: Use weston_view_move_to_layer() for fullscreen fades
Use our shiny new helper for fullscreen fades.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 62dbbd6706 desktop-shell: Use weston_view_move_to_layer() for fullscreen switching
When we're tabbing away from fullscreen views, use the new helper rather
than open-coding layer switching.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 7e1d446279 libweston: Add weston_view::map_signal
It fires when a view is mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 07103d1842 weston-desktop: Match desktop-shell view mapping semantics
Preserve the same order as desktop-shell for handling view (un)mapping,
so we can move these into a shared helper. These should have no
functional effect but provide a helpful bisect point.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 4b3e09fa71 desktop-shell: Centralise view mapping for shell_surfaces
shell_surface_update_layer() is the thing which moves our views around
into layers. Since we want to keep an invariant that a view is mapped if
it is on a layer, and unmapped if it is not on a layer, handle mapping
along with the layer moves.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 166d9661fb desktop-shell: Make view mapping more consistent
Try to stick to a pattern of first mapping a surface, then inserting a
view into a layer together with marking it as mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 54b78dd644 desktop-shell: Don't damage unmapped views
If a view isn't mapped, then we don't need to damage beneath it, as nothing's
beneath it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 0bee7ff4ee desktop-shell: Actually dirty surface regions when moving
weston_view_geometry_dirty() won't automatically clear out the old
region, so manually damage underneath the view before we mark the
geometry dirty.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 5ff5d0ea90 desktop-shell: shell_surfaces always have a layer
There is no way for shell_surface_calculate_layer_link() to give us a
NULL layer, so don't pretend it can and silently drop out without
removing it from the old layer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 2f2e20f3a3 weston_surface: Add map and unmap signals
These signals are emitted when the surface becomes mapped or unmapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Philipp Zabel 47180ad253 backend-wayland: fix error path in wayland_backend_create
Destroy the renderer before disconnecting the Wayland display.

Trying to destroy the GL renderer with the Wayland display already gone
crashes in the Mesa Wayland integration.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-26 13:45:59 +00:00
Philipp Zabel da683dad57 gl-renderer: clear renderer pointer in gl_renderer_destroy
After freeing the renderer, clear the compositor->renderer pointer to
avoid use-after-free errors.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-26 13:45:59 +00:00
Loïc Molinari edd5d1cc09 gl-renderer: Make clip_transformed() surf parameter constant
Calling clip_transformed() 4 times in a row with the same polygon8 in
commit a4d31fa8bd introduced a bug
because the surf input is modified each time. This is fixed by working
on a local copy. The input parameter is marked constant to reflect the
change on the function prototype.

Fixes #764

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-26 12:15:43 +00:00
Daniel Stone 68fd41a719 CI: Remove per-test-asan wrapper
Now that we've concluded the Xwayland/fontconfig stuff, we don't
actually need a per-test wrapper; we can just set the options globally.

It turns out that we don't need to set the options at all anyway, since
the previous commit adds the LSan suppressions to all test runs, and
LSan is enabled by default, so we can just bin it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-22 14:31:57 +01: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