Commit graph

7641 commits

Author SHA1 Message Date
Simon Zeni
0166fd9eb7 drm-lease-v1: remove connector active_lease & lease connectors
Upon leasing, the wlr_drm_lease_connector_v1 will be automatically clean up by the wlr_output
destroy handler. There is no need for the wlr_drm_lease_manager to keep track of leased connectors.
2025-08-28 16:33:35 +00:00
Simon Zeni
423afc3fc9 types: deprecate wlr-screencopy-unstable-v1 2025-08-28 16:23:56 +00:00
Simon Ser
122310a2de build: add wayland-protocols to dependencies array
We grab header files from there, ensure include directories are
properly set up when building wlroots.

Fixes missing header files when a wayland-protocols subproject is
used.
2025-08-27 16:11:49 -04:00
rewine
b799ffc6ae docs: deprecate legacy wlr_data_control_v1 interface
Add deprecation notice for wlr_data_control_v1, indicating that
it's superseded by ext-data-control-v1.

Related: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/136
2025-08-27 14:53:28 -04:00
Simon Ser
e95117b700 render/vulkan: remove hardcoded counts
Use the array size instead.
2025-08-27 14:26:21 -04:00
Simon Ser
1a18e47efa render/vulkan: fix VkPushConstantRange for wlr_vk_frag_texture_pcr_data
We pass an alpha multiplier plus a luminance multiplier now.

Fixes the following validation layer error:

    vkCmdPushConstants(): is called with
    stageFlags (VK_SHADER_STAGE_FRAGMENT_BIT), offset (80), size (72)
    but the VkPipelineLayout 0x510000000051 doesn't have a VkPushConstantRange with VK_SHADER_STAGE_FRAGMENT_BIT.
    The Vulkan spec states: For each byte in the range specified by offset and size and for each shader stage in stageFlags, there must be a push constant range in layout that includes that byte and that stage (https://docs.vulkan.org/spec/latest/chapters/descriptorsets.html#VUID-vkCmdPushConstants-offset-01795) (VUID-vkCmdPushConstants-offset-01795)

Fixes: 56d95c2ecb ("render/vulkan: introduce wlr_vk_frag_texture_pcr_data")
2025-08-27 14:26:21 -04:00
Simon Ser
bbd9a49bdf tinywl: stop generating xdg-shell header
We don't need to do this anymore for wayland-protocols.
2025-08-27 14:21:23 -04:00
xurui
7bf5ff4c02 wlr_xdg_toplevel_icon_v1: check the correct resource
Signed-off-by: xurui <xurui@kylinos.cn>
2025-08-27 20:01:50 +08:00
xurui
b0c886ec77 render/allocator/gbm: insert buffer after export gbm bo
Signed-off-by: xurui <xurui@kylinos.cn>
2025-08-25 14:05:13 +08:00
Simon Ser
7431d840d0 color-management-v1: handle inert outputs in get_output
wlr_output_from_resource() can return NULL if the outputs no longer
exists on the compositor side.

Closes: https://github.com/swaywm/sway/issues/8847
2025-08-18 14:09:13 +02:00
Kirill Primak
bb1f8673b3 compositor: use wl_resource_post_error_vargs() 2025-08-13 20:59:13 +00:00
Kirill Primak
ad1b2f2819 Avoid including generated headers publicly where possible
This is possible now that w-p ships enum headers. The remaining includes
are from wlr-protocols.
2025-08-13 22:46:37 +02:00
Kirill Primak
812675ba34 fixes: add implementation 2025-08-13 20:41:21 +00:00
Simon Ser
7392b3313a backend, output: send commit events after applying all in wlr_backend_commit()
We were iterating over involved outputs, applying the new state and
sending the commit event for each one. This resulted in commit
events being fired while we weren't done applying the new state for
all outputs.

Fix this by first applying all of the states, then firing all of
the events.

Closes: https://github.com/swaywm/sway/issues/8829
2025-08-12 19:04:05 +02:00
Jesper Jensen
07e92fb868 output/cursor: Fix double cursor bug
When we fail to render the cursor (in my case because the cursor is too
large) we bail out of the output_cursor_attempt_hardware function. This
causes output_cursor_set_texture to clean up after us, but we've already
cleared the hardware_cursor, and so output_disable_hardware_cursor
thinks we don't have a hardware cursor to disable.

We shouldn't modify the hardware_cursor variable before we've
successfully changed the hardware cursor, this way the caller can clean
up after us like it expect to.

This was brought up by an actual bug when playing the game Kaizen. Which
uses oddly sized cursors, that fell back to software cursors for me, and
left the hardware cursor hanging around. This change has been tested to
fix that.

During the testing of this change, I have noticed that the previous code
worked fine the first time the cursor was switch to software. It only
failed on subsequent attempts. I haven't figured out why that is.
2025-08-07 22:25:39 +02:00
Simon Ser
12316417b0 ext_image_capture_source_v1: advertise fallback {A,X}RGB8888 formats
We can't expect all clients to support all fancy formats.
WebRTC's reference implementation doesn't support 10-bit formats
yet. More generally, clients are limited by the libraries they
use: for instance, Pixman doesn't implement all OpenGL/Vulkan
formats.

Another MR [1] suggests advertising all render formats. This is a
bit heavy-handed because:

- Upgrading a 8-bit buffer to a 10-bit buffer doesn't make a lot
  of sense. I don't think the compositor should expose arbitrary
  pixel format conversions.
- The protocol has no preference order. Clients generally pick the
  first format they receive and support.

As an alternative, only advertise two fallback formats, ARGB8888
and XRGB8888. These two are already hard-required by wl_shm and
all clients should be able to handle them.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5019
2025-07-31 14:13:24 +00:00
Christopher Snowhill
dd3c63f5e6
color-representation-v1: Fix missing destroy signal init
Fixes #4001

Reported-by: CreeperFace / @dy-tea
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-07-31 06:46:47 -07:00
rewine
c8b7600adc wlr_ext_data_control_v1: Make all listeners private
For more context, see: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4873
2025-07-30 12:37:19 +00:00
Christopher Snowhill
51a78cb0ed
color_management_v1: set output color properties
This reports the output properties according to the current image description.
Firefox needs this to report HDR support to documents, at least.

v2: Move abort() calls out of switch to eliminate default case. Rename
    functions so they don't use a wlr_ prefix like public functions do.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-07-29 02:03:18 -07:00
1beb25a1c8 tinywl: fix cursor disappears when focused window is closed
Add listener for wlr_seat->pointer_state.events.focus_change

Fix #3802
2025-07-25 12:56:05 +00:00
Simon Ser
2f2c0dfcc6 scene: use helpers to convert TF/primaries enums 2025-07-24 15:02:39 +00:00
Simon Ser
47a90d6f1a color_management_v1: add helpers to convert TF/primaries enums
This makes it easier for protocol implementers to tie everything
together with wlroots backends and renderers.
2025-07-24 15:02:39 +00:00
llyyr
db5e9ca04c meson: bump minimum wayland-protocols version
color-representation was added in 1.44.

Fixes: eff620770c
2025-07-24 14:51:37 +00:00
rewine
efb17980a8 ext_image_capture_source_v1: remove unused struct definition
Remove the redundant wlr_ext_foreign_toplevel_image_capture_source_v1
struct that was not used anywhere in the codebase.
2025-07-24 14:49:27 +00:00
liupeng
be5e266211 cursor: update output cursor even if output is disabled
During suspend, we first disable output and then remove the input device.
This causes cursor->state->surface released while cursor->texture leaves.
Which leads to use-after-free after resume.
2025-07-24 14:47:32 +00:00
Andri Yngvason
80c7e0f772 ext-image-capture-source: output: Apply transform to cursor
The cursor can be expected to also be transformed if the output is
transformed.
2025-07-23 15:06:24 +00:00
Yixue Wang
ccec4116b3 types/color_management: check on invalid image description
Check if image description is valid. If not, post error to client.
2025-07-20 23:01:58 +08:00
Yixue Wang
d2007d7dc1 types/color_representation: correctly cleanup in manager create
Global should be created after all other initialization finished.
Free manager in err_options.
2025-07-18 18:12:40 +08:00
David Turner
a4eb2cff46 color-representation-v1: Add wlr enums + converters
Add wlr-internal enums for the properties specified in
color-representation-v1 (encoding, range, chroma siting, alpha mode) so
that other parts of wlroots can use these without depending on the
protocol specifics and without needing to include the protocol headers.
Also add conversion functions to convert the protocol enum values into
the wlroots enum values.
2025-07-17 16:41:14 +01:00
David Turner
eff620770c color-representation-v1: new protocol
Add a minimal implementation of the color-representation-v1 protocol
(not including anything to actually use the new properties in
rendering/scanout)
2025-07-17 16:40:45 +01:00
David Turner
f5dc6416f0 util/mem: Move memdup to new util/mem.c file
This seems handy and I want to use this in wlr_color_representation.
2025-07-17 16:39:58 +01:00
YaoBing Xiao
c14aa1d0b8 render/vulkan: destroy vulkan instance when drm phdev mismatch 2025-07-15 08:59:37 +08:00
Consolatis
c39b3ce7a3 transient_seat: initialize seat destroy listener
This fixes a `wl_list_remove()` from an uninitialized listener
when using `wlr_transient_seat_v1_deny()` in a `create_seat`
handler.
2025-07-10 19:52:45 +02:00
Simon Ser
f4327f52cf xdg-toplevel-tag-v1: new protocol
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/238
2025-07-07 09:10:37 +00:00
Consolatis
6aa654b728 wlr_text_input_v3: remove event arguments from header
Fixes 2d5492c737
2025-07-06 14:10:25 +02:00
Félix Poisot
31b78a4f3a scene: fix output transfer functions
fixes: bf40f396b
2025-07-03 12:29:27 +00:00
David Turner
58c3680d96 scene: Block damage on single-pixel buffer textures
We cache whether buffers are single-pixel buffers (and if so what color
they are) to allow rendering optimizations.  But this breaks if the
client changes out the single-pixel buffer for one with a different
color, because this updates the texture in-place instead of actually
changing the buffer.

We can fix this by blocking in-place texture updates for single pixel
buffers.

Original bug: https://codeberg.org/ifreund/waylock/issues/121
See also: !5092
2025-07-01 11:38:56 +01:00
Simon Ser
48bd1831fe render/egl: fix software rendering check
Commit b4ce0d8b39 ("render/egl: accept negative DRM FD to select
software rendering") added an EXT_device_drm check to figure out
whether the user selected a device with a DRM FD or without one.
However, for KMS-only devices, Mesa will never advertise the
selected KMS node:
3f1d40d230/src/egl/main/egldevice.c (L109)

Instead, pass down a parameter to indicate whether a DRM FD was
passed in.

Fixes: b4ce0d8b39 ("render/egl: accept negative DRM FD to select software rendering")
2025-06-29 10:57:56 +02:00
Simon Ser
8c7041c4e8 backend/drm: relay full HDR metadata 2025-06-26 11:02:26 +00:00
Simon Ser
aecb867098 output: add full HDR metadata to wlr_output_image_description
This allows sinks to improve their tone mapping.
2025-06-26 11:02:26 +00:00
Simon Ser
bf40f396bf scene: grab image description from output state
Alternative to https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5089
2025-06-26 09:56:12 +00:00
Simon Ser
2498036e67 output: add output_pending_image_description() 2025-06-26 09:56:12 +00:00
Simon Ser
e76f8ac2b3 output: add wlr_output.image_description
Stores the current image description.
2025-06-26 09:56:12 +00:00
tokyo4j
6d8bb66f98 xwm: add support for _NET_WM_ICON 2025-06-26 08:50:02 +00:00
Isaac Freund
f5e7caf599 util/box: set dest to empty if boxes don't intersect
Currently if both box_a and box_b are non-empty but do not intersect,
this function does not set dest to an empty box. This contradicts the
doc comments and is surprising for users.
2025-06-21 09:54:24 +00:00
Simon Ser
98af337175 output: shorten output enabled checks
Use a more concise loop instead of repeated logic.

No behavior change.
2025-06-20 19:02:54 +02:00
Simon Ser
0c272a3842 scene: add support for color-management-v1 primaries 2025-06-18 19:37:55 +00:00
Simon Ser
071773cb27 scene: add primaries support to wlr_scene_buffer 2025-06-18 19:37:55 +00:00
Simon Ser
ae85c31176 render/vulkan: add luminance multiplier for texture shader 2025-06-18 19:37:55 +00:00
Simon Ser
fa1feb447f render, render/vulkan: add primaries to wlr_render_texture_options 2025-06-18 19:37:55 +00:00