Commit graph

2856 commits

Author SHA1 Message Date
Simon Ser
bda1b41ee2 output-swapchain-manager: new helper
This new helper assists compositors in allocating buffers for
modesets. It degrades to different allocation parameters as
needed, and should help with screens not turning on when multiple
outputs are connected on some hardware (e.g. Intel).

For simplicity, the old logic to try allocating with explicit
modifiers first and then fallback to implicit modifiers later is
left as-is. We'll probably want to have more complicated logic
instead in the future: try the fallback on one output at a time,
and try dropping modifiers one by one instead of using implicit
modifiers (at the cost of some combinatorial explosion).

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1873
Co-authored-by: Kenny Levinsen <kl@kl.wtf>
2024-03-14 22:08:01 +00:00
Simon Ser
52e01a9c8b backend/drm: implement wlr_backend_impl.{test,commit} 2024-03-14 22:03:10 +00:00
Simon Ser
2ff3479558 output-management-v1: add wlr_output_configuration_v1_build_state()
A convenience function to make it easier for compositors to
implement the protocol.
2024-03-14 22:03:10 +00:00
Simon Ser
78c76ddd09 backend: add wlr_backend_{test,commit}() 2024-03-14 22:03:10 +00:00
Simon Ser
fc4996d853 backend/drm: rework struct wlr_drm_page_flip for multiple connectors
We need to store the CRTC ID for each connector at the time of the
atomic commit, because future commits may change the CRTC/connector
mapping.
2024-03-14 22:03:10 +00:00
Simon Ser
805807fd5b backend/drm: add infrastructure for device-wide commits 2024-03-14 22:03:10 +00:00
Simon Ser
4636f8c407 backend/drm: track pending atomic state in wlr_drm_connector_state
This centralizes logic common for both the atomic and libliftoff
backends. Additionally, a struct will make it easier to implement
multi-connector commits (since it can be stored in an array).
2024-03-14 22:03:10 +00:00
Simon Ser
f8f2dde1f0 backend/drm: add wlr_drm_connector_state.connector
Will be useful for multi-connector commits, to avoid having to
pass the list of connectors separately from their state.
2024-03-14 22:03:10 +00:00
Simon Ser
859373b253 scene: listen to renderer destroy in wlr_scene_buffer
When a renderer is destroyed, so are all textures. Reset the
texture in that case.
2024-03-14 22:07:42 +01:00
Simon Ser
f0d8377732 output: listen to renderer destroy in wlr_output_cursor
When a renderer is destroyed, so are all textures. Reset the
texture in that case.
2024-03-14 22:05:59 +01:00
Simon Ser
9e3576426d buffer: listen to renderer destroy in wlr_client_buffer
When a renderer is destroyed, so are all textures. Reset the
texture in that case.
2024-03-14 22:03:13 +01:00
Simon Ser
0e5034d8ba compositor: add wlr_compositor_set_renderer()
Allows compositors to switch the wlr_renderer at runtime.

Useful for handling GPU resets.
2024-03-14 14:34:44 +01:00
Simon Ser
3075e6a6f9 compositor: use compositor to get renderer
This allows us to remove the renderer destroy listener. The
listener was buggy: compositors can't destroy surface resources on
their own.

The wlr_compositor will always outlive the wlr_surface, so no need
for a destroy listener.
2024-03-14 12:29:01 +00:00
Simon Ser
508d8c9a01 compositor: handle renderer destroy
Don't leave a stale renderer pointer behind.
2024-03-14 12:29:01 +00:00
Alexander Orzechowski
8da93e5936 wlr_scene: Add support for custom swapchains 2024-03-12 11:26:03 -04:00
50eae512d9 xwayland: add wlr_xwayland_get_xwm_connection
Allows the compositors to get the xwm connection
2024-03-09 11:21:17 +00:00
Simon Ser
edbf8bf2ce input-device: drop wlr_input_device.{vendor,product}
These aren't super useful without the bus type. Compositors can
fish back this information from the libinput device if they want to.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3818
2024-03-07 11:08:18 +00:00
Simon Ser
e21b975f5d tablet-tool: add usb_vendor_id and usb_product_id to wlr_tablet 2024-03-07 11:08:18 +00:00
Isaac Freund
22178451f7
cursor-shape-v1: expose tablet tool in event
This allows compositors which use a separate cursor per tablet tool to
support setting tablet tool cursors individually using this protocol.
2024-03-05 11:20:05 +01:00
Simon Ser
16b42bf65b backend/drm: track cursor FB in wlr_drm_connector_state
Use the same logic for cursor FBs as we currently use for primary
FBs. This also fixes the same bug as [1] but in a different, more
robust way.

The new logic integrates better with atomic and will be required
anyways in the future when set_cursor will be superseded by a better
API.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4577
2024-03-04 11:26:20 +01:00
Simon Ser
f6659414ba backend/drm: add drm_fb_copy()
Similar to drm_fb_move(), but leaves old as-is.
2024-03-04 11:25:33 +01:00
Isaac Freund
2a897af7dc
wlr_tablet_v2: fix destroy listener name 2024-02-29 16:09:08 +01:00
Isaac Freund
b821be5749
input-device: unconfuse tablet naming
WLR_INPUT_DEVICE_TABLET_TOOL is renamed to WLR_INPUT_DEVICE_TABLET

The input device corresponds to wlr_tablet, not wlr_tablet_tool.
2024-02-29 16:09:07 +01:00
Simon Ser
cfd605705f input-device: fix WLR_INPUT_DEVICE_TABLET_TOOL doc comment
wlr_tablet_tool is not a wlr_input_device.

The name is confusing, but changing it would be a breaking change.
Let's fix the docs as a first step.
2024-02-29 12:43:08 +01:00
Simon Ser
ee70932422 backend/libinput: use NULL to indicate missing device name
libinput guarantees that the name is non-NULL, and an empty string
if unset. However wlroots uses NULL to indicate that an input device
name is unset.
2024-02-29 12:08:02 +01:00
Simon Ser
488a23c169 pointer: drop enum wlr_axis_orientation
Instead, use enum wl_pointer_axis from the Wayland protocol.
2024-02-28 16:39:18 +00:00
Simon Ser
ec5263e6b7 pointer: drop enum wlr_axis_relative_direction
Instead, use enum wl_pointer_axis_relative_direction from the
Wayland protocol.
2024-02-28 16:39:18 +00:00
Simon Ser
812451cd8f pointer: use enum wl_pointer_button_state 2024-02-28 16:39:18 +00:00
Simon Ser
9f4cf242d9 pointer: drop enum wlr_axis_source
Instead, use enum wl_pointer_axis_source from the Wayland protocol.
2024-02-28 16:39:18 +00:00
Simon Ser
c45e97f3a5 input-device: add doc comments 2024-02-28 11:31:54 +01:00
Simon Ser
54e1fefd2e render/egl: drop wlr_egl_is_current()
This is unused.
2024-02-23 18:52:48 +01:00
Simon Ser
c31d307971 render/egl: drop wlr_egl_save_context()
This is no longer used.
2024-02-23 18:52:48 +01:00
Simon Ser
d5556ec78f render/egl: add save_context parameter to wlr_egl_make_current()
Saving the old context and immediately making our own context
current is a common pattern. Let's make it easier to do.

No functional change, just refactoring.
2024-02-23 18:52:48 +01:00
John Lindgren
2521fba37c xwayland: add map_request signal
For XWayland surfaces that start maximized, it's best to send an initial
Configure event to set the size of the surface before mapping it. This
reduces visual glitches since the application sees the correct maximized
size when performing its initial layout and drawing.

wlroots surfaces emit their first "map" event after the XWayland window
has already been mapped and the first frame has been drawn & committed.
This is too late to send the initial Configure event.

So, add a new "map_request" event which is emitted immediately before
telling XWayland to map the window. Compositors can connect to this
event to send the initial Configure event to an XWayland app based on
its requested maximized (or fullscreen) state.

Compositors should not place anything visually on the screen at this
point but rather wait until the "map" event as before.
2024-02-23 12:46:25 -05:00
Simon Ser
0d9ffef774 backend/drm: don't destroy previous DRM master blobs
On startup, we fetch the previous MODE_ID blob ID so that
compositors can keep using the previous mode if they want to.
However, that blob doesn't belong to us, it belongs to the
previous DRM master. As a result, we get an error when trying to
destroy it.

Fix this by tracking whether the blob belongs to us or not.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3811
2024-02-21 15:10:44 +00:00
Simon Ser
d8f4a3d78c backend/drm: fix broken link to KMS property docs
The Linux graphics section of 01.org is no more. Link to more
official docs instead.
2024-02-21 12:03:37 +01:00
Simon Ser
d2acd4c362 backend/drm: move restore logic to drm.c
We'll need to use a bunch of internal functions from that file in
the next commits.
2024-02-15 09:37:46 +01:00
Simon Ser
505175e56f backend/drm: atomically reset state after VT switch
Allows the KMS driver to parallelize the modesets, so should be
faster than going through each CRTC one by one.
2024-02-14 19:13:23 +01:00
Simon Ser
741aaa3f76 backend/drm: drop wlr_drm_backend arg from create_mode_blob()
No need for this, the backend can be grabbed from the connector.
2024-02-14 17:13:25 +01:00
columbarius
9e426e70e6 ext-foreign-toplevel-list-v1: new protocol implementation
This implements the new ext-foreign-toplevel-list-v1 protocol [1].
Implemented analog to the zwlr-foreign-toplevel-management-v1 implementation.
The additional _ext_ in the names was added to avoid name collisions.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/187

Co-authored-by: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
2024-02-12 01:05:19 +01:00
Austin Shafer
4cd556ea20 linux_dmabuf_v1: allow callbacks for checking dmabuf import 2024-02-06 16:11:30 +00:00
Kirill Primak
811ca199c4 xdg-shell: drop automatic surface configuration
Compositors now are expected to wait for an initial commit by checking
wlr_xdg_surface.initial_commit on every surface commit and send
(schedule) configure events manually.
2024-02-06 13:48:00 +00:00
Austin Shafer
d368028bd5 allocator: remove backend parameter in allocator_autocreate_with_drm_fd
Since we only use the backend capabilities here we can simply pass
them in directly. This allows other locations to create an allocator
even if they don't have a backend. They can simply specify the caps
they want instead.
2024-02-02 16:36:31 -05:00
Simon Ser
a8aeadeab2 switch: add docs 2024-02-02 17:52:56 +01:00
Simon Ser
967e788bc8 backend/session: add docs 2024-02-01 16:08:47 +01:00
Kirill Primak
7dfbd87771 compositor: drop wlr_surface.external_damage 2024-02-01 14:51:43 +00:00
Leo Li
71fb55f3bf render/pixel-format: Move has_alpha into it's own array
Some opaque pixel formats (nv12, p010) require per-plane bytes_per_block
info. However, it doesn't make sense to store them in
wlr_pixel_format_info, as they will never be useful (currently, this
info is used for shm, which doesn't have a concept of multi-planar
buffers.)

Let's define a separate array and function for determining whether a
pixel format has alpha.
2024-01-31 13:47:17 -05:00
Andri Yngvason
3a91dc1b48 Create & implement transient seat protocol 2024-01-31 08:22:05 +00:00
Simon Ser
6991f03767 linux-dmabuf-v1: switch to stable
The protocol is no longer unstable.
2024-01-31 08:20:17 +00:00
Simon Ser
ba3c1ae065 linux-dmabuf-v1: fix include guard name 2024-01-31 08:20:17 +00:00