Commit graph

7849 commits

Author SHA1 Message Date
Félix Poisot
3bd8f29b13 scene: don't send new dmabuf feedback after node disable
The comparison done in `scene_buffer_send_dmabuf_feedback()` is
sufficient.

Close https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4088
2026-05-22 20:33:53 +00:00
Simon Ser
c6e2af1155 xwayland/xwm: check object type in xwm_handle_surface_id_message()
wlr_surface_from_resource() asserts that the object is a wl_surface.
Since arbitrary clients can send such messages, avoid aborting on
invalid input.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4093
2026-05-22 20:10:12 +02:00
Simon Ser
8154d80a4d xwayland/xwm: check whether surface is already associated for WL_SURFACE_ID
xwayland_surface_associate() asserts that the surface has not yet
been associated yet. Arbitrary clients can send these messages,
don't abort when that happens.
2026-05-22 20:05:17 +02:00
Simon Ser
041aa8c048 xwayland/xwm: expand comment about WL_SURFACE_ID event ordering
Make it clearer what's up.
2026-05-22 19:51:11 +02:00
Simon Ser
73d6968cd0 xwayland/xwm: align WL_SURFACE_ID error message with WL_SURFACE_SERIAL 2026-05-22 19:48:09 +02:00
Simon Ser
cb0fa9b0a3 xwayland/selection: stop using VLAs for MIME type atom lists
The size of the VLA is client-controlled and can overflow the
stack. Instead, allocate on the heap.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4090
2026-05-22 09:42:52 -04:00
Simon Ser
c91543352a xwayland: stop using xcb_get_property_reply_t.value_len
This field is difficult to use correctly, its meaning depends on
format.

xcb docs read:

> You should use the corresponding accessor instead of this field.

Replace all uses with the safe accessor.

This fixes potential out-of-bounds array accesses when the format
field isn't what we expect.
2026-05-22 09:34:30 -04:00
Simon Ser
5cb5373959 xwayland/xwm: pluralize array variable in read_surface_net_wm_state()
Make it clear this doesn't contain a single atom.
2026-05-22 09:34:30 -04:00
Simon Ser
851cdd0089 xwayland/xwm: fix out-of-bounds strndup() in read_surface_class()
We advance the class pointer here, but we forgot to decrease the
length.
2026-05-22 09:34:30 -04:00
Simon Ser
9d6c9e8783 xwayland: use const pointers for xcb_get_property_value()
These values must not be mutated, they are owned by the
xcb_get_property_reply_t.
2026-05-22 09:34:30 -04:00
Simon Ser
a00a9178ae virtual_keyboard_v1: handle NO_KEYMAP 2026-05-22 09:32:37 -04:00
Simon Ser
91ef4ce208 virtual_keyboard_v1: validate keymap format 2026-05-22 09:32:37 -04:00
Simon Ser
c5c1ba2baa protocol/virtual-keyboard: set format enum in zwp_virtual_keyboard_v1.keymap request 2026-05-22 09:32:37 -04:00
leiliang
1a791c2349 render/gles2: fix missing pop_gles2_debug on early return in render_pass_add_texture 2026-05-22 17:52:35 +08:00
Simon Ser
fd610841cc render/egl: disable implicit flush on context change
By default, switching the EGL context performs an implicit flush.
We may switch contexts quite often in multi-GPU scenarii. Avoid
any unintended flush.

See https://registry.khronos.org/OpenGL/extensions/KHR/KHR_context_flush_control.txt
2026-05-21 14:58:02 -04:00
xurui
cec4f5f04f xwayland: don't ping if client not supports
Signed-off-by: xurui <xurui@kylinos.cn>
2026-05-21 16:49:53 +00:00
qiu
b74e0cc75b backend/libinput: expose libinput context
Add `wlr_backend_get_libinput` getter, which returns a direct
handle to `struct libinput`.

Exposing the libinput context will allow compositors to load
libinput plugins after creating a `wlr_backend`.
Lua plugins are supported since libinput 1.30.0.
2026-05-21 15:23:30 +00:00
Isaac Freund
4b8c11bd46 xdg-foreign: remove unused field 2026-05-21 15:15:30 +00:00
liupeng
5ef24c2d17 wl_event_loop_add_fd: Only watch for READABLE & WRITABLE
Signed-off-by: liupeng <liupeng01@kylinos.cn>
2026-05-21 15:07:21 +00:00
Ronan Pigott
e532b4c26c scene: only send leave events to outputs with matching scene root
In handling scene buffer output updates, wlroots would send a leave event to
all entered outputs, even those that the scene root for the scene output update
event did not own. Leaving the output list inaccurate.

Sending leave events only for the given scene introduces a problem, though:
existing logic to de-duplicate leave events stops us from sending a leave event
when we leave all the outputs in a scene, and when the surface then becomes
visible in another scene, the frame pacing output cannot be selected
accurately. This breaks screen capture for off-screen windows in sway.

So, let us also mark outputs that would have been left but were spared by the
deduplication logic as "suspended" indicating they are ineligible as frame
pacing outputs.

Fixes: https://github.com/swaywm/sway/issues/9094
2026-05-19 19:52:08 +00:00
llyyr
9ecddaa673 wlr_pointer_warp_v1: add implementation 2026-05-17 20:20:53 +05:30
leiliang
aee9fa09f0 drm_syncobj_merger: fix memory leak and sync_fd corruption on error
Fix a memory leak when waiter_init fails in wlr_drm_syncobj_merger_add(),
and prevent the old sync_fd from being closed when sync_file_merge fails
in wlr_drm_syncobj_merger_add_sync_file().
2026-05-15 16:17:33 +08:00
YaoBing Xiao
6b5e2159c4 render/gles2: remove unused v_color varying from quad fragment shader
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2026-05-14 16:40:39 +08:00
Florian Kraupa
508fdba2c0 fix typo in WLR_HAS_LIBINPUT_BACKEND description in config.h.in 2026-05-12 14:40:38 +00:00
Consolatis
e4a1268b2a Revert "xwm: fix memory leak"
This reverts commit 02abf1cd28.

The change doesn't make sense. It causes a use-after-free when trying
to read the pixel data of the icon. The docs clearly state to use
'xcb_ewmh_get_wm_icon_reply_wipe()' when using the function which
correctly frees the reply *after* processing the pixel data.
2026-05-11 02:45:20 +02:00
Damino
75932662ce color_management_v1: send image description output updates 2026-05-09 03:54:12 +00:00
xurui
28d11d0580 linux_drm_syncobj_v1: fix inverted NULL check
Signed-off-by: xurui <xurui@kylinos.cn>
2026-05-08 15:28:18 +08:00
xurui
19df074c16 linux_drm_syncobj_v1: fix memory leak
Signed-off-by: xurui <xurui@kylinos.cn>
2026-05-08 15:27:50 +08:00
Alexander Orzechowski
37f30dc8d0 drm: Make it clear that we tried to import a shm buffer
Reduces the guess work in logs
2026-05-06 19:56:19 -04:00
Kenny Levinsen
57441ded02 util/rect_union: Limit rect_union_add to 1024 rects
If a very large number of clip rects are accumulated in rect_union_add,
rect_union_evaluate can end up being disproportionately expensive, and
as an extreme numbers of clip rects are not beneficial for drawing, this
is without any benefit.

Limit the number of rects to 1024 in rect_union_add, switching over to
bounding box mode instead when the limit is exceeded. This leads to a
small 70% reduction in CPU time in the Vulkan renderer on the
stacked/clip200/1024 benchmarks.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2026-05-01 12:50:04 +00:00
Kenny Levinsen
17c29268c9 util/rect_union: Take pixman_box32_t by pointer
rect_union_add takes a pixman_box32_t by value, and passes it along by
value to internal helpers. render_pass_mark_box_updated which is the
only caller receives the pixman_box32_t by reference, so just plumb it
through that way.

Results in a 13% improvement in CPU time when using the Vulkan renderer
on the stacked/clip200/1024 benchmarks on my machine.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2026-05-01 12:50:04 +00:00
Kenny Levinsen
8abe53d1d2 render/vulkan: Use instanced draws instead of scissors
Similar to what we have already done for gles2. To simplify things we
use the staging ring buffer for the vertex buffers by extending the
usage bits, rather than introducing a separate pool.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2026-05-01 12:50:04 +00:00
Kenny Levinsen
439258a43b render/vulkan: Intersect clip region once
We are spending quite significant CPU time walking through the clip
rects, taking a pixman box, converting it to a wlr box, intersecting it
and ultimately converting it back to a pixman box before adding it to
the rect union.

Just intersect the clip region once ahead of time, and use pixman boxes
the entire way. This also makes it easy to bail early if nothing
intersects.

Gives a small 97.95% reduction in CPU time for the Vulkan renderer in
the grid/clip200/1024 benchmark.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2026-05-01 12:50:04 +00:00
Kenny Levinsen
b01fdc3164 render/vulkan: Add unit-test for staging buffer
Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2026-05-01 12:50:04 +00:00
Kenny Levinsen
4ee896af99 render/vulkan: New staging buffer implementation
Implement a ring-buffer that uses timeline points to track and release
allocated spans. We add larger ring-buffers when it fills, and remove
them when they have been unused for many collection cycles.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2026-05-01 12:50:04 +00:00
xurui
02abf1cd28 xwm: fix memory leak
Signed-off-by: xurui <xurui@kylinos.cn>
2026-04-29 14:02:38 +08:00
Félix Poisot
8d0597e3db render/dmabuf: lower log level for sync file import/export failure
On platforms that lack the corresponding ioctl, this particular error
is expected and recoverable
2026-04-22 17:25:02 +00:00
Félix Poisot
9740ec61c8 linux_drm_syncobj_v1: add _state_add_release_from_implicit_sync()
This can help to gradually convert existing components away from
`wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer()`
2026-04-22 17:18:48 +00:00
Consolatis
f053f77dca toplevel_capture: allocate new_request argument on the stack
This fixes a memory leak.
2026-04-21 21:27:19 +00:00
Consolatis
700ee83ab8 scene/surface: schedule on frame pacing output
Otherwise wlr_scene_output_send_frame_done() drops frame callbacks
if only parts of a window on a non frame-pacing output is damaged.
2026-04-21 21:17:46 +00:00
rewine
e3e8877aa6 xdg-shell/layer-shell: use same unmap assert 2026-04-21 21:15:30 +00:00
Kenny Levinsen
fba00c4a04 wlr_compositor: Apply state before updating surface_damage
When locking surface state, surface_cache_pending will move the pending
surface state to a new, empty `wlr_surface_state`. This new surface
state will only contain the fields committed in the pending state, as
surface_state_move does not copy anything else.

surface_update_damage is called before we move state from pending to
current to merge buffer damage and surface damage, and it expects that
the pending surface state still contains prior committed details such as
scale and transform. This is not the case when we finally commit the
cached surface state.

Move surface_update_damage after surface_state_move and make it operate
purely on the current surface state.
2026-04-21 21:12:05 +00:00
llyyr
70d99eefef render/vulkan: destroy image view on allocation failure 2026-04-19 14:49:46 +00:00
llyyr
b808144b7b render/vulkan: don't free sync file fd on failure in submit_stage_wait
The caller does this already on failure
2026-04-19 14:49:46 +00:00
llyyr
39ea626e8f render/vulkan: free all render pass allocations on failure
Instead of just the struct
2026-04-19 14:49:46 +00:00
llyyr
53b8352526 render/vulkan: make bool function return false instead of NULL 2026-04-19 14:49:46 +00:00
Guido Günther
9479b45642 render/gles2: Fix wording
Drop superfluous "is" and use "They" to refer to the states.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2026-04-19 15:33:56 +02:00
Johan Malm
e8c03e9ce9 wlr_ext_workspace_v1.c: add new workspaces to end of list
...so that panels/bars like xfce4-panel and waybar show workspaces in the
right order.
2026-04-12 10:11:13 +00:00
tokyo4j
8dd1a77615 ext-foreign-toplevel-list: add new toplevels to end of list
Same as the prior patch for wlr-foreign-toplevel-management.
2026-04-12 13:03:33 +09:00
tokyo4j
84b45e4157 wlr-foreign-toplevel-management: add new toplevels to end of list
Prior to this patch, when the client binds the manager, the existing
toplevel handles were notified in the opposite order of their creation,
as wl_list_insert() adds a new handle to the head of the list and
wl_list_for_each() iterates from head to tail.
2026-04-12 00:25:49 +09:00