Commit graph

7723 commits

Author SHA1 Message Date
rewine
4fe51aa439 types: Simplify wlr_keyboard_group_destroy
If the wlr_keyboard_group_remove_keyboard function is expanded, the code
is equivalent to:

```
	wl_list_for_each_safe(device, tmp_device, &group->devices, link) {
		struct wlr_keyboard_group *_group = group;
		struct wlr_keyboard *_keyboard = device->keyboard;
		struct keyboard_group_device *_device, *_tmp;
		wl_list_for_each_safe(_device, _tmp, &_group->devices, link) {
			if (_device->keyboard == _keyboard) {
				remove_keyboard_group_device(_device);
				continue;
			}
		}
	}
```

It's just running one more loop meaninglessly.
2026-02-02 10:46:20 -05:00
liupeng
12c9502edf render/drm_syncobj: fix function name in drmSyncobjTimelineWait() error log
Signed-off-by: liupeng <liupeng01@kylinos.cn>
2026-02-02 09:12:39 +08:00
liupeng
7f87e258b2 render/drm_syncobj: drop unnecessary drmSyncobjTimelineWait() arg
Signed-off-by: liupeng <liupeng01@kylinos.cn>
2026-02-02 09:11:41 +08:00
Simon Ser
4477ca7d32 build: bump version to 0.20.0-rc1 2026-02-01 21:13:18 +01:00
Simon Ser
d6c7a161c7 color_representation_v1: send chroma_location protocol error
This error has been added in:
46f46863b7
2026-02-01 20:09:45 +00:00
tokyo4j
82d5ffb09e ext-workspace-v1: add implementation
Co-authored-by: Consolatis <40171-Consolatis@users.noreply.gitlab.freedesktop.org>
2026-01-31 01:44:23 +09:00
Kenny Levinsen
5e32b6663b ext_image_copy_capture_v1: Only render scene source on damage
wlr_scene_output_needs_frame checks wlr_output.needs_frame and
wlr_scene_output.gamma_lut_changed, neither of which incur damage. The
needs_frame flag is often set by e.g., cursor movement.

For the purpose of a capture frame we are only interested in frames with
damage. Continue without damage causes session_handle_source_frame to
silently skip copying the frame, which causes the session to get stuck:
no ready or failed event is emitted, and frame_pending is still set so
no further output frame events will occur.

Only render in case there is damage, but send frame callbacks
regardless.
2026-01-24 22:49:40 +00:00
Félix Poisot
5a40da7e15 render: don't infer luminance multipliers from color TF
Make scene pass them explicitly instead. Ref #3995
2026-01-23 19:41:14 +00:00
Félix Poisot
68052f34d3 color_management_v1: new enum value for 'srgb' transfer function
ref https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/442
2026-01-23 18:50:09 +00:00
Félix Poisot
bb882e97f1 color_management_v1: use 64bit image description identities
ref https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/385
2026-01-23 18:50:09 +00:00
Félix Poisot
58f0867c04 color_management_v1: relax restrictions on maxCLL and maxFALL
ref https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/428
2026-01-23 18:50:09 +00:00
Félix Poisot
e6ddb6cdd3 meson: bump minimum wayland-protocols version
1.47 brings updates to color-management
2026-01-23 18:50:09 +00:00
Kenny Levinsen
5661ac1cd2 output-swapchain-manager: Reject zero resolution
If an output with no mode and no valid pending resolution is attempted
enabled, it will trigger an assert in swapchain allocation instead of
failing on a rejected atomic commit or pre-commit test.

We can sometimes get such broken outputs if e.g., the underlying driver
failed to retrieve EDID, and so crashing on assert is suboptimal.

Reject zero-sized swapchains early and log the issue.
2026-01-22 12:55:13 +01:00
xurui
91c08d5a53 xwayland/selection/dnd: fix parameter type
Signed-off-by: xurui <xurui@kylinos.cn>
2026-01-20 16:39:08 +08:00
Jens Peters
3eb07b1fdb backend/libinput: expose libinput_tablet_tool
Exposing libinput_tablet_tool from libinput allows compositors
to set tool specific configuration options like pressure range
and eraser button behavior.

See 'libinput_tablet_tool_*()' functions which require a
'libinput_tablet_tool' handle:
https://wayland.freedesktop.org/libinput/doc/1.30.0/api/group__config.html
(libinput 1.30.0, latest at the time of writing).
2026-01-19 20:45:39 +01:00
Stephane Fontaine
b7312b4f95 xwm: don't leak msg in case of realloc failure 2026-01-18 17:42:25 +04:00
Isaac Freund
f735439543
xwayland: add set_size_hints signal
Currently there is no way for the compositor to be notified when an
Xwayland client sets/modifies its size hints.
2026-01-15 11:49:49 +01:00
Robin Ebert
ba76d37b0b
wlr_ext_image_copy_capture_v1: Fix segmentation fault when using cursor session
Fixes: 3b9f599cbe
2026-01-12 12:40:34 +01:00
Alexander Orzechowski
1f0fb95e3b wlr_scene: Add documentation to scene_node_update() 2026-01-08 13:03:46 -05:00
Alexander Orzechowski
ed7b633669 wlr_scene: Only do disable cleanup when explicit damage is given
We don't want to iterate the subtree for trivial update scenarios. We only
care when a scene is reparented or disabled in which both cases provides
us with explicit damage
2026-01-08 13:03:46 -05:00
Alexander Orzechowski
ef19f52ca9 wlr_scene: Update outputs when node is disabled 2026-01-08 13:03:46 -05:00
Alexander Orzechowski
56eb27ab0b wlr_scene: Don't recurse when disabling scene node if a child is already disabled
If a child is disabled, that means the node already went through the
rigamarole of cleaning up its state. Don't do it again.
2026-01-08 13:03:46 -05:00
Alexander Orzechowski
edc12e81d9 wlr_scene: Make restack_xwayland_surface_below generic
more stuff will be put here
2026-01-08 13:03:46 -05:00
Peter Kaplan
49576469ec image_capture_source: wlr_output_try_from_ext_image_capture_source_v1() 2026-01-07 09:18:25 +01:00
Peter Kaplan
3b9f599cbe wlr_ext_image_copy_capture_v1: new_session event
And a destroy event in wlr_ext_image_copy_capture_session_v1.
2026-01-07 09:18:25 +01:00
Simon Ser
368dcfb9f6 ext_image_capture_source_v1: wait for capture client before sending frame event
We were sending an output frame event as soon as we were done
rendering. As a result, the output would render in a busy loop when
a client was using the capture output for frame pacing purposes.

Instead, use the request_frame hook introduced in the previous
commit to throttle output frame events.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4036
2026-01-05 15:03:18 -05:00
Simon Ser
f93865ed1f ext_image_copy_capture_v1: replace schedule_frame with request_frame
schedule_frame is only called when the client has submitted damage
and a new frame should be rendered immediately. schedule_frame is
not called when the capture client is waiting for the next frame
but hasn't submitted damage.

Sources implementing a rendering loop based on the capture rate
need to know when a capture client is ready to accept a new frame.
Such sources want to trigger a redraw if and only if (1) they are
dirty (their contents have changed) and (2) the capture client is
ready to accept a new frame.

Replace schedule_frame with request_frame, triggered each time a
client sends a capture request. A flag indicates whether the capture
client has submitted damage.
2026-01-05 15:03:18 -05:00
llyyr
6ae54dca23 xwayland: lock new buffer instead of the old one
Fixes: 84d603acc0
2026-01-05 20:53:34 +05:30
Simon Ser
84d603acc0 xwayland: take wlr_buffer in wlr_xwayland_set_cursor() 2026-01-05 10:10:32 -05:00
Simon Ser
53d75a41c7 cursor: use wlr_xcursor_image_get_buffer() 2026-01-05 10:10:32 -05:00
Simon Ser
d7f7b68f49 xcursor: introduce wlr_xcursor_image_get_buffer()
This makes it so callers no longer need to juggle with raw pixel
pointers anymore, and only need a single wlr_buffer-based codepath.

Additionally, cursors can be unloaded without risking use-after-free.
2026-01-05 10:10:32 -05:00
Simon Ser
98733c91b4 xcursor: add shared helper to create a wlr_xcursor_image
This logic was duplicated in two spots.
2026-01-05 10:10:32 -05:00
Simon Ser
89c9ef6692 render/gles2: skip glslang check when shaders are unchanged
Currently, the glslang check is run every time ninja is invoked,
even with an up-to-date build directory when GLSL shaders haven't
been modified. This is due to glslang not creating any output
file: the _check file never exists so ninja keeps trying to
generate it by running the command.

Unfortunately Meson doesn't support running commands with no
outputs [1]. Create an empty output file to fix this by setting
`capture: true`.

This doesn't work out-of-the-box, because glslang prints messages
to stdout, and provides no way to change this [2]. As a result,
shader errors are not surfaced back to the user - they end up in
the _check file. Workaround this with a thin wrapper which
redirects stdout to stderr when invoking glslang.

[1]: https://github.com/mesonbuild/meson/issues/11506
[2]: https://github.com/KhronosGroup/glslang/pull/4138
2026-01-05 09:59:58 -05:00
Simon Ser
2c64b30a67 scene: add knob to turn off Xwayland surface restacking
This is useful in these cases:

- The same surface is added to two different scene-graphs. wlroots
  can't figure out on its own which scene-graph should drive the
  Xwayland stacking.
- A compositor uses multiple Xwayland servers (e.g. one per app).
  wlroots will try to restack surfaces from different Xwayland
  instances and this will not go well.
2026-01-04 16:02:52 +00:00
Simon Ser
b094f8aeb3 scene/surface: don't cache frame pacing output
Storing the frame pacing output in a per-scene and per-surface
struct doesn't play well with multiple scenes. outputs_update is
only triggered for outputs the scene knows about, but operates on
all outputs the surface has entered regardless of the scene. Thus
leaving an output on one scene will not refresh the frame pacing
output on other scenes, and these other scenes will operate with
a stale frame pacing output. The surface will not receive any more
wl_surface.frame done events.

This also avoids keeping a dangling pointer around when the frame
pacing output is destroyed but the output isn't added in the scene.

References: https://github.com/swaywm/sway/issues/8885
2026-01-04 14:40:18 +01:00
Simon Ser
2699b68b34 ext_image_capture_source_v1/scene: fix stop for parallel captures
The stop handler disables the output. However, the same source can
be captured multiple times in parallel. In that case, stop might
be called while another capture session is still ongoing.

Only disable the output if the last session is stopped.
2026-01-04 00:34:39 +00:00
Simon Ser
caed9d78d7 render: drop <linux/dma-buf.h> compat defines
It's been 3 years, so these defines are widespread enough by now.
2026-01-04 00:30:34 +00:00
Simon Ser
3f9a164484 scene: keep last preferred configuration when leaving last output
Before this patch, when a surface became occluded on all outputs,
we'd reconfigure it with a base configuration (scale set to 1,
transform set to NORMAL, image description set to gamma 2.2/sRGB).
As a result, when quickly hiding a toplevel and showing it again,
the client would render to switch to the base configuration, then
render again to switch to the output configuration.

Avoi this needless back-and-forth by retaining the last sent
preferred configuration when a surface leaves all outputs.
2026-01-04 00:24:47 +00:00
Simon Ser
ca8b49d858 render/vulkan: add new 16- and 32-bits-per-component pixel formats
Compatibility table based on pixfmtdb.
2026-01-03 17:47:19 +00:00
Simon Ser
1723f851d2 render/gles2: add BGR161616F and BGR161616 2026-01-03 17:47:19 +00:00
Simon Ser
d512c00791 render: add new 16- and 32-bits-per-component pixel formats
These new formats have been introduced in libdrm 2.4.129:
31e68ea81c
2026-01-03 17:47:19 +00:00
Simon Ser
53cdceb371 scene: constify pixman_region32_t
Makes it easier to figure out which functions build regions, and
which functions consume them.
2025-12-28 22:56:55 +01:00
Simon Ser
8611aa8440 scene: don't assign outputs to invisible nodes
If a node has no visible areas, leave active_outputs empty.

Fixes: 95b2771bfd ("scene: ignore outputs with too small intersection with nodes")
2025-12-28 22:30:25 +01:00
sunzhguy
9119b8aa85 session: simplify libudev unref handling
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
2025-12-22 10:55:08 +08:00
John Lindgren
16cb509a6e render/allocator: add missing wlr_buffer_finish() in destroy impls
Fixes use-after-free on exit of labwc running nested:

==50906== Invalid write of size 8
==50906==    at 0x4A85403: wl_list_remove (wayland-util.c:57)
==50906==    by 0x40BBAF9: destroy_wl_buffer (output.c:146)
==50906==    by 0x40B9B4F: backend_destroy (backend.c:488)
==50906==    by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906==    by 0x40B78A6: multi_backend_destroy (backend.c:62)
==50906==    by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906==    by 0x4043DA0: server_finish (server.c:788)
==50906==    by 0x403AA85: main (main.c:277)
==50906==  Address 0xb4435e8 is 40 bytes inside a block of size 136 free'd
==50906==    at 0x4A3E8EF: free (vg_replace_malloc.c:989)
==50906==    by 0x409C954: buffer_destroy (shm.c:28)
==50906==    by 0x40E96F4: buffer_consider_destroy (buffer.c:42)
==50906==    by 0x40E9754: wlr_buffer_drop (buffer.c:52)
==50906==    by 0x41498DA: slot_reset (swapchain.c:44)
==50906==    by 0x4149933: wlr_swapchain_destroy (swapchain.c:53)
==50906==    by 0x40CB1FA: wlr_output_finish (output.c:410)
==50906==    by 0x40BE00B: output_destroy (output.c:957)
==50906==    by 0x40CB2FC: wlr_output_destroy (output.c:436)
==50906==    by 0x40B9AFC: backend_destroy (backend.c:481)
==50906==    by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906==    by 0x40B78A6: multi_backend_destroy (backend.c:62)
==50906==  Block was alloc'd at
==50906==    at 0x4A42C13: calloc (vg_replace_malloc.c:1675)
==50906==    by 0x409CA84: allocator_create_buffer (shm.c:68)
==50906==    by 0x409C7BA: wlr_allocator_create_buffer (allocator.c:186)
==50906==    by 0x4149B80: wlr_swapchain_acquire (swapchain.c:102)
==50906==    by 0x40C90DA: render_cursor_buffer (cursor.c:246)
==50906==    by 0x40C93DC: output_cursor_attempt_hardware (cursor.c:303)
==50906==    by 0x40C9A61: output_cursor_set_texture (cursor.c:420)
==50906==    by 0x40C9738: wlr_output_cursor_set_buffer (cursor.c:352)
==50906==    by 0x40F13A0: output_cursor_set_xcursor_image (wlr_cursor.c:507)
==50906==    by 0x40F1B28: cursor_output_cursor_update (wlr_cursor.c:630)
==50906==    by 0x40F1C2A: cursor_update_outputs (wlr_cursor.c:657)
==50906==    by 0x40F1CF9: wlr_cursor_set_xcursor (wlr_cursor.c:674)

Fixes: 7963ba6a0d
("buffer: introduce wlr_buffer_finish()")
2025-12-20 15:02:08 -05:00
liupeng
0ad8395ae6 backend/session: respond to event hangup or error
Signed-off-by: liupeng <liupeng01@kylinos.cn>
2025-12-19 10:38:26 +00:00
Félix Poisot
450d90a55d render/color: assert that wlr_color_transform_pipeline contains no NULLs
Consumers of transform pipelines are not expected to handle no-op
stages
2025-12-18 14:58:28 +00:00
Félix Poisot
32d5fc1d11 render/color: introduce color_transform_compose
It flattens color transform pipelines, and facilitates building
pipelines of variable content
2025-12-18 14:58:28 +00:00
Simon Ser
3d8c471aef color_management_v1: add BT.1886 to TF-from-renderer helper
BT.1886 support has been added to wlroots after this helper got
written.
2025-12-18 09:54:27 -05:00
Simon Ser
c0b93a9e7c render/pixman: add support for ABGR16161616
PIXMAN_a16b16g16r16 has been added in Pixman in this commit:
c0d38585f1
2025-12-18 09:48:02 -05:00