Commit Graph

1722 Commits

Author SHA1 Message Date
Kenny Levinsen
bedc890935 backend/drm: Use cached vrr support flag
We do not expect the connector support to change throughout the lifetime
of the link on this connector, so use the value we initially probed.
2024-06-21 14:18:34 +00:00
Kenny Levinsen
f10327f915 wlr_output: Add adaptive_sync_supported
This will let compositors know if changing adaptive_sync state has any
chance of working. When false, then the current state is the only
supported state, including if adaptive_sync is currently enabled as is
the case for Wayland and X11 backends.

When true, changing state might succeed, but no guarantee is made. It
just indicates that the backend does not already know it to be
impossible.
2024-06-21 14:18:34 +00:00
Kirill Primak
55bee71a53 backend/wayland: destroy ignored tablet proxies
This fixes a memory leak when there are multiple tablets.
2024-06-20 11:13:15 +03:00
Kirill Primak
27d2eb8596 backend/wayland: dispatch remote display when waiting for a configure event
We don't need to process all events, only those that come from the host
compositor. This also avoids running user event handlers while in the
middle of committing an output.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3857
2024-06-18 18:31:34 +03:00
Simon Ser
cedcd3252a backend/session: use "KMS" instead of "DRM" in log messages
Some DRM devices are not KMS-capable. DRM card nodes (also
known as DRM primary nodes) are created for render-only devices
as well. Let's just use "KMS" everywhere instead of "DRM" and
"DRM card".
2024-06-17 09:43:38 +02:00
Simon Ser
2504ca929f backend/session: log when loading WLR_DRM_DEVICES
It may not be obvious in the logs when the user specifies an
explicit fixed list of KMS devices to open.
2024-06-17 09:42:23 +02:00
Kirill Primak
629a5171f2 backend/wayland: don't ack outdated configures
This commit fixes the following interaction:

1) The host compositor sends a configure sequence for an output.
2) Before handling it, the guest compositor disables and immediately
re-enables the output.
3) The guest compositor tries to ack the configure event from step 1
which isn't relevant anymore after unmapping and re-initialization.

Instead, ignore all configure events after unmapping until we're sure
the host compositor has processed the unmapping.

Also see
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/108.
2024-06-11 09:44:42 +03:00
Kirill Primak
d80c46250d backend/wayland: improve/fix xdg_toplevel (re-)initialization
- Reset all variables representing an initialized xdg_toplevel's state
on unmap.
- Send an initial commit only when an output is about to be enabled.
- If an output isn't configured yet, don't commit a buffer.
2024-06-11 09:44:42 +03:00
Kirill Primak
d9f6498f8a backend/wayland: commit null buffer only on unmap
If the guest compositor disabled an output and then immediately
committed another state, we would perform a commit with a null buffer,
which is against the protocol, as the host compositor expects an
initial commit with no buffer at all.
2024-06-11 09:44:42 +03:00
Kirill Primak
baf1e4f674 backend/wayland: don't ack a configure event too early
Postpone sending xdg_surface.ack_configure until the guest compositor
commits a buffer, if at all.

Also see
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/128.
2024-06-11 09:44:42 +03:00
Kirill Primak
94e7165e85 backend/wayland: don't request a state too early
An xdg_toplevel configure sequence ends with xdg_surface.configure.
Wait for it before relaying the request to the guest compositor.
2024-06-11 09:44:42 +03:00
Kirill Primak
a62dfebf10 backend/wayland: store output xdg_toplevel title
This will be required to re-initialize the toplevel properly later.
2024-06-11 09:44:42 +03:00
Leonardo Hernández Hernández
385c9ade5f
add an option to enable/disable libliftoff
instead of always using it if found
2024-06-05 22:33:05 -06:00
Kirill Primak
bd7a47e139 backend/drm: avoid "maybe uninitialized" warning
Fixes: 95ac3e9924
2024-06-05 01:07:24 +03:00
Kirill Primak
95ac3e9924 backend/drm: add libliftoff log handler 2024-05-31 18:52:51 +00:00
Simon Ser
6e6c4408d3 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.
2024-05-31 12:32:32 +00:00
Kirill Primak
08c64c166f backend/x11: send correct keyboard layout 2024-05-26 12:52:42 +00:00
nerdopolis
35c3194ae5 backend/libinput: Fix call of handle_libinput_readable() when WLR_LIBINPUT_NO_DEVICES is set 2024-05-21 08:26:04 -04:00
Simon Zeni
325d843814 backend/x11: don't exit on dri3 DRM FD query failure
Even if the backend advertises dri3 support, querying the DRM FD may fail.
Instead of returning early, the backend creation process must continue because
shm might be supported.
2024-05-15 17:54:58 +00:00
Kenny Levinsen
be667b0628 backend/drm: Free drm device name on error 2024-04-30 10:18:05 +02:00
Simon Ser
3aef433f97 backend/drm: handle errors when fetching DRM name/version
These functions can fail if the FD is not a DRM device or on
memory allocation failure, for instance.
2024-04-30 09:57:28 +02:00
Simon Ser
0686666cf5 render: drop wlr_renderer_get_dmabuf_texture_formats()
wlr_renderer_get_texture_formats() with WLR_BUFFER_CAP_DMABUF is
the replacement.
2024-04-21 11:27:29 +00:00
Simon Zeni
cc10a5259d backend/libinput: avoid potential NULL access in wlr_libinput_get_device_handle 2024-04-18 16:47:09 +02:00
Kirill Primak
2f82c92307 Avoid using wayland-{client,server}.h
Their use is discouraged. Instead, include -core or -protocol headers.
2024-04-17 13:37:12 +00:00
Kenny Levinsen
9c1930d462 backend/drm: Skip multi-gpu outputs in backend tests
Our multi-gpu path currently needs to blit a buffer in order to have a
primaryfb to add to the commit. This is expensive, and we skip it
entirely during test commits. This in turn also means that we skip tests
commits entirely for such outputs, outside our own basic tests.

Backend-wide commits missed this check, and tried to perform test
commits for multi-gpu outputs despite no primaryfb having been attached,
making them always fail. Add the same exception as we have in the
per-connector commit-test.
2024-04-09 21:57:02 +02:00
Ian Forbes
e3bd318547 drm/backend: add support for cursor hotspots
Enables DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT and sets the cursor hotspots on the
cursor plane so virtualized drivers can accelerate mouse movement.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3776
2024-03-22 13:54:18 -05:00
Simon Ser
7a8e2cd8ed backend/libinput: drop stray space 2024-03-15 12:48:27 +01:00
Simon Ser
bd8796d465 backend/libinput: drop outdated gesture cap logging
We've been supporting gesture events for a long time.
2024-03-15 12:34:19 +01:00
Kirill Primak
71be993982 backend/drm: set adaptive_sync_status again
Fixes: d7d974ae30
2024-03-15 10:39:05 +03:00
Simon Ser
52e01a9c8b backend/drm: implement wlr_backend_impl.{test,commit} 2024-03-14 22:03:10 +00:00
Simon Ser
d41b5efc65 backend/drm: fix adaptive sync no-op changes
When a compositors submits a wlr_output_state with
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED set and
adaptive_sync_enabled = false on an output which doesn't support
adaptive sync, we'd fail the commit. Fix this.

This bug was previously hidden because wlr_output_commit() drops
no-op changes from wlr_output_state.committed.
2024-03-14 22:03:10 +00:00
Simon Ser
35737ab00c backend/drm: add drm_connector_prepare()
Extract bits we'll re-use for device-wide commits.
2024-03-14 22:03:10 +00:00
Simon Ser
a4f54086c1 backend/drm: move post-commit disable logic to drm_connector_apply_commit()
After disabling a connector, we need to cleanup the connector to
teardown the surfaces and unlock the FBs.

Move this logic into drm_connector_apply_commit() so that it's
applied when drm_commit() is called from somewhere else than
drm_connector_commit_state().
2024-03-14 22:03:10 +00:00
Simon Ser
5efa88ee7a backend/drm: drop drm_device_state_init_single()
There is a single caller now, so we can inline the function.
2024-03-14 22:03:10 +00:00
Simon Ser
ee01712847 backend/drm: unify connector test and commit codepaths
There is some duplicated logic between these two functions.

The commit codepath was calling the test function before doing the
real commit, so this also saves an unnecessary test-only commit
when performing a real commit.
2024-03-14 22:03:10 +00:00
Simon Ser
917c650903 backend/multi: implement wlr_backend_impl.{test,commit} 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
d7d974ae30 backend/drm: drop VRR debug message
These weren't super helpful and will get in our way for
multi-connector commits.
2024-03-14 22:03:10 +00:00
Simon Ser
3d72da9ed7 backend/drm: extract post-commit logic into functions
It's more readable, and we'll soon call this from a loop for
multi-connector commits.
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
94dbb3cfb5 backend/libinput: check bus type before setting tablet USB IDs
References: https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/977
2024-03-07 12:19:07 +01: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
Simon Ser
c3743364e2 backend/drm: ensure CRTC is set up in drm_connector_state_init()
In [1] we discovered a bug where wlr_drm_connector_state.primary_fb
would not be set up correctly because drm_connector_alloc_crtc() was
called after drm_connector_state_init(). This is tricky to discover,
so instead assert() that we have a usable CRTC by the time
drm_connector_state_init() is called.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4569
2024-03-04 14:42:11 +00: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
Simon Ser
1a54d33e77 backend/drm: clear pending cursor FB in drm_connector_set_cursor()
When disabling the cursor, don't leave a stale pending FB behind.
2024-03-04 11:23:35 +01:00