I am testing this by running some 2D/3D graphical apps, and they all seem to behave the same. Reproducing on Thinkpad T480. Right after booting, I get good performance from those apps and htop readings are not out of the ordinary. After S3 suspend and resume, things get different. Applications show much lower performance, some becoming unusable, and htop shows up to 800% CPU usage. I'm running dwm on X11 modesetting with latest drm-kmod installed from ports. Tried resetting Xorg / powerd after resuming, but didn't help. /var/log/messages and /var/log/Xorg.0.log show no new errors after resuming.
> some 2D/3D graphical apps, Can you name one? And the exact version, please. > Thinkpad T480 What's the graphics hardware? > top shows up to 800% CPU usage. For which process(es)?
It is not caused by suspend-resume but a switching vt terminal. Try to set kern.vt.suspendswitch=0, see for details https://github.com/freebsd/drm-kmod/issues/175
(In reply to Graham Perrin from comment #1) > Can you name one? And the exact version, please. For example, the latest version of Stellarium, 23.1 stops working -- it hangs on start while eating all available CPU cycles after VT switch (which is likely the trigger, not going in and out of S3) as I've reported earlier: https://github.com/Stellarium/stellarium/issues/3145. Previous versions are immune to this bug. > What's the graphics hardware? Looking at the issue linked in comment #2 it can happen on both AMD and Intel, e.g. UHD Graphics 620 (Kaby Lake GT2) in my case.
I've got UHD Graphics 620. But anyway, what Oleksandr Kryvulia said is true, there is no longer an issue after configuring kern.vt.suspendswitch=0. Thank you!
Changed the title to reflect what this bug is really about after comment #4. Details to be found in the linked GitHub drm-kmod issue (https://github.com/freebsd/drm-kmod/issues/175).
*** Bug 266745 has been marked as a duplicate of this bug. ***
FreeBSD 13.2 FreeBSD 14.1 FreeBSD 14.2 CPU: Intel i7-4770k GPU: Intel HD Graphics 4600 Kernel module: i915kms After switching from a graphical console to another console via CTRL+ALT+F1 and back CTRL+ALT+F9, hardware graphics acceleration disappears. My post: https://forums.freebsd.org/threads/switching-between-tty-consoles-breaks-intel-hardware-acceleration-i915kms.96348/
I would also add version 13.1 to the list of versions.
FreeBSD 14.1 FreeBSD 14.2 CPU: Intel i7-4770k GPU: Intel HD Graphics 4600 Kernel module: i915kms I solved this problem with the loss of intel hardware acceleration via xorg.conf. I added "DRI" "3": /usr/local/etc/X11/xorg.conf.d/xorg.conf Section "Device" Identifier "Card0" Driver "intel" Option "DRI" "3" BusID "PCI:0:2:0" EndSection Anyone who has this problem, please check this configuration and report the results here or on the forum https://forums.freebsd.org/threads/switching-between-tty-consoles-breaks-intel-hardware-acceleration-i915kms.96348/ # pkg info | grep -i drm drm-61-kmod-6.1.92 DRM drivers modules libdrm-2.4.123,1 Direct Rendering Manager library and headers # pkg info | grep -iE 'intel|libva|vaapi' libva-2.22.0 VAAPI wrapper and dummy driver libva-intel-driver-2.4.1_3 VAAPI legacy driver for Intel GMA 4500 (Gen4) to UHD 630 (Gen9.5) libva-intel-hybrid-driver-1.0.2_3 Hybrid VP8 encoder and VP9 decoder for Intel GPUs libva-utils-2.22.0 Collection of tests and utilities for VAAPI xf86-video-intel-2.99.917.923_1,1 X.Org legacy driver for Intel integrated graphics chipsets
Created attachment 261402 [details] drm: check if fpriv is the current master of the device Short story, the attached patch should fix the problem. Long story, the issue is reproducible with the modesetting drivers in Xorg, not with the outdated xf86-video-intel or xf86-video-amdgpu. So proposing to add a section to Xorg to use "Intel" driver instead of the modesetting driver has nothing to do with the bug itself. When switching to VT, modesetting_drv calls drmDropMaster and drmGetMaster when switching back to X. Without the additional check proposed in the patch, the magic map of the real master of the device (which is Xorg) is cleaned up, programs using DRI were getting a different magic_map for a different master, and thus the magic_map of authenticated clients of the real master Xorg remains free, and so all clients get authentication error, loosing hardware acceleration. You can trace the idr_alloc/idr_find in drm_getmagic/drm_authmagic to see the problem yourself. I've tested with drm-61-kmod on amd based system Thinkpad T495 and intel one X270 (without the amdgpu or intel xorg drivers obviously, using only modesetting_drv) On FreeBSD 14.3-RELEASE PS: Linux upstream commit: 0aae5920a84469: drm: Clear up master tracking booleans
(In reply to Ali Abdallah from comment #10) Your patch fixes an issue for me on current and graphics/drm-66-kmod. Thank you!
Great Ali! Thanks.
Applied the one-liner to 66 on my Alden Lake laptop and it made no difference. Still comes back from VT with zink instead of iris with a message: failed to authenticate magic 1 failed to load driver: iris I was just sure that this would fix it. :-( Running current updated to the latest yesterday afternoon (8d51f2aba9ad).
(In reply to rkoberman from comment #13) Are you sure you installed and loaded drm.ko after applying the patch?
It works fine for me on my amd machine, no way to test on intel right now but I can't see why it wouldn't work.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8ebe065203495c6c246d0ce3c29619a11c9cf910 commit 8ebe065203495c6c246d0ce3c29619a11c9cf910 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2025-06-20 06:25:10 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2025-06-20 06:25:10 +0000 graphics/drm-66-kmod: Update to drm_v6.6.25_5 This update fixes GPU acceleration when switching to VT and back to Xorg. PR: 271995 Sponsored by: Beckhoff Automation GmbH & Co. KG graphics/drm-66-kmod/Makefile | 2 +- graphics/drm-66-kmod/Makefile.version | 2 +- graphics/drm-66-kmod/distinfo | 6 +++--- graphics/nvidia-drm-66-kmod/Makefile | 2 +- graphics/nvidia-drm-66-kmod/distinfo | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=2648f5b3b996ac77536a60f2a6012db1eb5a4349 commit 2648f5b3b996ac77536a60f2a6012db1eb5a4349 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2025-06-20 06:22:13 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2025-06-20 06:22:13 +0000 graphics/drm-515-kmod: Update to drm_v5.15.160_5 This update fixes GPU acceleration when switching to VT and back to Xorg. PR: 271995 Sponsored by: Beckhoff Automation GmbH & Co. KG graphics/drm-515-kmod/Makefile | 2 +- graphics/drm-515-kmod/Makefile.version | 2 +- graphics/drm-515-kmod/distinfo | 6 +++--- graphics/nvidia-drm-515-kmod/Makefile | 2 +- graphics/nvidia-drm-515-kmod/distinfo | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=275846acd725a3e0240e07ae88773158c4d5f29c commit 275846acd725a3e0240e07ae88773158c4d5f29c Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2025-06-20 06:23:54 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2025-06-20 06:23:54 +0000 graphics/drm-61-kmod: Update to drm_v6.1.128_4 This update fixes GPU acceleration when switching to VT and back to Xorg. PR: 271995 Sponsored by: Beckhoff Automation GmbH & Co. KG graphics/drm-61-kmod/Makefile | 2 +- graphics/drm-61-kmod/Makefile.version | 2 +- graphics/drm-61-kmod/distinfo | 6 +++--- graphics/nvidia-drm-61-kmod/Makefile | 2 +- graphics/nvidia-drm-61-kmod/distinfo | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-)
(In reply to Ali Abdallah from comment #10) > Linux upstream commit: 0aae5920a84469: drm: Clear up master tracking booleans Kudos for digging this Ali, it is huge! Posting the clickable link to aforementioned commit for some extra convenience: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0aae5920a84469
(In reply to Emmanuel Vadot from comment #15) Yes, it appears that I did, as you suggest, fail to install the patched code. I patched, built and staged, but did not install the fixed module. I'm very sorry for the error. I was just anxious to get this resolved that I built the port and rebooted.
Ali, THX!!!
- drm-510-kmod is still affected[1] (unlike drm-54-kmod) and required for FreeBSD 13.* until EOL on 2026-04-30 - Do you plan to MFH to /quarterly? May help reduce support load with new users who are unaware of this bug. [1] According to "git blame" on 5.10-lts branch the true culprit is https://github.com/freebsd/drm-kmod/commit/1f3625023b0f On newer branches it was squashed into the upstream commit.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=408bc22ceb8f1971abdb5271decf4275a7af9d8f commit 408bc22ceb8f1971abdb5271decf4275a7af9d8f Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2025-06-21 11:32:07 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2025-06-21 11:32:07 +0000 graphics/drm-510-kmod: Update to drm_v5.10.163_8 This update fixes GPU acceleration when switching to VT and back to Xorg. PR: 271995 Sponsored by: Beckhoff Automation GmbH & Co. KG graphics/drm-510-kmod/Makefile | 3 +-- graphics/drm-510-kmod/Makefile.version | 2 +- graphics/drm-510-kmod/distinfo | 6 +++--- graphics/nvidia-drm-510-kmod/Makefile | 1 + graphics/nvidia-drm-510-kmod/distinfo | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-)
As this PR is about graphics/drm-{510,515,61}-kmod, and the commit affects drm-510-kmod only, Commits for 515 and 61 kmods are missing.
> Commits for 515 and 61 kmods are missing. FreeBSD 14.2 drm-61-kmod-6.1.128.1402000_5 Build from ports, problem solved.
Just wanted to report that, for me, the problem in fact had been already fixed somehow by switching to a recent stable/14 and drm-61-kmod-6.1.128.*_5 (corresponding to tag drm_v6.1.128_3) on one of my Intel laptops that had been showing the issue, so without the patch above. So there is something else at play here. Hopefully the patch above is enough to fix all cases.
(In reply to Olivier Certner from comment #26) drm-61-kmod-6.1.128.*_5 is tracking drm_v6.1.128_4 and so have the patch for this issue.
> (snip) by switching to a recent stable/14 and drm-61-kmod-6.1.128.*_5 (snip) Correction: drm-61-kmod-6.1.128.*_4
(In reply to Emmanuel Vadot from comment #27) > drm-61-kmod-6.1.128.*_5 is tracking drm_v6.1.128_4 Yes, but I made a mistake in the package version. The corresponding DRM tag is drm_v6.1.128_3, so without the fix.