Commit Graph

607 Commits

Author SHA1 Message Date
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
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
Kenny Levinsen 2cf78f4c5b output: allow_artifacts -> allow_reconfiguration
The name "allow_artifacts" and associated description is very vague, and
theoretically allow for tearing behavior. Clarify that we only intend to
mean artifacts related to output configuration (e.g., modesets).

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3740
2023-10-09 08:31:35 +00:00
Simon Ser a1679c92ce backend/drm: restore pending page-flip check when tearing
DRM_MODE_PAGE_FLIP_ASYNC doesn't allow user-space to submit new
buffers before waiting for the uevent: the kernel will return EBUSY
in that case.

Fixes: c2aa7fd965 ("backend/drm: Add async page flip support to legacy")
2023-10-02 10:26:47 +02:00
vaxerski c2aa7fd965 backend/drm: Add async page flip support to legacy
Atomic doesn't support such flags yet.
2023-09-28 16:53:08 +00:00
Alexander Orzechowski 9be72ec4ca backend/drm: Compute custom mode correctly 2023-09-07 01:56:32 +00:00
Simon Ser 717ded9bb0 backend/drm: drop no-op shortcut
Since e5fc8cd4c7 ("output: trigger frame/present events on all
commits on enabled output"), any commit on an enabled output is
supposed to trigger frame/present events.

The DRM backend was skipping the commit completely for no-op
commits. Stop doing so.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3719
2023-08-25 17:16:05 +02:00
Simon Ser e5fc8cd4c7 output: trigger frame/present events on all commits on enabled output
Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
2023-08-23 15:42:22 +00:00
Rose Hudson fc81d06add backend/drm: report !presented if session is inactive 2023-08-23 16:36:43 +02:00
Rose Hudson f7afef0b1f backend/drm: don't set frame_pending on modeset
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3664#note_2020392
we're gonna have to trust Simon on this one 🤞
2023-08-23 16:36:43 +02:00
Alexander Orzechowski 8f0d4c9332 backend/drm: Use output state to set init mode 2023-08-16 18:37:40 +02:00
Alexander Orzechowski a34d349963 backend/drm: Move output variable up in connect_drm_connector 2023-08-16 11:46:27 -04:00
Alexander Orzechowski 6cda3e251c output: Add initialization state to wlr_output_init 2023-08-16 11:46:27 -04:00
Simon Ser 37ef9d7356 backend/drm: stop checking for wlr_client_buffer
wlr_client_buffer is a bad indicator for direct scan-out.
Compositors might use the underlying wlr_buffer instead.
2023-07-14 15:20:35 +02:00
Simon Ser fe06e5f49a Use wl_container_of() instead of casts
This slightly improves type safety.

The culprits were found with:

    git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
2023-07-11 20:16:17 +02:00
Simon Ser 7a9f8d8d6b Use struct initializers instead of memset()
This is a bit more type-safe.
2023-07-07 17:31:11 +02:00
Clayton Craft aca48124ad
backend/drm: use panel_orientation if it is set
This fixes an issue where the panel_orientation parameter was set but wlroots was ignoring it and
returning OUTPUT_TRANSFORM_NORMAL.

Fixes 2e12de96
2023-06-30 09:34:28 -07:00
Alexander Orzechowski 8243399385 output: Set output mode during main commit
Removes duplication across all the backends to finally apply the mode
to the output.
2023-06-27 11:47:58 -04:00
Alexander Orzechowski 5567aefb1c backend/drm: Don't add pollute fixed modes list with custom modes
Nobody remembers why this is done and it isn't that great if people
use a lot of custom modes.
2023-06-27 11:14:55 -04:00
Simon Ser cbcd99435f backend/drm: remove duplicate needs_frame() in set_cursor()
wlr_output_update_needs_frame() is called unconditionally at the
end of the function already.
2023-06-26 11:49:38 +02:00
Simon Ser be05097968 output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having
fields with uninitialized memory when missing from the committed
bitflag, all fields are always initialized (and maybe NULL/empty),
just like we do in wlr_surface_state. This reduces the chances of
footguns when reading a field, and removes the need to check for
the committed bitfield everywhere.

A new wlr_output_state_init() function takes care of initializing
the Pixman region.
2023-06-23 18:07:26 +00:00
Simon Ser fffa1908af backend/drm: fix libliftoff_plane double-free
Destroying the liftoff_device invalidates all of the liftoff_planes.
Destroy the liftoff_planes before the liftoff_device to fix this.
2023-06-22 18:00:34 +00:00
Alexander Orzechowski ecbe48f3bc backend/drm: Fix typo 2023-06-21 10:23:56 +02:00
Simon Ser 30aca4df0d backend/drm: introduce wlr_drm_mode_get_info()
This allows compositors to get back the raw drmModeModeInfo and
look at DRM-specific fields and flags.
2023-05-31 22:37:12 +00:00
Alexander Orzechowski 90d08f8f1c wlr_drm_format: Rework wlr_drm_format_intersect
Now it takes a reference to a destination format
2023-05-11 18:24:43 +02:00
Alexander Orzechowski b45396c790 wlr_drm_format: Introduce drm_format_finish 2023-05-11 03:51:01 -04:00
Simon Ser 1d64e12391 backend/drm: log drm_connector_alloc_crtc() failures
Helps figuring out why e.g. get_primary_formats fails.
2023-03-20 20:21:28 +01:00
Simon Ser a160304289 backend/drm: use libdisplay-info for CVT mode generation 2023-02-28 14:44:02 +00:00
Simon Ser b33ab26fe7 render/swapchain: make public
We've had this struct for a while. It'd be useful for compositors
if they want to manage the swap chains themselves instead of being
forced to use wlr_output's. Some compositors might also want to use
a swapchain without an output.
2023-02-21 17:14:31 +01:00
Simon Ser 8338d17d7e backend/drm: drop wlr_drm_layer.pending_{width,height}
No need to store this info in struct wlr_drm_layer. We can just
extract the size when we need it.
2023-02-21 09:45:47 +00:00
Simon Ser 22d9df2af4 backend/drm: send output layer feedback events 2023-02-20 18:38:57 +01:00
Simon Ser 4d6fbb2289 backend/drm: add support for output layers 2023-02-20 18:38:57 +01:00
Simon Ser 9d43e7e4d6 backend/drm: add libliftoff interface 2023-02-20 18:38:57 +01:00
Simon Ser b4e9487312 backend/drm: init wlr_drm_plane for all plane types 2023-02-20 18:38:57 +01:00
Simon Ser d36dd96e8d backend/drm: set "max bpc" property based on pixel format
Since 1d581656c7 ("backend/drm: set "max bpc" to the max") we
set the "max bpc" property to the maximum value. The kernel driver
is supposed to clamp this value depending on hardware capabilities.

All kernel drivers lower the value depending on the GPU capabilities.
However, none of the drivers lower the value depending on the DP-MST
link capabilities. Thus, enabling a 4k@60Hz mode can fail on some
DP-MST setups due to the "max bpc" property.

Additionally, it's not a good idea to unconditionally set "max bpc"
to the max. A high bpc consumes more lanes and more clock speed,
which means higher power consumption and the busy lanes cannot be
used for something else (e.g. other data transfers on a USB-C cable).

For now, let's tie the "max bpc" to the pixel format of the buffer.
Introduce a heuristic to make "high bit-depth buffer" a synonym of
"I want the best quality".

This is not perfect: a "max bpc" higher than 8 might be desirable
for pixel formats with a color depth of 8 bits, for instance when
the color management KMS properties are used. But we don't really
support that yet, so let's leave this for later.

Closes: https://github.com/swaywm/sway/issues/7367
2023-01-31 09:32:11 +00:00
Simon Ser dc7cc98cf2 backend/drm: check return value of get_drm_{connector,crtc}_props()
We already do it for get_drm_plane_props().
2022-12-16 10:30:14 +01:00
Simon Ser 8b8921d57b backend/drm: remove wlr_drm_crtc.legacy_crtc
We only need it for one thing: gamma size. Moreover, some bits in
the drmModeCrtc will become out-of-date, for instance the current
mode, so let's avoid caching the whole struct and only keep what
we know won't change.
2022-12-15 19:31:06 +01:00
Simon Ser 8b18352318 backend/drm: fetch fresh legacy CRTC in connector_get_current_mode()
connect_drm_connector() may be called long after create_drm_connector().
During that time the DRM mode might have changed. Avoid working with
stale information.
2022-12-15 19:26:20 +01:00
Simon Ser caaea01bf6 backend/drm: drop unused arg in connector_get_current_mode() 2022-12-13 21:35:10 +00:00
Simon Ser c675380c56 backend/drm: prevent out-of-bounds array access on unknown subpixel
If the kernel adds new enum entries for subpixel, don't read past
the end of the subpixel_map array.
2022-12-13 19:44:44 +00:00
Simon Ser bde68b1df7 backend/drm: refuse to switch CRTC for enabled connector
match_obj() might return a configuration where the CRTC for an
enabled connector is switched to another one.

We don't support this correctly: the wlr_output common code would
need to query again the supported formats, re-allocate the
swapchain, etc.

What's more, the kernel doesn't even support this [1]: it
requires planes to be disabled to change their CRTC, it rejects
commits directly switching the CRTC used by a plane.

[1]: https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_atomic.c?h=6e90293618ed476d6b11f82ce724efbb9e9a071b#n697
2022-12-13 19:15:09 +00:00
Simon Ser 99fb2fefc3 backend/drm: rename wlr_drm_backend.outputs to connectors
This list contains wlr_drm_connector entries, and there is no
guarantee that the wlr_output fields are initialized.
2022-12-13 19:15:09 +00:00
Simon Ser 2c042566eb backend/drm: clear pending cursor FB in drm_connector_commit_state()
Ensure we unlock any pending cursor FB when disabling a connector.
2022-12-13 19:12:12 +00:00
Simon Ser ea14e9c95f backend/drm: update wlr_drm_connnector.crtc in drm_connector_commit_state()
If the commit fails, then our local state becomes out-of-sync with
the kernel's. Additionally, when disabling a connector without going
through dealloc_crtc(), conn->crtc would still be set.

Fix this by updating conn->crtc in drm_connector_commit_state().
2022-12-13 19:12:12 +00:00
Simon Ser e59c3602f7 backend/drm: print stringified connector status in realloc_crtcs()
The raw enum value wasn't informative enough. It's not trivial to
tell whether 0 means connected or disconnected.

Drop the status from the state after realloc, since the exact same
information is printed right above.
2022-12-13 16:50:27 +00:00
Simon Ser 037b21647b backend/drm: store pending FB in state
Instead of having a pending_fb field on the struct wlr_drm_plane,
move it to struct wlr_drm_connector_state. That way, there's no
risk having a stale pending FB around: the state doesn't survive
across tests and commits.

The cursor is a special case because it's disconnected from the
atomic state: the wlr_backend_impl.set_cursor hook sets the cursor
for the next commit. Move the field to
wlr_drm_connector.cursor_pending_fb.
2022-12-07 17:45:59 +01:00
Simon Ser ae61cd6bfb backend/drm: use separate field to store pending cursor FB
We'll move the pending primary FB into the connector state in the
next commit, dropping wlr_drm_plane.pending_fb in the process.
Introduce a dedicated field for the cursor, which has to be managed
in a special way due to our set_cursor API.
2022-12-07 17:44:51 +01:00
Simon Ser 72d1fd1446 backend/drm: simplify dealloc_crtc() commit
No need to manually call drm_connector_state_init() here, we can
just let drm_connector_commit_state() handle it.
2022-12-07 17:44:51 +01:00
Simon Ser 90a6c7b7e1 backend/drm: fix VRR test
We were calling drm_connector_supports_vrr() before
drm_connector_alloc_crtc(). Thus, when an output is currently off,
the VRR test would always fail, because it checks that the
vrr_enabled CRTC prop exists.
2022-12-07 10:43:02 +01:00
Simon Ser 4452ed0651 backend/drm: don't damage output on CRTC change
There's no reason why the output should be damaged here. The current
buffer doesn't need to be re-painted.
2022-11-17 09:17:32 +00:00
Simon Ser ef5e2cc5e3 output: call wlr_output_update_enabled() after commit
Backends no longer need to manually call wlr_output_update_enabled()
in their commit hook: wlr_output will take care of that.
2022-11-17 09:12:25 +00:00
Simon Ser f863b93c05 backend/drm: only request page-flip if active
It doesn't make sense to request a page-flip for a disabled output.

Fixes: 84e727daae ("backend/drm: request page-flip event on modeset")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3528
2022-11-15 14:14:18 +00:00
Simon Ser a40ba16a64 backend/drm: fix FPE when disabling output
Fixes: 65836ce357 ("backend/drm: log modesetting commits")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3534
2022-11-15 10:06:23 +01:00
Simon Ser 65836ce357 backend/drm: log modesetting commits 2022-11-14 17:39:39 +00:00
Simon Ser b3da33116e backend/drm: log refresh rate in Hz 2022-11-14 17:39:39 +00:00
Simon Ser 84e727daae backend/drm: request page-flip event on modeset
The old drm_connector_set_mode() function did that by calling
drm_crtc_page_flip(). We lost this in the refactoring.

Fixes: f216e97983 ("backend/drm: drop drm_connector_set_mode()")
2022-11-11 14:46:51 +00:00
Simon Ser fc3d8b228b backend/drm: get possible CRTCs in create_drm_connector()
This stuff is immutable for a given connector.
2022-11-02 14:48:30 +00:00
Simon Ser 92580a2f67 backend/drm: extract create_drm_connector()
Move a bit more logic out of the big loop in scan_drm_connectors().
2022-11-02 14:48:30 +00:00
Simon Ser c6d8a11d2c backend/drm: fetch current CRTC once on startup
Once we are DRM master, the CRTC cannot be changed behind our back
except during a VT switch.

After a VT switch, we try to restore whatever KMS state we had last
programmed. Reloading the current CRTC from KMS breaks this and
can result in a modeset without a FB.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3432
2022-10-19 00:23:18 +00:00
Simon Ser a2063c93ea backend/drm: drop drm_crtc_page_flip()
Inline it in drm_connector_commit_state(). Brings us a step closer
to unifying the test code-path and the commit code-path.
2022-10-17 17:39:41 +02:00
Simon Ser 98a83ce14c backend/drm: fix EINVAL atomic commits after VT switch
The drm_connector_commit_state() call in handle_session_active()
was not resulting in any atomic commit, because it didn't match any
of the if branches: active = true, no new buffer was committed,
and adaptive sync/gamma LUT were unchanged. Thus the commit was a
no-op.

Later on, when the compositor performs regular page-flips, the
kernel would return EINVAL indicating that a modeset was needed.

Rework the logic to use a non-blocking page-flip commit if a buffer
was committed, and use a blocking commit if the connector is on or
is being disabled. The only case where we should skip the atomic
commit is when disabling (active = false) an already-disabled
connector (conn->crtc == NULL).

Note, 6936e163b5 ("backend/drm: short-circuit no-op commits")
has introduced early returns for other situations where we don't
need to perform an atomic commit (e.g. updating scale or transform
of an output).

Fixes: f216e97983 ("backend/drm: drop drm_connector_set_mode()")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3432
2022-10-17 15:14:02 +00:00
Simon Ser ca432ea539 backend/drm: extract current mode logic into separate function
Extract the logic to fetch the current mode to a separate function
to make it more readable. Stop dying in an assert when
get_drm_prop_blob() fails. Always make it so the drmModeModeInfo
pointer is allocated so that we can free() it unconditionally.
2022-10-17 11:36:58 +02:00
Simon Ser eeb7a81138 backend/drm: extract connect_drm_connector() logic
We already have disconnect_drm_connector() to handle the
CONNECTED → DISCONNECTED transition. Let's add
connect_drm_connector() to handle DISCONNECTED → CONNECTED. This
makes scan_drm_connectors() shorter and easier to follow.

No functional change, literally just moving code around.
2022-10-15 12:20:55 +02:00
Simon Ser 9560a7eefd backend/drm: use atomic API to fetch current connector's CRTC
We were using the legacy API (with a detour through drmModeEncoder)
to find out the current CRTC for a connector. Use the atomic API
when available.

Also extract the whole logic into a separate function for better
readability, and better handle errors.
2022-10-14 15:13:14 +00:00
Simon Ser 0c0cea0258 backend/drm: use wl_container_of() instead of casts for wlr_drm_mode
Instead of casting a wlr_output_mode to wlr_drm_mode, use
wl_container_of() for slightly better type safety.
2022-10-13 16:11:39 +00:00
Simon Ser f216e97983 backend/drm: drop drm_connector_set_mode()
Instead of special-casing modesets, we can just cut the wrapper
and directly call drm_crtc_page_flip(). drm_connector_test() should
already have the checks previously done in drm_connector_set_mode(),
all we need to do is update enabled/mode after a successful atomic
commit.
2022-10-10 07:48:25 +00:00
Simon Zeni 694e9bbb9d backend/drm: allocate connector CRTC on lease creation
This was leading to crash in compositors if the wanted connector had no CRTC
2022-10-07 15:54:51 -04:00
Simon Ser f4cf0a8d86 backend/drm: nuke wlr_drm_connector.desired_enabled
This field becomes stale too easily: for instance, see 6adca4089c
("backend/drm: don't unconditionally set desired_enabled").
Additionally, drm_connector_alloc_crtc() needs to do some weird
dance, restoring its previous value.

Instead, add a connector arg to realloc_crtcs() to indicate a new
connector we want to enable.
2022-10-07 16:28:36 +00:00
Simon Ser 5a207aea72 backend/drm: drop unnecessary wlr_drm_connector.crtc checks
drm_connector_alloc_crtc() already checks this.
2022-10-07 16:09:05 +00:00
Simon Ser 0613fb0159 backend/drm: remove outdated TODO
This has been addressed in 8795dde94e ("Initialize connectors
current mode to the mode used by KMS on startup.").
2022-10-03 12:07:10 +02:00
Simon Ser 6adca4089c backend/drm: don't unconditionally set desired_enabled
We were unconditonally setting desired_enabled = true for all
connected connectors. This makes realloc_crtcs() always keep a CRTC
active for these, even if the user doesn't want to enable them.
2022-10-03 12:04:12 +02:00
Simon Ser 651c876e79 backend/drm: fix missing wlr_output_state.allow_artifacts
Without allow_artifacts, applying the new state will fail because
it requires ALLOW_MODESET.

Fixes VT switch and disabling CRTCs.
2022-09-30 13:35:07 +02:00
Simon Ser a0345f2854 output: add wlr_output_state.allow_artifacts
When starting up, the compositor might call wlr_output_set_mode()
with a mode which is already the current one. wlroots will detect
this and make the wlr_output_set_mode() call a no-op. During the
next wlr_output_commit() call, wlroots will perform an atomic
commit without the ALLOW_MODESET flag.

This is an issue, because some drivers need ALLOW_MODESET even if
the mode is the same. For instance, if the FB stride or modifier
changed, some drivers require a modeset.

Add a new flag "allow_artifacts" which is set when the compositor
calls mode-setting functions. Use this flag to figure out whether
we want to perform atomic commits with ALLOW_MODESET.

(The name "allow_artifacts" is picked because ALLOW_MODESET is a
misnomer, see [1].)

[1]: https://patchwork.freedesktop.org/patch/505107/

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3499
2022-09-30 10:58:17 +00:00
Simon Ser 0cabc83046 backend/drm: pass through mode picture aspect ratio 2022-09-22 09:38:27 +02:00
Simon Ser 800ea7d52d backend/drm: de-duplicate wlr_drm_mode creation
Introduce a function to convert a drmModeModeInfo into a new
wlr_drm_mode.
2022-09-21 01:35:30 +00:00
vanfanel 8795dde94e Initialize connectors current mode to the mode used by KMS on startup. 2022-09-16 14:15:58 +00:00
Simon Ser 8c70245d5f output: fail commits if adaptive sync cannot be enabled
Previously, adaptive sync was just a hint and wouldn't make any
atomic commit fail if the backend didn't support it. The main reason
is wlr_output_test wasn't supported at the time.

Now that we have a way for compositors to test whether a change can
work, let's remove the exception for adaptive sync and convert it to
a regular output state field.
2022-08-30 17:53:50 +00:00
Alexander Orzechowski 8bd7170fd9 Use env helpers 2022-08-22 10:18:52 -04:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Simon Ser f244094682 backend/drm: drop enum wlr_drm_connector_status
We can just use libdrm's drmModeConnection enum instead.
2022-08-10 14:19:58 +00:00
Simon Ser 08973d2430 backend/drm: drop WLR_DRM_CONN_NEEDS_MODESET
- Add wlr_output.enabled checks to CONNECTED checks
- Replace NEEDS_MODESET with CONNECTED
2022-08-10 14:19:58 +00:00
Simon Ser 7b5e890e61 backend/drm: use drmModeConnectorGetPossibleCrtcs
This function has been merged in libdrm.

References: 3ee004ef52
2022-07-25 17:28:33 +00:00
Simon Ser bd587a7f43 backend/drm: use drmModeGetConnectorTypeName
No need to manually maintain this table now.

The wlroots names and the libdrm (= kernel) names all match.

References: 50f8d51773
2022-07-25 17:28:33 +00:00
Simon Ser 1d581656c7 backend/drm: set "max bpc" to the max
"max bpc" is a maximum value, the driver is free to choose a
smaller value depending on the bandwidth available.

Some faulty monitors misbehave with higher bpc values. We'll add
a workaround if users get hit by these in practice.

References: https://gitlab.freedesktop.org/wayland/weston/-/issues/612
2022-06-19 16:55:36 +00:00
Simon Ser 1f1c0275be backend/drm: remove unused CRTC count check
drmIsKMS already checks for this.
2022-06-19 16:48:44 +00:00
Simon Ser 1f96f388e9 backend/drm: make serial optional
The EDID 1.4 spec says that the serial number is optional:

> If this field is not used, then enter “00h, 00h, 00h, 00h”.

Leave the wlr_output.serial field NULL in that case, and hide it
from the output description.
2022-06-07 13:27:18 +00:00
Isaac Freund 2b10ae62ad
backend/drm: fix check for no-op commits
Since 6936e163b, we short-circut no-op commits as an optimization.
However, the logic in the check was slightly off.
2022-06-02 20:18:16 +02:00
Simon Ser 6936e163b5 backend/drm: short-circuit no-op commits
Some output commits (changing e.g. the output scale or transform)
don't require any change in the KMS state. Instead of going through
a KMS commit, return early. Blocking KMS commits can be expensive.
2022-06-02 11:46:31 +00:00
Simon Ser 25dd3cc0cd output: pass wlr_output_state to backend
Groundwork for the following commits. The goal is to allow users
to specify their own wlr_output_state instead of wlr_output.pending.
2022-05-30 11:34:57 +02:00
Simon Ser e646d882cf backend/drm: fetch EDID manufacturer from udev_hwdb
Maintaining our internal table up-to-date is tedious: one needs to
manually go through the PnP ID registry [1] and check whether we're
missing any entry.

udev_hwdb already has an API to fetch a manufacturer name from its
PnP ID. Use that instead.

[1]: https://uefi.org/pnp_id_list
2022-05-11 14:06:11 +00:00
Simon Ser 6c350799b2 Zero-initialize structs in init functions
Ensures there is no field left to its previous undefined value after
calling an init function.
2022-04-28 10:09:50 +02:00
Samuel Čavoj 5c17452ae0
Pass O_CLOEXEC to drmModeCreateLease calls
The lease_fd is currently being leaked to child processes

Link: https://github.com/swaywm/sway/issues/4286#issuecomment-1065987957
2022-03-13 13:28:48 +01:00
Simon Ser a15c327718 backend/drm: use drmModeFormatModifierBlobIterNext
This avoids open-coding our own logic. The resulting code is more
readable.

References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146
2021-12-14 13:21:09 +00:00
Simon Ser 36a2b19485 output: introduce wlr_output_set_name
wlroots picks names for all outputs, but it might be desirable for
compositor to override it.

For instance, Sway will use a headless output as a fallback in
case no outputs are connected. Sway wants to clearly label the
fallback output as such and label "real" headless outputs starting
from HEADLESS-1.
2021-12-09 15:46:46 +01:00
Simon Ser ef1669d33e backend/drm: always add LINEAR to supported modifiers 2021-11-26 16:40:53 +00:00
Simon Ser affe9eda57 Require INVALID for implicit format modifiers
See [1] for the motivation.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-11-26 16:40:53 +00:00
Simon Ser e656697a7d backend/drm: scan leases on uevent
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3181
2021-11-19 16:06:07 +00:00
Simon Ser 86f5ecf468 backend/drm: introduce wlr_drm_lease
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3183
2021-11-19 16:06:07 +00:00
Simon Ser e13f3f8608 backend/drm: handle per-connector hotplug events
When a connector ID is specified in a hotplug event, don't scan all
connectors. Only scan the connector that has changed.
2021-11-02 13:36:43 +01:00
Kirill Primak 2af8cc769a output: add presented flag to presentation event 2021-10-15 09:38:58 +02:00