Commit Graph

7149 Commits

Author SHA1 Message Date
Simon Ser
5bc39071d1 build: bump version to 0.18.1 2024-09-20 12:51:54 +02:00
Simon Ser
6f2ce4766f 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
(cherry picked from commit 52dce29e06)
2024-08-23 13:42:57 -04:00
Simon Ser
f43ac6cf9c 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
(cherry picked from commit d2a5dbe104)
2024-08-23 09:30:33 -04:00
Kirill Primak
0a4cd88637 scene: resize damage ring on geometry update
(cherry picked from commit cf93d31736)
2024-08-23 09:30:19 -04:00
Kirill Primak
b79fc11df8 scene: update output geom on commit after dropping pending damage
Otherwise the whole output damage gets ignored.

(cherry picked from commit 62cc96b3a4)
2024-08-23 09:30:07 -04:00
Dudemanguy
1f96bcc1db 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.

(cherry picked from commit 3d2f09bace)
2024-08-23 09:29:52 -04:00
zhoulei
0992422493 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>
(cherry picked from commit 2c64f36e88)
2024-08-23 09:29:38 -04:00
Leonardo Hernández Hernández
4900daa787 linux-drm-syncobj-v1: actually use the requested version
(cherry picked from commit baaec88e2f)
2024-08-23 09:29:27 -04:00
Alexander Orzechowski
72a290ba01 wlr_scene: Fix WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT when output is transformed
(cherry picked from commit 4f1104654f)
2024-08-15 11:27:42 -04:00
Alexander Orzechowski
055c0d28d1 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
(cherry picked from commit 14e1987f50)
2024-08-15 11:27:36 -04:00
Alexander Orzechowski
a4cafc1ef5 wlr_scene: Inline output_state_apply_damage
(cherry picked from commit 3e1358fec9)
2024-08-15 11:27:28 -04:00
Alexander Orzechowski
f9de859194 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.

(cherry picked from commit 147c5c37e3)
2024-08-15 11:27:21 -04:00
Alexander Orzechowski
43388cd277 wlr_scene: Funnel all damage operations through scene_output_damage
We want to add logic to this function later

(cherry picked from commit 78dfa4f06d)
2024-08-15 11:27:12 -04:00
Isaac Freund
89e1ea130d backend/drm: don't set vsync present flag if page flip was async
(cherry picked from commit 08495d2596)
2024-08-15 11:13:05 -04:00
Kirill Primak
b4bec0cd3a 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.

(cherry picked from commit 3103ea3af9)
2024-08-15 11:06:50 -04:00
Kirill Primak
7df7b0e092 linux-drm-syncobj: add missing decls in the header
(cherry picked from commit ee21deb458)
2024-08-15 11:06:02 -04:00
Kirill Primak
a095120b7d pointer-constraints: don't init/finish current/pending states
wlr_surface_synced does it automatically.

Reported-by: llyyr <llyyr.public@gmail.com>
(cherry picked from commit 70c99460ca)
2024-08-15 11:05:44 -04:00
Kirill Primak
9e107e3c77 xdg-popup: don't set a role resource destroy handler
wlr_xdg_surface tracks role resource destruction itself.

(cherry picked from commit c52e01e85f)
2024-08-15 11:05:32 -04:00
Consolatis
490769f2a6 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.

(cherry picked from commit adf9d8b0be)
2024-08-15 11:05:20 -04:00
project-repo
2b8f94cf09 Fix memory leak in xwayland.c
(cherry picked from commit e209fe2d05)
2024-08-12 10:08:27 -04:00
project-repo
52834f29ad Fix memory leak in drm.c
(cherry picked from commit 3cae2a2c01)
2024-08-12 10:08:20 -04:00
Alexander Orzechowski
03f06207f0 wlr_scene: Force blend mode to PREMULTIPLIED if calculate visibility is disabled
We do it here so WLR_SCENE_HIGHLIGHT_TRANSPARENT_REGION doesn't break

(cherry picked from commit 4481c6b243)
2024-08-06 08:09:40 -04:00
Kirill Primak
81a08aeeb0 output-power-management: send zwlr_output_power_v1.failed on output destroy
From the event description:

This event indicates that the output power management mode control is no
longer valid. This can happen for a number of reasons, including:
<...>
- The output disappeared

(cherry picked from commit de574ac098)
2024-08-06 08:09:28 -04:00
chenyongxing
6cc80472cb render/vulkan: Fix draw rect clip region invalid in blend none mod
(cherry picked from commit 015bb8512e)
2024-08-06 08:09:15 -04:00
Isaac Freund
2005cc0fd6 docs: update comments for wlr_output API changes
The old wlr_output_{commit,test}() functions are still mentioned in
multiple places.

(cherry picked from commit 7550e483ae)
2024-07-15 09:58:22 -04:00
Isaac Freund
7d0f337a35 wlr_output: remove dead function
(cherry picked from commit 2a8a23c467)
2024-07-15 09:58:22 -04:00
Bill Li
4534421279 ci: use package x11-servers/xwayland instead of x11-servers/xwayland-devel
(cherry picked from commit 22adc65586)
2024-07-15 09:58:22 -04:00
Simon Ser
4666996b2a build: bump version to 0.18.0 2024-07-12 23:39:50 +02:00
Simon Ser
e34cc23549 scene: only skip bottom-most black rects with fractional scaling
We were relying on the fact that we wouldn't paint anything on top
of the black background in the region of a black rect. However
when fractional scaling is used the repaint region might get
expanded to nearby pixels by scale_output_damage(). As a result
the neighbour scene nodes might leak into the skipped black rect's
region.

Avoid this by using this optimization for bottom-most black rects
only when fractional scaling is used.

References: https://github.com/swaywm/sway/issues/8233
2024-07-11 21:03:27 +02:00
Simon Ser
f057239b6a ci: use tinywl built by Meson
This removes the need for repeating and keeping in sync build
options for Meson and make invocations.
2024-07-11 02:54:26 +00:00
Simon Ser
a35b4f059d backend/drm: add support for SIZE_HINTS property
This property allows the driver to advertise support for multiple
cursor sizes. On Intel, using a smaller buffer size reduces power
consumption.

References: https://lore.kernel.org/dri-devel/20240227193523.5601-2-ville.syrjala@linux.intel.com/
2024-07-10 22:42:44 +00:00
Simon Ser
6f63f55ace build: use auto_features=disabled for libdrm subproject
Instead of individually disabling each driver, use
auto_features=disabled to disable all feature options by default.
2024-07-10 17:47:12 +00:00
Simon Ser
59138460c4 render: init wl_shm version 2 2024-07-07 18:52:24 +02:00
Simon Ser
0028e0638f backend/wayland: use wl_shm.release if available 2024-07-07 18:16:48 +02:00
Simon Ser
22dab77d28 shm: add support for wl_shm version 2
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/335
2024-07-07 18:16:45 +02:00
Kirill Primak
9646742502 meson: bump wayland dep version to 1.23
libwayland 1.23 includes a wl_event_loop destroy signal fix which our
backends depend on to shut down correctly.
2024-07-05 17:29:05 +03:00
Simon Ser
0a79bc28c7 build: require libinput v1.19
This version has been published back in 2021.
2024-07-04 22:51:07 +02:00
Alexander Orzechowski
ee24201e26 wlr_scene: Don't disable scene nodes at creation time 2024-07-04 14:35:52 -04:00
Alexander Orzechowski
a9375d6bac wlr_scene: Drop map/unmap listeners from layer_shell_v1
Redundant.
2024-07-04 14:10:33 -04:00
Alexander Orzechowski
48b9b7d406 wlr_scene: Drop map/unmap listeners from drag_icon
Redundant.
2024-07-04 14:09:47 -04:00
Alexander Orzechowski
24a9f88873 wlr_scene: Drop map/unmap listeners from xdg_shell
subsurface_tree will handle it. This was redundant.
2024-07-04 14:08:24 -04:00
Kirill Primak
67b88e46b0 Fix __VA_OPT__ macro invocations 2024-06-30 09:01:15 +03:00
Alexander Orzechowski
65e6579c56 wlr_scene: send preferred buffer transform 2024-06-28 13:44:35 -04:00
Simon Ser
85875c47d9 build: build with C23 if supported
This lets us conditionally leverage C23 features.

Force one build to C11 in CI to make sure we stay C11-compatible.
2024-06-27 18:13:05 +00:00
Simon Ser
3880ee15d7 Use standard __VA_OPT__ instead of GNU's ##__VA_ARGS__
C23 has standardized a way to write variadic macros that accept
zero arguments:
https://open-std.org/JTC1/SC22/WG14/www/docs/n3033.htm

Use that instead of the GNU extension when available.
2024-06-27 18:13:05 +00:00
Simon Ser
315e022f2f backend/drm: fix swapped calloc() arguments in get_or_create_layer()
../backend/drm/drm.c:415:49: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
      415 |         layer->candidate_planes = calloc(sizeof(bool), drm->num_planes);
          |                                                 ^~~~
2024-06-27 18:13:05 +00:00
Simon Ser
29cb151987 backend/drm: fix return value type in create_drm_connector()
../backend/drm/drm.c:1435:24: error: incompatible types when returning type ‘_Bool’ but ‘struct wlr_drm_connector *’ was expected
     1435 |                 return false;
          |                        ^~~~~
2024-06-27 18:13:05 +00:00
Simon Ser
a75c6cca54 render/color: fix return value type
../render/color_lcms2.c: In function ‘wlr_color_transform_init_linear_to_icc’:
    ../render/color_lcms2.c:26:24: error: incompatible types when returning type ‘_Bool’ but ‘struct wlr_color_transform *’ was expected
       26 |                 return false;
          |                        ^~~~~
2024-06-27 18:13:05 +00:00
Simon Ser
fe429b2463 Switch to stable tablet-v2 protocol
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/284
2024-06-27 18:04:00 +00:00
Simon Ser
099350a414 build: check eglext.h header version
We use EGL_EXT_device_drm_render_node, which has been introduced
here:
53f038f6fd
2024-06-27 17:54:57 +00:00