Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 438848 - some full-screen egl apps crashes/hangs on start: QEglContext::swapBuffers(): "Bad surface (0x300D)"
Summary: some full-screen egl apps crashes/hangs on start: QEglContext::swapBuffers():...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-18 20:30 UTC by Bernd Grubert
Modified: 2014-11-10 01:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
stellarium log file (log.txt,1.47 KB, text/plain)
2012-10-18 20:30 UTC, Bernd Grubert
Details
EGL_PLATFORM=drm LIBGL_DEBUG=verbose eglinfo (eglinfo-drm,2.11 KB, text/plain)
2012-10-25 21:20 UTC, Rafał Mużyło
Details
EGL_PLATFORM=x11 LIBGL_DEBUG=verbose eglinfo (eglinfo-x11,2.38 KB, text/plain)
2012-10-25 21:20 UTC, Rafał Mużyło
Details
output of apitrace trace stellarium -o stellarium.trace iwth xz compression (stellarium.trace.xz,293.15 KB, text/plain)
2012-10-26 19:32 UTC, Bernd Grubert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Grubert 2012-10-18 20:30:51 UTC
Created attachment 326884 [details]
stellarium log file

On starting stellarium 0.11.4 it reports the error message: QEglContext::swapBuffers(): "Bad surface (0x300D)". After that, in 50% of the case the desktop is completely frozen, and I have kill stellarium from another virtual console to make the desktop useable, again.
I have started stellarium with and without the -s option and there is now difference in the behaviour. I have attached the gdb output, and the log-file, that is generated by stellarium. 

Output of gdb:
==============

LC_ALL=C gdb --args stellarium -s
GNU gdb (Gentoo 7.3.1 p2) 7.3.1
Copyright (C) 2011 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-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/stellarium...done.
(gdb) run
Starting program: /usr/bin/stellarium -s
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using default graphics system specified at build time:  raster 
[New Thread 0x7ffff01fb700 (LWP 26568)]
 ------------------------------------------------------- 
[ This is Stellarium 0.11.4 - http://www.stellarium.org ] 
[ Copyright (C) 2000-2012 Fabien Chereau et al          ] 
 ------------------------------------------------------- 
Writing log file to: "/home/bernd/.stellarium/log.txt" 
File search paths: 
  0 .  "/home/bernd/.stellarium" 
  1 .  "/usr/share/stellarium" 
Config file  "/home/bernd/.stellarium/config.ini"  does not exist. Copying the default file. 
Config file is:  "/home/bernd/.stellarium/config.ini" 
libEGL warning: failed to create a pipe screen for i965
OpenGL supported version:  "2.1 Mesa 8.0.4" 
Qt GL paint engine is:  "OpenGL" 
QEglContext::swapBuffers(): "Bad surface (0x300D)" 
QEglContext::swapBuffers(): "Bad surface (0x300D)" 
QEglContext::swapBuffers(): "Bad surface (0x300D)" 
QEglContext::swapBuffers(): "Bad surface (0x300D)" 
[New Thread 0x7fffe6ab6700 (LWP 26570)]
intel_do_flush_locked failed: Invalid argument
[Thread 0x7ffff01fb700 (LWP 26568) exited]
[Thread 0x7fffe6ab6700 (LWP 26570) exited]
[Inferior 1 (process 26562) exited with code 01]
Comment 1 Rafał Mużyło 2012-10-18 20:47:33 UTC
'emerge -1pv qt-gui qt-opengl', if you don't mind
Comment 2 Bernd Grubert 2012-10-19 05:07:41 UTC
(In reply to comment #1)
> 'emerge -1pv qt-gui qt-opengl', if you don't mind

Here is the output of 
emerge -1pv qt-gui qt-opengl:

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] x11-libs/qt-gui-4.8.2  USE="accessibility cups dbus egl exceptions gif glib mng qt3support tiff xv (-aqua) (-c++0x) -debug -gtkstyle -nas -nis -pch (-qpa) -trace -xinerama" 0 kB
[ebuild   R    ] x11-libs/qt-opengl-4.8.2  USE="egl exceptions qt3support (-aqua) (-c++0x) -debug -pch (-qpa)" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB
Comment 3 Mr. Bones. (RETIRED) gentoo-dev 2012-10-19 16:01:43 UTC
I don't think this is a stellarium bug so much as a intel video bug.
Comment 4 Rafał Mużyło 2012-10-19 16:19:46 UTC
My question was not as random as it would seem.
I've just had a similar problem with doomsday 1.9.9 (not in portage yet, but neither is quake2-yamagi, so whatever).

The solution was 'qt-gui[-egl] qt-opengl[-egl].

There is a slight problem with qt configure script, that this useflag effectively turns into sort of automagical (missing) dependency.

The script autodetects 'OpenGL support ......... yes (Desktop OpenGL)' but if egl is passed, it sets qt-opengl to use egl, while in natural detection full screen egl requires OpenGl ES, which would be detected as 'OpenGL support ......... yes (OpenGL ES 2.x)'.

The solution is most likely to pass '-opengl desktop' instead of '-opengl' for [-egl] and '-opengl es2' for [egl] (and adjust virtual/opengl dep accordingly).
Comment 5 Davide Pesavento gentoo-dev 2012-10-19 16:38:08 UTC
(In reply to comment #4)

It's gles that requires egl, not the other way around.

Desktop opengl + egl is a valid combination, at least according to the configure script, although discouraged because of bug 405989. Maybe we should just mask the egl USE flag...
Comment 6 Rafał Mużyło 2012-10-19 17:04:59 UTC
(In reply to comment #5)
> (In reply to comment #4)
> 
> It's gles that requires egl, not the other way around.
> 
> Desktop opengl + egl is a valid combination, at least according to the
> configure script, although discouraged because of bug 405989. Maybe we
> should just mask the egl USE flag...

Well, that configure script is a bit hard to read, but I suspect the issue here is that doomsday is a fullscreen app (is stellarium one too ?) and that might just change the equation a bit.
Comment 7 Davide Pesavento gentoo-dev 2012-10-19 17:35:08 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > 
> > It's gles that requires egl, not the other way around.
> > 
> > Desktop opengl + egl is a valid combination, at least according to the
> > configure script, although discouraged because of bug 405989. Maybe we
> > should just mask the egl USE flag...
> 
> Well, that configure script is a bit hard to read, but I suspect the issue
> here is that doomsday is a fullscreen app (is stellarium one too ?) and that
> might just change the equation a bit.

So what's the configuration that works for you?
Comment 8 Rafał Mużyło 2012-10-19 23:21:32 UTC
@comment 7: TBH, I'm just guessing here, as I simply rebuilt gui and opengl with [-egl] and on my x86 machine building those two takes a bit too long for to be willing to test my guess, especially that I don't think I actually needed egl support in qt.
However, I think certain portions on the script suggest the above as a correct solution.Though perhaps it would be a good idea to ask upstream to clarify what *they* except, as I can't quite find any docs talking about it.

OK, on further note: I've been playing with mesa-demos (those from git), mostly with eglinfo, eglgears_screen, eglgears_x11 and eglkms.
I can't get eglkms to work - perhaps it's a permission problem (so let's skip it).
eglgears_x11 works, but eglgears_screen fails with 'EGLUT: failed to choose a config' - that's probably due to eglChooseConfig returning 0 configs. TBH, I don't know enough about EGL to tell why.
Comment 9 Bernd Grubert 2012-10-21 15:30:59 UTC
(In reply to comment #8)
> @comment 7: TBH, I'm just guessing here, as I simply rebuilt gui and opengl
> with [-egl] and on my x86 machine building those two takes a bit too long
> for to be willing to test my guess, especially that I don't think I actually
> needed egl support in qt.
> However, I think certain portions on the script suggest the above as a
> correct solution.Though perhaps it would be a good idea to ask upstream to
> clarify what *they* except, as I can't quite find any docs talking about it.
> 
> OK, on further note: I've been playing with mesa-demos (those from git),
> mostly with eglinfo, eglgears_screen, eglgears_x11 and eglkms.
> I can't get eglkms to work - perhaps it's a permission problem (so let's
> skip it).
> eglgears_x11 works, but eglgears_screen fails with 'EGLUT: failed to choose
> a config' - that's probably due to eglChooseConfig returning 0 configs. TBH,
> I don't know enough about EGL to tell why.

I set -egl in the USE variable in make.conf and then
emerge -qvauND world
emerge --depclean
revdep-rebuild

After that stellarium works. However, if I understand the description of egl right, I loose some performance, when using OpenGL. But, at least at the moment, I'm fine with the solution.

Thanks for your help!
Comment 10 Matt Turner gentoo-dev 2012-10-25 02:35:40 UTC
Could you capture a trace with dev-util/apitrace and post an xz compressed file showing the problem?
Comment 11 Rafał Mużyło 2012-10-25 21:20:06 UTC
Created attachment 327428 [details]
EGL_PLATFORM=drm LIBGL_DEBUG=verbose eglinfo

While not really what was asked for, these two files should shed some light on the problem.
Note, that EGL_PLATFORM=drm needed to be run by root, otherwise the result was:
drm_radeon_getparam_t (RADEON_PARAM_DEVICE_ID): -13
failed to load module: /usr/lib/gbm/gbm_gallium_drm.so: cannot open shared object file: No such file or directory
eglinfo: eglInitialize failed
(on this machine, mesa was [-gallium], so there might be a problem with the ebuid/build system)

Among a few differences, one seems to stand out: for drm only supported surfaces are windows, for x11 the list is longer.
Comment 12 Rafał Mużyło 2012-10-25 21:20:56 UTC
Created attachment 327430 [details]
EGL_PLATFORM=x11 LIBGL_DEBUG=verbose eglinfo
Comment 13 Matt Turner gentoo-dev 2012-10-25 21:26:06 UTC
Does prefixing EGL_PLATFORM=x11 on the stellarium invocation fix the problem?
Comment 14 Bernd Grubert 2012-10-26 19:32:09 UTC
Created attachment 327490 [details]
output of apitrace trace stellarium -o stellarium.trace iwth xz compression
Comment 15 Matt Turner gentoo-dev 2012-10-26 20:08:07 UTC
(In reply to comment #14)
> Created attachment 327490 [details]
> output of apitrace trace stellarium -o stellarium.trace iwth xz compression

Does this trace replay anything for you? For me

$ ./eglretrace ~/Desktop/stellarium.trace 
6 glClearColor(red = 0, green = 0, blue = 0, alpha = 1)
6: warning: no current context
warning: ignoring call to unavailable function glClearColor
error: unavailable function glGetError

(I had to build eglretrace from apitrace git, since our ebuild doesn't build it for some reason)
Comment 16 Mr. Bones. (RETIRED) gentoo-dev 2013-06-03 17:54:58 UTC
re-add me if there's something I need to do with stellarium
Comment 17 Davide Pesavento gentoo-dev 2014-11-10 01:19:07 UTC
Please reopen if this is still reproducible on recent versions of qt (4.8.5 or 4.8.6), and also please answer the question in comment #15.