Commit Graph

7319 Commits

Author SHA1 Message Date
Isaac Freund
da8f7a07ba
backend/headless: actually perform output test
Currently the headless backend does not actually implement the
wlr_output_test function, causing tests containing output state
unsupported by the headless backend to succeed while committing the same
state will always fail.

This commit fixes that by actually hooking up the already exisiting test
function.

References: https://codeberg.org/river/river/issues/1154
2024-10-24 10:49:08 +02:00
xurui
0d467ef9aa xdg-positioner: use enum_is_valid functions
Signed-off-by: xurui <xurui@kylinos.cn>
2024-10-23 18:52:34 +08:00
xurui
527b77b445 xdg-toplevel: use enum_is_valid functions
Signed-off-by: xurui <xurui@kylinos.cn>
2024-10-23 18:52:26 +08:00
David Turner
c87ab6465d Support direct scanout with src crop and dst boxes
Enable scene-tree direct scanout of a single buffer with various options
for scaling and source crop. This is intended to support direct scanout
for fullscreen video with/without scaling, letterboxing/pillarboxing
(e.g. 4:3 content on a 16:9 display), and source crop (e.g. when
1920x1088 planes are used for 1920x1080 video).

This works by explicitly specifying the source crop and destination box
for the primary buffer in the output state.  DRM atomic and libliftoff
backends will turn this into a crop and scale of the plane (assuming the
hardware supports that).  For the Wayland/X11/DRM-legacy backends I just
reject this so scanout will be disabled.

The previous behaviour is preserved if buffer_src_box and buffer_dst_box
are unset: the buffer is displayed at native size at the top-left of the
output with no crop.

The change to `struct wlr_output_state` makes this a binary breaking
change (but this works transparently for scene-tree compositors like
labwc after a recompile).
2024-10-22 18:28:09 +01:00
YaoBing Xiao
47fb00f66d wlr_linux_dmabuf_v1: log plane index in error messages for dma-buf
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2024-10-15 18:05:16 +00:00
Kenny Levinsen
ba0cc8eb05 backend/multi: Advance index on backend_commit
wlr_multi_backend sorts the states it is given and tries to perform
sequential backend-wide commits for each sub-backend with the states
that belong to it.

It did not manage the index correctly for the next iteration, so given N
states for a backend it would perform N backend-wide commits.

Clarify the logic by calculating a length rather than an end pointer and
update the index after each iteration.
2024-10-15 17:32:54 +02:00
Kirill Primak
7952658367 scene: crop output buffer damage before adding
This piece of logic was accidentally removed in
009515161b.
2024-10-15 12:59:40 +00:00
Simon Ser
3b3ed21e61 backend/drm: fix timeline feature flag on multi-GPU setups
This piece of code checks for multi-GPU renderer support, so it
needs to run after the renderer is initialized.

Fixes: 514c4b4cce ("backend: add timeline feature flag")
Closes: https://github.com/swaywm/sway/issues/8382
2024-10-12 17:12:29 +02:00
Alexander Orezechowski
402a862413 output: Change wlr_output_add_software_cursors_to_render_pass to take buffer coordinates
Since wlr_damage_ring now only works with buffer local coordinates, this
creates an inpedance mismatch for compositors that want to use this
function. Instead of compositors needing to the the conversion itself,
change thu function to take buffer local coordinates directly.
2024-10-12 07:30:11 +00:00
Simon Ser
1e949402b0 output: drop output timeline flag
This has been superseded by the backend-wide feature flag.
2024-10-11 17:11:35 +00:00
Simon Ser
785e340f01 scene: use backend-wide timeline feature flag 2024-10-11 17:11:35 +00:00
Simon Ser
186bdc8da4 output: use backend-wide timeline feature flag 2024-10-11 17:11:35 +00:00
Simon Ser
514c4b4cce backend: add timeline feature flag
The output feature flag has a flaw: it's not possible to check
whether the backend supports timelines during compositor
initialization when we need to figure out whether we want to enable
the linux-drm-syncobj-v1 protocol.

Introduce a backend-wide feature flag to indicate support for
timelines to address this defect.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3904
2024-10-11 17:11:35 +00:00
Alexander Orezechowski
8d8d5f5e94 scene: Rename some functions 2024-10-11 00:37:55 +03:00
Alexander Orezechowski
009515161b scene: Only accept buffer coordinates for damage 2024-10-11 00:37:55 +03:00
Alexander Orezechowski
f1b8937345 scene: Factor scaling into output transform function 2024-10-11 00:37:51 +03:00
Alexander Orezechowski
b9f0b9c766 scene: Apply damage ring as buffer local coordinates 2024-10-11 00:37:51 +03:00
Alexander Orezechowski
831e7fc7ee damage_ring: Add notes about damage being in buffer local coordinates 2024-10-11 00:37:48 +03:00
Alexander Orzechowski
79e063035c damage_ring: Remove wlr_damage_ring_set_bounds
This wasn't that great:
1. Now that damage ring tracks damage across actual wlr_buffer objects,
   it can use the buffer size to do any sort of cropping that needs to
   happen.
2. The damage ring size really should be the size of the transformed
   size of the output. Compositors currently have to call
   `wlr_damage_ring_set_bounds()` where it might not be clear when to
   call the function. Compositors can just check against the actual
   output bounds that they care about when processing the damage.

Fixes: #3891
2024-10-09 06:31:46 +00:00
Alexander Orzechowski
6202580b7b damage_ring: Stop using ring->{width, height} 2024-10-09 06:31:46 +00:00
Alexander Orzechowski
502eb38d80 damage_ring: Remove return value of wlr_damage_ring_add/wlr_damage_ring_add_box
Compositors should compute whether the damage is part of the output
themselves.
2024-10-09 06:31:46 +00:00
Alexander Orzechowski
fbafd8ed94 wlr_damage_ring: Clamp damage region to buffer size 2024-10-09 06:31:46 +00:00
Alexander Orzechowski
9904f160af scene: Don't rely on return value of wlr_damage_ring_add 2024-10-09 06:31:46 +00:00
Alexander Orzechowski
b8418b7b91 scene: Use wlr_output_transformed_resolution 2024-10-09 06:31:46 +00:00
Kirill Primak
dd8f4913a4 subcompositor: drop unused subsurface state 2024-10-08 19:18:38 +03:00
Simon Ser
6ada67da9b xwayland/xwm: implement somewhat asynchronous request flushing
Instead of calling xcb_flush() directly, wait until the FD is
writable.

Ideally we'd have a non-blocking variant instead of xcb_flush(),
but libxcb doesn't have this. Also libxcb blocks when its internal
buffer is full, but not much we can do here.
2024-10-07 21:51:15 +03:00
Simon Ser
c9fe96102d xwayland/xwm: extract read loop to separate function 2024-10-07 21:47:00 +03:00
Simon Ser
95d25d833f keyboard: add utilities for pointer keys
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3803
2024-10-07 18:41:07 +00:00
Simon Ser
7ce868bcf6 render/vulkan: make VK_KHR_external_semaphore_fd optional
We already block instead of using sync_file when the driver
doesn't support import/export.
2024-10-03 19:24:30 +02:00
Kirill Primak
ab118042ea ext-foreign-toplevel-list: add _from_resource() 2024-10-01 18:59:18 +03:00
Simon Ser
3da6fac1f2 render/vulkan: check size when creating shm texture 2024-09-29 15:22:56 +00:00
Simon Ser
d55c175777 render/vulkan: log size when importing too-large DMA-BUF 2024-09-29 15:22:56 +00:00
Kirill Primak
a8d1e5273a linux-dmabuf-v1: use static_assert 2024-09-24 19:56:36 +00:00
Kirill Primak
56d69320c7 pointer: release pressed buttons on destroy 2024-09-24 19:53:54 +00:00
Kirill Primak
c752270be7 tinywl: drop focused surface check for interactive ops
This serves as a bad example: compositors should validate serials from
events instead. Also, the current implementation segfaults if
focused_surface is NULL.
2024-09-20 10:48:32 +00:00
YaoBing Xiao
7debaced03 x11/backend: Optimize query_version error handling
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2024-09-12 17:52:26 +08:00
llyyr
bf0cac12a3 input-method-v2: set no keymap format if no keymap is set
Also don't copy the keymap each time it gets sent to a client
2024-09-11 15:09:56 +05:30
YaoBing Xiao
04525e6f82 wlr_screencopy_v1: send fine-grained damage events
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2024-09-10 20:54:04 +08:00
Kenny Levinsen
96ad414ec9 backend/drm: Remove call to CRTC realloc on scan
After a connector scan, new connectors might have appeared and old ones
gone away. At this point, old CRTC allocations are already gone, while
new allocations are not yet needed. Skip the call.
2024-09-09 13:22:56 +00:00
YaoBing Xiao
9f7ab85718 tearing_control_v1: Free the wlr_tearing_control_v1 on error
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2024-09-09 16:16:56 +08:00
Simon Ser
1a7981f7c9 compositor: document surface events 2024-09-05 19:49:20 +02:00
Simon Ser
234d31f138 backend/drm: improve doc comment for match_connectors_with_crtcs_()
- Add general description
- Mention the computer theory problem that this is solving
- More wording cleanup
2024-09-02 17:12:32 +00:00
Kenny Levinsen
beb9a9ad0a linux-drm-syncobj-v1: Skip release if there is no timeline
If a surface with an existing buffer has a syncobj surface state created
without committing a new buffer with associated timelines, callers will
see the surface as having a syncobj state and may try to use it, but
calling the signal_release_with_buffer helper at this time will assert
on the lacking release timeline.

As this is a valid situation, remove the assert and replace it with an
early return so that callers do not need to explicitly check for the
presence of valid timelines.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3895
2024-08-28 18:44:46 +02:00
YaoBing Xiao
0db4df4c8e gles2/pass: remove duplicate variable declarations 2024-08-27 20:25:18 +08:00
Simon Ser
0d6284eb62 backend/drm: add explicit sync support to libliftoff interface 2024-08-26 18:21:50 +02:00
Simon Ser
d7223eae02 backend/drm: add explicit sync support to multi-GPU blits 2024-08-26 18:09:27 +02:00
Alexander Orzechowski
3187479c07 render/color: Invert ownership model of color_transform types.
Color transform can have multiple types and these different types
want to store different metadata. We previously stored this metadata
directly on wlr_color_transform even for transforms that don't use it.

Instead, let's take the prior art from wlr_scene where each scene node
is built on a base node. Notice how wlr_color_transform_lut3d now has
a `struct wlr_color_transform base`. This is advantageous in multiple
ways:

1. We don't allocate memory for metadata that will never be used.
2. This is more type safe: Compositors can pass around a
struct wlr_color_transform_lut3d if they know they only want to use a
3d_lut.
3. This is more scalable. As we add more transform types, we don't have
to keep growing a monolithic struct.
2024-08-24 14:33:22 -04:00
Simon Ser
fa2abbeefb render/color: return tranform in wlr_color_transform_ref()
This is more consistent with the rest of the wlroots APIs and is
more concise.
2024-08-24 11:07:58 +02:00
YaoBing Xiao
a5aae69b2a backend/drm: remove unnecessary semicolons 2024-08-24 08:36:46 +00:00
Alexander Orzechowski
52afedadea wlr_scene: Assert wlr_scene_rect has nonnegative dimensions 2024-08-23 16:53:32 -04:00