Commit graph

9725 commits

Author SHA1 Message Date
Marius Vlad
d3038814ed build: bump to version 14.0.3 for the point release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-04-24 10:47:31 +03:00
Leandro Ribeiro
8f12365f13 drm: use output capture task destroy listener for writeback
No behavior changes; this is a follow-up of "drm: handle client buffer
destroyed while writeback scheduled".

That commit protects against clients disconnecting while a writeback job
is scheduled, which could otherwise lead to crashes if the buffer is
destroyed before the wb job completes. However, output capture provides
the same functionality: it listens to the client buffer destroy event to
retire the capture task.

Instead of listening to the wl_buffer destroy event, simply listen to
the capture task destroy event. GL renderer already follows this
pattern, and now DRM aligns with it.

See also:
weston_capture_task_buffer_destroy_handler()
weston_capture_task_add_destroy_listener()

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 04a85ab71c)
2026-04-23 20:51:50 +03:00
Leandro Ribeiro
4c2bbc5180 drm: assert writeback state is freed after capture task retirement
No behavior change, just a refactor to make it more clear that the state
is freed after the capture task is retired.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 7444c29fd2)
2026-04-23 20:51:48 +03:00
Derek Foreman
e4323dc7c9 libweston: Add an output capture task destroy listener
An output task may be destroyed by a client disconnect. This causes
problems for our drm backend's asynchronous capture task handler, which
currently has no way to notice this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit d2bab8a5ee)
2026-04-23 20:37:43 +03:00
Leandro Ribeiro
641ac3ef82 drm: handle client buffer destroyed while writeback scheduled
Currently when a client buffer gets destroyed, the output capture task
gets destroyed with weston_capture_task_buffer_destroy_handler().

The problem is that we may have a writeback task scheduled, so
wb_state->ct would be pointing to a ct that has already been retired
and destroyed.

In this commit we start handling this case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 1152c53e58)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-04-23 14:42:06 +03:00
lxylxy123456
65c7cc45b3 clients/window: Fix segfault when dragging with touchscreen
Signed-off-by: lxylxy123456 <lixiaoyi13691419520@gmail.com>
(cherry picked from commit 874bf36c51)
2026-04-23 14:42:06 +03:00
Wang Ruitang
60963b795c libweston: check focus surface before enabling pointer constraint
Check if surface matches before enabling pointer constraint. If not
match, no constraint enabled. Otherwise, assertion would failed in
confined_pointer_grab_pointer_motion() and weston would crash.

This fixes crashes reported in GitLab issues #185 and #670.

Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/185
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/670
Signed-off-by: Ruitang Wang <Ruitang.Wang@amd.com>
(cherry picked from commit c23ea4ba8d)
2026-04-23 14:42:06 +03:00
Pekka Paalanen
d1f9bd3d09 compositor: fix finish_frame presentation feedback crash
This was brought up in issue 1063. The assertion in
weston_presentation_feedback_present_list() will trigger randomly during
repeated suspend/resume testing, presumably while a client is animating
and asking for presentation feedback.

drm_output_start_repaint_loop() has a path where drmWaitVBlank() is able
to pull a good timestamp for the last vblank. This results in a call to
weston_output_finish_frame() with a good timestamp and
WP_PRESENTATION_FEEDBACK_INVALID in the flags.

Previously it was assumed that in such case the presentation feedback
list cannot have any entries. This assumption is false. It is possible
that while the output is in idle state, a client will post an update to
a surface and ask for presentation feedback on it. This should trigger
drm_output_start_repaint_loop() with a non-empty feedback list.

It is unclear why this problem was not seen in the wild much more often.

Start-repaint-loop does not present anything by definition, it only acts
to synchronize the output repaint loop with the (hardware) scanout
cycle. Therefore no feedback must be sent there. As
WP_PRESENTATION_FEEDBACK_INVALID flag indicates no feedback must be
sent, use it to avoid calling
weston_presentation_feedback_present_list().

References: https://gitlab.freedesktop.org/wayland/weston/-/issues/1063
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit d69e816b54)
2026-04-23 14:42:06 +03:00
Derek Foreman
5ea838be63 compositor: Fix output reflowing when mirroring is in use
When we have a mirror, it will be at the same x,y position as the output
it's mirroring. On hot unplug, the current logic results in the mirroring
output being moved to the left by the width of its target output. The
mirror will then be destroyed, and the views can be left dangling outside
of usable space when a hot plug restores the outputs.

Subtly change the reflow logic to only reflow outputs to the right of the
removed output by testing co-ordinates, instead of assuming that every
output in the list is to the right of the previous.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 1a9cf3bfb6)
2026-04-23 14:42:06 +03:00
Leandro Ribeiro
1a9149cc06 drm: avoid dma-buf feedback endless loop
Currently we have the following situation: we add a scanout tranche
because if the client re-allocates with another format/modifier, the
chances of being placed in a DRM/KMS plane is higher.

But then we run out of overlay planes. So we remove the scanout tranche,
because the format/modifier available in the renderer tranche are
optimal for rendering.

Now Weston detects again that the format/modifier is what may be
avoiding the view being place in a plane, re-adding the scanout tranche.
And we have an endless loop.

To avoid this, let's accumulate the reasons why placing the view in a
place failed. So if we detect that we don't have planes available, no
matter the format/modifier, we won't add the scanout tranche.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit d3ead778de)
2025-07-18 11:59:26 -03:00
Leandro Ribeiro
0b5c47edca drm: fix issue with enum being wrongly used
FAILURE_REASONS_ADD_FB_FAILED is defined as (1 << 3), so when we are
accumulating "failure reasons" in a variable we don't need to do the bit
shift again.

This results in an issue, because (1 << FAILURE_REASONS_ADD_FB_FAILED)
results in (1 << (1 << 3)) == (1 << 8).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 8b83bb5ceb)
2025-07-18 11:59:07 -03:00
Leandro Ribeiro
6445af1ead drm: fix a few dma-buf feedback failure reasons
There are a few points in the code where we are wrongly using
FAILURE_REASONS_ADD_FB_FAILED, probably because we didn't have so many
"failure reasons" previously. This update such cases to use enum's that
make sense.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 3210cec531)
2025-07-18 11:58:48 -03:00
Leandro Ribeiro
8f1a089917 drm: try other planes that may support fences
Do not skip all the planes if a single one of them do not support
fences. The other may do.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit b347af2ce0)
2025-07-18 11:58:27 -03:00
Marius Vlad
015b3b4d4c build: bump to version 14.0.2 for the point release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-04-25 15:37:41 +03:00
Derek Foreman
51dfd1be3a frontend: Fix crash in output resize handler
The output resized signal sends a struct weston_output as the data, not
a struct weston_head.

Fixes 197c5e0084

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 52204f55ea)
2025-04-25 15:02:09 +03:00
Pekka Paalanen
ef25333fac libweston: fix bitshift in weston_idalloc_get_id()
Fixes the following UBSan error:

../../git/weston/libweston/id-number-allocator.c:140:16: runtime error:
left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit 6773ffa758)
2025-04-17 11:51:04 +03:00
Pekka Paalanen
cb8bb2763a libweston: fix realloc in weston_idalloc
realloc() does not initialize the added memory, it needs to be zeroed
explicitly.

Not zeroing this memory had one severe consequence: if the new
lowest_free_bucket was 0xffffffff, weston_idalloc_get_id() would fail an
assertion.

Otherwise non-zero bits in the added memory would just cause id numbers
to be skipped unnecessarily, which does no harm.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1000

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit ed51e9ae43)
2025-04-17 11:50:53 +03:00
Pekka Paalanen
3b340a2f9e libweston: refactor update_lowest_free_bucket()
No functional change here other than asserting that next_num didn't wrap
around. This reorganization helps adding the code
needed to clear the memory added by xrealloc() in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit 2733a95962)
2025-04-17 11:50:39 +03:00
Michael Olbrich
f87d119e56 libweston-desktop: don't try to move child surfaces to not existing layer
The parent surface may not be on a layer. In that case, remove all child
surfaces from their current layer as well.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit 6e88a851a4)
2025-04-17 11:50:12 +03:00
kang-sooyeon
1cb63e1f83 libweston/input.c: Fix weston crash with the mouse event
Fix weston crash when user click the mouse continuosly while
the video is playing.
Call weston_view_update_transform before calling
weston_coord_global_to_surface to update view->transform.dirty to 0.

Fixes #985

Tested-by: Sooyeon Kang sooyeon8979@gmail.com
Signed-off-by: Sooyeon Kang sooyeon8979@gmail.com
(cherry picked from commit c77a5d386a)
2025-04-17 11:50:00 +03:00
Marius Vlad
23f254c690 windowed-output-api.h: Provide ARRAY_LENGH() for windowed-output-api
We need this common helper as we don't have access to shared helper, so
just define one in-situ.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 43f7b7b3bb)
2025-04-17 11:49:47 +03:00
Derek Foreman
11f20fa8e4 drm: Fix underlay test
We need to reset the underlay check inside the view evaluation loop,
otherwise once we need an underlay we'll treat every following view as
needing an underlay.

Fixes: 1065d23406 ("backend-drm: Improve plane assignment for underlay platform")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 8dbb3e17d0)
2025-04-17 11:49:29 +03:00
Marius Vlad
9eb44254a7 compositor: Mark pnode accordingly when buffer type is direct
As we exit early we never have the chance to mark it as is_direct when
the buffer type is direct_display.

This is required as is_direct is never checked in GL attach part we
end up tripping on invalid renderer_private causing it to assert.

Fixes 2db4f17244f, "compositor: re-order paint node placeholder checks"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 9d841e39e8)
2025-04-17 11:49:16 +03:00
Derek Foreman
8eb0ff8a19 compositor: re-order paint node placeholder checks
Doing these in the wrong order breaks content protection, and breaks
placing direct-display paint nodes on underlays.

Fixes: 827e2276 ("gl-renderer: Draw holes on primary plane for the view on underlay")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 53189ebb89)
2025-04-17 11:49:03 +03:00
Marius Vlad
af871d82ef gl-renderer: Take direct-display into consideration
The buffer_init function added with commit 83b37c0ac4, "renderers: pull
dmabuf initial setup out of attach", doesn't take into consideration the
the buffer's direct-display property.

Previously, gl_renderer_attach_dmabuf, wasn't being called when dmabuf's
direct-display  was turned on, but with commit 83b37c0ac4 this has been changed.

So with commit 83b37c0ac4, linux_dmabuf_buffer_get_user_data will never
return a valid gb (gl buffer state), causing a crash using
direct-display extension. This adds an explicit check to return early
when this happens.

Fixes: 83b37c0ac4, "renderers: pull dmabuf initial setup out of attach"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit bf7b2311e7)
2025-04-17 11:48:42 +03:00
Ian Ray
ee92a531da shared: fix binding-modifier none
Fix binding-modifier "none" which was defaulting to Super.

Commit [1] introduced the original support for "none" but the logic was
subsequently lost in f7ba35f5.

[1] 553d1248 ("desktop-shell: Allow binding-modifier weston.ini option to be none")

Fixes: #976

Fixes: f7ba35f5 ("kiosk-shell: Enable debug keybindings")
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
(cherry picked from commit fc278fb3cc)
2025-04-17 11:48:30 +03:00
Philipp Zabel
353600b6fc vnc: Allow neatvnc in version 0.9.0
Neat VNC 0.9.0 is backwards compatible.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
(cherry picked from commit b4386289d6)
2025-04-17 11:48:12 +03:00
Derek Foreman
a712e803d2 compositor: Prevent startup crash when hdcp mode is set on display
We can startup with the display already in type1 content protection mode.
When this happens, we call weston_output_dirty_paint_nodes() on a display
that hasn't yet been enabled. The paint node list isn't initialized yet,
so we crash.

We don't actually need to touch the paint nodes here anyway, as
weston_output_damage() ensures a repaint if the ourput is enabled, and
weston_output_dirty_paint_nodes() just forces calculation of things
unrelated to protection, and we'll override most of that in
maybe_replace_paint_node() if necessary when we get there.

Just drop the weston_output_dirty_paint_nodes() call to stop the
crash.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 4f2cc67fde)
2025-04-17 11:47:58 +03:00
Marius Vlad
d70f91d3f1 libweston/desktop: Avoid a potential crash on invalid resource
This checks for a valid resource when getting a xdg_popup. Similar to
the check in get_toplevel.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 80e47a7161)
2025-04-17 11:47:36 +03:00
Marius Vlad
26e03f3891 libweston/desktop: Don't destroy the xdg_surface
Upon xdg_toplevel::destroy we seem to be calling xdg_surface::destroy
destroy handler. Protocol states that we should umap the surface with
client having the posibility to getting another toplevel role for the
same xdg_surface and re-map the window.

This also adds a guard for an unlikely invalid resource.

Fixes: #774

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 8b5bb588df)
2025-04-17 11:47:28 +03:00
Marius Vlad
61f2248de2 build: bump to version 14.0.1 for the point release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-10-21 16:22:27 +03:00
Marius Vlad
7eaba52a22 libweston/matrix: Fix narrow conversion with C++
Fixes the following C++ narrow conversion:

/include/libweston-14/libweston/matrix.h: In function ‘weston_coord
weston_coord_truncate(weston_coord)’:
/include/libweston-14/libweston/matrix.h:212:39: error: narrowing
conversion of ‘(int)in.weston_coord::x’ from ‘int’ to ‘double’
[-Werror=narrowing] 212 |         return (struct weston_coord){
	(int)in.x, (int)in.y };
      |                                       ^~~~~~~~~
/home/mvlad/install-new/include/libweston-14/libweston/matrix.h:212:50:
error: narrowing conversion of ‘(int)in.weston_coord::y’ from ‘int’ to
‘double’ [-Werror=narrowing] 212 |         return (struct weston_coord){
	(int)in.x, (int)in.y };

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit a501acd291)
2024-10-21 13:41:04 +03:00
Jeri Li
502e4bd31d libweston/desktop: avoid weston crash while xdg_surface ack_configure
checks the resource and sends a protocol error if the client tries to
send a request to an inert object then returns out of the request
handler

Signed-off-by: Jeri Li <jeri.li@mediatek.com>
(cherry picked from commit 04f27f1be2)
2024-10-14 14:26:34 +03:00
Marius Vlad
e056153bf4 desktop-shell: Don't attempt to re-add the view to panel layer
This change fixes a side-effect of weston_view_move_to_layer helper
which would basically unmap the view because the layer entry list is no
longer visible. Only add the view to panel layer the first time.

Fixes: #956

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 217fb30847)
2024-10-11 13:30:52 +03:00
Marius Vlad
6d015b4759 libweston: Move weston_get_backend_type after enum declaration
Fix: #951

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 68bbc4cf51)
2024-10-11 13:30:13 +03:00
Jan Engelhardt
ca3c5b8015 build: insert missing wayland-server-protocol dependency
A new build error sprung up in weston-14 compared to 13.0.0.
Fix it.

FAILED: tests/liblib_lcms_util.a.p/lcms_util.c.o
cc -Itests/liblib_lcms_util.a.p -Itests -I../tests -I. -I.. -Iinclude
-I../include -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/liblib_lcms_util.a.p/lcms_util.c.o -MF
tests/liblib_lcms_util.a.p/lcms_util.c.o.d -o
tests/liblib_lcms_util.a.p/lcms_util.c.o -c ../tests/lcms_util.c
In file included from ../tests/lcms_util.c:35:
../include/libweston/matrix.h:33:10: fatal error:
wayland-server-protocol.h: No such file or directory

   33 | #include <wayland-server-protocol.h>

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
(cherry picked from commit f86ff8c07d)
2024-10-11 13:30:07 +03:00
David Edmundson
1e667cf0c3 libweston: Send seat name before announcing devices
Clients need to know the seat name at the time they create mouse and
keyboard objects. This brings Weston in line with other compositors.

The documentation upstream currently is not super clear. It states name
is explicitly sent on bind, capabilities don't mention being sent on
bind in any way.

Signed-off-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit fe64eee3ae)
2024-10-11 13:30:01 +03:00
EatingSumo
efd6789934 libweston/screenshooter: Fix build when __builtin_clz is not available
Fix compilation error when `__builtin_clz` is not available by renaming variable 'u' to 'run'

Signed-off-by: Junyu Long <877730493@qq.com>
(cherry picked from commit 312c8bea66)
2024-10-11 13:29:51 +03:00
Jan Alexander Steffens (heftig)
32f5596178 libweston/noop-renderer: Check shm_buffer for NULL
Copy the check from the pixman renderer.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/953
Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
(cherry picked from commit 0e451e8dc3)
2024-10-11 13:28:48 +03:00
Marius Vlad
60981998b2 build: bump to version 14.0.0 for the official release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-09-04 11:53:50 +03:00
Marius Vlad
186937dc95 build: bump to version 13.0.95 for the RC3 release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-09-02 10:56:26 +03:00
Derek Foreman
50d92f9d6f libweston: Fix crash with mirror-of
Since c4eb15d453 we keep a copy of
native mode parameters, however we forgot to initialize the
native mode parameters in some situations, which breaks the
output mirroring code when it sees uninitialized data.

Fixes c4eb15d453
Fixes #949

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-30 08:16:45 -05:00
Marius Vlad
f81c0358c5 build: bump to version 13.0.94 for the RC2 release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-30 09:43:45 +03:00
Marius Vlad
3dc28308e6 libweston/color-management: Add fallback for static_assert
Attempt to fix the following with clang-18:

../weston-9999/libweston/color-management.c:890:2: error: call to
undeclared function 'static_assert'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration] 890 |
static_assert(UINT32_MAX <= SIZE_MAX, |         ^

Fixes: #948

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-29 16:20:47 +03:00
Marius Vlad
6bcf9ca6ba build: bump to version 13.0.93 for the RC1 release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-28 10:40:07 +03:00
Marius Vlad
fe2ea233b1 libweston/drm-virtual: Point output base backend the DRM backend
This would allow output_repaint_timer_handler() to find a backend
as well for the DRM virtual outputs created by DRM virtual API and
with it to trigger a repaint for the outputs created by
plug-ins (remoting and pipewre).

Fixes 1f8c49d5bdd20, 'compositor: repaint backends separately'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-08-27 17:32:30 +03:00
Marius Vlad
b4726ef024 libweston/drm-virtual: Add prepare_repaint to perform a repaint
With commit a1f8c49d5b, 'compositor: repaint backends
separately' a prepare repaint was introduced. Use it for DRM virtual API
to allow repainting the remoting/pipewire output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-27 17:19:11 +03:00
Marius Vlad
aa3fe6a27a build: bump to version 13.0.92 for the beta release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-21 12:01:02 +03:00
Derek Foreman
60d777803d drm: Remove unnecessary parameter from drm_output_state_alloc()
We never pass this anything but NULL.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-19 10:25:25 -05:00
Marius Vlad
49278973c0 build: bump to version 13.0.91 for the alpha release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-14 11:23:07 +03:00