Commit graph

7820 commits

Author SHA1 Message Date
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
Kenny Levinsen
35c35530a3 vulkan: Add support for render timer using timestamp queries 2026-04-09 15:13:49 +02:00
Dylan Donnell
8a9e3a84b5 ext_background_effect_v1: add implementation 2026-04-09 10:43:46 +00:00
Simon Ser
c393fb6bfa wlr_virtual_keyboard_v1: specify size when creating keymap
xkb_keymap_new_from_string() assumes that the string is
NULL-terminated, but we don't check this so the function might
access outside the mmap'ed region. Use the safer
xkb_keymap_new_from_buffer() function.

Reported-by: Julian Orth <ju.orth@gmail.com>
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4072
2026-04-07 09:43:08 +00:00
Isaac Freund
9de0ec3089 keyboard: fix modifiers event when no keymap set
Actually send the modifiers event when there is no keymap set.

Compositors may need lower-level "raw" access to the key/modifiers
events from the backend. Currently it is impossible for a compositor
to get modifier events from the backend without them being filtered
through an xkb_state controlled by wlroots.

I need this feature for river in order to fix some keyboard state
synchronization bugs.

Note that setting a keymap resets the modifiers so I don't think setting
wlr_keyboard->modifiers directly here is a concern.
2026-04-05 10:52:25 +00:00
Consolatis
c66a910753 render/pixman: fix bilinear filtering to match gles2 renderer
Before this patch the pixman renderer would use "constant padding"
for bilinear scaling which meant that the edges would either be dark
or turn transparent. The effect was most obvious when trying to scale
a single row buffer to a height like 100. The center would have the
desired color but the edges to both sides would fade into transparency.

We now use PIXMAN_REPEAT_PAD which clamps out-of-bound pixels and
seems to match the behavior of the gles2 renderer.
2026-04-02 00:59:44 +02:00
Isaac Freund
e22084f639
ext_image_capture_source_v1/scene: fix extents
Currently the width/height of the extents is too small if the first node
visited has position/dimensions 0,0,100,100 and the second node has
position/dimensions -20,-20,10,10.

In this case the current code calculates total extents as
-20,-20,100,100 but the correct extents are -20,-20,120,120.

References: https://codeberg.org/river/river-classic/issues/17
2026-03-30 17:23:02 +02:00
Simon Ser
334019f839 render/drm_syncobj: use drmSyncobjEventfd()
Avoids using a raw IOCTL directly.

This function was introduced way back in libdrm 2.4.116.
2026-03-27 18:09:07 +00:00
Simon Ser
a1ed6fca52 render/drm_syncobj: fix flags docs for wlr_drm_syncobj_timeline_waiter_init()
wlr_drm_syncobj_timeline_check() is a bit different because zero
will error out if the point has not materialized yet.

Kernel docs for struct drm_syncobj_eventfd:
https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#c.drm_syncobj_eventfd
2026-03-27 18:02:46 +00:00
Félix Poisot
f295d0322a render: explicit sync for wlr_texture_read_pixels() 2026-03-26 12:44:09 +00:00
Simon Zeni
413664e0b0 render/vulkan: compile against vulkan 1.2 header
Uses the EXT version of VK_PIPELINE_COMPILE_REQUIRED in `vulkan_strerror` func since it requires
Vulkan 1.3, switch to VK_EXT_global_priority instead of VK_KHR_global_priority which is only
promoted to core in Vulkan 1.3 as well.
2026-03-24 12:33:12 -04:00
Félix Poisot
fd870f6d27 linux_drm_syncobj_v1: fix handling of empty first commit
As reported in
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4979#note_3385626,
bfd6e619fc did not correctly handle clients
that don't immediately follow their call to
`wp_linux_drm_syncobj_manager_v1.get_surface` with a commit attaching
a buffer

Fixes: bfd6e619fc
2026-03-20 15:36:16 +00:00
Simon Ser
4ca40004fd color_management_v1: ignore surface update if no-op
If the new image description is identical to the old one, skip the
event.
2026-03-19 21:46:28 +00:00
Simon Ser
7287f700ab color_management_v1: use early continue in surface loop 2026-03-19 21:46:28 +00:00
Simon Ser
8fe3034948 tinywl: bump wlroots version to 0.21 2026-03-19 20:23:35 +01:00
Simon Ser
627da39e76 build: bump version to 0.21.0-dev 2026-03-19 20:14:53 +01:00
Félix Poisot
8d454e1e34 output/drm: don't use OUT_FENCE_PTR
The returned fence is not required to be signalled at the earliest
possible time. It is not intended to replace the drm flip event, and is
expected to be signalled only much later
2026-03-17 18:14:35 +00:00
Félix Poisot
cd555f9261 backend/drm: properly delay syncobj signalling
DRM CRTC signals when scanout begins, but
wlr_output_state_set_signal_timeline() is defined to signal buffer
release. Delay to the next page flip
2026-03-17 18:14:35 +00:00
Félix Poisot
b2f6a390a4 scene: transfer sample syncobj to client timeline 2026-03-17 18:14:35 +00:00
Félix Poisot
bfd6e619fc linux_drm_syncobj_v1: add release point accumulation
This changes the behavior of wlr_linux_drm_syncobj_surface_v1 to
automatically signal release of previous commits as they are replaced.

Users must call wlr_linux_drm_syncobj_v1_state_add_release_point or
wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer to delay the
signal as appropriate.
2026-03-17 18:14:35 +00:00
Félix Poisot
e83a679e23 drm/syncobj: add timeline point merger utility 2026-03-17 18:14:35 +00:00
Félix Poisot
1f3d351abb scene: add buffer release point to 'sample' event 2026-03-17 18:14:35 +00:00
Félix Poisot
0af9b9d003 render/drm_syncobj: add wlr_drm_syncobj_timeline_signal() 2026-03-17 18:13:10 +00:00
David Turner
abb6eeb422 backend/drm/atomic: Add support for color representation
Basic implementation of color representation in drm/atomic: when buffers
are presented for scanout which have color-representation data attached,
set the correct color encoding and range on the plane.  If the plane
does not support color-representation then the commit will fail and the
caller can retry without color-representation.
2026-03-17 16:32:30 +00:00
David Turner
dca0703dac backend/drm: Add color_range/encoding properties
Add the following optional DRM properties, for use by the
color-representation-v1 protocol:
- COLOR_ENCODING
- COLOR_RANGE
2026-03-17 16:32:30 +00:00
David Turner
80bcef908b scene: Set color representation on scanout
When doing direct-scanout, if the surface has color-representation
metadata present then pass on that metadata to the output state.

Also, if a buffer has color representation IDENTITY+FULL then normalise
this to NONE+NONE which is equivalent.
2026-03-17 16:32:30 +00:00
David Turner
58c158dba6 output: Add color-representation to output state
Add color_representation to wlr_output_state, holding color
representation metadata about the primary buffer.  This can be set
using wlr_output_state_set_primary_color_representation() and a
new enum value WLR_OUTPUT_STATE_COLOR_REPRESENTATION in
wlr_output_state.committed indicates when this data is present.

Also add color-representation to wlr_output, and discard
color-representation in wlr_output_state if it matches what's already
been committed to the output.
2026-03-17 16:32:30 +00:00
Isaac Freund
1fa8bb8f7a
virtual-keyboard: handle seat destroy
We must make the virtual keyboard inert when the seat is destroyed.
2026-03-17 09:53:32 +01:00
Isaac Freund
ec746d3e3e virtual-keyboard: add wlr_virtual_keyboard_v1_from_resource()
I want to use the zwp_virtual_keyboard_v1 object in a custom river
protocol and need to be able to obtain the corresponding wlroots struct.
2026-03-17 08:45:12 +00:00
Scott Moreau
1fc928d528 wlr_ext_image_copy_capture_v1: Fix crash when client creates a cursor session not implemented server side
This guards against a crash where the server implements
wlr_ext_image_capture_source_v1_interface without setting .get_pointer_cursor().
In general, we should install a NULL check here because this is a crash
waiting to happen. Now, instead of crashing, the resource will be created and
the copy capture session will be stopped.
2026-03-14 19:04:42 +00:00