Bug 275899 - graphics/mesa-dri: DRI stopped working with the Intel graphics card
Summary: graphics/mesa-dri: DRI stopped working with the Intel graphics card
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:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-23 17:29 UTC by Roman Bogorodskiy
Modified: 2024-03-02 16:21 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
Xorg.0.log of ctwm startup (and termination) (29.00 KB, text/plain)
2024-01-11 15:30 UTC, marek
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Bogorodskiy freebsd_committer freebsd_triage 2023-12-23 17:29:26 UTC
The issue is that DRI using apps, started complaining about mesa. E.g.: glxgears complains on start:

MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
failed to load driver: zink

This also happens in some other apps, and also with mpv, which prints the similar error and then falls back to vo=x11.

I think it's started with 23.3.0. I've also updated once again recently, and now it's at 23.3.1, but the problem persists.

The card I have:

vgapci0@pci0:0:2:0:     class=0x030000 rev=0x0c hdr=0x00 vendor=0x8086 device=0x4692 subvendor=0x103c subdevice=0x89b5
    vendor     = 'Intel Corporation'
    device     = 'Alder Lake-S GT1 [UHD Graphics 730]'
    class      = display
    subclass   = VGA
Comment 1 marek 2024-01-11 12:00:23 UTC
I have this issue too. In my case it's enough to run emacs (from the shell command line - no X11):

~ % emacs &
[1] 92567
marek@simba:~ % MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
failed to load driver: zink

[1]    Done                          emacs
~ % 

13.2-RELEASE-p9
FreeBSD simba 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64

vgapci0@pci0:0:2:0:     class=0x030000 rev=0x09 hdr=0x00 vendor=0x8086 device=0x0166 subvendor=0x103c subdevice=0x179b
    vendor     = 'Intel Corporation'
    device     = '3rd Gen Core processor Graphics Controller'
    class      = display
    subclass   = VGA
Comment 2 Jan Beich freebsd_committer freebsd_triage 2024-01-11 12:58:11 UTC
Can you reproduce with graphics/mesa-devel? If may have an upstream fix. Otherwise, it doesn't include zink and swrast, so should fail hard instead of giving buggy experience.

Can you reproduce under x11-wm/ctwm? It doesn't have OpenGL or XRENDER compositor thus relying on very primitive framebuffer compositing built into Xorg itself.

May be related to bug 267915 i.e., mesa-dri regression before it was conflated with drm-kmod regression.
Comment 3 marek 2024-01-11 15:01:34 UTC
1. Rectification to my comment (#1): it is not true that there was no X11. It's true that I started emacs from the command line but that was from within xterm run under xming (on Windows 11).

2. After installing graphics/mesa-devel the same steps lead to the following messages:
~ % emacs &
[1] 43239
~ % MESA-LOADER: failed to open zink: Cannot open "/usr/local/lib/dri-devel/zink_dri.so" (search paths /usr/local/lib/dri-devel, suffix _dri)
failed to load driver: zink
MESA-LOADER: failed to open swrast: Cannot open "/usr/local/lib/dri-devel/swrast_dri.so" (search paths /usr/local/lib/dri-devel, suffix _dri)
failed to load driver: swrast

[1]    Done                          emacs
~ % 

3. I installed x11-wm/ctwm, but I can't seem to get it to work. I tried a simple xinit, but it seems to run twm, not ctwm (no error messages above, by the way).

4. I noticed the issue today right after pkg upgrade'ing (if I noticed correctly one of the updated packages was mesa). There was no such problem before the upgrade.
Comment 4 marek 2024-01-11 15:30:14 UTC
Created attachment 247597 [details]
Xorg.0.log of ctwm startup (and termination)
Comment 5 marek 2024-01-11 15:38:55 UTC
(In addition to marek, comment #4)
I was finally able to run ctwm (echo "exec ctwm" > ~/.xinitrc; xinit).
See the attached Xorg.0.log (I don't see any mesa-related errors in it).
Comment 6 Jan Beich freebsd_committer freebsd_triage 2024-01-11 16:39:00 UTC
Try actually running something OpenGL *under* ctwm e.g., if emacs no longer prints zink warning it'd be a new finding. The point is to check if X11 compositor sabotages regular X11 clients. For example, kwin_x11 (Plasma) or mutter (GNOME) do too much and are known sources of Xorg-specific bugs like bug 251836 or bug 253746.
Comment 7 Jan Beich freebsd_committer freebsd_triage 2024-01-12 12:18:34 UTC
Alternatively, neither comment 0 nor comment 1 provided enough details to reproduce (not even drm-*kmod version). DRI/X11 works fine on my Intel iGPU (Skylake, 0x1912) with drm-515-kmod and mesa-devel: tested Xwayland (sway-devel) and Xorg (dwm + picom or ctwm, modesetting or xf86-video-intel + SNA + DRI3). Like comment 0 I use mpv (mainly with --vo=gpu-next --gpu-api=vulkan --hwdec=vulkan) and like comment 1 I use emacs (mainly -devel and PGTK=on).
Comment 8 marek 2024-01-12 15:03:54 UTC
Regarding versions, it is (after today's upgrade):

- mesa-devel-23.3.b.3608
- mesa-dri-23.3.2
- mesa-libs-23.3.2
- drm-510-kmod-5.10.163_8
- libdrm-2.4.119,1

No error messages are diplayed when emacs and glxgears run locally (directly on FreeBSD laptop).

However, when run remotely, in an environment provided by XMING or MOBAXTERM (on Windows 11), they display the following:

~ % emacs &
[1] 59259
~ % MESA-LOADER: failed to open zink: Cannot open "/usr/local/lib/dri-devel/zink_dri.so" (search paths /usr/local/lib/dri-devel, suffix _dri)
failed to load driver: zink
MESA-LOADER: failed to open swrast: Cannot open "/usr/local/lib/dri-devel/swrast_dri.so" (search paths /usr/local/lib/dri-devel, suffix _dri)
failed to load driver: swrast

[1]    Done                          emacs

~ % glxgears &
[1] 64849
~ % MESA-LOADER: failed to open zink: Cannot open "/usr/local/lib/dri-devel/zink_dri.so" (search paths /usr/local/lib/dri-devel, suffix _dri)
failed to load driver: zink
MESA-LOADER: failed to open swrast: Cannot open "/usr/local/lib/dri-devel/swrast_dri.so" (search paths /usr/local/lib/dri-devel, suffix _dri)
failed to load driver: swrast
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
X connection to localhost:10.0 broken (explicit kill or server shutdown).

[1]    Exit 1                        glxgears
~ %
Comment 9 marek 2024-01-12 15:31:14 UTC
Don't you think it's the difference in driver modules?
You have drm-515-kmod and I have drm-510-kmod (and zink and swrast are really missing in the location stated in error messages).
Comment 10 Jan Beich freebsd_committer freebsd_triage 2024-01-12 16:25:21 UTC
(In reply to marek from comment #8)
Remove mesa-devel. It's not suitable for X11 forwarding: DRI mostly expects local GPU, otherwise falls back to swrast (llvmpipe) which mesa-devel (unlike mesa-dri) doesn't provide.
Sorry, I can't test remote X11 on my side, let alone via XMING or MOBAXTERM.

(In reply to marek from comment #9)
Unlikely. Remote X11 (except VirtualGL, WSLg) with 3D rendering (via OpenGL) instead of 2D rendering (via pixman, cairo, skia, etc) is simply not tested much. Regressions usually come from mesa-* or xorg-server updates.
Comment 11 Roman Bogorodskiy freebsd_committer freebsd_triage 2024-01-12 18:13:29 UTC
(In reply to Jan Beich from comment #7)

I have:

mesa-dri-23.3.1                OpenGL hardware acceleration drivers for DRI2+
mesa-libs-23.3.1               OpenGL libraries that support GLX and EGL clients

drm-515-kmod-5.15.118_2        DRM drivers modules
gpu-firmware-kmod-20230210_1,1 Firmware modules for the drm-kmod drivers
libdrm-2.4.118,1               Userspace interface to kernel Direct Rendering Module services

I use openbox. I haven't yet updated after reporting the issue. IIRC, I've tried mesa-devel as well but it didn't help. I think I'll update this weekend and check things again.
Comment 12 Roman Bogorodskiy freebsd_committer freebsd_triage 2024-01-12 18:17:12 UTC
(In reply to Roman Bogorodskiy from comment #11)

I forgot to mention that I'm using x11-wm/openbox:

$ cat ~/.xinitrc 
exec ssh-agent openbox-session
$
Comment 13 Emmanuel Vadot freebsd_committer freebsd_triage 2024-01-13 10:05:02 UTC
(In reply to Roman Bogorodskiy from comment #0)

It's a bit weird that it tries to use zink.
Note that I don't have any problem using x11 on my skylake or apollolake machine.

Alderlake support in 5.15 is present but afaik not really stable so I wonder if previously you didn't had gpu acceleration and since the update mesa tries to do opengl via zink for some reason and obviously it doesn't work as you also have no Vulkan.
Can you post the output of glxinfo -B please ? (pkg install mesa-demos).
Comment 14 Roman Bogorodskiy freebsd_committer freebsd_triage 2024-01-13 10:54:29 UTC
(In reply to Emmanuel Vadot from comment #13)

$ glxinfo -B
name of display: :0
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
failed to load driver: zink
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Mesa (0xffffffff)
    Device: llvmpipe (LLVM 15.0.7, 256 bits) (0xffffffff)
    Version: 23.3.1
    Accelerated: no
    Video memory: 32768MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 4.5
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 10 MB, largest block: 10 MB
    VBO free aux. memory - total: 30296 MB, largest block: 30296 MB
    Texture free memory - total: 0 MB, largest block: 0 MB
    Texture free aux. memory - total: 30296 MB, largest block: 30296 MB
    Renderbuffer free memory - total: 0 MB, largest block: 0 MB
    Renderbuffer free aux. memory - total: 30296 MB, largest block: 30296 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 531525 MB
    Total available memory: 564293 MB
    Currently available dedicated video memory: 0 MB
OpenGL vendor string: Mesa
OpenGL renderer string: llvmpipe (LLVM 15.0.7, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 23.3.1
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.3.1
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.3.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

$
Comment 15 Emmanuel Vadot freebsd_committer freebsd_triage 2024-01-13 16:52:20 UTC
Right so I think that my theory is correct, I think that you never had gpu accel and now you have this weird side effect with newer mesa that it tries to use zink to have opengl because the main opengl didn't worked.
AlderLake is better supported with drm-61-kmod but that needs -CURRENT.
Comment 16 Roman Bogorodskiy freebsd_committer freebsd_triage 2024-01-14 07:05:09 UTC
(In reply to Emmanuel Vadot from comment #15)

Yes, I think I didn't have the gpu accel too. However, I've been using the scfb driver and I *think* mpv used some more sane vo than x11 (at least it didn't print all these error messages).

I'm actually running -CURRENT, but didn't follow drm-kmod development closely. I've switched to drm-61-kmod and it appears to work fine so far.
Comment 17 Chris Wells 2024-03-02 16:21:12 UTC
I believe I'm having this problem as well, but I have an AMD Radeon RX 550. After recent  updates (a few weeks ago) on the quarterly branch, I was no longer able to launch Firefox from an XRDP session and saw the failure to load zink when launching it from a terminal. However, it launched fine locally. I also have a "guest" profile in Firefox that I use for testing that did load in the XRDP session, so I looked for preferences I'd changed in my main profile and found gfx.webrender.all:

https://wiki.mozilla.org/Platform/GFX/Quantum_Render

With that enabled, my main Firefox profile fails to load in an XRDP session. With it disabled, it loads fine. I can toggle the setting to provide output/logs, if needed. Maybe it would be helpful to see data from 1) working locally, 2) broken in XRDP, and 3) fixed in XRDP? I just need to know what information might be useful.

To start, this is my video card:

vgapci0@pci0:16:0:0:    class=0x030000 rev=0xff hdr=0x00 vendor=0x1002 device=0x67ff subvendor=0x1682 subdevice=0x9550
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Baffin [Radeon RX 550 640SP / RX 560/560X]'
    class      = display
    subclass   = VGA
    cap 09[48] = vendor (length 8)
    cap 01[50] = powerspec 3  supports D0 D1 D2 D3  current D0
    cap 10[58] = PCI-Express 2 legacy endpoint max data 256(256) RO NS
                 max read 512
                 link x8(x8) speed 2.5(8.0) ASPM disabled(L1)
    cap 05[a0] = MSI supports 1 message, 64 bit enabled with 1 message
    ecap 000b[100] = Vendor [1] ID 0001 Rev 1 Length 16
    ecap 0001[150] = AER 2 0 fatal 0 non-fatal 1 corrected
    ecap 0015[200] = Resizable BAR 1
    ecap 0019[270] = PCIe Sec 1 lane errors 0
    ecap 000f[2b0] = ATS 1
    ecap 0013[2c0] = Page Page Request 1
    ecap 001b[2d0] = Process Address Space ID 1
    ecap 0018[320] = LTR 1
    ecap 000e[328] = ARI 1
    ecap 001e[370] = L1 PM Substates 1

DRM:

pkg info | grep drm
drm-510-kmod-5.10.163_8        DRM drivers modules
drm-kmod-20220907_1            Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-kmod-20230210_1,1 Firmware modules for the drm-kmod drivers

Mesa:

pkg info | grep mesa
mesa-demos-8.4.0_3             OpenGL demos distributed with Mesa
mesa-dri-23.3.4                OpenGL hardware acceleration drivers for DRI2+
mesa-libs-23.3.4               OpenGL libraries that support GLX and EGL clients

If you believe my issue is unrelated to this one, just tell me to buzz off.