Commit graph

6759 commits

Author SHA1 Message Date
Simon Ser
a2d2c38a31 build: bump version to 0.17.4 2024-06-27 20:25:08 +02:00
Kirill Primak
644f9a2d73 backend/wayland: destroy ignored tablet proxies
This fixes a memory leak when there are multiple tablets.

(cherry picked from commit 55bee71a53)
2024-06-21 09:02:10 -04:00
Kirill Primak
0dc1e0ed2a input-method: unmap popup surfaces on deactivate
Fixes 743da5c0ae

(cherry picked from commit f464213447)
2024-06-11 09:34:22 -04:00
Kirill Primak
388af6a62b xdg-popup: validate positioner on reposition request
(cherry picked from commit 1e58e4006d)
2024-06-11 09:34:05 -04:00
Kirill Primak
9915b1c3ee xdg-popup: don't emit parent's new_popup signal too early
(cherry picked from commit e7deea44fd)
2024-06-11 09:27:38 -04:00
Kirill Primak
d4e1c4d915 backend/x11: send correct keyboard layout
(cherry picked from commit 08c64c166f)
2024-06-11 09:24:21 -04:00
Isaac Freund
ea7083784b wlr_surface: update get_root_surface() docs
Since destroying a wlr_surface now makes all subsurfaces inert, this
function can no longer fail and return NULL. Document this.

(cherry picked from commit 6219d7b819)
2024-06-11 13:21:05 +00:00
nerdopolis
8fe2dd82b1 backend/libinput: Fix call of handle_libinput_readable() when WLR_LIBINPUT_NO_DEVICES is set
(cherry picked from commit 35c3194ae5)
2024-06-11 13:21:05 +00:00
JiDe Zhang
d4ff45ec8d output: reset hardware_cursor on failure
The DRM backend's set_cursor function always return true if the
buffer is NULL. If using a NULL cursor's buffer on startup, the
wlr_output_cursor will be marked as a hardware cursor. If the
cursor later gains a non-NULL buffer and the DRM backend rejects
that buffer, the cursor will remain marked as a hardware cursor,
despite the backend not displaying it as such. As a result, the
cursor will not be displayed at all. Fix this by always resetting
the hardware_cursor field in output_cursor_attempt_hardware().

(cherry picked from commit 36c0d5fe3a)
2024-06-11 13:21:05 +00:00
Simon Ser
60885c639b render/vulkan: don't use UNDEFINED layout for imported DMA-BUFs
UNDEFINED when used as source layout means that the contents of
the underlying memory becomes undefined. This isn't what we want
here: we don't want to mutate the imported pixel data.

The Vulkan spec isn't really clear what the proper value should be
here, but after discussing with driver developers [1] it seems like
UNDEFINED isn't the right one. The recommendation is to use GENERAL
instead.

[1]: https://github.com/ValveSoftware/gamescope/issues/356

(cherry picked from commit 2c4d3ad12d)
2024-06-11 13:21:05 +00:00
Kirill Primak
e8cf5b1c2a render/vulkan: free render format setups on destroy
(cherry picked from commit 073c3e8837)
2024-06-11 13:21:05 +00:00
Kirill Primak
cdc63d9983 render/vulkan: free pipeline layouts on destroy
(cherry picked from commit e20ae113f8)
2024-06-11 13:21:05 +00:00
Kirill Primak
a198549ef5 render/vulkan: fix texture clip region leak
(cherry picked from commit 00bc75439f)
2024-06-11 13:21:05 +00:00
Kirill Primak
9fa8867c16 output: disable hardware cursor when falling back to software
(cherry picked from commit 510664e79b)
2024-06-11 13:21:05 +00:00
Kirill Primak
13a2020334 output: extract hardware cursor disabling logic
(cherry picked from commit f534434be6)
2024-06-11 13:21:05 +00:00
Kirill Primak
a1b3be49c5 xdg-toplevel: allow edge_none for resizing
(cherry picked from commit 9c50cd71b6)
2024-06-11 13:21:05 +00:00
groveer
136c1b281a wlr_pointer_gestures_v1: emit destroy signal in destroy function
(cherry picked from commit 293b0aa502)
2024-06-11 13:21:05 +00:00
groveer
8c0d194539 wlr_pointer_gestures_v1: init destroy signal
(cherry picked from commit dead0ebcc8)
2024-06-11 13:21:05 +00:00
Kirill Primak
9d6b95a5a8 scene: fix double scaling of opaque region for blend mode optimization
(cherry picked from commit 8fdf9dc4f0)
2024-06-11 13:21:05 +00:00
David Turner
e722e0a14d render/pixman: Fix non-uniform scale with rotation
e08d52bb introduced a bug when rotating by 90 or 270 degrees and doing
non-uniform scaling (different scale factor on X and Y axes).  The scale
factor was calculated as the ratio between the src box and the rotated
dst box.  But scaling is applied after rotation, so the scale factor
should instead be the ratio between rotated src box and dst box.

(cherry picked from commit 34201b0e7f)
2024-06-11 13:13:09 +00:00
David Turner
21cc647816 render/pixman: Improve transform performance
The old code to render transformed textures with pixman would run
composite over the whole output regardless of the texture size.  When
rendering something small this caused a huge performance hit.

Rewrite the transform branch of render_pass_add_texture to:
- Only composite over the rectangle we're drawing to
- Generally try to make things a lot clearer and some comments

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3832

(cherry picked from commit e08d52bbc6)
2024-06-11 13:13:09 +00:00
Simon Ser
1bfd0613ca backend/drm: add support for libliftoff v0.5.0
Don't require libliftoff 0.5.0 just yet: we want to be able to
backport this patch.

(cherry-picked from commit 6e6c4408d3)
2024-05-31 14:58:00 +02:00
Simon Ser
bc73e507ab build: bump version to 0.17.3 2024-04-26 20:32:52 +02:00
Alexander Orzechowski
365b3d271a wlr_scene: Schedule new frame for WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT in output commit handler
We were doing it too early before and the output would disregard a
scheduled frame if called when we were first putting together the output
state

(cherry picked from commit 1dc44a1afe)
2024-04-26 13:44:29 -04:00
David Turner
18b290de21 render/pixman: Fix source crop
Fix source crop in the pixman render backend.  It was being applied by
using a source offset as arguments to pixman_image_composite32().  But
this is wrong because the source crop should get applied before all the
other transforms, not after them (or at least this is how it works in
the other wlroots render backends).  Instead, apply the source crop as
yet another matrix transform when we're doing transforms (Or keep it the
same as previously if there's no other transforming going on).

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3830
(cherry picked from commit ee0007c0f2)
2024-04-26 13:19:22 -04:00
David Turner
e3e84ab87a render/pixman: fix flipped transforms
The translations for flipped offsets were set the same as non-flipped
ones which was totally wrong and meant that any textures with
flipped-transforms rendered entirely outside the viewport and were
basically invisible.

(cherry picked from commit 061b996768)
2024-04-26 13:19:08 -04:00
Isaac Freund
545a294532 scene: ensure layer surface usable area >0
Clients may, for example, commit an exclusive zone larger than the
output dimensions. Compositors must handle this gracefully, which likely
requires more work on the compositor side but returning a usable area
with negative width or height in wlr_scene_layer_surface_v1_configure()
is nonsensical.

(cherry picked from commit cb01c63a8d)
2024-04-22 10:35:28 -04:00
Ilia Bozhinov
59f026465e xwayland: add a size-safe wrapper for xcb_send_event
xcb_send_event expects the caller to always provide 32 byte data, even if the actual event struct is
smaller than that.

Reference: https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/18
(cherry picked from commit c63275d75e)
2024-04-22 10:34:56 -04:00
Biswapriyo Nath
e2cbbf0b4a render/vulkan: Fix clang compiler error in 32 bit ARM Android
This adds proper calling convention attribute for callbacks used in vulkan
and fixes the following compiler error.

../src/render/vulkan/vulkan.c:175:22: error: incompatible function pointer types
initializing 'PFN_vkDebugUtilsMessengerCallbackEXT' (aka 'unsigned int (*)
(enum VkDebugUtilsMessageSeverityFlagBitsEXT, unsigned int, const struct
VkDebugUtilsMessengerCallbackDataEXT *, void *) __attribute__((pcs("aapcs-vfp")))')
with an expression of type 'VkBool32 (*)(VkDebugUtilsMessageSeverityFlagBitsEXT,
VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *, void *)'
(aka 'unsigned int (*)(enum VkDebugUtilsMessageSeverityFlagBitsEXT, unsigned int,
const struct VkDebugUtilsMessengerCallbackDataEXT *, void *)')
[-Wincompatible-function-pointer-types]
    .pfnUserCallback = &debug_callback,
                       ^~~~~~~~~~~~~~~

(cherry picked from commit dd2061b073)
2024-04-12 09:34:55 -04:00
Chloé Vulquin
f79d68491e xcursor: catch theme inheritance loops
As of currently, when an xcursor theme depends on itself or another theme
that will eventually depend on it, `xcursor_load_theme` will recurse
infinitely while processing the inherits.

This change introduces a stack-allocated linked list of visited nodes
by name, and skips any already visited nodes in the inherit list.

Side effects:
* Since the linked list is stack-allocated, there is a potential for an
  overflow if there is a very long list of dependencies. If this turns out
  to be a legitimate concern, the linked list is trivial to convert to
  being heap-allocated.
* There is an existing linked list (technically doubly linked list)
  implementation in the wayland codebase. As of currently, the xcursor
  codebase does not refer to it. Consequently, this change writes a
  minimal single linked list implementation to utilize directly.

This changeset is based on the merge request in wayland/wayland!376.
The xcursor code is mostly shared between the two.
This changeset diverges the files slightly due to stylistic differences
between the repositories, but the logic is identical.

Signed-off-by: Chloé Vulquin <toast@bunkerlabs.net>
(cherry picked from commit 172c8add7d)
2024-04-12 09:34:55 -04:00
Kenny Levinsen
d5117961b4 render/vulkan: Avoid double-free on calloc error
In query_modifier_support, the calloc for either or both of render_mods
and texture_mods may fail, in which case both are freed for convenience.
However, if one is non-NULL, vulkan_format_props_finish will try to free
it again.

NULL them to avoid double-free.

(cherry picked from commit 4d68d3759b)
2024-04-12 09:34:55 -04:00
Kenny Levinsen
f6efdc2be1 wlr_gamma_control: Store gamma size when creating control
When a wlr_gamma_control client calls set_gamma, we allocate a LUT based
on the value returned from wlr_output_get_gamma_size at the time of the
call.

If the output is off and has no CRTC, such as if gamma changes in the
background while a display is disabled for idle reasons,
wlr_output_get_gamma_size returns 0. This leads to a zero-sized table,
which the drm backend interprets as a request to reset gamma tables to
their default.

Store the gamma size when the gamma control was created. Even if the
size changes, this is the size the client was sent and uses to create
the LUTs it sends.

(cherry picked from commit f0ce906b73)
2024-04-12 09:34:55 -04:00
John Lindgren
fb07101bb1 util: fix non-linear behavior of wlr_box_closest_point()
Per comments in util/box.h, the width and height of a wlr_box are
exclusive; that is, for a 100x100 box at (0,0), the point (99,99) is
inside it while the point (100,100) is outside it.

Thus mathematically, there exists no single closest point to the
bottom-right corner of the box while remaining inside it. You can
construct an infinite series approaching the limit, such as {(99,99),
(99.9,99.9), (99.99,99.99)...}, but since the intervals are half-open,
there is no "last" point.

wlr_box_closest_point() must therefore define an arbitrary "closest"
point. For points below and to the right of the box, the current
implementation returns (box.x + width - 1, box.y + height - 1). Let's
continue to do this.

However, the current implementation is non-linear: with the example
100x100 box, it will return an input point of (99.9,99.9) unchanged, but
for an input point (100.1,100.1) the returned point will jump back to
(99.0,99.0).

In practice, this non-linearity results in strange behaviors when
driving the mouse cursor to a screen corner. On a 1920x1080 display for
example, driving the cursor quickly to the bottom-left corner results in
a position of exactly (0,1079). Continuing to slowly nudge the cursor
downward results in the position jumping between (0,1079) and other,
fractional coordinates such as (0,1079.88).

The fractional coordinates expose some client/toolkit-side bugs (which,
to be clear, should be fixed on the client side), but IMHO the wlroots
behavior is also inconsistent and wrong -- when I drive the mouse cursor
into the corner of the screen, it should come to a stop at a fixed
position, not jitter around.

(cherry picked from commit 3fc66d4525)
2024-04-12 09:34:55 -04:00
Kirill Primak
0f040dfc38 viewporter: fix "has buffer" check
Previously, cases when a viewport source box was updated without attaching
a buffer weren't checked for correctness properly because the state's buffer
would be NULL. Use wlr_surface_state_has_buffer() instead.

(cherry picked from commit 072f6ed977)
2024-04-12 09:34:55 -04:00
Isaac Freund
19aaaff429 tablet_v2: destroy tablet seats on manager destroy
This fixes an invalid write in tablet_seat_destroy if the tablet manager
is destroyed before the wlr_seat.

(cherry picked from commit 5bef385ffc)
2024-04-12 09:34:55 -04:00
Guido Günther
d334507dc2 gles2: Avoid crash when glGetInteger64vEXT is missing
The spec for GL_EXT_disjoint_timer_query says

> The GetInteger64vEXT command is required only if OpenGL ES 3.0 or later
> is not supported.

Some GLES 3.2 implementations like the proprietary mali driver on the
rk3566 based OrangePi advertise GL_EXT_disjoint_timer_query but lack
glGetInteger64vEXT. Use glGetInteger64v instead.

(cherry picked from commit 341b3c8bd2)
2024-04-12 09:34:55 -04:00
John Lindgren
d98a3eb492 vulkan: perform sRGB-to-linear conversion correctly for premultiplied values
Pre-multipled sRGB values need to be un-multiplied before conversion
to linear and then re-multiplied after. Compare shaders/texture.frag.

This fixes an issue in labwc where titlebar corners (rendered as
ARGB textures) did not match the rest of the titlebar (rendered as
a solid wlr_scene_rect).
2024-04-07 02:06:04 -04:00
Simon Ser
6dce6ae2ed build: bump version to 0.17.2 2024-03-11 18:44:24 +01:00
Simon Ser
63e2f2e28f cursor-shape-v1: handle inert tablet tool client
If the tablet tool is inert, the wlr_tablet_tool_client_v2 can be
NULL.

(cherry picked from commit 31c842e5ec)
2024-03-04 13:09:14 -05:00
Simon Ser
af445f475a backend/drm: fix queued cursor FB overwritten with NULL
With the following sequence of events, the cursor FB fields could
end up being all set to NULL while the cursor is enabled:

1. set_cursor is called, conn->cursor_pending_fb is set to a FB
   pointer.
2. The output is committed with a buffer. crtc->cursor->queued_fb
   is set to the FB pointer, conn->cursor_pending_fb is reset to
   NULL. A page-flip event is expected in the future.
3. The output is committed with a modeset before the page-flip
   event is triggered. crtc->cursor->queued_fb is reset to NULL.

At this point all of crtc->cursor->current_fb,
crtc->cursor->queued_fb and conn->cursor_pending_fb are NULL which
is a bogus state when the cursor plane is enabled.

To avoid this issue, avoid overwriting crtc->cursor->queued_fb
with a NULL pointer on commit. The cursor logic still isn't great,
but let's keep a rework of that for a separate patch.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3734
(cherry picked from commit f5889319f7)
2024-03-03 20:41:23 -05:00
Simon Ser
72dfb6ae2c backend/drm: fix fb_damage_clips_arr memory leak
(cherry picked from commit 97a6a58a95)
2024-02-19 10:20:07 -05:00
Kirill Primak
c9909ac54c pointer-constraints: handle inert pointer resources correctly
(cherry picked from commit cb815e8847)
2024-02-06 21:01:37 -05:00
Kirill Primak
9a9540aa8c cursor: fix and simplify region mapping
Fixes: 4462f5dcb3
(cherry picked from commit 56cc25185d)
2024-02-01 09:44:15 -05:00
Kirill Primak
fc8fd786c0 backend/drm: use wlr_drm_backend.name for fd cloning
This also fixes a memleak.

(cherry picked from commit 92ff86db23)
2024-02-01 09:40:08 -05:00
Félix Poisot
e3760fb1b7 render/vulkan: correct sRBG gamma expansion in shader
(cherry picked from commit 5ae8ce807a)
2024-01-26 08:54:16 -05:00
Sarunas Valaskevicius
108be5ef47 Fix disappearing menus in QT apps
A motivating example of such problem - Zoom's popups that open on button presses.

Before this fix the popup would flicker and immediately disappear - because the PID is not yet
available for the verification (as the surface has not been associated yet), wlroots would refuse to
focus the popup and instead focus the previous window. This leads QT to interpret this as a sign to
close the popup.

This change moves the PID aqcuisition to an earlier phase - just where the window is created.

(cherry picked from commit 7c080c3b60)
2024-01-25 10:40:23 -05:00
Kirill Primak
945f777593 xwayland/xwm: associate even on xcb_get_property() failure
This matches the behavior before f5797be8a8.

(cherry picked from commit f91fc445ff)
2024-01-24 09:27:52 -05:00
Kirill Primak
82278edf3c layer-shell: forbid set_size with values ≥INT32_MAX
(cherry picked from commit be1c48cbfb)
2024-01-24 09:27:34 -05:00
Kirill Primak
2c48c3837e tinywl: depend on the server xdg-shell header
(cherry picked from commit ce89f49b7a)
2024-01-24 09:24:59 -05:00
MaxVerevkin
4414321897 fix outdated comment in wlr_output.h
(cherry picked from commit 48721bca65)
2024-01-24 09:24:45 -05:00