Commit Graph

1758 Commits

Author SHA1 Message Date
Peng Liu
0ba1982488 backend/x11: delete xcb conn check NULL
xcb_connect always returns a non-NULL pointer
to a xcb_connection_t, even on failure.

Signed-off-by: Peng Liu <liupeng01@kylinos.cn>
2024-10-24 09:02:41 +00:00
Isaac Freund
da8f7a07ba
backend/headless: actually perform output test
Currently the headless backend does not actually implement the
wlr_output_test function, causing tests containing output state
unsupported by the headless backend to succeed while committing the same
state will always fail.

This commit fixes that by actually hooking up the already exisiting test
function.

References: https://codeberg.org/river/river/issues/1154
2024-10-24 10:49:08 +02:00
David Turner
c87ab6465d Support direct scanout with src crop and dst boxes
Enable scene-tree direct scanout of a single buffer with various options
for scaling and source crop. This is intended to support direct scanout
for fullscreen video with/without scaling, letterboxing/pillarboxing
(e.g. 4:3 content on a 16:9 display), and source crop (e.g. when
1920x1088 planes are used for 1920x1080 video).

This works by explicitly specifying the source crop and destination box
for the primary buffer in the output state.  DRM atomic and libliftoff
backends will turn this into a crop and scale of the plane (assuming the
hardware supports that).  For the Wayland/X11/DRM-legacy backends I just
reject this so scanout will be disabled.

The previous behaviour is preserved if buffer_src_box and buffer_dst_box
are unset: the buffer is displayed at native size at the top-left of the
output with no crop.

The change to `struct wlr_output_state` makes this a binary breaking
change (but this works transparently for scene-tree compositors like
labwc after a recompile).
2024-10-22 18:28:09 +01:00
Kenny Levinsen
ba0cc8eb05 backend/multi: Advance index on backend_commit
wlr_multi_backend sorts the states it is given and tries to perform
sequential backend-wide commits for each sub-backend with the states
that belong to it.

It did not manage the index correctly for the next iteration, so given N
states for a backend it would perform N backend-wide commits.

Clarify the logic by calculating a length rather than an end pointer and
update the index after each iteration.
2024-10-15 17:32:54 +02:00
Simon Ser
3b3ed21e61 backend/drm: fix timeline feature flag on multi-GPU setups
This piece of code checks for multi-GPU renderer support, so it
needs to run after the renderer is initialized.

Fixes: 514c4b4cce ("backend: add timeline feature flag")
Closes: https://github.com/swaywm/sway/issues/8382
2024-10-12 17:12:29 +02:00
Simon Ser
1e949402b0 output: drop output timeline flag
This has been superseded by the backend-wide feature flag.
2024-10-11 17:11:35 +00:00
Simon Ser
514c4b4cce backend: add timeline feature flag
The output feature flag has a flaw: it's not possible to check
whether the backend supports timelines during compositor
initialization when we need to figure out whether we want to enable
the linux-drm-syncobj-v1 protocol.

Introduce a backend-wide feature flag to indicate support for
timelines to address this defect.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3904
2024-10-11 17:11:35 +00:00
Kirill Primak
56d69320c7 pointer: release pressed buttons on destroy 2024-09-24 19:53:54 +00:00
YaoBing Xiao
7debaced03 x11/backend: Optimize query_version error handling
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2024-09-12 17:52:26 +08:00
Kenny Levinsen
96ad414ec9 backend/drm: Remove call to CRTC realloc on scan
After a connector scan, new connectors might have appeared and old ones
gone away. At this point, old CRTC allocations are already gone, while
new allocations are not yet needed. Skip the call.
2024-09-09 13:22:56 +00:00
Simon Ser
234d31f138 backend/drm: improve doc comment for match_connectors_with_crtcs_()
- Add general description
- Mention the computer theory problem that this is solving
- More wording cleanup
2024-09-02 17:12:32 +00:00
Simon Ser
0d6284eb62 backend/drm: add explicit sync support to libliftoff interface 2024-08-26 18:21:50 +02:00
Simon Ser
d7223eae02 backend/drm: add explicit sync support to multi-GPU blits 2024-08-26 18:09:27 +02:00
YaoBing Xiao
a5aae69b2a backend/drm: remove unnecessary semicolons 2024-08-24 08:36:46 +00:00
Simon Ser
5432108846 backend/drm: drop SKIP in match_connectors_with_crtcs()
It's unused.
2024-08-21 22:25:19 +02:00
Simon Ser
5f3b99bbed backend/drm: rename i param in match_connectors_with_crtcs_()
Use a more descriptive name to make it clear what kind of index
this is.
2024-08-21 22:25:19 +02:00
Simon Ser
1e03719361 backend/drm: drop match_connectors_with_crtcs() return value
It's unused.
2024-08-21 22:25:19 +02:00
Simon Ser
0bf642d246 backend/drm: use more descriptive names for match_obj()
This function is only used for connectors and CRTCs, so instead of
the abstract "obj"/"resource" wording, just use the concrete names.
2024-08-21 22:25:19 +02:00
Simon Ser
d2a5dbe104 backend/drm: use CRTCs in-order
When lighting up a new connector, we'd use the last CRTC instead of the
first one. This causes issues because drivers have the expectation that
userspace will match CRTCs to connectors in-order [1].

The order has regressed a long time ago in 5b13b8a12c ("backend/drm:
consider continue not using resources"). That commit was a fix to
avoid moving a connector between CRTCs [2]. Revert that commit and
use a different approach: even if we've found a solution, always try
not using a CRTC in the hope that we'll find another solution with
less CRTC replacements.

[1]: https://lore.kernel.org/dri-devel/20240612141903.17219-2-ville.syrjala@linux.intel.com/
[2]: https://github.com/swaywm/wlroots/issues/1230

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3098
2024-08-21 15:17:04 +00:00
YaoBing Xiao
43554c1966 types/wlr_output: removing the useless pointer 2024-08-21 14:04:24 +00:00
Alexander Orzechowski
bfcaa4bc44 swapchain, damage_ring: Drop buffer age 2024-08-21 09:45:54 -04:00
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