i915 GPU hang on FreeBSD 13

Hi all,

My computer freezes during graphical sessions with a "GPU hang" message at least once a day:
drmn0: Resetting chip for hang on rcs0

First my graphical application freezes, then the mouse freezes, then I get a black screen with a cursor in the middle, and so far have been unable to kill X, run any commands (blindly), get back to TTY, etc. I must press the reset button and reboot.

I'm using:

uname -a

dmesg | grep Intel
Intel i7-2620M with built-in GPU

I installed via graphics/drm-kmod (tried both quarterly packages and from ports, nothing changed)

pkg which /boot/modules/i915kms.ko:
/boot/modules/i915kms.ko was installed by package drm-fbsd13-kmod-5.4.144.g20210908

My /etc/rc.conf contains the following:

kldstat shows the following are loaded:

kldstat -h -v -n i915kms shows that I am loading the following:

I have tried the advice here: https://lists.freebsd.org/pipermail/freebsd-questions/2021-May/294002.html
I.E. I tried changing kld_list="i915kms" to kld_list="drm" but this left me with a low-resolution console and desktop which I was unable to change with x11/xrandr, for example.

My /boot/loader.conf contains the following, but commenting them out in various combinations made no difference.:

The Xorg.0.log doesn't show any helpful entries after restarting, but just in case:

I believe I am using the "modesetting" driver.
cat /var/log/Xorg.0.log | grep -i modesetting:
[ 32.807] (==) Matched modesetting as autoconfigured driver 1
[ 32.808] (II) LoadModule: "modesetting"
[ 32.808] (II) Loading /usr/local/lib/xorg/modules/drivers/modesetting_drv.so
[ 32.808] (II) Module modesetting: vendor="X.Org Foundation"
[ 32.810] (II) modesetting: Driver for Modesetting Kernel Drivers: kms

Messages show the following:
cat /var/log/messages | grep -i "Oct 11 15:08:":
Oct 11 15:08:57 laptop devd[56925]: notify_clients: send() failed; dropping unresponsive client
Oct 11 15:08:57 laptop kernel: drmn0: GPU HANG: ecode 6:1:0xc3c3c3c3, in MainThread [100526], hang on rcs0
Oct 11 15:08:57 laptop kernel: drmn0: Resetting chip for hang on rcs0
Oct 11 15:08:57 laptop syslogd: last message repeated 2 times

I have read the following but it didn't help me:

I have nothing in /usr/local/etc/Xorg/xorg.conf.d/ apart from loading some fonts.

I start my graphical session with startx, and the problem persists with multiple window managers.

I have run out of ideas.
Any suggestions?
No idea how to solve this, but as a workaround you can try using xf86-video-intel instead of modesetting. That's what I use at the moment because of an other bug affecting drm-kmod.
You're right, sorry. I don't know if those bugs (the hang mentioned here as well as the suspend/resume one) are imputable to modesetting or rather to drm-kmod, but at least in my case using xf86-video-intel instead of modesetting solved it.


I would first try it with DRI 2 since the standard is DRI 3.

If it still does not work, i would create a PR in your place, after all, this problem should be solved because simply switch to older or other things is not the right solution in a long term.

Back when DXVK really was going on we had often gpu hangs which we all have reported fastly.
I never tried this but i believe this is a device option:
Section "Device"
    Identifier  "Intel Graphics"
    Driver      "modesetting"
    Option      "DRI"  "1"
OK - I will try this (first with "DRI 2" and then "DRI 1") soon and report back.

However, a new version of graphics/drm-kmod (specifically, in my case graphics/drm-fbsd13-kmod and graphics/gpu-firmware-kmod) has recently landed in the quarterly repo, so I will try this for a few days and see how that goes first.

If neither works, I will install x11-drivers/xf86-video-intel and see how that goes and then report back.
x11-drivers/xf86-video-intel has been installed on my desktop since FreeBSD 8 or 9? Present configuration:
Operating System: FreeBSD 13.0
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.2
Kernel Version: 13.0-RELEASE-p11 (64-bit)
Graphics Platform: X11
Memory: 15.9 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 3000

This box definitely has some age on it. I build using poudriere. This supposed GPU hang problem has been hanging around since FreeBSD 11.1 and presenting itself in all sorts of manners. You know, 'The hit the power button hang', 'the reboot from console hang' and finally the 'restart plasma5 from vt hang. To further complicate things these hangs sometimes appeared to occur more regularly after some inexplicable sequence or usage if you will. To be honest I feel like an Intel ninja warrior.
Below are the only changes I needed to get rid of this annoyance.
This is in/etc
As per eternal-noob's post x11-drivers/xf86-video-intel is deleted. Then something amazing happened, on first reboot my plasma5/sddm login page DID NOT FLICKER when mousing over the login rectangle. After checking logs DRI2 was enabled by default and this Sandy Bridge intel HD3000 machine has not had a single hang for a week. That has not happened in a long time.
To conclude it looks as if the newer drivers did not play well with Xorg.
Please notice that OP nickednamed has not posted since October of last year. Having noted that, I too was having similar timing problems and system deadlocks last year, while using older point releases of 13.0-RELEASE, with both the radeonkms and i915kms kernel modesetting drivers.

I suggest first upgrading to 13.0-RELEASE-p11 using freebsd-update fetch && freebsd-update install.

If that doesn't work, you might try removing all graphics configuration hints, if you now have any, from /etc/X11/xorg.conf, /etc/X11/xorg.conf.d/, /usr/local/etc/X11/xorg.conf, /usr/local/etc/X11/xorg.conf.d/, and /boot/loader.conf files and directories. I do not have a /usr/local/etc/Xorg/ directory, however, these measures, if I recall correctly, should cause the i915kms kernel modesetting driver and the modesetting video driver to be automatically loaded when X starts.

If that still doesn't work, try removing the kld_list="i915kms" directive from /etc/rc.conf, and installing the package xf86-video-intel. This should cause the "intel" video driver to be automatically loaded when X starts, instead of the more generic "modesetting" video driver.

If still no luck, you might consider upgrading to 13.1-RELEASE, especially considering that 13.0 will be end-of-life in just a few more months.
rhsbsd try graphics/drm-510-kmod with FreeBSD 13.1-RELEASE.
Is this the package that is touted as more intelligent, and sets up the driver stack based on hardware detection? Presently using graphics/drm-fbsd13-kmod-5.4.144.g20220223. Plain text cause port macros just did not work! Just checking cause really my acceleration is better now than its ever been on any version of FBSD. Also I messed up reading my logs and this driver is using 'DRI 1' by default. Three weeks and nary a tear or hang in sight.