Commit graph

140 commits

Author SHA1 Message Date
André Silva
7ad035d1a7
cleanup 2025-11-04 22:53:29 +00:00
André Silva
4fe2d8883b
prevent double-free and use-after-free crashes during DRM backend shutdown 2025-11-04 14:13:10 +00:00
jaro
3b3d8a8bde
drm: ensure disconnect called for removed connectors (#215)
Originally disconnected monitors were not removed from hyprland
correctly and duplications were created when an external monitor was
reattached leading to invalid behavior when switching
(empty desktop is visible).

Now removed monitors are explicitly disconnected during connectors
scanning.
2025-10-07 13:44:35 +02:00
Tom Englund
81a0ddf42f rendernode: dont bother finding one on evdi
evdi/displaylink devices doesnt give us a rendernode at all, and asahi
was hard to associate if a rendernode was related to the
displaynode/card so we fallback to just first found if that occurs.
might be more appropiate to figure out a proper way to deal with these
cases then workaround ever single driver that doesnt give rendernodes
but so far seems only to be evdi.

problem that occured is a 3 gpu situation, the evdi card ended up using
a rendernode for a complete different gpu because it fallbacked to that.
2025-10-06 13:04:33 +02:00
Tom Englund
50637ed23e
drm: revert #203 and half of #202 (#204)
either there is a fd going wrong here or certain drivers just plain
fails with this. revert for now. but leave the cdrmrenderer using
rendernode.
2025-08-19 20:44:40 +01:00
Tom Englund
84d53cadf8
drmdumb: reopen displaynode (#203)
if the backends now gets a rendernode it wont call the authmagic on the
displaynode making dumb buffer creation failing on certain drivers. so
reopen it again in the creation of the CDRMDumbAllocator.
2025-08-17 20:16:10 +01:00
Tom Englund
498f46686d
renderer: use rendernode if available (#202)
* renderer: use rendernode if available

init the CDRMRenderer on the rendernode if available otherwise fallback
to the displaynode.

* backend: use rendernode if available

use rendernode if available for the backends, or fallback to display
node. make cdrmrenderer use backend fd.
2025-08-12 17:06:31 +01:00
Tom Englund
f0db9b7eed
core: introduce drmRenderNodeFD() (#193)
make a getter for drmRenderNodeFD() so we can create sync timelines on
the rendernode on devices not supporting fences on the card* device
directly.
2025-07-21 20:57:00 +02:00
Tom Englund
d04e01e70c
core: use -Wpedantic and fix warnings (#187)
* core: use -Wpedantic and fix warnings

dont use anonymous structs, iso c++ forbids it. compound literals is a
c99 thing use designated c++20 initializing instead.

* flake.lock: update

* core: rename .bits to .values

make the name more appropiate to its usage.

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-07-08 12:25:39 +02:00
Tiago Dinis
e2e3f8b4d8
drm: Avoid unnecessary modeset (fixed) (#184)
* feat: only do modeset when the mode is different from the current one

* style: remove braces around 1-line if

* fmt: run clang-format

* drm: add reset function back and remove reset from start

* drm: fix dpms on fastboot

* fmt: run clang-format

* Update Atomic.cpp
2025-07-07 16:19:52 +02:00
dd92142139
core: Use new typed signals from hyprutils (#178) 2025-06-26 23:44:32 +02:00
UjinT34
1d2dbd72c2
drm: restore hdr metadata after vt switch (#163) 2025-03-29 17:25:29 +01:00
Lee Bousfield
b058847592
backend, allocator: Fix mGPU backend + allocator swapchain combos (#159) 2025-03-16 22:52:24 +01:00
Tom Englund
b236a43699
drm: only scan connected connectors (#155)
only scan connected connectors when deciding which gpu to become primary
mux switched laptops still have connectors for internal panel but not
connected.
2025-03-04 14:58:38 +01:00
Lee Bousfield
7b5db3d8a2
drm: Add strict typing to attachment manager (#152)
* misc: Add strict typing to attachment manager

* misc: Trim down CAttachmentManager comments

* misc: Return full pointer in attachment manager
2025-03-02 22:32:33 +01:00
Lee Bousfield
09b3fd5932
drm: Fix multi-GPU support for Nvidia (#147)
* allocator: Don't force linear for multigpu if unsupported

* drm: Use an intermediate CPU buffer for blit if necessary

* drm: Add comment and cleanup style a bit

* drm: Fix formatting from comment addition

* drm: Use std::vector and std::span for intermediateBuf

* drm: Fix style and add null check

* drm: Remove TODO about pixel buf format
2025-03-02 03:07:00 +01:00
Ikalco
e62592f0f4
drm/atomic: fix atomic reset being skipped, check nullptr elsewhere instead (#149) 2025-02-27 15:21:05 +01:00
Ikalco
a3dda0d10c
drm: prioritize gpus with the most internal panels (#144) 2025-02-09 13:22:25 +01:00
Honkazel
343178ba45
core: Compiler fixes and options (#141)
* reorder ctors

* sign-compare

* Add some compile options from Hyprland
2025-02-02 13:46:00 +01:00
Ikalco
95506e561d
egl/drm: consolidate EGL init/state (#138)
* move renderer to EGLRenderer

* consolidate EGL state and initialization

* move over eglSync

* unbreak abi
2025-02-01 16:17:49 +01:00
Honkazel
4edeb99390
core: add clang-tidy (#135) 2025-01-22 22:39:30 +01:00
maround95
03677f8561
core: GPU hotplug support (#130) 2025-01-10 18:39:08 +00:00
UjinT34
c2369bc3ab
drm: Avoid excessive atomic properties updates (#95)
* do not set cursor planeProps unless smth changed

* do not skip cursor state flag setting

* drm: scan only cards and not outputs, safeguard against null renderer (#106)

* drm: dont scan card outputs

no need to scan for card[0-9]* and probe card0-eDP etc if they are kms,
bootvga and rendernodes etc. skip the wildcard and remove a unused
size_t variable.

* drm: dont commit state if renderer is missing

setting certain env vars to force egl implentations makes the render
creation fail on the second gpu. instead of causing a coredump,
safeguard commitState and let the monitor turn blank instead.

* props: bump version to 0.5.0

* drm: Validate conn before dereference in CDRMAtomicRequest::commit() (#108)

During startup, CDRMAtomicImpl::reset() may emit a call to method
commit of a CDRMAtomicRequest instance with member "conn" uninitialized,
leading to a segfault. Validate the the pointer before dereference it as
a workaround.

Fixes: 55ac962 ("DRM: preliminary atomic support")
Closes: https://github.com/hyprwm/aquamarine/issues/107

Signed-off-by: Yao Zi <ziyao@disroot.org>

* buffer: remove useless forward def

* drm: clearer flow when rescanning connectors (#113)

* consolidates into checkOutput for clearer flow when rescanning connectors

* add error log

* drm: allow multigpu blit from explicit to implicit (#114)

* version: bump to 0.5.1

* flake.lock: update

* flake.nix: gcc13 -> gcc14 (#118)

* drm: udev scan only drm_minor, not connectors (#119)

* drm: log errno set by drmModeAtomicCommit (#120)

* drm: moved null check for renderer to shouldBlit() (#109) (#121)

* drm: only fail INVALID format when enabled (#122)

* flake.lock: update

* drm: only clear buffers when fullReconfigure succeeds (#124)

* core/drm: Add HDR Support (#112)

* version: bump to 0.6.0

* drm: limit udev drm_minor to Linux after a132fa41be (#129)

Not implemented by libudev-devd yet:

[ERR] [AQ] drm: No gpus in scanGPUs.
[ERR] [AQ] drm: Found no gpus to use, cannot continue
[ERR] [AQ] DRM Backend failed

* do not set cursor planeProps unless smth changed

* test separate cursor commits

* do not change hdr blob unless asked to

* rebase

* split atomic commit processing and move hdr & colorspace into modeset

* fix wide color gamut flag & cleanup

* remove unused debug var

---------

Signed-off-by: Yao Zi <ziyao@disroot.org>
Co-authored-by: Tom Englund <tomenglund26@gmail.com>
Co-authored-by: Vaxry <vaxry@vaxry.net>
Co-authored-by: Ziyao <ziyao@disroot.org>
Co-authored-by: Ikalco <73481042+ikalco@users.noreply.github.com>
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Co-authored-by: Austin Horstman <khaneliman12@gmail.com>
Co-authored-by: Richard Henninger <56615615+richen604@users.noreply.github.com>
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
2025-01-10 18:38:51 +00:00
Jan Beich
5bc315ed56
drm: limit udev drm_minor to Linux after a132fa41be (#129)
Not implemented by libudev-devd yet:

[ERR] [AQ] drm: No gpus in scanGPUs.
[ERR] [AQ] drm: Found no gpus to use, cannot continue
[ERR] [AQ] DRM Backend failed
2025-01-07 11:35:34 +00:00
UjinT34
aeab812e0f
core/drm: Add HDR Support (#112) 2025-01-05 14:44:39 +00:00
Ikalco
5e3f6013e9
drm: only fail INVALID format when enabled (#122) 2024-12-21 23:14:38 +01:00
Richard Henninger
a23e9a9bdf
drm: moved null check for renderer to shouldBlit() (#109) (#121) 2024-12-18 16:01:56 +01:00
Ikalco
a132fa41be
drm: udev scan only drm_minor, not connectors (#119) 2024-12-17 02:58:49 +01:00
Ikalco
9fc2d8e1fb
drm: allow multigpu blit from explicit to implicit (#114) 2024-12-09 22:14:39 +01:00
Ikalco
1af9816244
drm: clearer flow when rescanning connectors (#113)
* consolidates into checkOutput for clearer flow when rescanning connectors

* add error log
2024-12-07 17:53:24 +01:00
Tom Englund
3b00e96f90
drm: scan only cards and not outputs, safeguard against null renderer (#106)
* drm: dont scan card outputs

no need to scan for card[0-9]* and probe card0-eDP etc if they are kms,
bootvga and rendernodes etc. skip the wildcard and remove a unused
size_t variable.

* drm: dont commit state if renderer is missing

setting certain env vars to force egl implentations makes the render
creation fail on the second gpu. instead of causing a coredump,
safeguard commitState and let the monitor turn blank instead.
2024-11-13 11:10:16 +00:00
Vaxry
e6c392aa2c
DRM: Add a dumb allocator (#104)
Adds a drm_dumb allocator to the DRM allocator for nvidia hw cursors.
2024-11-11 13:04:23 +00:00
Maximilian Seidler
8d732fa8af
drm: guard cursorFB buffer in restoreAfterVT (#100) 2024-10-21 17:13:19 +01:00
Ikalco
7c1322da25
drm: fix leases not having a backend attached (#97) 2024-10-14 11:36:46 +01:00
Vaxry
d352c0dd98
DRM/Output: Implement CTM support (#92)
* flake.lock: update hyprutils

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-10-07 19:40:37 +01:00
Ikalco
a8eb8ae014
drm: add AQ_NO_MODIFIERS to try to mitigate hardware limitations (#77) 2024-09-06 01:00:39 +01:00
Ikalco
dd9890d2bc
drm: allow disabling commit, even if pageFlipPending (#72) 2024-09-01 19:48:15 +02:00
865cd94f97 gbm/drm: conform to different scanout requirements for different planes
ref https://github.com/hyprwm/Hyprland/issues/7005
2024-08-31 13:52:04 +02:00
Ikalco
561f50bfae
drm: don't connect before crtcs are guaranteed (#68) 2024-08-29 15:51:04 +02:00
Tom Englund
7cc3d3179c
misc: make for loops const reference (#66)
we all like the dreams and prayers that compilers can optimize things
further with const.
2024-08-27 20:04:26 +02:00
Ikalco
abb3c81c59
drm: recheck crtcs before connecting on udev event (#65) 2024-08-26 20:36:16 +02:00
romanstingler
9a3161ad4c
drm: fix typo in schedule (#62)
Co-authored-by: Roman Stingler <roman.stingler@waterdrop.com>
2024-08-21 21:59:51 +01:00
Colt-M16A1
41d842669b
drm: request page flip events after commit (#60)
Apparently fixes stuff.
2024-08-21 20:36:34 +01:00
1c3256287c drm: verify output format in commit 2024-08-21 12:17:50 +02:00
Tom Englund
b02d4f4d72
output: avoid crashing on no crtc (#58)
dual gpus can init with no crtc and later rescan for them, however
getRenderFormats might be called before that happends and null ptr
deref, guard against it.
2024-08-20 20:10:13 +01:00
b474796cdb drm: reconfigure swapchain props after creating 2024-08-20 20:58:07 +02:00
8079098326 drm: fix crash on null crtc setCursor
ref #54
2024-08-20 18:44:18 +02:00
696a5ad4ec gbm: guard for drm renderer being present before clearing
ref #56
2024-08-19 18:26:38 +02:00
Vaxry
2bff4a4521
drm: don't schedule new frame events on disabled outputs (#52)
* drm: don't schedule new frame events on disabled outputs

* e

* test
2024-08-18 19:24:52 +01:00
2d29c86d69 drm: use modelines in vt restore 2024-08-18 20:15:46 +02:00