iris driver is broken in Freedesktop 19.08
Even the simplest SDL2 applications are not able to work with the iris
DRI driver, if the intel
DDX driver is in use instead of modesetting
.
At first, we hit this bug with Widelands 20 (Widelands 21 from the beta
channel is affected as well):
- https://github.com/widelands/widelands/issues/3937#issuecomment-650288132
- https://github.com/flatpak/flatpak/issues/3673#issuecomment-650287489
gdb log:
Thread 1 "widelands" received signal SIGSEGV, Segmentation fault.
0x00007ffff429a726 in ?? () from /usr/lib/x86_64-linux-gnu/GL/default/lib/dri/iris_dri.so
dmesg log:
[123206.297256] widelands[21037]: segfault at a0 ip 00007f19973f2846 sp 00007fffdd3279c0 error 4 in libgallium_dri.so[7f19969ee000+cfd000]
And here you can find much more compact example (SDL2 sample app):
gdb log:
Thread 1 "gltest2" received signal SIGSEGV, Segmentation fault.
0x00007ffff630f726 in ?? () from /usr/lib/x86_64-linux-gnu/GL/default/lib/dri/iris_dri.so
dmesg log:
[123454.773720] gltest2[21982]: segfault at 24 ip 00007f94038cc1dc sp 00007ffc6492d460 error 6 in libgallium_dri.so[7f9402ec7000+cfd000]
I was able to reproduce this error in SDL1 as well. It basically freezes the app after calling glClear
:
glClear(GL_COLOR_BUFFER_BIT);
It only applies to Freedesktop 19.08 (Mesa 19.1.5 (although i965
is the preferred driver here, so we have to force iris
via the MESA_LOADER_DRIVER_OVERRIDE
variable), 20.0.5, 20.1.1).
Graphics: OpenGL: Version "3.1 Mesa 19.1.5"
Graphics: OpenGL: Version "4.6 (Compatibility Profile) Mesa 20.0.5"
Graphics: OpenGL: Version "4.6 (Compatibility Profile) Mesa 20.1.1"
Freedesktop 18.08 (Mesa 19.1.7) is not affected, but it is built without the iris
driver, so we can't even force it using MESA_LOADER_DRIVER_OVERRIDE=iris
.
Graphics: OpenGL: Version "3.1 Mesa 19.1.7"
MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri)
libGL error: failed to load driver: iris
Please keep in mind that all of these programs work fine with the i965
driver.
I believe that it can be related to the GCC version and/or some hardening/optimization flags used by Freedesktop.
Freedesktop 18.08:
- https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/freedesktop-sdk-18.08.39/elements/desktop/mesa.bst#L148
- https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/freedesktop-sdk-18.08.39/project.conf#L154
$ flatpak run --command=gcc org.freedesktop.Sdk//18.08 --version
gcc (GCC) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ flatpak run --command=cat org.freedesktop.Sdk//18.08 /etc/flatpak-builder/defaults.json
{
'libdir': '/usr/lib/x86_64-linux-gnu',
'cflags': '-march=x86-64 -mtune=generic -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection',
'cxxflags': '-march=x86-64 -mtune=generic -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection',
'cppflags': '',
'ldflags': '-L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed'
}
Freedesktop 19.08:
- https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/freedesktop-sdk-19.08.11/elements/extensions/mesa/mesa.bst#L153
- https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/freedesktop-sdk-19.08.11/include/_private/build-flags.yml#L8
flatpak run --command=gcc org.freedesktop.Sdk//19.08 --version
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ flatpak run --command=cat org.freedesktop.Sdk//19.08 /etc/flatpak-builder/defaults.json
{
'libdir': '/usr/lib/x86_64-linux-gnu',
'cflags': '-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection',
'cxxflags': '-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection',
'cppflags': '',
'ldflags': '-L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed'
}
This is the list of issues that may be related to this error:
- https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1877879
- https://bugs.freedesktop.org/show_bug.cgi?id=111376
- #1358 (closed)
See also:
Some other details:
$ flatpak-builder --run "build" "org.freedesktop.mesa-demos.yaml" "sh"
(flatpak-builder:15011): flatpak-builder-WARNING **: 01:09:40.531: rofiles-fuse not available, doing without
sh-5.0$ glxinfo -B
name of display: :99.0
display: :99 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Intel (0x8086)
Device: Mesa Intel(R) HD Graphics 630 (KBL GT2) (0x591b)
Version: 20.0.5
Accelerated: yes
Video memory: 3072MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.6
Max compat profile version: 4.6
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.5
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.5
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
sh-5.0$ MESA_LOADER_DRIVER_OVERRIDE=i965 glxinfo -B
name of display: :99.0
display: :99 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Intel Open Source Technology Center (0x8086)
Device: Mesa DRI Intel(R) HD Graphics 630 (KBL GT2) (0x591b)
Version: 20.0.5
Accelerated: yes
Video memory: 3072MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.6
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 630 (KBL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.5
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 3.0 Mesa 20.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
sh-5.0$ MESA_LOADER_DRIVER_OVERRIDE=iris glxinfo -B
name of display: :99.0
display: :99 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Intel (0x8086)
Device: Mesa Intel(R) HD Graphics 630 (KBL GT2) (0x591b)
Version: 20.0.5
Accelerated: yes
Video memory: 3072MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.6
Max compat profile version: 4.6
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.5
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.5
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
sh-5.0$ exit
exit
$ flatpak-builder --run "build" "org.freedesktop.mesa-demos.yaml" "sh"
(flatpak-builder:15644): flatpak-builder-WARNING **: 01:12:24.685: rofiles-fuse not available, doing without
sh-5.0$ eglinfo | grep -Ei '^EGL driver name: '
EGL driver name: kms_swrast
EGL driver name: iris
EGL driver name: iris
EGL driver name: iris
EGL driver name: swrast
sh-5.0$ MESA_LOADER_DRIVER_OVERRIDE=iris eglinfo | grep -Ei '^EGL driver name: '
EGL driver name: kms_swrast
EGL driver name: iris
EGL driver name: iris
EGL driver name: iris
EGL driver name: swrast
sh-5.0$ MESA_LOADER_DRIVER_OVERRIDE=i965 eglinfo | grep -Ei '^EGL driver name: '
EGL driver name: kms_swrast
EGL driver name: i965
EGL driver name: i965
EGL driver name: i965
EGL driver name: swrast
sh-5.0$ exit
exit
# lspci | grep -Ei "^[^ ]+ (VGA|2D|3D) "
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
# lshw -C display
*-display UNCLAIMED
description: 3D controller
product: GP107M [GeForce GTX 1050 Ti Mobile]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:01:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: latency=0
resources: memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff
*-display
description: VGA compatible controller
product: HD Graphics 630
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 04
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:127 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64)
Please note that I don't use the NVIDIA GPU on this system at all (neither Mesa/Nouveau, nor NVIDIA blob):
# grep -HEo '[^ ]*nouveau[^ ]*' /etc/default/grub /etc/grub2-efi.cfg /etc/sysconfig/grub
/etc/default/grub:nouveau.modeset=0
/etc/default/grub:rd.driver.blacklist=nouveau
/etc/grub2-efi.cfg:nouveau.modeset=0
/etc/grub2-efi.cfg:rd.driver.blacklist=nouveau
/etc/grub2-efi.cfg:nouveau.modeset=0
/etc/grub2-efi.cfg:rd.driver.blacklist=nouveau
/etc/grub2-efi.cfg:nouveau.modeset=0
/etc/grub2-efi.cfg:rd.driver.blacklist=nouveau
/etc/grub2-efi.cfg:nouveau.modeset=0
/etc/grub2-efi.cfg:rd.driver.blacklist=nouveau
/etc/sysconfig/grub:nouveau.modeset=0
/etc/sysconfig/grub:rd.driver.blacklist=nouveau
# uname -rv
3.10.0-1127.13.1.el7.x86_64 #1 SMP Fri Jun 12 14:34:17 EDT 2020
# grep -HR '' /etc/*release*
/etc/os-release:NAME="Red Hat Enterprise Linux Server"
/etc/os-release:VERSION="7.8 (Maipo)"
/etc/os-release:ID="rhel"
/etc/os-release:ID_LIKE="fedora"
/etc/os-release:VARIANT="Server"
/etc/os-release:VARIANT_ID="server"
/etc/os-release:VERSION_ID="7.8"
/etc/os-release:PRETTY_NAME="Red Hat Enterprise Linux"
/etc/os-release:ANSI_COLOR="0;31"
/etc/os-release:CPE_NAME="cpe:/o:redhat:enterprise_linux:7.8:GA:server"
/etc/os-release:HOME_URL="https://www.redhat.com/"
/etc/os-release:BUG_REPORT_URL="https://bugzilla.redhat.com/"
/etc/os-release:
/etc/os-release:REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
/etc/os-release:REDHAT_BUGZILLA_PRODUCT_VERSION=7.8
/etc/os-release:REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
/etc/os-release:REDHAT_SUPPORT_PRODUCT_VERSION="7.8"
/etc/redhat-release:Red Hat Enterprise Linux Server release 7.8 (Maipo)
/etc/system-release:Red Hat Enterprise Linux Server release 7.8 (Maipo)
/etc/system-release-cpe:cpe:/o:redhat:enterprise_linux:7.8:ga:server
# yum -q list marco mate-desktop xorg-x11-server-Xorg 2>/dev/null
Installed Packages
marco.x86_64 1.16.1-4.el7 @epel
mate-desktop.x86_64 1.16.2-1.el7 @epel
xorg-x11-server-Xorg.x86_64 1.20.4-10.el7 @rhel-7-server-rpms
# rpm -qi marco mate-desktop xorg-x11-server-Xorg
Name : marco
Version : 1.16.1
Release : 4.el7
Architecture: x86_64
Install Date: Sat 08 Dec 2018 04:22:42 PM CET
Group : Unspecified
Size : 5654491
License : LGPLv2+ and GPLv2+
Signature : RSA/SHA256, Sat 03 Nov 2018 07:06:27 PM CET, Key ID 6a2faea2352c64e5
Source RPM : marco-1.16.1-4.el7.src.rpm
Build Date : Sat 03 Nov 2018 05:56:46 PM CET
Build Host : buildhw-08.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://mate-desktop.org
Bug URL : https://bugz.fedoraproject.org/marco
Summary : MATE Desktop window manager
Description :
MATE Desktop window manager
Name : mate-desktop
Version : 1.16.2
Release : 1.el7
Architecture: x86_64
Install Date: Wed 31 Jan 2018 01:33:41 PM CET
Group : Unspecified
Size : 170248
License : GPLv2+ and LGPLv2+ and MIT
Signature : RSA/SHA256, Sun 26 Mar 2017 04:34:47 PM CEST, Key ID 6a2faea2352c64e5
Source RPM : mate-desktop-1.16.2-1.el7.src.rpm
Build Date : Sun 26 Mar 2017 03:30:55 PM CEST
Build Host : buildhw-04.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://mate-desktop.org
Summary : Shared code for mate-panel, mate-session, caja, etc
Description :
The mate-desktop package contains an internal library
(libmatedesktop) used to implement some portions of the MATE
desktop, and also some data files and other shared components of the
MATE user environment.
Name : xorg-x11-server-Xorg
Version : 1.20.4
Release : 10.el7
Architecture: x86_64
Install Date: Sun 05 Apr 2020 01:01:10 PM CEST
Group : User Interface/X
Size : 3765814
License : MIT
Signature : RSA/SHA256, Mon 13 Jan 2020 06:07:24 PM CET, Key ID 199e2f91fd431d51
Source RPM : xorg-x11-server-1.20.4-10.el7.src.rpm
Build Date : Fri 10 Jan 2020 04:21:38 PM CET
Build Host : x86-034.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor : Red Hat, Inc.
URL : http://www.x.org
Summary : Xorg X server
Description :
X.org X11 is an open source implementation of the X Window System. It
provides the basic low level functionality which full fledged
graphical user interfaces (GUIs) such as GNOME and KDE are designed
upon.
This is my X.Org configuration when it comes to the Intel GPU:
Section "Device"
Identifier "Intel"
#Driver "modesetting"
Driver "intel"
BusID "PCI:0:2:0"
###
Option "TearFree" "True"
#Option "DRI" "3"
Option "DRI" "2"
Option "AccelMethod" "glamor"
EndSection
Please note that a fresh installation of CentOS 7.8 is not affected, because it uses the modesetting
driver by default. However, this driver doesn't support the TearFree
option: