Commit graph

7283 commits

Author SHA1 Message Date
Alexander Orzechowski
21b04a8c7f wlr_raster: Implement CPU blits
We need this really slow path if the user is using GPUs that don't have
common compatible modifiers. One example of a vendor that doesn't support
rendering to a LINEAR modifier (which otherwise should always exist)
is NVIDIA.
2024-10-13 11:58:53 -04:00
Alexander Orzechowski
df20cd28d0 wlr_raster: Implement explicit sync for multigpu blits 2024-10-13 11:58:53 -04:00
Alexander Orzechowski
5ac236085d wlr_raster: Implement multi-renderer blits
We also need to introduce allocator variants to wlr_raster_upload_texture
and wlr_raster_attach so that the given allocator can be used to
allocate a stanging buffer to aid in blitting
2024-10-13 11:51:42 -04:00
Alexander Orzechowski
6caa8cd4f0 wlr_scene: Precompute raster textures before rendering 2024-10-13 11:51:42 -04:00
Alexander Orzechowski
2cbf7b563a drm/monitor: Remove primary_drm
This field is not used anymore. This also gives us the opportunity to
clean up backend autocreation.
2024-10-13 11:51:42 -04:00
Alexander Orzechowski
e319909294 backend/drm: Drop parent drm device
Compositors should instead blit to secondary drm devices themselves.
2024-10-13 11:51:41 -04:00
Alexander Orzechowski
2cca0086fb wlr_raster: Support multiple renderers 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
477c556019 wlr_raster: Use wlr_surface_consume() 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
e20c0290c1 wlr_compositor: Introduce wlr_surface_consume
If the compositor is running without a renderer, that means that
the compositor must be driven by something external that may or may not
be there. So we have two scenarios:
1. This compositor is currently being watched and driven by some
external source that is consuming buffers. This is okay, because
during the commit handler `surface->current.buffer` and
`surface->buffer_damage` will be usable and things will be handled
like normal.
2. Things break however if the compositor is not currently driven. This
however is commonly temporary. Something may not be interested right now,
but later it can be. In this case we have to accumulate state until
this external consumer is ready. Here, we have to accumulate the
`buffer_damage` and keep the buffer locked until the consumer is ready.

`wlr_surface_consume` needs to be called when the state of this surface
was consumed so that it is safe to release these resources.
2024-10-13 11:48:12 -04:00
Alexander Orzechowski
42c395f39c wlr_compositor: release state on buffer release
wlr_compositor will now wait for the current buffer to be released before
clearing relevant state. For now, this will always happen at the end of
the commit so there should be no functional change here.
2024-10-13 11:48:12 -04:00
Alexander Orzechowski
06cd96b832 wlr_compositor: Move buffer damage clear to end of commit
It makes sense to do it here because it is where we null the buffer. The
buffer damage is only useful to us as long as we have the buffer.
2024-10-13 11:48:12 -04:00
Alexander Orzechowski
dc67a853fd tinywl: Use wlr_raster 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
19b1b44230 wlr_scene: Remove usage of wlr_client_buffer 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
99eaf7006f wlr_scene: Introduce wlr_scene_buffer_set_raster_with_damage 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
56c38586fc wlr_scene: Manage textures through a raster 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
17cdf9b4eb wlr_cursor_set_surface: Use wlr_raster to generate texture from surface
Since wlr_raster supports wlr_compositor usage with and without a renderer,
use it for wlr_curosr so cursors support running on a surface without
a renderer.
2024-10-13 11:48:12 -04:00
Alexander Orzechowski
ce09ecedfd wlr_raster: Add backwards compatibility with wlr_client_buffer 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
851440f59d wlr_raster: Add partial texture uploads to surface helper 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
7d87ae563e wlr_raster: Add surface helper 2024-10-13 11:48:12 -04:00
Alexander Orzechowski
e83147bb71 wlr_buffer: Introduce prerelease
The prerelease signal lets users do things things at the last moment
that would be inappropriate to do on the release signal. Inside the
prerelease signal, it is allowed to lock the buffer and also
upload/import the contents of the buffer to a texture.
2024-10-13 11:48:12 -04:00
Alexander Orzechowski
057fd1a0e3 wlr_raster: Introduce new abstraction 2024-10-13 11:48:12 -04: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