Is accelerated graphics possible with i915kms on FreeBSD 13 and 14 [32-bit]?

I just installed FreeBSD 14.0-RELEASE i386 some days ago on a ThinkPad x201i with i3 (M 330) cpu [integrated graphics]. I did the following as Handbook suggested:

- doas pkg install xorg drm-kmod
- added
Code:
kld_list="i915kms"
on /etc/rc.conf (also tried absolute path)
- ran startx from tty as non-root user

I got:
Code:
Caught signal 6 (Abort trap). Server aborting
(xorg log)

Then I tried installing x11-drivers/xf86-video-intel, then startx, which brought up GUI desktop. I tried doas pkg install mesa-demos, then:

Code:
$ glxinfo | grep -i accel
    Accelerated: no

So there is no graphics acceleration. As far as I remember, on 12.4 on the same machine I used to get "yes". But 12.4 is going EOL soon, so running it is not an option. Is there any way to get accelerated graphics back on 14?

I don't know if it's related or not, but tried 13.2 and now on 14.0, both crashes randomly (with xf86-video-intel like above). I also found a trigger event. When I installed sysutils/hw-probe and ran doas hw-probe -min it crashes the system (and restarts).

Right now I have something like this to run in scfb mode and hoping it doesn't crash before I can finish posting this thread:

Code:
$ cat /usr/local/etc/X11/xorg.conf.d/10-driver.conf
Section "Device"
  Identifier    "Card0"
  Driver        "scfb"
EndSection

Info:

Code:
$ pciconf -lv | grep -A4
vgavgapci0@pci0:0:2:0:    class=0x030000 rev=0x02 hdr=0x00 vendor=0x8086 device=0x0046 subvendor=0x17aa subdevice=0x215a
    vendor     = 'Intel Corporation'
    device     = 'Core Processor Integrated Graphics Controller'
    class      = display
    subclass   = VGA
$ doas dmidecode -t 4
# dmidecode 3.5
Scanning /dev/mem for entry point.
SMBIOS 2.6 present.

Handle 0x0006, DMI type 4, 42 bytes
Processor Information
    Socket Designation: None
    Type: Central Processor
    Family: Other
    Manufacturer: GenuineIntel
    ID: 52 06 02 00 FF FB EB BF
    Version: Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz
    Voltage: 1.3 V
    External Clock: 133 MHz
    Max Speed: 2130 MHz
    Current Speed: 2130 MHz
    Status: Populated, Enabled
    Upgrade: None
    L1 Cache Handle: 0x000A
    L2 Cache Handle: 0x000B
    L3 Cache Handle: 0x000C
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Core Count: 2
    Core Enabled: 2
    Thread Count: 4
    Characteristics: None

$ kldstat | grep kms
 4    1 0x24200000   190000 i915kms.ko
$ grep kms /etc/rc.conf
#kld_list="i915kms"
kld_list="/boot/modules/i915kms.ko"

I tried "vesa", but it shows right half of the screen on left and left half to the right.

Won't lie, having a bad time with FreeBSD 14.
 
I tried some things and wanted to share some progress.

A) Reinstalled FreeBSD 14.0 i386 and did some things differently. It reduced the crashes.

- chose a 4gb swap partition (previously it was 2gb)
- chose mbr (previously it was gpt)
- I did not run sync as much and let FreeBSD handle it
- I ran graphics capability wanting programs less (like mpv)

I don't know if any of that contributed to the reduction of crashes. I'll have to test longer to confirm.

B) I would like to add to the issue, that mpv can't play videos. I saved these outputs before reinstalling (these are from a session without above xorg scfb config if it matters). Sharing this if it is helpful in solving it:

Code:
$ yt-dlp --format='bestvideo[height<=360]+bestaudio' --output=video.mkv https://youtube.com/watch?v=aqz-KE-bpKQ

$ mpv --no-config video.mkv
 (+) Video --vid=1 (*) (vp9 640x360 30.000fps)
 (+) Audio --aid=1 (*) (aac 6ch 48000Hz)
libEGL warning: DRI2: failed to authenticate
[vo/gpu/opengl] Suspected software renderer or indirect context.
[vo/gpu/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
WARNING: Kernel has no file descriptor comparison support: No such file or directory
Abort trap

$ ffmpeg -i video.mkv video.webm  # for testing in firefox

$ mpv --no-config video.webm
 (+) Video --vid=1 (*) (vp9 640x360 30.000fps)
 (+) Audio --aid=1 (*) (opus 6ch 48000Hz)
libEGL warning: DRI2: failed to authenticate
[vo/gpu/opengl] Suspected software renderer or indirect context.
[vo/gpu/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
WARNING: Kernel has no file descriptor comparison support: No such file or directory
Abort trap

$ doas gdb --args mpv --no-config video.mkv
GNU gdb (GDB) 13.2 [GDB v13.2 for FreeBSD]
Copyright (C) 2023 Free Software Foundation, Inc.
...
...
Reading symbols from mpv...
(No debugging symbols found in mpv)
(gdb) run
Starting program: /usr/local/bin/mpv --no-config video.mkv
[New LWP 100872 of process 30792]
[New LWP 100873 of process 30792]
[New LWP 100874 of process 30792]
[New LWP 100875 of process 30792]
[New LWP 100876 of process 30792]
[New LWP 100877 of process 30792]
[LWP 100877 of process 30792 exited]
[New LWP 100878 of process 30792]
[LWP 100878 of process 30792 exited]
[New LWP 100879 of process 30792]
[New LWP 100880 of process 30792]
 (+) Video --vid=1 (*) (vp9 640x360 30.000fps)
 (+) Audio --aid=1 (*) (aac 6ch 48000Hz)
[New LWP 100881 of process 30792]
[LWP 100881 of process 30792 exited]
[New LWP 100882 of process 30792]
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Authorization required, but no authorization protocol specified

[vo/gpu/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[New LWP 100883 of process 30792]
[New LWP 100884 of process 30792]
WARNING: Kernel has no file descriptor comparison support: No such file or directory

Thread 12 "mpv/vo" received signal SIGABRT, Aborted.
Sent by thr_kill() from pid 30792 and user 0.
[Switching to LWP 100882 of process 30792]
0x23ba7c9f in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x23ba7c9f in thr_kill () from /lib/libc.so.7
#1  0x23b2509b in raise () from /lib/libc.so.7
#2  0x23bd060b in abort () from /lib/libc.so.7
#3  0x2bad4d46 in ?? () from /usr/local/lib/dri/crocus_dri.so
#4  0x2bad298f in ?? () from /usr/local/lib/dri/crocus_dri.so
#5  0x2b317921 in ?? () from /usr/local/lib/dri/crocus_dri.so
#6  0x2afe3c3b in ?? () from /usr/local/lib/dri/crocus_dri.so
#7  0x2b00109b in ?? () from /usr/local/lib/dri/crocus_dri.so
#8  0x2ace0290 in ?? () from /usr/local/lib/dri/crocus_dri.so
#9  0x2823cb38 in ?? () from /usr/local/lib/libEGL_mesa.so.0
#10 0x28245a5a in ?? () from /usr/local/lib/libEGL_mesa.so.0
#11 0x2823e515 in ?? () from /usr/local/lib/libEGL_mesa.so.0
#12 0x2823133d in ?? () from /usr/local/lib/libEGL_mesa.so.0
#13 0x239959c9 in eglSwapBuffers () from /usr/local/lib/libEGL.so.1
#14 0x00615413 in ?? ()
#15 0x005b9917 in ?? ()
#16 0x005d932a in ?? ()
#17 0x005d7940 in ?? ()
#18 0x23a70a97 in ?? () from /lib/libthr.so.3
#19 0x00000000 in ?? ()

Surprisingly the video.webm file played without any issues on Firefox!

C) Another thing I wanted to share is that I got some older MESA ports working (not MESA Amber) so attaching this here. I tried them in the previous install and it at least played the video in mpv. I'm not good with ports and it may break things idk. Feel free to improve on it and share changes. I'm also interested in a MESA Amber port if anybody can provide that.

UPDATE1: Noticed that mesa-classic.zip had empty dirs, probably a bug in Xarchiver. I attached mesa-classic_fixed.zip with the files.
 

Attachments

  • mesa-classic.zip
    1.4 KB · Views: 56
  • mesa-classic_fixed.zip
    23 KB · Views: 46
Last edited:
You need minimum Intel Broadwell (2014) You can try with multimedia/libva-intel-driver/
mpv --hwdec=vaapi video.mp4
Looking at this wiki page i3 M330 is probably listed as "Core i3-3x0M" which is Ironlake (Arrandale) [2010]. Is there any solution for pre-Haswell hardware?

After I installed the ports above, the video plays, that's a good news. But when mpv is maximized it slows down. Better than latest mesa packages at least but not ideal.
 
libva-intel-driver (g45-h264 branch) was the solution for your hardware.
It's time for hardware upgrade. Be sure that the new laptop has support of AV1 codec hardware decoding (Intel® UHD Graphics 750 and above) or it's discrete graphics card support that codec.
 
libva-intel-driver (g45-h264 branch) was the solution for your hardware.
I already had it installed, but it didn't allow to play the video.

It's time for hardware upgrade.
I tried Void Linux i686 (they have a xfce live iso for easy testing) and it played videos fine. Even resizing player window didn't slow it down. The machine seems to be perfectly capable. Void Linux is using mesa 23.x and it works with that version. So far I can tell no old version, no amber branch. glxinfo -B showed "Accelerated: yes"

It seems the issues are on FreeBSD side only.
 
Hi qurier, I have been round this loop over the last 3 days and now have accelerated graphics working (reliably, as far as I can tell) on my X201 using 14.0-RELEASE. My machine is very similar to your X201i.

Howver there is a bug in the VT switching layer that breaks acceleration. Please see this thread https://forums.freebsd.org/threads/...se-dri-crocus-driver.91824/page-2#post-637930

The bottom line is that accelerated graphics will work if you boot your machine, start X, and then never switch to another VT. At least, I haven't found anything else that breaks it, so far anyway, only the VT switch.

If you want to use suspend-resume, then you need to set
sysctl kern.vt.suspendswitch=0
in /etc/syslog.conf
- otherwise you will find that acceleration is broken after the resume; this is because a VT switch happens by default during suspend and resume, and this setting will switch that off.

Please note I have been told that setting that sysctl can cause some problems in other areas, I don't have any details of what other problems it can cause, so I just say be aware and recommend that you test your system.

Hope this helps!

P.S. Just in case you're not familiar... VT means "virtual terminal", ie the other text consoles you can reach by pressing Ctrl-Alt-F1 thru F8.
 
The bottom line is that accelerated graphics will work if you boot your machine, start X, and then never switch to another VT.
Sadly not working for me.

After bootup I login to the tty that comes in (without switching) and then run startx. I don't usually switch to another tty if it is absolutely necessary. But the issues are there even with this style of usage (video slowdown on resize, crashes etc. which doesn't happen on Void Linux i686 as pointed above)

Although VT/tty switching creates another interesting issue. After switching and coming back to X, when I play a video it plays fullscreen, without any mpv UI, without mouse cursor. Pressing Alt+F4 or Ctrl+C doesn't work. The only way I found is to switch to a tty, login and do a pkill mpv

To test if logging in with tty is the problem I installed x11/xdm, added xdm_enable="YES" to rc.conf and rebooted. Logged in from xdm directly but it still has video slowdowns, crashes etc.

I use freebsd-ufs filesystems inside a geli container. The crash messages sometimes say "fatal trap 12", "panic: page fault" etc. (and sometimes no message at all, just reboots by itself.) I searched with some of the messages and it came up that zfs is the issue. But I don't have any zfs filesystems in my system, not even in other connected but unused storage devices. This is making FreeBSD 14 unusable for me.

It seems like the issue is deep somewhere in FreeBSD or probably in drm-kmod driver (I suspect this because I couldn't start X with "modesetting" driver, X seems to find "intel" driver automatically when x11-drivers/xf86-video-intel is installed and this is what I'm currently running it with). I wish I had the skills to find the solution.
 
I'll be interested to know whether the 32-bit version of NomadBSD succeeds.

 
Yes I had that same full screen lockout with mpv, when the DRI driver was wraster and modesetting was used.

So the thing that's strange is that you aren't able to get the modesetting driver to even run.

So, hang on though... are you really running the 32-bit code, ie the i386 build? If so I would definitely try the 64-bit version, since your cpu is a 64-bit cpu. The iso image you need to install for 64-bit is FreeBSD-14.0-RELEASE-amd64-dvd1.iso. I don't think the i386 image is the correct one for your machine, if that is what you are using. We have the same CPU, just slightly different clock speed and cache, and I am definitely running amd64 on my box.

If you open a terminal and type the command "uname -m", what does it say? It should say 'amd64', but if it says 'i386' then I think you need to install the amd64 version.
 
You i3-330M CPU spec is here:-


Notice halfway down the page it says the instruction set is 64-bit, meaning it's a 64-bit cpu, ie it uses the amd64 instruction set. So you need to install the amd64 .iso image, if you are not running that.
 
Check OP's hardware specs in the Opening Post of this thread, balanga ...
I have a ThinkPad X201 and amd64 works fine on it.

The only ThinkPads I have which won't work with amd64 are my X21, X41 T60 and various T4x all of which are 32bit.

I'm quite happy with my X201, but don' t have it with me to check its spec at the moment.
 
Same here, X201 working with amd64; the X201i is an identical machine except for a slightly lower performance CPU, and of course a lower price point.
 
Same here, X201 working with amd64; the X201i is an identical machine except for a slightly lower performance CPU, and of course a lower price point.

I have its predecessor X200, Core2Duo 2.4GHz, amd64; introduced over 2 years earlier than the first i3, all of which are amd64.

My IBM T23 was a Pentium 3-M 1133MHz "686-class" i386; ~6 times slower than my X200 on raw number-crunching jobs, even using only one X200 core.
 
I'm guessing that there would be no difference in performance between amd64 and i386..
Well, you won't be able to address so much memory with the 32-bit version, for a start, but that won't affect it if he's got <= 4GB RAM... and of course depending on what it's running. I've got 8GB RAM in mine which gives it a nice big filesystem cache.
 
I just installed FreeBSD 14.0-RELEASE i386 some days ago on a ThinkPad x201i with i3 (M 330) cpu [integrated graphics].

I'm going to be more direct: until you've installed the right amd64 version of the OS, we can't tell if your problems are not due to, for example, some incompatibility between the video drivers and the i386 code, as everyone else who can run amd64 is doing so.

A) Reinstalled FreeBSD 14.0 i386 and did some things differently. It reduced the crashes.

You haven't said why you installed the 32-bit version?

Hi qurier, I have been round this loop over the last 3 days and now have accelerated graphics working (reliably, as far as I can tell) on my X201 using 14.0-RELEASE. My machine is very similar to your X201i.

That's post #7 above; suggest you read it thoroughly.

It seems like the issue is deep somewhere in FreeBSD or probably in drm-kmod driver

Or the interaction of it with the 32-bit code? You've nothing to lose by installing amd64, so you'll be on the same page as others with similar kit.

So, hang on though... are you really running the 32-bit code, ie the i386 build? If so I would definitely try the 64-bit version, since your cpu is a 64-bit cpu. The iso image you need to install for 64-bit is FreeBSD-14.0-RELEASE-amd64-dvd1.iso. I don't think the i386 image is the correct one for your machine, if that is what you are using. We have the same CPU, just slightly different clock speed and cache, and I am definitely running amd64 on my box.

Just so. Please try that next, in conjunction with related advice about avoiding VT switching after running startx and setting the sysctl as a workaround.
 
A gentle reminder, to check what you have got installed now, just run "uname -m". If it doesn't say 'amd64', then you need to install the amd64 .iso image.
 
Thanks for helping me on this. Sorry for late reply.

Notice halfway down the page it says the instruction set is 64-bit, meaning it's a 64-bit cpu, ie it uses the amd64 instruction set. So you need to install the amd64 .iso image, if you are not running that.
I used the installation a bit. Will have to backup and reinstall FreeBSD 14 amd64. It may take some time. Will report if I get any success. But I really want to run 32-bit version for my other machine which is an Intel Atom machine. Very low power (1 hr backup on the original decade-old battery) and good enough for running a local server. I'm trying this out on this ThinkPad first to see if everything works for me.

I don't see operator in there... Sometimes, membership in that group is needed to query devices listed in /dev/, iirc.

Good point. I added my user to operator group with pw group mod operator -m $USER. Then did pkg unlock mesa-dri; pkg unlock mesa-libs, ran an update and those packages were installed from repo to version 23.3.2; commented all lines on custom xorg conf (file mentioned in first post), booted into GENERIC kernel. To summerize I tried to be as close to default setup as possible. When I ran startx and ran tried glxinfo it shows:

Code:
$ glxinfo -B | grep -i accel
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
failed to load driver: zink
    Accelerated: no
$ groups
user wheel operator video network

So still no acceleration.
 
In the meanwhile though,

a) I had a Devuan 32-bit (Testing) install running on the same machine (I ruined it during an update and no longer working), in which I ran xdriinfo and it said something like "Screen 0: crocus". On Void Linux i686 live I did sudo xbps-install -Su xdriinfo and then xdriinfo; also did the same to install glxinfo package and ran it, results are below:

Code:
$ glxinfo -B
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics (ILK) (0x46)
    Version: 23.1.3
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: compat (0x2)
    Max core profile version: 0.0
    Max compat profile version: 2.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 2.0
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics (ILK)
OpenGL version string: 2.1 Mesa 23.1.3
OpenGL shading language version string: 1.20

OpenGL ES profile version string: OpenGL ES 2.0 Mesa 23.1.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

$ xdriinfo
Screen 0: crocus

On FreeBSD 14 i386 (with mesa-dri, mesa-libs from repo + x11-drivers/xf86-video-intel installed) I get:

Code:
$ xdriinfo
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
failed to load driver: zink
Screen 0: swrast

With my mesa-classic ports (shared above) I think I got "Screen 0: i965" but not crocus. I tried to set
Code:
Option "DRI" "crocus"
on the custom xorg conf. If I remember correctly it crashes. Perhaps being able to get crocus to work will make acceleration work?

b) Tried with pae kernel:

- When I booted to the pae kernel, it started showing glitches on screen sometimes, for example, when I load firefox.
- I added "vm.pmap.pae_mode=0" in loader.conf and it got rid of those glitches, but now (i) mesa is not working. so thinking of building mesa-classic ports that I posted above with pae support (but not sure if I have to do something specific to get pae version or just build). (ii) Another issue is that after some time of use, firefox shows no caption on tabs and webpage area becomes slow to respond. Otherwise, the random crashes have stopped. If I can get mesa-classic ports to work in any way, it will be at least usable.
 
Back
Top