Title OpenGL + i915 + 1.0rc2 = SIGSEGV [workaround available]
Priority release-blocker Status open
Assigned To fluzz Keywords opengl
Linked issues Watchers fluzz

Submitted on 2019-11-07 19h19 by bircoph, last changed by jesusalva.

File name Uploaded Type Edit Remove
glxinfo bircoph, 2019-11-07.19:19:44 application/octet-stream
lspci bircoph, 2019-11-07.19:20:15 application/octet-stream
Author: bircoph Date: 2019-11-07   19h19

I've build FreedroidRPG-1.0rc2 with opengl support enabled on x86 EEEPC 1000H with ASUSTeK Computer Inc. Mobile 945GSE Express Integrated Graphics Controller (i915). When I ran freedroidRPG, I got SIGSEGV:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x0046a5c7 in safely_set_some_open_gl_flags_and_shade_model () at open_gl.c:313
#2  0x0046a669 in init_open_gl () at open_gl.c:335
#3  0x00434f40 in set_video_mode_for_open_gl () at graphics.c:718
#4  0x00435030 in init_video () at graphics.c:766
#5  0x00440303 in InitFreedroid (argc=1, argv=0xbfffdbb4) at init.c:962
#6  0x004590c4 in main (argc=1, argv=0xbfffdbb4) at main.c:153

If I run freedroidRPG without OpenGL support (-n option) it works fine.
FreedroidRPG-0.16 with OpenGL enabled also works fine.

I use mesa-19.2.2 configured with the following options:

X classic egl gbm gles2 osmesa -d3d9 -debug -dri3 -gallium -gles1 -libglvnd -llvm -lm-sensors -opencl -pax_kernel -selinux -test -unwind -vaapi -valgrind -vdpau -vulkan -vulkan-overlay -wayland -xa -xvmc ABI_MIPS="-n32 -n64 -o32" ABI_RISCV="-lp64 -lp64d" ABI_S390="-32 -64" ABI_X86="32 -64 -x32" VIDEO_CARDS="i915 intel -freedreno -i965 -iris -lima -nouveau -panfrost -r100 -r200 -r300 -r600 -radeon -radeonsi -vc4 -virgl -vivante -vmware"

and glew-2.1.0 with the following configuration:
doc -static-libs ABI_MIPS="-n32 -n64 -o32" ABI_RISCV="-lp64 -lp64d" ABI_S390="-32 -64" ABI_X86="32 -64 -x32"

My kernel is 4.19.81, glxinfo output is in the attached file glxinfo, lspci -vvv for the video card is in the lspci file.

Attached glxinfo.
Author: bircoph Date: 2019-11-07   19h20
This is the lspci file.

Attached lspci.
Author: bircoph Date: 2019-11-07   19h28
From the backtrace it can be seen, that problem is in the following block in open_gl.c:

    // Create a pixel buffer object if supported
    if (GLEW_VERSION_2_1 || GLEW_ARB_pixel_buffer_object || GLEW_EXT_pixel_buffer_object) {
        glGenBuffers(1, &pbo);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);

I tried to disable it using the following patch, since my hardware supports only OpenGL-1.4 and I assumed that maybe (just maybe) OpenGL-2.1 is required for this code to work properly:

--- freedroidrpg-1.0RC2/src/open_gl.c.orig  2019-05-12 18:03:36.000000000 +0300
+++ freedroidrpg-1.0RC2/src/open_gl.c   2019-11-07 11:46:24.199633336 +0300
@@ -309,7 +309,7 @@

    // Create a pixel buffer object if supported
-   if (GLEW_VERSION_2_1 || GLEW_ARB_pixel_buffer_object || GLEW_EXT_pixel_buffer_object) {
+   if (GLEW_VERSION_2_1 && (GLEW_ARB_pixel_buffer_object || GLEW_EXT_pixel_buffer_object)) {
        glGenBuffers(1, &pbo);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);

With this patch this part of code works fine, but it segfaults in another place:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x0052423f in safely_set_some_open_gl_flags_and_shade_model () at open_gl.c:313
#2  0x00524318 in init_open_gl () at open_gl.c:335
#3  0x00492737 in set_video_mode_for_open_gl () at graphics.c:718
#4  0x00492a66 in init_video () at graphics.c:766
#5  0x004b6430 in InitFreedroid (argc=1, argv=0xbfffdbb4) at init.c:962
#6  0x004fb67f in main (argc=1, argv=0xbfffdbb4) at main.c:153

And I see no easy way to completely disable use of shaders. I compared 0.16 and 1.0rc2 opengl code and it seems that there were no shaders at all in 0.16. Maybe they should be optionally disabled for older hardware (e.g <  OpenGL-2)?

I also considered that possibility that my OpenGL setup is broken, but another application using glew and OpenGL like scorched3d work just fine (slow of course, but without segfaults). So it is quite possible that something is amiss within the FreedroidRPG.
Author: bircoph Date: 2019-11-08   09h32
I found a workaround for this problem: in driconf on Debugging page enable stub ARB_occlusion_query support on 915/945. This correspornds to ~/.drirc:

<option name="stub_occlusion_query" value="true" />

I hope this will help to find the bug (or if this is not a bug, please add this information to the README).

Note: disabling of texture tiling indeed improves performance on such card.
Date User Action Args
2019-11-11 01:09:49jesusalvasetpriority: important -> release-blocker
nosy: + fluzz
assignedto: fluzz
2019-11-08 09:32:26bircophsettitle: OpenGL + i915 + 1.0rc2 = SIGSEGV -> OpenGL + i915 + 1.0rc2 = SIGSEGV [workaround available]
2019-11-08 09:32:06bircophsetmessages: + msg3661
2019-11-07 19:32:53bircophsetpriority: bug -> important
2019-11-07 19:28:01bircophsetmessages: + msg3659
2019-11-07 19:20:15bircophsetfiles: + lspci
messages: + msg3658
2019-11-07 19:19:45bircophcreate