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
Simon Ser
91f4890ec2
gamma_control_v1: add wlr_gamma_control_v1_get_color_transform()
2025-10-18 20:36:01 +02:00
Simon Ser
74ce6c22a5
output: check for color transform no-op changes
...
This allows callers to always set this state and not care whether
the output currently has the same color transform applied.
2025-10-18 20:36:01 +02:00
Simon Ser
0b58bddf13
render/color: add wlr_color_transform_pipeline
...
Useful to apply multiple transforms in sequence, e.g. sRGB inverse
EOTF followed by gamma LUTs.
2025-10-18 20:36:01 +02:00
Simon Ser
3d36ab9211
render/color: add wlr_color_transform_eval()
...
Makes it so the Vulkan renderer can handle arbitrary color
transforms, and doesn't need to be updated each time a new one is
added.
2025-10-18 20:35:02 +02:00
Furkan Sahin
d786e07899
backend/session: use device boot_display
...
shouldn't need to check for `boot_vga` if newer, more general
sysfs `boot_display` is set.
closes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4016
2025-10-17 17:35:51 +00:00
Simon Ser
6d63871f05
linux_drm_syncobj_v1: fix use-after-free in surface_commit_destroy()
...
surface_commit_destroy() accesses a field from
struct wlr_linux_drm_syncobj_surface_v1, however that struct may have
been free'd earlier:
==1103==ERROR: AddressSanitizer: heap-use-after-free on address 0x7cdef7a6e288 at pc 0x7feefaac335a bp 0x7ffc4de8f570 sp 0x7ffc4de8f560
READ of size 8 at 0x7cdef7a6e288 thread T0
#0 0x7feefaac3359 in surface_commit_destroy ../subprojects/wlroots/types/wlr_linux_drm_syncobj_v1.c:195
#1 0x7feefaac34cd in surface_commit_handle_surface_destroy ../subprojects/wlroots/types/wlr_linux_drm_syncobj_v1.c:211
#2 0x7feefbd194cf in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x84cf) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#3 0x7feefaa52b22 in surface_handle_resource_destroy ../subprojects/wlroots/types/wlr_compositor.c:730
#4 0x7feefbd1bb9f (/usr/lib/libwayland-server.so.0+0xab9f) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#5 0x7feefaa46a18 in surface_handle_destroy ../subprojects/wlroots/types/wlr_compositor.c:65
#6 0x7feef89afac5 (/usr/lib/libffi.so.8+0x7ac5) (BuildId: d5e3b0d8921923f35438adefa9f864745abc5e90)
#7 0x7feef89ac76a (/usr/lib/libffi.so.8+0x476a) (BuildId: d5e3b0d8921923f35438adefa9f864745abc5e90)
#8 0x7feef89af06d in ffi_call (/usr/lib/libffi.so.8+0x706d) (BuildId: d5e3b0d8921923f35438adefa9f864745abc5e90)
#9 0x7feefbd17531 (/usr/lib/libwayland-server.so.0+0x6531) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#10 0x7feefbd1cd2f (/usr/lib/libwayland-server.so.0+0xbd2f) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#11 0x7feefbd1b181 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa181) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#12 0x7feefbd1d296 in wl_display_run (/usr/lib/libwayland-server.so.0+0xc296) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#13 0x555bf0a55a40 in server_run ../sway/server.c:615
#14 0x555bf0a4a654 in main ../sway/main.c:376
#15 0x7feef9227674 (/usr/lib/libc.so.6+0x27674) (BuildId: 4fe011c94a88e8aeb6f2201b9eb369f42b4a1e9e)
#16 0x7feef9227728 in __libc_start_main (/usr/lib/libc.so.6+0x27728) (BuildId: 4fe011c94a88e8aeb6f2201b9eb369f42b4a1e9e)
#17 0x555bf0a03f54 in _start (/home/leo/code/stuff/sway/build/sway/sway+0x390f54) (BuildId: e3d4e653af1aa0885f0426c403e16fc87c086d33)
0x7cdef7a6e288 is located 8 bytes inside of 176-byte region [0x7cdef7a6e280,0x7cdef7a6e330)
freed by thread T0 here:
#0 0x7feefb71f79d in free /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:51
#1 0x7feefaac29f1 in surface_destroy ../subprojects/wlroots/types/wlr_linux_drm_syncobj_v1.c:84
#2 0x7feefaac2e47 in surface_handle_resource_destroy ../subprojects/wlroots/types/wlr_linux_drm_syncobj_v1.c:143
#3 0x7feefbd1bb9f (/usr/lib/libwayland-server.so.0+0xab9f) (BuildId: b9664217748f523995e3f855fa197cf8e59942d1)
#4 0x7feefaac2a12 in surface_handle_destroy ../subprojects/wlroots/types/wlr_linux_drm_syncobj_v1.c:89
#5 0x7feef89afac5 (/usr/lib/libffi.so.8+0x7ac5) (BuildId: d5e3b0d8921923f35438adefa9f864745abc5e90)
previously allocated by thread T0 here:
#0 0x7feefb7205dd in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:74
#1 0x7feefaac4abd in manager_handle_get_surface ../subprojects/wlroots/types/wlr_linux_drm_syncobj_v1.c:313
#2 0x7feef89afac5 (/usr/lib/libffi.so.8+0x7ac5) (BuildId: d5e3b0d8921923f35438adefa9f864745abc5e90)
Fix this by storing the struct wlr_surface in the field.
Closes: https://github.com/swaywm/sway/issues/8917
2025-10-17 09:05:53 +00:00
tokyo4j
19c5d22beb
util/box.c: use 1/256 instead of 1/65536 in wlr_box_closest_point()
...
This fixes the issue that a scrollbar in a maximized GTK/Chromium window
cannot be dragged when cursor is on the right/bottom edge of the output.
The issue was caused by rounding in `wl_fixed_from_double()` ([1]); if
`wlr_cursor_move()` constrains the x-position of the cursor to
`(output width)-1/65536`, `wl_fixed_from_double()` converts it to just
`(output width)`, which is perceived as outside of the window by
GTK/Chromium.
Using 1/256 (minimal unit of `wl_fixed_t`) instead of 1/65536 avoids
this rounding issue.
[1]: f246e619d1
2025-10-16 13:46:27 +00:00
Furkan Sahin
06275103f2
input-method-v2: Destroy keyboard grab before input method
...
Fixes race condition in where the keyboard grab tries to reference the
input manager after it's been set to null.
2025-10-16 12:07:47 +00:00
Simon Ser
03e7966650
ci: fix VKMS lookup after faux bus migration
...
VKMS has been migrated to the new faux bus. This causes breakage
in CI, because we used the platform bus to find the right device.
udev hasn't been updated yet to support the faux bus, so just use
sysfs instead.
2025-10-16 11:04:25 +02:00
llyyr
5529aae3e6
wlr_scene: fix direct scanout for gamma2.2 buffers
...
Fixes incorrectly rejecting scanout for gamma2.2 buffers when the output
has no image description set. This happens on `hdr off` mode on sway.
Also refactor the scanout check into its own function while at it to
make it easier to follow.
2025-10-05 23:53:25 +05:30
llyyr
6e1c8748ff
render: introduce bt.1886 transfer function
2025-10-04 18:13:37 +05:30
Félix Poisot
d8fb7adcf0
scene, render: use Gamma 2.2 TF as default
2025-10-03 19:48:12 +00:00
Félix Poisot
c2d9ae2142
render: introduce Gamma 2.2 color transform
2025-10-03 19:39:17 +00:00
Simon Ser
6978509f64
Revert "wlr_scene: fix tf/prim comparison for scanout attempt"
...
This reverts commit dde07b6840 .
This is incorrect as discussed here:
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5163#note_3118744
2025-10-03 20:42:21 +02:00
llyyr
2252854297
wlr_scene: return scene_direct_scanout_result instead of bool
2025-10-02 13:51:41 +05:30
llyyr
dde07b6840
wlr_scene: fix tf/prim comparison for scanout attempt
...
We were incorrectly doing comparison with `!= 0` to detect non-sRGB
tf/primaries. Since these enums are bit flags, the default sRGB values
are 1, not 0, so sRGB buffers were incorrectly rejected.
Fixes: bf40f396bf ("scene: grab image description from output state")
2025-10-02 11:57:52 +05:30
Simon Ser
406aa5f7f5
backend/session: fix crash on udev device remove event
...
libwayland adds phantom listeners here:
d81525a235/src/wayland-server.c (L2378)
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3982
2025-10-01 17:05:10 +02:00
Simon Ser
2ec4012559
backend/drm: avoid error message when EDID is missing
...
We'd attempt to parse an EDID even when the connector has no EDID,
printing "Failed to parse EDID" in logs. Instead, don't attempt to
parse the EDID and print a more appropriate log message.
2025-10-01 15:14:46 +02:00
Simon Ser
d039ad8da3
backend/wayland: continue reading on hangup
...
If we stop immediately, we won't see any wl_display.error events.
Make sure we've read everything before handling hangup.
2025-09-30 09:25:14 -04:00
Simon Ser
3f0d338643
backend/wayland: log when getting disconnected from remote display
...
It can be a bit confusing to understand why a compositor is shutting
down on its own. Log a message when we get disconnected from the
parent compositor to explain the cause.
2025-09-30 09:25:14 -04:00
Simon Ser
60d72724cd
render/color: fix bounds check in lut_1d_get()
...
i == len is out-of-bounds.
Fixes: 74217a4d93 ("render/color: introduce COLOR_TRANSFORM_LUT_3X1D")
2025-09-30 09:34:40 +02:00
Simon Ser
7cb3393e75
scene: send color_management_v1 surface feedback
...
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3999
2025-09-23 09:22:00 -04:00
Simon Ser
26c1476827
color_management_v1: add destroy event to manager
2025-09-23 09:22:00 -04:00
Simon Ser
138210f01c
color_management_v1: make from_wlr enum converters public
...
This can be useful for compositors to set surface feedback.
2025-09-23 09:22:00 -04:00
Simon Ser
845a7a581d
color_management_v1: drop duplicated enum converters
2025-09-23 09:22:00 -04:00
Simon Ser
108d94f798
Add release script
...
This is useful to speed up the release process and avoid making
mistakes.
2025-09-22 10:12:43 -04:00
xurui
aaf82ee332
wlr_drag: drag motion signal also needs to be sent
...
Signed-off-by: xurui <xurui@kylinos.cn>
2025-09-22 10:04:30 -04:00
Simon Ser
d1c88e9497
render/vulkan: add linear single-subpass
...
When the TF is set to EXT_LINEAR, we can write out color values
straight up to a non-SRGB image view.
2025-09-20 10:50:22 +00:00
Simon Ser
3e88a79e6f
render/vulkan: replace wlr_vk_render_pass.srgb_pathway with two_pass
...
The important bit here is whether this is using a single or two
sub-passes. The flag isn't used for anything else.
Preparation for an upcoming one-subpass codepath.
2025-09-20 10:50:22 +00:00
Simon Ser
b2d09cdee9
render/vulkan: add wlr_vk_render_pass.render_buffer_out
...
Simplifies the logic and prepares for a new render setup.
2025-09-20 10:50:22 +00:00
Simon Ser
35eba5f2fe
render/vulkan: add wlr_vk_render_pass.render_setup
...
Simplifies the logic and prepares for a new render setup.
2025-09-20 10:50:22 +00:00
Simon Ser
a91f96b391
render/vulkan: introduce wlr_vk_render_buffer_out
...
Holds common state for final output buffer targets.
2025-09-20 10:50:22 +00:00
Simon Ser
6fee3623e4
render/vulkan: rename vulkan_setup_srgb_framebuffer() for linear
...
Rename to "one-pass" (to indicate no blending buffer is involved),
because this will get re-used when introducing a linear
single-subpass codepath.
2025-09-20 10:50:22 +00:00
Simon Ser
7f6d66ea62
render/vulkan: use sRGB image view when color transform is set
...
If the color transform is set to sRGB inverse EOTF, we can use the
sRGB image view just like when no color transform is passed in.
2025-09-20 10:50:22 +00:00
Simon Ser
54374b6fe6
render/vulkan: rename plain to two_pass
...
We will introduce a new subpass without any post-processing step.
Rename "plain" so that there's no confusion.
2025-09-20 10:50:22 +00:00
Kenny Levinsen
dd7f543189
render/vulkan: Handle multi-descriptor sets
...
A combined image sampler may need several descriptors in a descriptor
set. We are not currently checking how many descriptors are required,
nor is it presumably guaranteed that such multi-descriptor allocation
will not fail due to fragmentation.
If the pool free counter is not zero, try to allocate but continue with
the next pool and fall back to creating a new pool if the allocation
failed.
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4010
2025-09-20 07:59:02 +00:00
JiDe Zhang
d7ae9a866b
xwayland: fix assertion failure in wlr_xwayland_shell_v1
...
The issue occurred when `wlr_xwayland_shell_v1` was destroyed before
`wlr_xwayland`. This happened because `wlr_xwayland` didn't remove the
listener for the shell's destroy event in `handle_shell_destroy`.
2025-09-16 13:59:06 +08:00
Simon Ser
462046ffdc
cursor: use source buffer to signal release timeline point
...
Same as 128cd07e91 ("scene/surface: use source buffer to signal
release timeline point"), but for the cursor.
2025-09-11 12:33:04 +00:00
Simon Ser
bd566225ea
scene/surface: fix NULL deref when source buffer is destroyed
...
Fixes the following crash, witnessed after a GPU reset:
#0 0x00007fba9a32774c n/a (libc.so.6 + 0x9774c)
#1 0x00007fba9a2cddc0 raise (libc.so.6 + 0x3ddc0)
#2 0x00007fba9a2b557a abort (libc.so.6 + 0x2557a)
#3 0x00007fba9a2b54e3 n/a (libc.so.6 + 0x254e3)
#4 0x00007fba9a53fb78 wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer (libwlroots-0.20.so + 0x26b78)
#5 0x00007fba9a590846 surface_reconfigure (libwlroots-0.20.so + 0x77846)
#6 0x00007fba9a590cbb scene_surface_set_clip (libwlroots-0.20.so + 0x77cbb)
#7 0x00007fba9a590efa subsurface_tree_set_clip (libwlroots-0.20.so + 0x77efa)
#8 0x00007fba9a590f1f subsurface_tree_set_clip (libwlroots-0.20.so + 0x77f1f)
#9 0x00007fba9a590f1f subsurface_tree_set_clip (libwlroots-0.20.so + 0x77f1f)
#10 0x00007fba9a590f8d wlr_scene_subsurface_tree_set_clip (libwlroots-0.20.so + 0x77f8d)
Reported-by: Hubert Hirtz <hubert@hirtz.pm>
2025-09-11 12:33:04 +00:00
Simon Ser
b62c6878e1
scene/surface: simplify single-pixel-buffer check in surface_reconfigure()
...
No need to call wlr_client_buffer_get() on wlr_client_buffer.base:
we're already manipulating a wlr_client_buffer.
2025-09-11 12:33:04 +00:00