Commit graph

6721 commits

Author SHA1 Message Date
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
Simon Ser
f2ef71a83b backend/drm: save current refresh rate
wlr_output.refresh is populated by core wlr_output, and thus will
be zero for a custom mode with an unset refresh rate.

Save the refresh rate from the drmModeModeInfo in wlr_drm_connector
instead.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3791
(cherry picked from commit f81c3d93cd)
2024-01-24 09:24:31 -05:00
Sergei Trofimovich
d924d55fea backend: fix build against upcoming gcc-14 (-Werror=calloc-transposed-args)
`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
detected minor infelicity in `calloc()` API usage in `wlroots`:

    ../backend/libinput/tablet_pad.c: In function 'add_pad_group_from_libinput':
    ../backend/libinput/tablet_pad.c:36:38: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
       36 |         group->rings = calloc(sizeof(unsigned int), group->ring_count);
          |                                      ^~~~~~~~
    ../backend/libinput/tablet_pad.c:36:38: note: earlier argument should specify number of elements, later size of each element

(cherry picked from commit f3e1f7b2a7)
2024-01-24 09:24:20 -05:00
Simon Ser
3f2aced8c6 build: bump vesion to 0.17.1 2023-12-21 19:42:26 +01:00
Simon Ser
7824b31195 output-layout: fix missing global for outputs with a custom mode
Before we were populating wlr_output.current_mode with a generated
fixed mode when a custom mode was committed in the DRM backend. But
that's no longer the case: now a custom mode behaves the same under
the DRM backend and other backends.

wlr_output_layout was still assuming that an output without a
current_mode was disabled. Fix that assumption.

Fixes: 5567aefb1c ("backend/drm: Don't add pollute fixed modes list with custom modes")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3743
(cherry picked from commit 11e3c376e7)
2023-12-21 13:07:55 -05:00
pastel raschke
fc66ba68e3 input-method-v2: validate commit serial
(cherry picked from commit 3bf9000a52)
2023-12-18 10:22:00 -05:00
pastel raschke
9f1a31e7f3 input-method-v2: free current strings on commit
(cherry picked from commit 6ee5bd9eee)
2023-12-18 10:21:50 -05:00
Simon Ser
5c44678862 input-method-v2: drop unnecessary variable and cast
(cherry picked from commit 81f5607ad9)
2023-12-18 10:21:33 -05:00
Simon Ser
c55ab21899 xcursor: fix duplicate cursor check check in load_callback()
wlr_xcursor_theme_get_cursor() now does some fallback logic. We
don't want that for checking whether a cursor has already been
loaded.

Fixes: dbedcdb418 ("xcursor: add fallbacks for legacy names")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3783
(cherry picked from commit d6998d36ed)
2023-12-12 14:48:25 -05:00
Simon Ser
0e2bfd0329 cursor: fix initial cursor position for new outputs
The fresh new wlr_output_cursor is positioned at (0, 0).

Call wlr_output_cursor_move() after creating the wlr_output_cursor
to fix this.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3777
(cherry picked from commit 7ef62cc995)
2023-12-12 14:42:53 -05:00
Simon Ser
a577308276 cursor: send surface scale events
wlr_cursor is responsible for sending enter/leave events, but
doesn't send fractional-scale-v1 and wl_surface.preferred_buffer_scale
events. This is not an easy thing to do from a compositor, so let's
just do it in wlr_cursor itself.

(cherry picked from commit 78836298ef)
2023-12-04 10:53:41 -05:00
Simon Ser
bb8bcb354e render: disable linux-dmabuf without DRM FD
linux-dmabuf used to not need a DRM FD, however since v4 a DRM FD
is required for the main_device event.

(cherry picked from commit 4ed8df9ab2)
2023-12-04 10:53:32 -05:00
Simon Ser
fcf62ba709 render/egl: fallback to GBM FD if EGLDevice is not available
It's possible that we don't have an EGLDevice if we created the
EGL context from a GBM device. Let's ensure all GPU-accelerated
renderers always have a DRM FD to return by falling back to GBM's
FD.

(cherry picked from commit 395a08f5d1)
2023-12-01 09:55:55 -05:00
Simon Zeni
6d13d1814e types/output: emit destroy event before destroying global
(cherry picked from commit 5d639394f3)
2023-12-01 09:53:01 -05:00
Simon Ser
b05fef20ff viewporter: fix src buffer bounds check
The surface scale and transform are applied before the viewport.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3766
(cherry picked from commit 4fbe648faf)
2023-11-28 12:28:08 -05:00
Simon Ser
f070bab7db viewporter: listen to client_commit
The commit event fires too late: we're interested in checking the
values at wl_surface.commit time, not after.

(cherry picked from commit 7dcb045176)
2023-11-28 10:36:27 -05:00
Simon Ser
8f6625945e viewporter: rename state var in viewport_handle_surface_commit()
"current" is misleading, since we are using the pending state here.

(cherry picked from commit d1c88a22a3)
2023-11-28 10:36:22 -05:00
Kirill Primak
3ada3efe4f backend/x11: check buffer format in output_test()
(cherry picked from commit 4102b722d9)
2023-11-28 10:36:10 -05:00
Kirill Primak
b909cc71cd backend/x11: don't send ConfigureRequest with the same size
Under X11, ConfigureNotify means that the window has already been resized.
Sending ConfigureRequest with the received size is not only useless, but also
can confuse the window manager, which will probably reply with the current
(i.e. *old*) size causing a configure loop.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3769
(cherry picked from commit 4990ed99eb)
2023-11-28 10:36:03 -05:00
Simon Ser
fe53ec6937 tinywl: fix wlroots dependency constraint in Makefile 2023-11-21 17:22:02 +01:00
Simon Ser
767eedd3cb build: bump version to 0.17.0 2023-11-21 17:06:13 +01:00
Manuel Stoeckl
dbe7fb7027 render/vulkan: undo alpha premult for 8-bpc ARGB/ABGR
When a texel from the Vulkan format VK_FORMAT_B8G8R8A8_SRGB is read,
the sRGB to linear conversion is applied independently to the R, G,
and B channels; the A channel has no influence on this. However,
DRM_FORMAT_ARGB8888 buffers are, per Wayland protocol, not encoded
in this fashion; one must first unpremultiply the color channels
before doing sRGB to linear conversion. This commit switches to
handling ARGB8888 and ABGR8888 formats using the general fragment
shader conversion from electrical to optical values.
2023-11-21 11:08:55 +00:00
Simon Ser
fe6a432299 linux-dmabuf-v1: skip import check on split render/display SoCs
Unfortunately we have no way to get back the proper render node in
that case. This will be fixed with [1]: with that Mesa patch, the
wlr_renderer will return the proper render node and the existing
logic will work fine.

[1]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24825

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3757
2023-11-20 19:54:16 +01:00
Alexander Orzechowski
515681503e screencopy: Use box size instead for shm copy
This doesn't change functionality, both the values are the same. Less
confusing to use the box size.
2023-11-20 11:33:11 -05:00
Alexander Orzechowski
7a22030071 screencopy: Move frame bounds sanity check into common code 2023-11-20 11:33:11 -05:00
Alexander Orzechowski
c8861a2865 screencopy: Define proper destination for dmabuf copy
Leaving this empty would have it filled in with the size of the source
texture, but we want the destination size.

Fixes: #3758
2023-11-20 11:33:10 -05:00
Simon Ser
bd18d5ccfc backend/drm: drop unnecessary flags in legacy interface
drm_crtc_commit() already ensures that atomic-only flags are
disallowed.
2023-11-19 15:32:30 +01:00
Simon Ser
8c44e86077 backend/drm: add wlr_drm_connector_state.nonblock
Instead of having this condition checked in multiple places,
centralize it so that they don't go out-of-sync.
2023-11-19 15:32:30 +01:00
Simon Ser
f47b6e3fce backend/drm: fix pending page-flip check
This chunk of code was moved by mistake.

Fixes: 3b53d1cbf1 ("backend/drm: introduce page-flip tracking struct")
2023-11-19 15:14:22 +01:00
Kirill Primak
c6b498528c xcursor: don't store NULL xcursors 2023-11-19 15:33:39 +03:00
Kirill Primak
e16b0068a7 xcursor: fix NULL deref on malloc() fail 2023-11-19 15:33:39 +03:00
Alexander Orzechowski
b06d58fa8b backend/drm: Destroy page flips on backend destroy
When we destroy the backend, page flips will no longer be invoked meaning
those won't clean up the page flips for us.
2023-11-17 14:34:32 -05:00
Alexander Orzechowski
3aed24b8d4 backend/drm: Track page flips in list 2023-11-17 13:49:18 -05:00
Simon Ser
3b53d1cbf1 backend/drm: introduce page-flip tracking struct
Introduce a per-page-flip tracking struct passed to the kernel
when we request a page-flip event for an atomic commit. The kernel
will pass us back this pointer when delivering the event.

This eliminates any risk of mixing up events together. In particular,
if two events are pending, or if the CRTC of a connector is swapped,
we no longer blow up in the page-flip event handler.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3753
2023-11-17 16:59:04 +00:00
sunzhguy
c9c9dd6a5b backend/drm: free fb later
since 4932e0d347f("backend/drm: ensure plane surfaces are cleaned up on shutdown")
at finish_drm_resources called drm_plane_finsh_surface has already free the fb

Signed-off-by: zhoulei zhoulei@kylinos.cn
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
2023-11-17 12:38:21 +08:00
mfk530
92dabc3a01 xwayland: fix user_event_handler
Don't break and free event as the commont says:
wlr-xwayland will free the event.
2023-11-17 02:33:18 +00:00
Alexander Orzechowski
303f23d7dd wlr_scene: Update outputs if subpixel status changes
This is important for buffers that are meant to render any sort of
text.
2023-11-15 18:42:12 -05:00
Alexander Orzechowski
50446fe75e wlr_scene: Update outputs when primary output is changed
Helpers care about the primary output. They need to know when it changes
even if intersection status has not changed necessarily.
2023-11-15 18:42:12 -05:00
Alexander Orzechowski
889c5ed5ff wlr_scene: Update outputs when output scale/transform changes
We want to call the outputs updated signal when an output scale or transform
changes. Otherwise helpers like the scene surface helpers will not be
notified of scale changes and not pass them to clients.
2023-11-15 18:38:12 -05:00