Commit graph

6928 commits

Author SHA1 Message Date
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
Simon Ser
b0bd86285f backend/drm: leave CRTCs on when shutting down
This avoids a black screen during multiple seconds on shutdown.
To fully allow for flicker-free transitions between DRM masters,
we will also need [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4394

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3497
2023-11-15 01:37:59 +00:00
Simon Ser
4932e0d347 backend/drm: ensure plane surfaces are cleaned up on shutdown
Right now this is done "by chance" because we disable all CRTCs
on shutdown. However, we'll stop doing this. Plus, if disabling
a CRTC fails, we don't cleanup properly.
2023-11-15 01:37:59 +00:00
Kirill Primak
86b2cac921 Add missing type declarations in headers 2023-11-14 18:44:53 +00:00
Alexander Orzechowski
3d3cca9164 wlr_scene: Introduce wlr_scene_subsurface_tree_set_clip 2023-11-14 17:27:08 +00:00
Alexander Orzechowski
d1ddd4ca3a wlr_scene_surface: Introduce scene_surface_set_clip 2023-11-14 17:27:08 +00:00
Alexander Orzechowski
c6d356648c set_buffer_with_surface_state: Take whole surface struct 2023-11-14 17:27:08 +00:00
Alexander Orzechowski
1c0b10b61a wlr_scene_subsurface_tree: Addon to scene
We will need this later so that we can determine the subsurface tree
that owns any given scene node.
2023-11-14 17:27:08 +00:00
Alexander Orzechowski
33b437d574 wlr_scene: Amend scene_buffer.point_accepts_input to take coordinate pointers
The pointers mean that we can mutate them. This will be useful later
so we can hide details from the compositor when we clip subsurface trees.
2023-11-14 17:27:08 +00:00
Kirill Primak
6cf0bb4b19 tinywl: don't use "I"/"my" in docs 2023-11-14 19:46:04 +03:00
Kirill Primak
73a387d3b6 tinywl: fix xdg_toplevel_destroy() docs 2023-11-14 19:40:26 +03:00
Simon Ser
73ab5246ea tinywl: stop using the word "view" to refer to toplevels
"View" has been cargo-culted from Weston. In Weston, a view is not
even necessarily a toplevel -- it's just a way to draw an arbitrary
somewhere (a surface may be painted at multiple locations
simultaneously). The Weston concept has been misunderstood and then
was carried over to rootston, Sway, and tinywl.

Let's just use the official Wayland wording instead.
2023-11-14 17:31:35 +01:00
Simon Ser
9e5d0f95f8 tinywl: fix crash when previously focused surface is not a toplevel
It can be e.g. a popup.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3754
2023-11-13 10:32:03 +01:00
Simon Ser
319e4125ab xdg-shell: add wlr_xdg_{toplevel,popup}_try_from_wlr_surface()
Convenience helpers for compositors. Saves them the trouble of
manually checking the role (and if they forget to do so, prevents
an invalid cast).
2023-11-13 10:31:00 +01:00
Väinö Mäkelä
5de9e1a99d wlr-output-management: Send custom modes to clients
Since commit 5567aefb, fixed modes haven't been automatically generated
for custom modes, so the output management implementation needs to be
able to handle them directly. To avoid polluting the mode list, only a
single custom mode can be listed at a time and will be removed when a
fixed mode is set.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3744
2023-11-06 17:46:55 +00:00
Simon Ser
26eac25d7f ci: halt on UBSan error in smoke test
By default UBSan prints a message and carries on, which makes it
easy to miss errors.
2023-11-02 11:01:08 +01:00
Simon Ser
dbedcdb418 xcursor: add fallbacks for legacy names
Some XCursor themes still use the legacy names instead of the newer
cursor naming spec [1]. Fall back to the legacy name if the standard
one could not be found.

[1]: https://www.freedesktop.org/wiki/Specifications/cursor-spec/

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3746
2023-11-01 13:13:22 +00:00
JiDe Zhang
8ebfeffdc8 Remove unnecessary code
Not needs set GL_DEPTH_TEST, Because when rendering to a framebuffer
that has no depth buffer, depth testing always behaves as though
the test is disabled, The initial value for each capability with
the exception of GL_DITHER is GL_FALSE.
2023-10-31 15:59:38 +00:00
Simon Ser
22df8d3847 cursor: log missing XCursor
Log a debug message when the XCursor theme is missing a cursor.
Eases debugging.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3746
2023-10-31 13:37:00 +00:00
sunzhguy
dbf20b0ad3 wlr_cursor: update cursor when output enable and transform changed
Signed-off-by: zhoulei <zhoulei@kylinos.cn>
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
2023-10-31 01:29:02 -04:00
Simon Ser
1c24b1182b backend: drop wlr_backend_get_presentation_clock()
We can just assume CLOCK_MONOTONIC everywhere.

Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
2023-10-30 18:39:39 +01:00
Kirill Primak
5fac9b1beb xdg-toplevel: don't send maximized if tiled is requested but not supported
This is a bit too magical and may break compositors which try not to
send duplicate configure events.
2023-10-29 15:51:12 +00:00
John Lindgren
af165acb42 xwayland: add wlr_xwayland_set_workareas()
This function allows compositors to set the _NET_WORKAREA property on
the root window. XWayland clients use _NET_WORKAREA to determine how
much of the screen is not covered by panels/docks. The property is used
for example by Qt to determine areas of the screen that popup menus
should not overlap (see QScreen::availableVirtualGeometry).
2023-10-26 15:05:08 -04:00
Simon Ser
2410710a0f util/token: add docs 2023-10-26 16:30:12 +00:00
Simon Ser
55be74ad86 util/token: rename TOKEN_STRLEN to TOKEN_SIZE
TOKEN_STRLEN is not actually the strlen() of the token. It's the
size taken by the token included the final zero byte.

Change the name to make this clearer, and remove unnecessary +1's.
2023-10-26 16:30:12 +00:00
eri
3232697252 render/vulkan: use VK_KHR_global_priority
References: #3386
2023-10-26 16:17:57 +00:00
Kirill Primak
d253d70786 xdg-shell: use wlr_surface.unmap_commit 2023-10-26 19:06:40 +03:00
Simon Zeni
1c2f608331 render/vulkan: remove unused queue_props in renderer 2023-10-26 15:12:58 +00:00
Kirill Primak
d8515b3446 layer-shell: track surface init state 2023-10-26 14:57:10 +00:00
Kirill Primak
f750c7445d layer-shell: don't use wlr_surface_role.unmap hook
A layer-shell surface can be unmapped if wlr_layer_shell_v1 is
destroyed or the client has committed a NULL buffer. Let's use the
previously introduced wlr_surface.unmap_commit to handle the latter
case instead; this is more consistent with the xdg_surface
implementation logic, where using the hook is more trouble than it's
worth.

Additionally, this commit adds an unconditional surface reset on
destroy, so popups are properly cleaned up even if originally created
with an unmapped layer-shell surface as a parent. Doing so with the
role unmap hook would either result in possibly resetting the surface
twice, which is suboptimal, or having an awkward
`if (mapped) { unmap() } else { reset() }` check.
2023-10-26 14:57:10 +00:00
Kirill Primak
4d2e310122 compositor: add wlr_surface.unmap_commit
This flag can be used to figure out whether a particular commit has
unmapped the surface. Private state for now in case we find a better
way to track this.
2023-10-26 14:57:10 +00:00
Kirill Primak
e1c2671725 layer-shell: check the configured flag earlier 2023-10-26 14:57:10 +00:00
Simon Ser
ffa8e3ec81 examples: drop dead client code
Client examples have been moved to another repo, but it seems I
forgot to delete some files.

Fixes: 0bb445eeff ("examples: split clients in separate repository")
2023-10-25 17:53:43 +02:00
Brett Ernst
47bf87ade2 renderer/vulkan: don't add two alphas together in blend func 2023-10-21 17:25:46 +00:00
eri
bfc42e0f62
linux_dmabuf_v1: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:42 +02:00
eri
c46d3da976
drm: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:38 +02:00
eri
8ccbe45143
buffer: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:27 +02:00
Simon Ser
5adf325333 render/vulkan: undo alpha premult before sRGB encoding/decoding
sRGB encoding/decoding needs to happen with straight alpha, not
pre-multiplied alpha.
2023-10-17 17:28:56 +02:00
JiDe Zhang
b560f36207 Fix output layers order error on wayland backend 2023-10-16 11:14:44 +00:00
John Lindgren
6114dd6a83 xwayland: stop translating _NET_WM_STRUT_PARTIAL coordinates
Translating the right/bottom coordinates from offsets to absolute
coordinates in wlroots (rather than in the compositor) was supposed to
be more reliable, since wlroots had access to the X11 screen size.

It ended up being less reliable, because the screen size values
(xwm->screen->width_in_pixels/height_in_pixels) are not updated when the
output layout changes.

So let's remove the translation from wlroots, and let the compositor
figure it out. From what I can understand of the current XWayland code,
the X11 screen size should generally match the overall wlr_output_layout
bounding box, which the compositor has access to.
2023-10-14 21:27:34 -04:00
Simon Ser
0bb445eeff examples: split clients in separate repository
The client examples are useful to try out protocols, however they
don't need to live in the wlroots repository. Having both clients
and compositors in the same place is confusing. The wlroots API
changes often but protocols are set in stone.
2023-10-12 18:00:52 +00:00
Simon Ser
b82a53a918 Revert "backend/drm: Automatic non-blocking commits"
This reverts commit 45ba35719e.

Sadly, this causes regressions on amdgpu [1] and even with these
fixed, there are fundamental issues with non-blocking modesets [2].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3745
[2]: https://oftc.irclog.whitequark.org/dri-devel/2023-10-11#1697031838-1697036920;
2023-10-12 16:31:33 +00:00
Simon Ser
ecc7f01705 build: rename libdrm partial dep to be more explicit
The variable is named "libdrm" but it's a partial dependency with
just the headers. Reflect this in the name to avoid confusion (Meson
variables are global to the whole project).
2023-10-12 18:29:48 +02:00
Kirill Primak
0de3659698 Drop wl_client and user data assertions in bind handlers
A client can never be NULL and user data assertions aren't really
useful there.
2023-10-10 20:10:00 +03:00