Commit graph

9068 commits

Author SHA1 Message Date
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
Daniel Stone 386dcd904f build: Switch join_paths(foo, bar) to foo / bar
Available since Meson 0.49.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-22 14:31:57 +01:00
Pekka Paalanen d65e819bf7 build: use full_path()
Fixes:

../../git/weston/doc/sphinx/meson.build:57: WARNING: Project targets '>=
0.63.0' but uses feature deprecated since '0.55.0':
ExternalProgram.path. use ExternalProgram.full_path() instead

../../git/weston/doc/sphinx/meson.build:58: WARNING: Project targets '>=
0.63.0' but uses feature deprecated since '0.55.0':
ExternalProgram.path. use ExternalProgram.full_path() instead

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-06-22 15:31:35 +03:00
Pekka Paalanen bd794a0149 build: use project_source_root()
Fixes Meson warning:

../../git/weston/doc/sphinx/meson.build:40: WARNING: Project targets '>=
0.63.0' but uses feature deprecated since '0.56.0': meson.source_root.
use meson.project_source_root() or meson.global_source_root() instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-06-22 15:28:51 +03:00
Pekka Paalanen 2da397c5da doc: set language for Sphinx
When I upgraded Sphinx to 5.3.0 from Debian bookworm, I got the error:

Warning, treated as error:
Invalid configuration value found: 'language = None'.
Update your configuration to a valid language code.
Falling back to 'en' (English).

This fixes it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-06-22 15:24:29 +03:00
Philipp Zabel 38fea7c3b4 libweston: prefer active, high refresh rate outputs during surface assignment
Prefer outputs that are not powered off when assigning a surface to an
output. If a surface covers the same area on two outputs, prefer the
one with the higher refresh rate.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-21 10:33:39 +00:00
Daniel Stone 3100d3635f surface: Pass weston_surface_state into attach
attach needs to consider the viewport as well, so it makes more sense
for attach to consistently access the weston_surface_state, rather than
part from the surface and part from a function argument.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone a994e02a7e surface: Inline buffer-size calculation to attach
Pull the buffer-size calculation in when we attach a new buffer. This
will be able to save us from doing the calculation at all in some cases.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone 406b31f95f surface: Convert a couple of bools to dirty flags
We already calculate the dirty flags, so just check those instead of
their component bools.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone ead8bd5fdb surface: Only rebuild paint node regions when necessary
Rebuilding regions can be an expensive operation, and we're adding more
of them. This means we need to be clever about when we actually do them.

Only dirty the paint nodes when the transform or buffer size has
actually changed, not on every commit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone 8532c28761 surface: Start tracking weston_surface_status
Akin to the paint_node_status we already have, start also tracking a
surface dirty status. This will allow us to minimise the updates we need
to make.

Currently this is only collected, with no functional change made.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone 4863ee5ef1 surface: Move presentation-feedback discard to commit
There's no reason for it to belong in attach, really.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone f6d81e42d4 surface: Convert a couple of ints to bools
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Michael Tretter 914be30bc0 backend-drm: change default for required-outputs to any
On a desktop system, the expected behavior during a Weston start is that if any
monitor can be enabled, Weston starts up and enables the monitor. Outputs that
could not be enabled, stay disabled. This helps the user in debugging the failed
outputs.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-20 19:46:11 +00:00
Michael Tretter 20508c148e backend-drm: add config option require-outputs
If Weston fails to configure a DRM output for whatever reason, it will fail to
start. Depending on the use-case, this may or may not be the correct behavior.

Add the "require-outputs" option to allow configuring the error behavior on
missing outputs.

Add documentation of the possible options to the man page.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-20 19:46:11 +00:00
Michael Tretter 98e398e78b backend-drm: print failing output in error message
Print the name of the failing output to help debugging.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-20 19:46:11 +00:00
Philipp Zabel 72e2da24f9 backend-vnc: render bypass support
If there is an opaque full-screen view with a compatible SHM client
buffer left after peeling off the client-side cursor view, bypass the
renderer and let Neat VNC read from the client buffer directly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-20 09:21:14 +02:00
Philipp Zabel 8f18958cc5 backend-vnc: use weston_region_global_to_output
Instead of directly converting damage from pixman_region32_t in
global coordinates to pixman_region16_t in local coordinates,
use weston_region_global_to_output() to convert to pixman_region32_t
in local coordinates and then convert again to pixman_region16_t
in the same coordinate system, using vnc_region32_to_region16().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-19 21:36:17 +00:00
Daniel Stone 7c8685769d CI: Enable ASan memory-leak checking
Now that we clean up everything to do with wet_process, we can enable
memleak checking in CI.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +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 be55909779 backend-drm: Don't leak writeback-format property blob
We were freeing the writeback-format blob on error, but not on success.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 2896a0e9ab text-backend: Don't restart client on exit
When we're shutting down, don't try to restart the IM client.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00