Commit graph

7261 commits

Author SHA1 Message Date
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
5a72ea9ac1 tinywl: Use wlr_output_manager 2024-09-14 18:03:05 -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
873ce330a7 drm/monitor: Remove primary_drm
This field is not used anymore. This also gives us the opportunity to
clean up backend autocreation.
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
a96efda6c5 tinywl: Use wlr_raster 2024-09-14 17:42:41 -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
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
Simon Ser
52dce29e06 render/vulkan: use non-coherent memory for read_pixels()
The spec for VkMemoryPropertyFlagBits says:

> device coherent accesses may be slower than equivalent accesses
> without device coherence [...] it is generally inadvisable to
> use device coherent or device uncached memory except when really
> needed

We don't really need coherent memory so let's not require it and
invalidate the memory range after mapping instead.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3868
2024-08-22 18:19:22 +02:00
Simon Ser
5432108846 backend/drm: drop SKIP in match_connectors_with_crtcs()
It's unused.
2024-08-21 22:25:19 +02:00
Simon Ser
5f3b99bbed backend/drm: rename i param in match_connectors_with_crtcs_()
Use a more descriptive name to make it clear what kind of index
this is.
2024-08-21 22:25:19 +02:00
Simon Ser
1e03719361 backend/drm: drop match_connectors_with_crtcs() return value
It's unused.
2024-08-21 22:25:19 +02:00
Simon Ser
0bf642d246 backend/drm: use more descriptive names for match_obj()
This function is only used for connectors and CRTCs, so instead of
the abstract "obj"/"resource" wording, just use the concrete names.
2024-08-21 22:25:19 +02:00
Simon Ser
d2a5dbe104 backend/drm: use CRTCs in-order
When lighting up a new connector, we'd use the last CRTC instead of the
first one. This causes issues because drivers have the expectation that
userspace will match CRTCs to connectors in-order [1].

The order has regressed a long time ago in 5b13b8a12c ("backend/drm:
consider continue not using resources"). That commit was a fix to
avoid moving a connector between CRTCs [2]. Revert that commit and
use a different approach: even if we've found a solution, always try
not using a CRTC in the hope that we'll find another solution with
less CRTC replacements.

[1]: https://lore.kernel.org/dri-devel/20240612141903.17219-2-ville.syrjala@linux.intel.com/
[2]: https://github.com/swaywm/wlroots/issues/1230

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3098
2024-08-21 15:17:04 +00: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