Commit graph

7687 commits

Author SHA1 Message Date
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
Simon Ser
322291cdcf tinywl: fix duplicate object files passed to linker
On BSD make, $> is an alias for $^. On both GNU and BSD make, $^
is supported. Specifying both resulted in duplicate object files
passed to the linker:

    ld: error: duplicate symbol: main
    >>> defined at tinywl.c:887
    >>>            tinywl.o:(main)
    >>> defined at tinywl.c:887
    >>>            tinywl.o:(.text+0x0)
    cc: error: linker command failed with exit code 1 (use -v to see invocation)

Only use $^ and remove $>.
2025-12-18 15:22:33 +01:00
Simon Ser
9b4d9eabb1 color_management_v1: add helpers to get supported TFs/primaries
This avoids hardcoding lists of TFs/primaries in compositors.

I've considered adding wlr_color_manager_v1_create_with_renderer()
instead, but I'm worried that some aspects of the options struct
don't really depend on the renderer, but on the compositor. Such
things are features and render intents.

I've considered returning a const array, but this would tie our
hands if we want to make the renderer advertise the set of
TFs/primaries it supports, instead of having a single flag gating
all of them.
2025-12-15 11:07:26 -05:00
tokyo4j
ba931024a5 Add wlr_version_get_{major,minor,micro}()
Can be used to detect wlroots version at runtime rather than
compile-time.
2025-12-13 11:06:28 +00:00
Ilia Bozhinov
0e9c6ddefa seat: add wlr_seat_touch_notify_clear_focus
This is needed for cases where the touch operation goes over a region
where no surfaces are present. In this case, we'd want to notify the
touch grabs (for example DnD grabs) that no focus is currently focused.
2025-12-11 21:10:59 +00:00
Ilia Bozhinov
03b465f324 drag: destroy data source on touch_up
This is in case we drop the drag with no focus, we want to destroy the
drag to tell the client the drag was cancelled.
2025-12-11 21:10:59 +00:00
llyyr
bf9452433c render/vulkan: normalize luminance range in bt.1886 formula
BT.1886 is different from other EOTFs in that the spec says that offset
b must be in electrical domain, so use the assumed display environment
from the specification as Lmin and Lmax then normalize bt.1886 to
produce optical luminance L in [0, 1]. See discussion at
https://gitlab.freedesktop.org/pq/color-and-hdr/-/merge_requests/63#note_3090016
2025-12-11 21:04:41 +00:00
Félix Poisot
a962d58727 render/color: make wlr_color_primaries_from_named public 2025-12-05 19:14:49 +00:00
llyyr
c45b3b1f5f color_representation_v1: don't leak supported_* on display destroy 2025-12-04 15:27:22 +05:30
Dale Turner
47486545b1 Add "const" to eliminate "error: initialization discards ‘const’ qualifier from pointer target type" 2025-12-03 20:02:29 -04:00
tokyo4j
abf80b529e wlr-foreign-toplevel: avoid wl_resource_find_for_client()
If the client application is composed of multiple components and they
bind the manager global separately, choosing a single toplevel resource
with wl_resource_find_for_client() may result in a component only seeing
unknown toplevel handles from another component.

Maybe we should track which toplevel handle resource originate from
which manager resource so that a component never sees toplevel handles
resources from another component, but it's too annoying to implement.
2025-11-25 18:54:20 +00:00
Félix Poisot
811765ffa0 output: don't rebuild cursor color transform for each update 2025-11-24 23:26:14 +00:00
Félix Poisot
7101a69804 scene: don't rebuild color transforms each frame 2025-11-24 23:26:14 +00:00
Félix Poisot
3d3d5fb1b7 render: remove buffer primaries from pass options
colorspace conversion is now carried explicitely by setting a
wlr_color_transform_matrix in the color transform
2025-11-24 23:26:14 +00:00
Félix Poisot
fdb473e675 scene: always apply user gamma after scene color transform
Fixes 989cffe, making renderer-applied transform consistent with
hardware-applied transform
2025-11-24 23:26:14 +00:00
Félix Poisot
2cac711e55 render/vulkan: apply "matrix" color transforms in shader 2025-11-24 23:26:14 +00:00
Simon Ser
2995f31102 render/color: introduce wlr_color_transform_matrix
This is useful to perform color space conversions.
2025-11-24 23:26:14 +00:00
Félix Poisot
17f3f28865 render/color: add wlr_color_primaries_transform_absolute_colorimetric 2025-11-24 23:26:14 +00:00
Guido Günther
9b9d7d845d input-method-unstable-v2: surrounding text sends surrounding text
Don't claim it sends preedit

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-11-23 17:14:01 +00:00
Guido Günther
bd861267e3 input-method-unstable-v2: There are no enable / disable events
So don't mention them

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-11-23 17:14:01 +00:00
Félix Poisot
b98904705d render/vulkan: fix single-pass linear path
Fixes d1c88e9 "render/vulkan: add linear single-subpass"

`find_or_create_render_setup` still assumed a single-buffer setup
always implied use of an srgb format
2025-11-23 10:30:51 +00:00
Félix Poisot
106f0f9506 output/state: add missing unref for color_transform 2025-11-14 11:10:37 +00:00
Simon Ser
fa7b66bcf4 color_representation_v1: add helper to create global from renderer 2025-11-13 10:35:56 -05:00
Simon Ser
87c3cb5c52 scene: add support for color-representation-v1 coeffs and range 2025-11-13 10:35:56 -05:00
Simon Ser
2fbc0b5ac1 scene: add support for color encoding and range 2025-11-13 10:35:56 -05:00
Simon Ser
e8f9e9eea6 color_representation_v1: make supported_alpha_modes const 2025-11-13 10:35:56 -05:00
Simon Ser
fecaf6d1e8 render/vulkan: add suport for color encoding and range 2025-11-13 10:35:56 -05:00
Simon Ser
2a87ec8a35 render: add color encoding and range to wlr_render_texture_options 2025-11-13 10:35:56 -05:00
Simon Ser
378a491823 render/color: turn enum wlr_color_encoding into a bitfield
This will allow us to describe the set of supported encodings as
a bitfield.
2025-11-13 10:35:56 -05:00
Félix Poisot
0d24cdb822 cursor: apply output image description when preparing texture 2025-11-11 21:55:06 +00:00
David96
aef84f0e4d wlr_virtual_pointer: Set axis source on all axis
Currently it is possible to crash a wlroots compositor by setting any
axis source other than 0 and sending an axis event in the HORIZONTAL
direction from wlr_virtual_pointer since the axis source is only set on
the first axis.
This then hits the assert in wlr_seat_pointer.c:332.

Fix by always setting the source on all axis.
2025-11-06 16:02:58 +00:00
Félix Poisot
8f7d763ad1 drm: save edid color characteristics in wlr_output 2025-11-06 10:29:12 +00:00
xurui
47d0a90274 types/wlr_input_device: name maybe NULL
Signed-off-by: xurui <xurui@kylinos.cn>
2025-11-04 17:29:23 +08:00
llyyr
604fcdb1db render/vulkan: clip negative values before applying transfer function
Not all eotf or eotf inverse are well defined for values outside the
intended domain, so just ignore it and clamp it away.

An alternative solution would be to use sign preserving pow here (i.e.
sign(x) * pow(abs(x), p)), however I'm not sure that makes sense or is
defined anywhere. Negative values here are likely a result of colors
being outside the gamut range, so clipping them to 0 is more correct
than mirroring from 0.
2025-10-29 03:09:11 +05:30
David Turner
879243e370 xwm: Fix double-close
When an FD is passed to xcb_connect_to_fd(), xcb takes ownership of that
FD and is responsible for closing it, which it does when
xcb_disconnect() is called.  But the xwayland handler code also keeps a
copy of the FD and closes it via safe_close() in
server_finish_process().

This double-close can cause all sorts of problems if another part of
wlroots allocates another FD between the two closes - the latter close
will close the wrong FD and things go horribly wrong (in my case leading
to use-after-free and segfaults).

Fix this by setting wm_fd[0]=-1 after calling xwm_create(), and ensuring
that xwm_create() closes the FD if startup errors occur.
2025-10-20 14:02:29 +01:00
Simon Ser
989cffe70d scene: add software fallback for gamma LUT 2025-10-18 20:36:01 +02:00
Simon Ser
3e08e3be4a gamma_control_v1: introduce fallback_gamma_size 2025-10-18 20:36:01 +02:00