Commit Graph

7317 Commits

Author SHA1 Message Date
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
Consolatis
adf9d8b0be ext-foreign-toplevel-list: use correct interface and add missing handler
Without this patch, a client calling handle.destroy() will trigger
an assert in libwayland due to a NULL pointer for the destroy handler.

Also implement a missing .destroy handler for the manager itself
and delay destruction of the manager resource from the .stop handler
to the .destroy handler.
2024-08-12 22:31:31 +02:00
project-repo
e209fe2d05 Fix memory leak in xwayland.c 2024-08-12 14:06:10 +00:00
project-repo
3cae2a2c01 Fix memory leak in drm.c 2024-08-12 14:06:10 +00:00
John Lindgren
6214144735 xwayland: add wlr_xwayland_surface_has_window_type()
The infrastructure to read _NET_WM_WINDOW_TYPE already exists in wlroots
(it's used for example in wlr_xwayland_or_surface_wants_focus()). But
the window type isn't easily accessible to the compositor because the
atoms to compare against are private to xwm.c.

labwc has recently gone to a fair amount of effort (including opening a
whole new xcb connection) just to get the needed window type atoms:
a04b394e59

It seems much cleaner to add the remaining few (3) atoms to wlroots and
implement a shared function which can be used by any wlroots compositor.

v2: naming updates
2024-08-10 16:10:34 +00:00
Alistair Buxton
71cc47b859 Fix Meson version required for C23 support
Attempting to build with Meson 1.3.2 (current version in Ubuntu 24.04 LTS) gives the following error:

    meson.build:1:0: ERROR: Unknown C std ['c23'].

This is because C23 support was not added until Meson 1.4.0.

See:

https://github.com/mesonbuild/meson/blob/1.3.2/mesonbuild/compilers/c.py#L59
https://github.com/mesonbuild/meson/blob/1.4.0/mesonbuild/compilers/c.py#L49
2024-08-10 15:54:23 +00:00
Kirill Primak
08e779bd85 seat/pointer: reset pressed buttons on focus change
This fixes two problems:
- A surface could get unexpected release events for buttons pressed
  while other surface was focused;
- Clearing focus while a button is pressed would lead to the button
  getting "stuck".

Fixes: 8730ca9661
2024-08-10 09:55:17 +03:00
Consolatis
0a388a14f1 xwm: supply wlr_xwayland pointer to user_event_handler callback
Previously it was supplying a pointer to private struct wlr_xwm
which was useless for compositors. The wlr_xwayland pointer in
contrast does have a generic data field and thus can be used by
compositors to attach their own pointer.

Additionally change the return value from int to bool.
2024-08-08 17:00:08 +00:00
Consolatis
20997df416 xwm: add request_close signal
This is especially useful if the compositor wants to support X11
panels to control windows. Without the signal a compositor does
have to hook into the user_event_handler callback but that would
not change the _NET_SUPPORTED root window property.
2024-08-08 15:49:11 +00:00