Commit graph

2692 commits

Author SHA1 Message Date
Alexander Orzechowski
863ed02d54 Merge branch 'gpu-reset-recover' into 'master'
Automatic GPU reset recovery

See merge request wlroots/wlroots!3910
2024-10-09 09:31:41 +00: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
95d25d833f keyboard: add utilities for pointer keys
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3803
2024-10-07 18:41:07 +00:00
Kirill Primak
ab118042ea ext-foreign-toplevel-list: add _from_resource() 2024-10-01 18:59:18 +03: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
Alexander Orzechowski
9b2b9d1367 wlr_raster_from_surface: Implement surface invalidation 2024-09-14 18:06:15 -04:00
Alexander Orzechowski
dbf10ebdf1 wlr_raster: Introduce invalidated signal
If this raster becomes invalid meaning that the buffer neither
has a buffer or textures. The invalidated signal will be called
to signify to its owner that it should be recreated.
2024-09-14 18:05:45 -04:00
Alexander Orzechowski
204a2b733b surface_invalidation_v1: New protocol implementation 2024-09-14 18:05:45 -04:00
Alexander Orzechowski
941c8261e3 wlr_output_manager: Automatically recreate the context on loss 2024-09-14 18:05:45 -04:00
Alexander Orzechowski
bf3ee92741 wlr_output_manager: Introduce new abstraction 2024-09-14 18:03:05 -04:00
Alexander Orzechowski
4fe6a8e857 Use wlr_raster allocator variants 2024-09-14 18:03:05 -04:00
Alexander Orzechowski
b0e8e6eae7 linux_dmabuf_v1: Introduce main device
Introduce properties for the main renderer and allocator the compositor
wants wlroots to use when it needs to blit to a staging buffer during
multigpu. We need to perform an additional blit if the modifier is not
compatible with the target GPU.
2024-09-14 18:03:05 -04:00
Alexander Orzechowski
5eb9a2ea10 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-09-14 18:03:05 -04:00
Alexander Orzechowski
99d543379e wlr_raster: Implement explicit sync for multigpu blits 2024-09-14 18:03:04 -04:00
Alexander Orzechowski
a28efaafa9 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-09-14 18:02:46 -04:00
Alexander Orzechowski
61c4ba5f70 wlr_scene: Precompute raster textures before rendering 2024-09-14 17:53:05 -04:00
Alexander Orzechowski
dc7855f674 backend/drm: Drop parent drm device
Compositors should instead blit to secondary drm devices themselves.
2024-09-14 17:53:05 -04:00
Alexander Orzechowski
38d761c837 wlr_raster: Support multiple renderers 2024-09-14 17:44:12 -04:00
Alexander Orzechowski
f1c5184ec3 wlr_raster: Use wlr_surface_consume() 2024-09-14 17:44:05 -04:00
Alexander Orzechowski
7ba7f774ca 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-09-14 17:43:56 -04:00
Alexander Orzechowski
4f0058f85c 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-09-14 17:43:56 -04:00
Alexander Orzechowski
ce918e8139 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-09-14 17:43:56 -04:00
Alexander Orzechowski
d74b6fb41f wlr_scene: Remove usage of wlr_client_buffer 2024-09-14 17:42:41 -04:00
Alexander Orzechowski
ea69cb66e6 wlr_scene: Introduce wlr_scene_buffer_set_raster_with_damage 2024-09-14 17:42:41 -04:00
Alexander Orzechowski
c218683adf wlr_scene: Manage textures through a raster 2024-09-14 17:42:41 -04:00
Alexander Orzechowski
a9458c5bc7 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-09-14 17:42:41 -04:00
Alexander Orzechowski
7a108f9883 wlr_raster: Add backwards compatibility with wlr_client_buffer 2024-09-14 17:42:41 -04:00
Alexander Orzechowski
ceff483764 wlr_raster: Add partial texture uploads to surface helper 2024-09-14 17:42:41 -04:00
Alexander Orzechowski
46b0ba0da6 wlr_raster: Add surface helper 2024-09-14 17:42:41 -04:00
Alexander Orzechowski
d9f6ec080f 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-09-14 17:42:41 -04:00
Alexander Orzechowski
48874c9e86 wlr_raster: Introduce new abstraction 2024-09-14 17:42:40 -04: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
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
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
Alexander Orzechowski
52afedadea wlr_scene: Assert wlr_scene_rect has nonnegative dimensions 2024-08-23 16:53:32 -04:00
YaoBing Xiao
43554c1966 types/wlr_output: removing the useless pointer 2024-08-21 14:04:24 +00:00
Kirill Primak
cf93d31736 scene: resize damage ring on geometry update 2024-08-21 13:53:34 +00:00
Alexander Orzechowski
bfcaa4bc44 swapchain, damage_ring: Drop buffer age 2024-08-21 09:45:54 -04:00
Alexander Orzechowski
eebaca8dbf output/render: Drop buffer age from wlr_output_begin_render_pass
For compositors wanting to damage track, `wlr_damage_ring_rotate_buffer()`
should be used and the damage should be set on the passed state.
2024-08-21 09:45:54 -04:00
Kirill Primak
62cc96b3a4 scene: update output geom on commit after dropping pending damage
Otherwise the whole output damage gets ignored.
2024-08-20 19:27:13 +03:00
Simon Ser
098cb9b7a3 xdg-shell: add wlr_xdg_toplevel_configure()
A struct wlr_xdg_toplevel_configure is passed in with the whole
state. This makes it a lot clearer that the size and WM state are
always sent to the client.
2024-08-20 09:15:39 +00:00
Kirill Primak
b4f077a596 drm-syncobj-v1: remove buffer release listener on signaller destroy 2024-08-19 15:49:01 +00:00