Bug 271995 - graphics/drm-{510,515,61}-kmod: VT switch disables hardware acceleration
Summary: graphics/drm-{510,515,61}-kmod: VT switch disables hardware acceleration
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL: https://github.com/freebsd/drm-kmod/i...
Keywords: needs-qa, performance
: 266745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-06-14 17:37 UTC by brtastic.dev
Modified: 2025-01-16 09:01 UTC (History)
13 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brtastic.dev 2023-06-14 17:37:31 UTC
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.
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2023-06-14 23:27:58 UTC
> 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)?
Comment 2 Oleksandr Kryvulia 2023-06-15 05:48:30 UTC
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
Comment 3 Alexey Dokuchaev freebsd_committer freebsd_triage 2023-06-15 07:48:23 UTC
(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.
Comment 4 brtastic.dev 2023-06-25 05:10:08 UTC
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!
Comment 5 Olivier Certner freebsd_committer freebsd_triage 2024-09-02 20:54:22 UTC
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).
Comment 6 Alexey Dokuchaev freebsd_committer freebsd_triage 2024-10-07 15:15:05 UTC
*** Bug 266745 has been marked as a duplicate of this bug. ***
Comment 7 Vurefozu 2025-01-07 12:35:51 UTC
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/
Comment 8 JBrown 2025-01-08 17:02:46 UTC
I would also add version 13.1 to the list of versions.
Comment 9 Vurefozu 2025-01-16 09:01:07 UTC
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