Bug 101055 - All GL programs segfault: i915_state_derived.c:calculate_vertex_layout: i915->fs == 0
Summary: All GL programs segfault: i915_state_derived.c:calculate_vertex_layout: i915-...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/i915g (show other bugs)
Version: 17.1
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
Depends on:
Reported: 2017-05-15 22:21 UTC by Karl-Johan Karlsson
Modified: 2019-09-18 19:31 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description Karl-Johan Karlsson 2017-05-15 22:21:36 UTC
I'm trying to reinstall an old laptop (Lenovo Thinkpad X60, with a Core 2 Duo CPU) with a modern Gentoo Linux, but have run into a problem where every program trying to use OpenGL segfaults immediately. This makes running e.g. KDE 5 a bit difficult. TWM works, though, so I can get X, just not OpenGL.

Here's what GDB thinks of glxgears, but every other program I've managed to debug crashes in the same way:

(gdb) run
Starting program: /usr/bin/glxgears 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.

Program received signal SIGSEGV, Segmentation fault.
calculate_vertex_layout (i915=0x616310) at /var/tmp/portage/media-libs/mesa-17.1.0/work/mesa-17.1.0/src/gallium/drivers/i915/i915_state_derived.c:72
72         for (i = 0; i < fs->info.num_inputs; i++) {
(gdb) bt
#0  calculate_vertex_layout (i915=0x616310) at /var/tmp/portage/media-libs/mesa-17.1.0/work/mesa-17.1.0/src/gallium/drivers/i915/i915_state_derived.c:72
#1  0x00007ffff41fd016 in i915_update_derived (i915=i915@entry=0x616310)
    at /var/tmp/portage/media-libs/mesa-17.1.0/work/mesa-17.1.0/src/gallium/drivers/i915/i915_state_derived.c:221
#2  0x00007ffff41ef31a in i915_clear_render (pipe=0x616310, buffers=5, color=0x7ffff7fd0b4c, depth=1, stencil=0)
    at /var/tmp/portage/media-libs/mesa-17.1.0/work/mesa-17.1.0/src/gallium/drivers/i915/i915_clear.c:254
#3  0x00007ffff3f56d71 in st_Clear (ctx=0x7ffff7fcf010, mask=18) at /var/tmp/portage/media-libs/mesa-17.1.0/work/mesa-17.1.0/src/mesa/state_tracker/st_cb_clear.c:481
#4  0x000000000040251e in draw () at glxgears.c:254
#5  0x0000000000401ce8 in draw_gears () at glxgears.c:316
#6  draw_frame (win=18874370, dpy=0x606010) at glxgears.c:341
#7  event_loop (win=18874370, dpy=0x606010) at glxgears.c:703
#8  main (argc=<optimized out>, argv=<optimized out>) at glxgears.c:798
(gdb) print fs
$1 = (const struct i915_fragment_shader *) 0x0

"fs" comes almost directly from the function argument:

   static void calculate_vertex_layout(struct i915_context *i915)
      const struct i915_fragment_shader *fs = i915->fs;

Then, in the for() loop, trying to dereference "fs" when it is a null pointer is obviously a bad thing.


~ # lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
~ # grep Chipset: /var/log/Xorg.0.log
[  4671.977] (--) intel(0): Integrated Graphics Chipset: Intel(R) 945GM
~ # grep name /proc/cpuinfo
model name      : Intel(R) Core(TM)2 CPU         T7200  @ 2.00GHz
model name      : Intel(R) Core(TM)2 CPU         T7200  @ 2.00GHz


~ # emerge --info media-libs/mesa 
Portage 2.3.5 (python 3.4.6-final-0, default/linux/amd64/13.0, gcc-6.3.0, glibc-2.24-r1, 4.11.0-gentoo x86_64)
                         System Settings
System uname: Linux-4.11.0-gentoo-x86_64-Intel-R-_Core-TM-2_CPU_T7200_@_2.00GHz-with-gentoo-2.3
KiB Mem:     3068136 total,   1191300 free
KiB Swap:    8388604 total,   8388604 free
Timestamp of repository gentoo: Mon, 15 May 2017 21:15:01 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.26.1::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.26.1::gentoo, 2.27::gentoo
sys-devel/gcc:            6.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000

    location: /usr/local/portage
    masters: gentoo
    priority: 0

    location: /var/lib/layman/torbrowser
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=native -O2 -pipe -ggdb"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe -ggdb"
EMERGE_DEFAULT_OPTS="--alphabetical --keep-going --quiet-build=n --verbose-conflicts"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nostrip parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--enable-new-dtags"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="X acl alsa amd64 berkdb bzip2 cli cracklib crypt cups cxx dbus dri egl emacs flac fortran gdbm gif iconv ipv6 jpeg kde lm_sensors modules mp3 multilib ncurses nls nptl ogg opengl openmp pam pcre png qt5 readline seccomp session ssl tcpd tiff truetype unicode vorbis x264 xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard libinput mouse wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby23 ruby24" USERLAND="GNU" VIDEO_CARDS="intel i915" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

                        Package Settings

media-libs/mesa-17.1.0::gentoo was built with the following:
USE="-bindist classic -d3d9 -debug dri3 egl gallium gbm -gles1 -gles2 llvm nptl -opencl -openmax -osmesa -pax_kernel -pic (-selinux) -unwind -vaapi -valgrind -vdpau -vulkan wayland -xa -xvmc" ABI_X86="-32 64 -x32" VIDEO_CARDS="-freedreno i915 -i965 -imx intel -nouveau -r100 -r200 -r300 -r600 -radeon -radeonsi -vc4 -vivante -vmware"
Comment 1 Emil Velikov 2017-05-15 22:49:01 UTC
Seems like you're using the i915g driver - updating the component accordingly.
As a temporary workaround, you can try the classic i915 driver?
Comment 2 Karl-Johan Karlsson 2017-05-16 16:31:22 UTC
You're right, sorry. I'm not entirely clear on the difference. I switched to the classic driver, and with that both glxgears and KDE Plasma works.
Comment 3 Frank Doepper 2017-11-02 22:13:24 UTC
Same in NixOS
Comment 4 Ilia Mirkin 2017-11-02 22:20:48 UTC
(In reply to Karl-Johan Karlsson from comment #2)
> You're right, sorry. I'm not entirely clear on the difference. I switched to
> the classic driver, and with that both glxgears and KDE Plasma works.

Clear can get called now with less state set in the driver. Many drivers weren't ready for this and had to be fixed. Looks like no one has fixed up i915g for a super-early clear call.
Comment 5 Rutger van Bergen 2017-12-17 01:52:39 UTC
I think this may relate to the problem described in this bug: https://bugs.freedesktop.org/show_bug.cgi?id=100189. It states there that the i915 Gallium driver is unmaintained, and may be removed from a future version of Mesa. 

In any case, I am running into exactly the same problem, which exposes itself by sddm-greeter crashing on startup, after a recent upgrade to  Mesa 17.1.10.
Comment 6 GitLab Migration User 2019-09-18 19:31:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/670.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.