Commit Graph

7275 Commits

Author SHA1 Message Date
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
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
Simon Ser
8582b45c9e xdg-shell: document struct wlr_xdg_toplevel_configure 2024-08-20 09:15:39 +00:00
Dudemanguy
3d2f09bace backend/drm: fix a use-after-free
The page_flip can be destroyed, but it is unconditionally accessed later
on when setting present_flags. Fix this by simply setting the
present_flags before the page_flip gets destroyed.
2024-08-19 13:46:41 -04:00
Kirill Primak
b4f077a596 drm-syncobj-v1: remove buffer release listener on signaller destroy 2024-08-19 15:49:01 +00:00
YaoBing Xiao
3048fb3fc6 render/egl: Release devices before return 2024-08-19 23:18:11 +08:00
Kenny Levinsen
5df2b34d2b allocator/gbm: Reset errno before gbm_bo_create
Not all paths in GBM set errno properly on error. Reset it to zero
before calling GBM to avoid accidentally printing a garbage error.
2024-08-19 14:59:44 +02:00
Kenny Levinsen
ccd4703207 allocator/gbm: Log errno if gbm_bo_create fails 2024-08-19 14:41:09 +02:00
Kirill Primak
a0450d219f layer-shell: introduce wlr_layer_surface_v1_get_exclusive_edge() 2024-08-18 01:02:08 +00:00
Kirill Primak
270e6f4ebb layer-shell: add v5 support 2024-08-18 01:02:08 +00:00
Kirill Primak
e88988e364 keyboard: simplify releasing keys on finish 2024-08-15 18:33:00 +00:00
Kirill Primak
310a5eb61c backend/wayland: simplify wl_keyboard.{enter,leave} processing 2024-08-15 18:33:00 +00:00
Isaac Freund
08495d2596 backend/drm: don't set vsync present flag if page flip was async 2024-08-15 15:11:10 +00:00
Kirill Primak
3103ea3af9 backend/wayland: process initial events from globals correctly
Previous logic could lead wlr_wl_backend.drm_render_name being written
to twice, causing a memory leak. This commit fixes the race condition.
2024-08-15 12:52:05 +03:00
Kirill Primak
ee21deb458 linux-drm-syncobj: add missing decls in the header 2024-08-15 09:02:04 +00:00
Leonardo Hernández Hernández
baaec88e2f
linux-drm-syncobj-v1: actually use the requested version 2024-08-14 23:03:14 -06:00
Kirill Primak
4da4269d8f seat/pointer: reset pressed buttons on "grab-compatible" focus change
Fixes: 08e779bd85
2024-08-14 22:43:44 +03:00
Kirill Primak
5c98d1a04a xdg-surface: fix window geometry handling
It was completely wrong: according to the protocol, the effective
geometry is only updated on commit time if there pending state has
new state from xdg_surface.set_window_geometry or
xdg_surface.set_window_geometry has never been sent at all.

This commit adds wlr_xdg_surface.geometry which correctly matches the
effective window geometry and removes now-useless
wlr_xdg_surface_get_geometry().
2024-08-14 18:52:13 +00:00
Kirill Primak
a1298580cc compositor: add surface role map hook 2024-08-14 18:52:13 +00:00
Alexander Orzechowski
515275ee72 wlr_scene: Introduce wlr_scene_set_gamma_control_manager_v1 2024-08-14 13:18:56 -04:00
Alexander Orzechowski
23202e192c wlr_scene: Introduce wlr_scene_output_needs_frame
It seems that some scene compositors want to avoid wlr_scene_output_commit
and use the lower lever wlr_scene_output_build_state. However, build
state does not early return if a frame is not needed so compositors will
implement the check themselves. Let's add a helper function that compositors
can use to implement the check.

Technically pending_commit_damage is a private interface, so this lets
compositors not interface with private interfaces to implement the check.
2024-08-14 12:51:15 -04:00
Alexander Orzechowski
2463a4723e wlr_scene: Ensure we restack all xwayland surfaces to the bottom when scene node is disabled 2024-08-14 11:53:20 -04:00
Alexander Orzechowski
291df10fe5 wlr_scene: Extract function to get xwayland surface from node 2024-08-14 11:53:05 -04:00
Alexander Orzechowski
235c8e922a Revert "wlr_scene: Ensure scene_node_update is updating entire node."
This reverts commit 66d96d244c.
2024-08-14 11:51:44 -04:00
Kirill Primak
70c99460ca pointer-constraints: don't init/finish current/pending states
wlr_surface_synced does it automatically.

Reported-by: llyyr <llyyr.public@gmail.com>
2024-08-14 15:41:31 +00:00
Alexander Orzechowski
4f1104654f wlr_scene: Fix WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT when output is transformed 2024-08-14 11:23:30 -04:00
Alexander Orzechowski
14e1987f50 wlr_scene: Don't special case swapchain buffers
This fixes direct scanout VRR. As direct scanout buffers are not part
of the swapchain, we would mistakenly union instead of subtract the damage
meaning it will just accumulate indefinitely.

The reason for this existing in the first place is for compositors that
might want to sidestep scene and commit their own buffers to the output.
In this case, scene could theoretically acknowledge that and update the
damage. Except, this really didn't work because WLR_OUTPUT_STATE_DAMAGE
would need to be defined which is optional. This patch also properly
acknowledges commits without damage.

In the use case of a weird compositor that might want to sidestep scene,
they can just trash the damage ring themselves.

Fixes: #3871
2024-08-14 11:23:02 -04:00
Alexander Orzechowski
3e1358fec9 wlr_scene: Inline output_state_apply_damage 2024-08-14 11:23:02 -04:00
Alexander Orzechowski
147c5c37e3 wlr_scene: Immediately apply pending output commit damage
There were two problems with the old implementation:
1. wlr_scene_output_commit would bail early if a frame wasn't requested
and there was no commit damage, however commit damage could never accumulate
until rendering happens. The check was subtly wrong as a result.
2. Previously, we would fill the pending commit damage based on the
current state of the damage ring. However, during direct scanout, the
damage would accumulate which would mean we would submit damage from
previous frames even if we didn't need to.
2024-08-14 11:23:01 -04:00
Alexander Orzechowski
78dfa4f06d wlr_scene: Funnel all damage operations through scene_output_damage
We want to add logic to this function later
2024-08-14 11:21:00 -04:00
Kirill Primak
c52e01e85f xdg-popup: don't set a role resource destroy handler
wlr_xdg_surface tracks role resource destruction itself.
2024-08-14 13:32:16 +00:00
Kirill Primak
6c8eabcecd xdg-foreign: clean up
This commit removes extra wlr_xdg_toplevel_set_parent() calls,
simplifies wlr_surface->wlr_xdg_toplevel conversion logic, makes related
structures store wlr_xdg_toplevel objects directly instead of
wlr_surface objects, and improves the code style.
2024-08-14 15:56:36 +03:00
zhoulei
2c64f36e88 xwayland/xwm: listen shell destroy signal
Otherwise we got invaild write in wl_list_remove.

Fixes: e209fe2d0 ("Fix memory leak in xwayland.c")

Signed-off-by: zhoulei <zhoulei@kylinos.cn>
2024-08-13 11:33:04 +08:00
Simon Ser
e6dbe4580e render/gles2: check for DRM_CAP_SYNCOBJ_TIMELINE
Before advertising support for timelines, check for
DRM_CAP_SYNCOBJ_TIMELINE. Without this, the user cannot
create/import drm_syncobj timelines.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4715#note_2523517
2024-08-12 22:37:34 +00:00