Bug 1854672 - Bug in xf86-video-intel (xorg-x11-drv-intel) prevents iris driver from working properly when DRI2 and intel DDX driver are in use
Summary: Bug in xf86-video-intel (xorg-x11-drv-intel) prevents iris driver from workin...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: xorg-x11-drv-intel
Version: 32
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Adam Jackson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-08 00:12 UTC by Tomasz Tomasik
Modified: 2021-05-25 17:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-25 17:11:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Upstream patch for xf86-video-intel (xorg-x11-drv-intel) (1.66 KB, patch)
2020-07-08 00:13 UTC, Tomasz Tomasik
no flags Details | Diff
X.Org configuration (277 bytes, text/plain)
2020-07-08 00:15 UTC, Tomasz Tomasik
no flags Details
RPM SPEC (17.50 KB, text/x-rpm-spec)
2020-07-08 00:16 UTC, Tomasz Tomasik
no flags Details
dmesg log (137 bytes, text/plain)
2020-07-08 00:17 UTC, Tomasz Tomasik
no flags Details
gdb log (3.24 KB, text/plain)
2020-07-08 00:17 UTC, Tomasz Tomasik
no flags Details
SRPM for EL6 (1.48 MB, application/x-rpm)
2020-07-08 00:20 UTC, Tomasz Tomasik
no flags Details
SRPM for EL7 (2.57 MB, application/x-rpm)
2020-07-08 00:21 UTC, Tomasz Tomasik
no flags Details
SRPM for EL8 (2.58 MB, application/x-rpm)
2020-07-08 00:21 UTC, Tomasz Tomasik
no flags Details
SRPM for FC30-FC31 (1.20 MB, application/x-rpm)
2020-07-08 00:22 UTC, Tomasz Tomasik
no flags Details
SRPM for FC32-FC33 (1.20 MB, application/x-rpm)
2020-07-08 00:22 UTC, Tomasz Tomasik
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github flatpak flatpak issues 3673 0 None open Possible incompatibility between Freedesktop's Mesa libraries and Mesa libraries or kernel driver on the host 2020-09-30 03:48:18 UTC
Github widelands widelands issues 3937 0 None open Widelands does not start on EL 7 with Mesa 20 and Intel GPU 2020-09-30 03:48:19 UTC
Gitlab freedesktop-sdk freedesktop-sdk issues 1071 0 None None None 2020-07-08 00:23:38 UTC
Red Hat Bugzilla 1854674 0 unspecified CLOSED Bug in xf86-video-intel (xorg-x11-drv-intel) prevents iris driver from working properly when DRI2 and intel DDX driver a... 2021-11-10 19:19:43 UTC
freedesktop.org Gitlab mesa mesa issues 3188#note_552650 0 None None None 2020-07-08 00:12:01 UTC

Internal Links: 1854674

Description Tomasz Tomasik 2020-07-08 00:12:01 UTC
Description of problem:
Even the simplest SDL2 applications are not able to work with the iris DRI driver, if DRI2 and the intel DDX driver is in use instead of modesetting.

Version-Release number of selected component (if applicable):
EL up to version 8
Fedora up to version 33 (Rawhide)
Basically, everything up to xorg-x11-drv-intel-2.99.917-45.20200205.fc33 is affected.
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1071#note_374809227

Steps to reproduce:
1. Configure X.Org to use DRI2 and the intel DDX driver.
2. Reboot system.
3. Log-in in any desktop environment that uses X.Org (GNOME on X.Org, GNOME Classic, MATE, etc.).
4. Run Widelands from Flathub. When it comes to Fedora, you can use the native package instead. For EL, please use the flatpak package.

X.Org configuration:
```
# cat /etc/X11/xorg.conf.d/20-intel.conf 
Section "Device"
        Identifier  "Intel"
        #Driver     "modesetting"
        Driver      "intel"
        ###
        Option      "TearFree"              "True"
        #Option     "DRI"                   "3"
        Option      "DRI"                   "2"
EndSection
```

Widelands packages:
https://flathub.org/apps/details/org.widelands.Widelands
https://github.com/scx/widelands-flatpak
https://koji.fedoraproject.org/koji/packageinfo?packageID=4332
https://copr.fedorainfracloud.org/coprs/scx/widelands

Expected results:
Run the application.

Actual results:
Crash the application.

Additional info:
https://github.com/widelands/widelands/issues/3937
https://github.com/flatpak/flatpak/issues/3673
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1071
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3188

dmesg log:
```
[  399.377617] widelands[5462]: segfault at 24 ip 00007f7d795db1dc sp 00007ffe6c3f8d30 error 6 in libgallium_dri.so[7f7d78bd6000+cfd000]
```

gdb log:
```
$ flatpak run -d --command=sh org.widelands.Widelands
[📦 org.widelands.Widelands ~]$ gdb
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file widelands
Reading symbols from widelands...
(No debugging symbols found in widelands)
(gdb) run
Starting program: /app/bin/widelands 
warning: File "/usr/lib/x86_64-linux-gnu/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
	add-auto-load-safe-path /usr/lib/x86_64-linux-gnu/libthread_db-1.0.so
line to your configuration file "/home/scx/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/scx/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
This is Widelands Version build-20 (Release)
Set home directory: /home/scx/.widelands
Adding directory: /app/share/widelands
selected language: (system language)
using locale en_US.UTF-8
[New LWP 9]
[New LWP 10]
[New LWP 11]
[New LWP 12]
Graphics: Try to set Videomode 800x600
Graphics: OpenGL: Version "4.6 (Compatibility Profile) Mesa 20.0.5"
Graphics: SDL_GL_RED_SIZE is 8
Graphics: SDL_GL_GREEN_SIZE is 8
Graphics: SDL_GL_BLUE_SIZE is 8
Graphics: SDL_GL_ALPHA_SIZE is 0
Graphics: SDL_GL_BUFFER_SIZE is 24
Graphics: SDL_GL_DOUBLEBUFFER is 1
Graphics: SDL_GL_DEPTH_SIZE is 24
Graphics: SDL_GL_STENCIL_SIZE is 8
Graphics: SDL_GL_ACCUM_RED_SIZE is 0
Graphics: SDL_GL_ACCUM_GREEN_SIZE is 0
Graphics: SDL_GL_ACCUM_BLUE_SIZE is 0
Graphics: SDL_GL_ACCUM_ALPHA_SIZE is 0
Graphics: SDL_GL_STEREO is 0
Graphics: SDL_GL_MULTISAMPLEBUFFERS is 0
Graphics: SDL_GL_MULTISAMPLESAMPLES is 0
Graphics: SDL_GL_ACCELERATED_VISUAL is 1
Graphics: SDL_GL_CONTEXT_MAJOR_VERSION is 2
Graphics: SDL_GL_CONTEXT_MINOR_VERSION is 1
Graphics: SDL_GL_CONTEXT_FLAGS is 0
Graphics: SDL_GL_CONTEXT_PROFILE_MASK is 2
Graphics: SDL_GL_SHARE_WITH_CURRENT_CONTEXT is 0
Graphics: SDL_GL_FRAMEBUFFER_SRGB_CAPABLE is 0
Graphics: OpenGL: Double buffering enabled
Graphics: OpenGL: Max texture size: 16384
Graphics: OpenGL: ShadingLanguage: "4.60"

Thread 1 "widelands" received signal SIGSEGV, Segmentation fault.
0x00007ffff3fb71dc in ?? ()
   from /usr/lib/x86_64-linux-gnu/GL/default/lib/dri/iris_dri.so
(gdb) quit
A debugging session is active.

	Inferior 1 [process 5] will be killed.

Quit anyway? (y or n) y
[📦 org.widelands.Widelands ~]$ exit
exit
```

The reason of using DRI2 and the intel DDX driver instead of modesetting:
https://github.com/flatpak/flatpak/issues/3673#issuecomment-650287489

In my opinion, it is the iris driver breaking ABI, but it seems that Intel is not interested into fixing it in Mesa. Instead, they provided fix in xf86-video-intel.
https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/commit/f2a54e256dd7539633c476a379db2b1e60eec811

Related issues:
https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/193
https://gitlab.freedesktop.org/mesa/mesa/-/issues/2845
https://gitlab.freedesktop.org/mesa/mesa/-/issues/2858
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3188

Currently, almost all Linux distributions are affected, including Fedora Rawhide and openSUSE Tumbleweed. When it comes to major Linux distributions, only Arch or Gentoo are not affected, because they tend to use the latest commit.
Although CentOS 7 doesn't provide the iris driver, it is affected as well, because Freedesktop 19.08 uses Mesa 20.x, in which iris is the default driver. This means that all current flatpak packages from Flathub are affected.

The solution is to patch xf86-video-intel in all current Linux distributions.
I've created the xorg-x11-drv-intel repo for EL 6-8 and Fedora 30-33:
https://copr.fedorainfracloud.org/coprs/scx/xorg-x11-drv-intel/

I've already tested it in RHEL 7 and Fedora 32. I can confirm it works.

SRC RPM:
https://download.copr.fedorainfracloud.org/results/scx/xorg-x11-drv-intel/fedora-32-x86_64/01524761-xorg-x11-drv-intel/xorg-x11-drv-intel-2.99.917-46.20200205.fc32.src.rpm

Full RPM SPEC:
https://download.copr.fedorainfracloud.org/results/scx/xorg-x11-drv-intel/fedora-32-x86_64/01524761-xorg-x11-drv-intel/xorg-x11-drv-intel.spec

Diff:
```
$ diff xorg-x11-drv-intel.spec.bak xorg-x11-drv-intel.spec | head -n -4
11c11
< Release:   45%{?gitrev}%{?dist}
---
> Release:   46%{?gitrev}%{?dist}
24a25,26
> # https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/commit/f2a54e256dd7539633c476a379db2b1e60eec811
> Patch10:    0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch
71a74
> %patch10 -p1 -b .dri2-iris
```

Patch ("0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"):
https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/commit/f2a54e256dd7539633c476a379db2b1e60eec811.patch

Comment 1 Tomasz Tomasik 2020-07-08 00:13:56 UTC
Created attachment 1700218 [details]
Upstream patch for xf86-video-intel (xorg-x11-drv-intel)

In mesa i915/i965 pass the bpp to use when creating the surface, but the gallium state tracker passed the depth. As it happens that BitsPerPixel(format) will do the right thing for both, use that.

Comment 2 Tomasz Tomasik 2020-07-08 00:15:42 UTC
Created attachment 1700219 [details]
X.Org configuration

X.Org configuration with DRI2 and the intel DDX driver instead of modesetting

Comment 3 Tomasz Tomasik 2020-07-08 00:16:26 UTC
Created attachment 1700220 [details]
RPM SPEC

RPM SPEC with "0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"

Comment 4 Tomasz Tomasik 2020-07-08 00:17:18 UTC
Created attachment 1700221 [details]
dmesg log

Error in libgallium_dri.so

Comment 5 Tomasz Tomasik 2020-07-08 00:17:49 UTC
Created attachment 1700223 [details]
gdb log

Error in /usr/lib/x86_64-linux-gnu/GL/default/lib/dri/iris_dri.so

Comment 6 Tomasz Tomasik 2020-07-08 00:20:41 UTC
Created attachment 1700225 [details]
SRPM for EL6

SRPM for EL6 with "0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"

Comment 7 Tomasz Tomasik 2020-07-08 00:21:08 UTC
Created attachment 1700226 [details]
SRPM for EL7

SRPM for EL7 with "0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"

Comment 8 Tomasz Tomasik 2020-07-08 00:21:38 UTC
Created attachment 1700227 [details]
SRPM for EL8

SRPM for EL8 with "0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"

Comment 9 Tomasz Tomasik 2020-07-08 00:22:28 UTC
Created attachment 1700228 [details]
SRPM for FC30-FC31

SRPM for FC30-FC31 with "0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"

Comment 10 Tomasz Tomasik 2020-07-08 00:22:57 UTC
Created attachment 1700229 [details]
SRPM for FC32-FC33

SRPM for FC32-FC33 with "0002-dri2-Interpret-DRI2ATTACH_FORMAT-as-depth-not-bpp.patch"

Comment 11 Domenico Ferrari 2020-08-24 08:23:59 UTC
I think I'm affected by this bug in Fedora 32.
I don't have problem with kernel version 5.6.19.
Kernel version from 5.7 are freezing my machine if acceleration is enabled.
See my opened bug
https://bugzilla.redhat.com/show_bug.cgi?id=1855558

I installed xorg-x11-drv-intel-2.99.917-46.20200205.fc32.x86_64 but this doesn't resolved the issue.

Is it the same bug or are they possibly related?

Comment 12 Tomasz Tomasik 2020-10-02 02:50:43 UTC
> Is it the same bug or are they possibly related?
I think it may be an another problem with the iris driver.
You can try to force use i965. However, please keep in mind that Gen12+ GPUs are supported only by iris.

At first, try this:
MESA_LOADER_DRIVER_OVERRIDE=i965 vlc
or this:
export MESA_LOADER_DRIVER_OVERRIDE=i965; vlc

If that helps, put this in ~/.drirc (user), /etc/drirc or /usr/share/drirc.d/01-i915-force-i965.conf (system):
<?xml version="1.0" standalone="yes"?>
<driconf>
    <device driver="loader" kernel_driver="i915">
        <option name="dri_driver" value="i965" />
    </device>
</driconf>

Comment 13 Domenico Ferrari 2020-11-09 11:19:12 UTC
Same problem on Fedora 33 with new kernel.

Comment 14 Domenico Ferrari 2021-02-15 13:47:02 UTC
Using kernel 5.11.0-0.rc7.149.fc34.x86_64 on Intel G3420.
So far, so good.

Comment 15 Fedora Program Management 2021-04-29 16:48:50 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 16 Ben Cotton 2021-05-25 17:11:30 UTC
Fedora 32 changed to end-of-life (EOL) status on 2021-05-25. Fedora 32 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.