Commit Graph

1737 Commits

Author SHA1 Message Date
Dudemanguy
3d2f09bace backend/drm: fix a use-after-free
The page_flip can be destroyed, but it is unconditionally accessed later
on when setting present_flags. Fix this by simply setting the
present_flags before the page_flip gets destroyed.
2024-08-19 13:46:41 -04:00
Kirill Primak
310a5eb61c backend/wayland: simplify wl_keyboard.{enter,leave} processing 2024-08-15 18:33:00 +00:00
Isaac Freund
08495d2596 backend/drm: don't set vsync present flag if page flip was async 2024-08-15 15:11:10 +00:00
Kirill Primak
3103ea3af9 backend/wayland: process initial events from globals correctly
Previous logic could lead wlr_wl_backend.drm_render_name being written
to twice, causing a memory leak. This commit fixes the race condition.
2024-08-15 12:52:05 +03:00
project-repo
3cae2a2c01 Fix memory leak in drm.c 2024-08-12 14:06:10 +00:00
Kirill Primak
8730ca9661 seat/pointer: handle duplicate presses/releases correctly 2024-08-06 22:53:08 +00:00
Simon Ser
3067e45c2e backend/drm: add support for explicit sync APIs 2024-08-06 17:37:06 +00:00
Simon Ser
a35b4f059d backend/drm: add support for SIZE_HINTS property
This property allows the driver to advertise support for multiple
cursor sizes. On Intel, using a smaller buffer size reduces power
consumption.

References: https://lore.kernel.org/dri-devel/20240227193523.5601-2-ville.syrjala@linux.intel.com/
2024-07-10 22:42:44 +00:00
Simon Ser
0028e0638f backend/wayland: use wl_shm.release if available 2024-07-07 18:16:48 +02:00
Simon Ser
0a79bc28c7 build: require libinput v1.19
This version has been published back in 2021.
2024-07-04 22:51:07 +02:00
Simon Ser
315e022f2f backend/drm: fix swapped calloc() arguments in get_or_create_layer()
../backend/drm/drm.c:415:49: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
      415 |         layer->candidate_planes = calloc(sizeof(bool), drm->num_planes);
          |                                                 ^~~~
2024-06-27 18:13:05 +00:00
Simon Ser
29cb151987 backend/drm: fix return value type in create_drm_connector()
../backend/drm/drm.c:1435:24: error: incompatible types when returning type ‘_Bool’ but ‘struct wlr_drm_connector *’ was expected
     1435 |                 return false;
          |                        ^~~~~
2024-06-27 18:13:05 +00:00
Simon Ser
fe429b2463 Switch to stable tablet-v2 protocol
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/284
2024-06-27 18:04:00 +00:00
Kirill Primak
f320df65e6 backend/wayland: introduce wlr_wl_output_set_app_id() 2024-06-26 19:43:20 +00:00
Kirill Primak
5201836868 backend/drm: store drm prop lists as structs
This makes modifying the property lists slightly easier.
2024-06-25 13:49:54 +00:00
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