Switching between TTY consoles breaks Intel hardware acceleration (i915kms)

Switching between TTY consoles breaks Intel hardware acceleration (i915kms)
The problem began to be noticed on FreeBSD 13, in the spring of 2023.

FreeBSD home 14.1-BETA2 FreeBSD 14.1-BETA2 releng/14.1-n267613-e3e57ae30ca3 MYGENERIC amd64
CPU: Intel i7-4770k
GPU: Intel HD Graphics 4600
Kernel module: i915kms
Xorg, sddm
User are member of the video group.

Code:
# pkg info | grep -i drm
drm-61-kmod-6.1.92.1401000_3 DRM drivers modules
drm-kmod-20220907_3 Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-kmod-20241114,1 Firmware modules for the drm-kmod drivers
libdrm-2.4.123,1 Direct Rendering Manager library and headers

# pkg info | grep -i intel
gpu-firmware-intel-kmod-alderlake-20230625.1401000 Firmware modules for alderlake Intel GPUs
gpu-firmware-intel-kmod-broxton-20230625.1401000 Firmware modules for broxton Intel GPUs
gpu-firmware-intel-kmod-cannonlake-20230625.1401000 Firmware modules for cannonlake Intel GPUs
gpu-firmware-intel-kmod-dg1-20230625.1401000 Firmware modules for dg1 Intel GPUs
gpu-firmware-intel-kmod-dg2-20230625.1401000 Firmware modules for dg2 Intel GPUs
gpu-firmware-intel-kmod-elkhartlake-20230625.1401000 Firmware modules for elkhartlake Intel GPUs
gpu-firmware-intel-kmod-geminilake-20230625.1401000 Firmware modules for geminilake Intel GPUs
gpu-firmware-intel-kmod-icelake-20230625.1401000 Firmware modules for icelake Intel GPUs
gpu-firmware-intel-kmod-kabylake-20230625.1401000 Firmware modules for kabylake Intel GPUs
gpu-firmware-intel-kmod-rocketlake-20230625.1401000 Firmware modules for rocketlake Intel GPUs
gpu-firmware-intel-kmod-skylake-20230625.1401000 Firmware modules for skylake Intel GPUs
gpu-firmware-intel-kmod-tigerlake-20230625.1401000 Firmware modules for tigerlake Intel GPUs
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
xf86-video-intel-2.99.917.923_1,1 X.Org legacy driver for Intel integrated graphics chipsets

Code:
kern.vt.suspendswitch=0

After switching from a graphical console to another console via CTRL+ALT+F1 and back CTRL+ALT+F9, hardware graphics acceleration disappears.
Example of vainfo output before and after switching:

Before switching:
Code:
# vainfo
Trying display: wayland
Trying display: x11
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Desktop - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD

After switching:
Code:
# vainfo
Trying display: wayland
Trying display: x11
libva info: VA-API version 1.22.0
libva error: vaGetDriverNames() failed with unknown libva error
vaInitialize failed with error code -1 (unknown libva error),exit

Who knows why this happens?
Is it possible to fix this?
Thanks.
 
Or upgrade to 14.2-RELEASE


But then you wade into the whole DRM mess.

Best to wait a while on Xorg.

Maybe 14.1-RELEASE is best for now.
 
The usual answer: compile the drm package from ports.
Not a solution in this case unfortunately; I experienced this on both 14.1-RELEASE and 14.2-RELEASE (and probably even before, I don't recall since I rarely switch from Xorg to a console) with drm-kmod built from ports. The only way to re-enable hardware acceleration was to restart XDM (if OP doesn't use a login manager maybe restarting Xorg could do, but is pretty impractical in both ways).
 
Or, upgrade to 14.1-RELEASE.
Or upgrade to 14.2-RELEASE
Best to wait a while on Xorg.
The problem began to be noticed on FreeBSD 13, in the spring of 2023.

As Maxnix correctly said, restarting the graphics subsystem helps. I do one of:
1) Start - Logout. Login via user input.
2) or service sddm restart

I experienced this on both 14.1-RELEASE and 14.2-RELEASE (and probably even before)
What processor/video card do you have and what driver are you using?
 
Found a few more similar topics:

amdgpu: Acceleration disabled by VT switch
https://github.com/freebsd/drm-kmod/issues/175
2022-07-07
13.1-RELEASE

graphics/drm-510-kmod: X11 GL_RENDERER reverts to llvmpipe after waking from suspend
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266745
2022-10-01
Status: Closed DUPLICATE of bug 271995

https://github.com/freebsd/drm-kmod/issues/209
2022-10-02
13.1-RELEASE-p2

x11-wm/mutter: after graphics/mesa-* 21.3.8 -> 22.2.3 update OpenGL compositing fails on Intel Iris Pro
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267915
2022-11-22
Status: Open

graphics/drm-{510,515,61}-kmod: VT switch disables hardware acceleration
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271995
2023-06-14
Status: Open

Intermittant bug in 14.0-RELEASE DRI/crocus driver?
https://forums.freebsd.org/threads/intermittant-bug-in-14-0-release-dri-crocus-driver.91824/
2024-01-08
 
Back
Top