Bug 324255 - glXCreateContextAttribsARB returns invalid non NULL context
Summary: glXCreateContextAttribsARB returns invalid non NULL context
Status: RESOLVED DUPLICATE of bug 327310
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 4.11.2
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2013-08-30 07:29 UTC by Γιώργος Κυλάφας (Giorgos Kylafas)
Modified: 2013-11-19 15:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
thomas.luebking: Mesa+
thomas.luebking: nouveau-


Attachments
kwin supportInformation with OpenGL 1.2 (5.28 KB, text/plain)
2013-09-02 15:20 UTC, Γιώργος Κυλάφας (Giorgos Kylafas)
Details
kwin supportInformation with OpenGL 2.0 (5.28 KB, text/plain)
2013-09-02 15:21 UTC, Γιώργος Κυλάφας (Giorgos Kylafas)
Details
kwin supportInformation with OpenGL 3.1 (3.01 KB, text/plain)
2013-09-02 15:21 UTC, Γιώργος Κυλάφας (Giorgos Kylafas)
Details
kwin supportInformation with XRender (4.66 KB, text/plain)
2013-09-02 15:22 UTC, Γιώργος Κυλάφας (Giorgos Kylafas)
Details
kwin --replace output (2.03 KB, text/plain)
2013-09-02 15:29 UTC, Γιώργος Κυλάφας (Giorgos Kylafas)
Details
New crash information added by DrKonqi (7.43 KB, text/plain)
2013-10-03 19:46 UTC, Diego
Details
glxinfo for my Intel card with Mesa 9.2 (8.58 KB, text/plain)
2013-10-03 20:07 UTC, Diego
Details
Patch to print what context is created (1.94 KB, patch)
2013-10-07 21:50 UTC, Thomas Lübking
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Γιώργος Κυλάφας (Giorgos Kylafas) 2013-08-30 07:29:12 UTC
Application: kwin (4.11.00)
KDE Platform Version: 4.11.00
Qt Version: 4.8.4
Operating System: Linux 3.8.0-30-generic x86_64
Distribution: Ubuntu 13.04

-- Information about the crash:
- What I was doing when the application crashed:
I had just updated kwin from 4.10.5 to 4.11.0 (kubuntu packages for 13.04) and rebooted the computer.
Kwin crashed and after its auto restart, the contents and the decorations of the windows were almost wholy invisible. They were made somewhat visible if I hovered the mouse over the window elements, however they were made invisible again as soon as I moved the window.

- Custom settings of the application:
I saw in systemsettings that the rendering type was "OpenGL 2.0". I switched it to "OpenGL 1.2" and the problems have been fixed AFAICT.

My graphics card is an nVidia and the X driver is "nouveau".

$ sudo lshw -class display
  *-display               
       description: VGA compatible controller
       product: G73 [GeForce 7600 GT]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nouveau latency=0
       resources: irq:16 memory:f8000000-f8ffffff memory:e0000000-efffffff memory:f9000000-f9ffffff ioport:df00(size=128) memory:fa000000-fa01ffff

The crash can be reproduced every time.

-- Backtrace:
Application: KWin (kwin), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f094a6b87c0 (LWP 9564))]

Thread 2 (Thread 0x7f091fdbc700 (LWP 9603)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f0949083b27 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#2  0x00007f0949083b59 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#3  0x00007f0941a41f8e in start_thread (arg=0x7f091fdbc700) at pthread_create.c:311
#4  0x00007f0949e8de1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 1 (Thread 0x7f094a6b87c0 (LWP 9564)):
[KCrash Handler]
#6  0x00007f0949dcb037 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#7  0x00007f0949dce698 in __GI_abort () at abort.c:90
#8  0x00007f0949dc3e03 in __assert_fail_base (fmt=0x7f0949f1a578 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f0947d18bd8 "!xcb_xlib_threads_sequence_lost", file=file@entry=0x7f0947d18e92 "../../src/xcb_io.c", line=line@entry=274, function=function@entry=0x7f0947d18fb8 <__PRETTY_FUNCTION__.14347> "poll_for_event") at assert.c:92
#9  0x00007f0949dc3eb2 in __GI___assert_fail (assertion=assertion@entry=0x7f0947d18bd8 "!xcb_xlib_threads_sequence_lost", file=file@entry=0x7f0947d18e92 "../../src/xcb_io.c", line=line@entry=274, function=function@entry=0x7f0947d18fb8 <__PRETTY_FUNCTION__.14347> "poll_for_event") at assert.c:101
#10 0x00007f0947ca7ae9 in poll_for_event (dpy=dpy@entry=0xc0f890) at ../../src/xcb_io.c:271
#11 0x00007f0947ca7b01 in poll_for_response (dpy=dpy@entry=0xc0f890) at ../../src/xcb_io.c:289
#12 0x00007f0947ca806d in _XEventsQueued (dpy=0xc0f890, mode=mode@entry=1) at ../../src/xcb_io.c:363
#13 0x00007f0947ca80c3 in _XFlush (dpy=<optimized out>) at ../../src/xcb_io.c:514
#14 0x00007f0947caacc5 in _XGetRequest (dpy=dpy@entry=0xc0f890, type=type@entry=5 '\005', len=len@entry=20) at ../../src/XlibInt.c:1971
#15 0x00007f0944d46de7 in DRI2GetBuffersWithFormat (dpy=0xc0f890, drawable=96476058, width=width@entry=0xfca778, height=height@entry=0xfca77c, attachments=0x7fff9ca9fd20, count=1, outCount=outCount@entry=0x7fff9ca9fd0c) at dri2.c:476
#16 0x00007f0944d4460c in dri2GetBuffersWithFormat (driDrawable=<optimized out>, width=0xfca778, height=0xfca77c, attachments=<optimized out>, count=<optimized out>, out_count=0x7fff9ca9fd0c, loaderPrivate=0x1264190) at dri2_glx.c:893
#17 0x00007f092c20e589 in dri2_drawable_get_buffers (count=<synthetic pointer>, atts=0x112a830, drawable=0x1230af0) at dri2.c:151
#18 dri2_allocate_textures (drawable=0x1230af0, statts=0x112a830, statts_count=1) at dri2.c:402
#19 0x00007f092c20d325 in dri_st_framebuffer_validate (stfbi=<optimized out>, statts=0x112a830, count=1, out=0x7fff9ca9fe50) at dri_drawable.c:81
#20 0x00007f0926da7006 in st_framebuffer_validate (stfb=0x112a3f0, st=0x115f830, st=0x115f830) at ../../../../../src/mesa/state_tracker/st_manager.c:195
#21 0x00007f0926da8243 in st_api_make_current (stapi=<optimized out>, stctxi=0x115f830, stdrawi=<optimized out>, streadi=<optimized out>) at ../../../../../src/mesa/state_tracker/st_manager.c:738
#22 0x00007f092c20ca3a in dri_make_current (cPriv=<optimized out>, driDrawPriv=0xfca750, driReadPriv=0xfca750) at dri_context.c:249
#23 0x00007f092c209616 in driBindContext (pcp=<optimized out>, pdp=<optimized out>, prp=<optimized out>) at ../../../../../../src/mesa/drivers/dri/common/dri_util.c:382
#24 0x00007f0944d45d1f in dri2_bind_context (context=0xd7e6e0, old=<optimized out>, draw=<optimized out>, read=<optimized out>) at dri2_glx.c:172
#25 0x00007f0944d1e5a6 in MakeContextCurrent (dpy=0xc0f890, draw=96476059, read=96476059, gc_user=0xd7e6e0) at glxcurrent.c:269
#26 0x00007f094a240061 in KWin::GlxBackend::initRenderingContext (this=this@entry=0xd6a290) at ../../kwin/glxbackend.cpp:207
#27 0x00007f094a2413cd in KWin::GlxBackend::init (this=0xd6a290) at ../../kwin/glxbackend.cpp:91
#28 0x00007f094a23e14c in KWin::SceneOpenGL::createScene () at ../../kwin/scene_opengl.cpp:199
#29 0x00007f094a21fd75 in KWin::Compositor::slotCompositingOptionsInitialized (this=0xdd36f0) at ../../kwin/composite.cpp:202
#30 0x00007f094427e0ef in QMetaObject::activate (sender=0x12f6090, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3539
#31 0x00007f094415d577 in QFutureWatcherBase::event (this=<optimized out>, event=0x7f09280024d0) at concurrent/qfuturewatcher.cpp:344
#32 0x00007f094360f8ec in QApplicationPrivate::notify_helper (this=this@entry=0xbfc250, receiver=receiver@entry=0x12f6090, e=e@entry=0x7f09280024d0) at kernel/qapplication.cpp:4567
#33 0x00007f094361225b in QApplication::notify (this=this@entry=0x7fff9caa0ff0, receiver=receiver@entry=0x12f6090, e=e@entry=0x7f09280024d0) at kernel/qapplication.cpp:4428
#34 0x00007f0948ae4916 in KApplication::notify (this=0x7fff9caa0ff0, receiver=0x12f6090, event=0x7f09280024d0) at ../../kdeui/kernel/kapplication.cpp:311
#35 0x00007f094426963e in QCoreApplication::notifyInternal (this=0x7fff9caa0ff0, receiver=receiver@entry=0x12f6090, event=event@entry=0x7f09280024d0) at kernel/qcoreapplication.cpp:946
#36 0x00007f094426d171 in sendEvent (event=0x7f09280024d0, receiver=0x12f6090) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#37 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0xb7f1f0) at kernel/qcoreapplication.cpp:1570
#38 0x00007f094426d4a3 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1463
#39 0x00007f09436b598c in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#40 QEventDispatcherX11::processEvents (this=0xb80ad0, flags=...) at kernel/qeventdispatcher_x11.cpp:75
#41 0x00007f094426838f in QEventLoop::processEvents (this=this@entry=0x7fff9caa0d00, flags=...) at kernel/qeventloop.cpp:149
#42 0x00007f0944268618 in QEventLoop::exec (this=this@entry=0x7fff9caa0d00, flags=...) at kernel/qeventloop.cpp:204
#43 0x00007f094426dcf6 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#44 0x00007f094360dffc in QApplication::exec () at kernel/qapplication.cpp:3828
#45 0x00007f094a1d7703 in kdemain (argc=2, argv=0x7fff9caa1138) at ../../kwin/main.cpp:589
#46 0x00007f0949db5ea5 in __libc_start_main (main=0x4006d0 <main(int, char**)>, argc=2, ubp_av=0x7fff9caa1138, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff9caa1128) at libc-start.c:260
#47 0x0000000000400701 in _start ()

Possible duplicates by query: bug 315521, bug 313655, bug 311955, bug 309626, bug 308195.

Reported using DrKonqi
Comment 1 Thomas Lübking 2013-08-30 20:31:46 UTC
This are two bugs for one.

1st a crash:
-----------
This looks like a threading issue, but just to rule that out: do you have a program called "bleachbit" installed?

2nd a GL issue (?) causing "invisible" (black?) textures:
---------------------------------------------------------
Please provide the ouput of "qdbus org.kde.kwin /KWin supportInformation" (With problematic settings, eg. prepend "sleep 30;" to get yourself 30s seconds to change settings before the command fires. Shift+Alt+F12 allows you to toggle the compositor on/off anytime)
Also ensure to enable (1212) KWin in "kdebugdialog" and run "kwin --replace &" from konsole and watch out for GL errors/warnings.

You'll get (much) more GL debug information by "export LIBGL_DEBUG=1", resp. "export LIBGL_DEBUG=verbose"
Comment 2 Γιώργος Κυλάφας (Giorgos Kylafas) 2013-09-02 15:20:01 UTC
Created attachment 82113 [details]
kwin supportInformation with OpenGL 1.2
Comment 3 Γιώργος Κυλάφας (Giorgos Kylafas) 2013-09-02 15:21:23 UTC
Created attachment 82114 [details]
kwin supportInformation with OpenGL 2.0
Comment 4 Γιώργος Κυλάφας (Giorgos Kylafas) 2013-09-02 15:21:47 UTC
Created attachment 82115 [details]
kwin supportInformation with OpenGL 3.1
Comment 5 Γιώργος Κυλάφας (Giorgos Kylafas) 2013-09-02 15:22:10 UTC
Created attachment 82116 [details]
kwin supportInformation with XRender
Comment 6 Γιώργος Κυλάφας (Giorgos Kylafas) 2013-09-02 15:29:15 UTC
Created attachment 82117 [details]
kwin --replace output
Comment 7 Thomas Lübking 2013-09-02 21:47:19 UTC
> Screens
> =======
> Multi-Head: no
> Number of Screens: 2
> Screen 0 Geometry: 0,0,1920x1080
> Screen 1 Geometry: 1920,0,1920x1080

Does it only happen with one screen?

> Compositing
> ===========
> Qt Graphics System: native

Does it happen with the raster graphicssystem?

> Currently Active Effects:
> -------------------------
> kwin4_effect_blur

Does it happen with blurring disabled?
Comment 8 Γιώργος Κυλάφας (Giorgos Kylafas) 2013-09-03 15:33:15 UTC
(In reply to comment #7)
> > Screens
> > =======
> > Multi-Head: no
> > Number of Screens: 2
> > Screen 0 Geometry: 0,0,1920x1080
> > Screen 1 Geometry: 1920,0,1920x1080
> 
> Does it only happen with one screen?

It happens with only one screen as well.

> > Compositing
> > ===========
> > Qt Graphics System: native
> 
> Does it happen with the raster graphicssystem?

Raster with OpenGL 2.0 does not crash kwin, but does not work either: windows lose their decorations and I cannot bring them to the foreground, I only see their borders when I click on the task bar.

Raster with OpenGL 3.1 crashes kwin every time.

> > Currently Active Effects:
> > -------------------------
> > kwin4_effect_blur
> 
> Does it happen with blurring disabled?

The above (1 Screen, Raster) were tested with blur disabled.


NOTE: This is my work computer and I will be out of office until the end of the week, so I won't be able to respond until next Monday.
Comment 9 Diego 2013-10-03 19:46:51 UTC
Created attachment 82645 [details]
New crash information added by DrKonqi

kwin (4.11.1) on KDE Platform 4.11.1 using Qt 4.8.5

- What I was doing when the application crashed:

Tried to switch from OpenGL 2.0 to OpenGL 3.1 on an updated Fedora 19.

I've got an Intel Graphics card:
00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10)

kernel-3.10.10-200.fc19.x86_64
mesa-dri-drivers-9.2-1.20130919.fc19.x86_64

Will try to provide the other informations that have been asked.

- Custom settings of the application:

Tried to set OpenGL 3.1.

-- Backtrace (Reduced):
#6  0x0000003d5cc35a19 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#7  0x0000003d5cc37128 in __GI_abort () at abort.c:90
#8  0x0000003d5cc2e986 in __assert_fail_base (fmt=0x7f5e1681f66f "%s%s%s:%u: %s%sasserzione \"%s\" non riuscita.\n%n", assertion=assertion@entry=0x3d5f0b0d08 "!xcb_xlib_threads_sequence_lost", file=file@entry=0x3d5f0b0b63 "xcb_io.c", line=line@entry=274, function=function@entry=0x3d5f0b1016 <__PRETTY_FUNCTION__.14368> "poll_for_event") at assert.c:92
#9  0x0000003d5cc2ea32 in __GI___assert_fail (assertion=assertion@entry=0x3d5f0b0d08 "!xcb_xlib_threads_sequence_lost", file=file@entry=0x3d5f0b0b63 "xcb_io.c", line=line@entry=274, function=function@entry=0x3d5f0b1016 <__PRETTY_FUNCTION__.14368> "poll_for_event") at assert.c:101
#10 0x0000003d5f041309 in poll_for_event (dpy=dpy@entry=0x9b1db0) at xcb_io.c:271
Comment 10 Diego 2013-10-03 20:07:07 UTC
(In reply to comment #9)
> Tried to set OpenGL 3.1.

Oh, probably that's the problem: the driver reports is able only to do OpenGL 2.1, not 3.1.
Comment 11 Diego 2013-10-03 20:07:43 UTC
Created attachment 82646 [details]
glxinfo for my Intel card with Mesa 9.2
Comment 12 Thomas Lübking 2013-10-04 10:30:02 UTC
(In reply to comment #10)
> Oh, probably that's the problem: the driver reports is able only to do
> OpenGL 2.1, not 3.1.

Yes, and the driver is correct about that.
Neither of the chips in this bug supports GL 3.1

Looking at Giorgos support informations, i assume he encountered the original crash/backtrace on attempting to set GL 3.1 as well, while on GL 2.1 he "only" has the invisible texture issue.

-> We could and maybe should invoke the detected GL platform version on creating the context, but glXCreateContextAttribsARB should return a NULL context for unsupported attribs, why this is very likely a driver bug - can anybody inject some patches to see where a non NULL context is returned?
Comment 13 Diego 2013-10-04 11:34:33 UTC
(In reply to comment #12)
> -> We could and maybe should invoke the detected GL platform version on
> creating the context, but glXCreateContextAttribsARB should return a NULL
> context for unsupported attribs, why this is very likely a driver bug - can
> anybody inject some patches to see where a non NULL context is returned?

Given some time and a patch I can get that information. Is it something I can even debug with gdb setting a breakpoint without patching?
Comment 14 Martin Flöser 2013-10-07 13:27:04 UTC
> Given some time and a patch I can get that information. Is it something I
> can even debug with gdb setting a breakpoint without patching?
debugging is quite difficult. You must run from a tty and OpenGL might not work 
then, because it's not the same VT.

I guess Thomas wanted to see whether the mentioned method is NULL and whether 
the extension is supported.
Comment 15 Thomas Lübking 2013-10-07 17:12:24 UTC
Nope, i wanted to check which attribute gets us a non NULL context (what causes skipping the fallbacks) and whether it yells an error despite.

glXCreateContextAttribsARB should be present since we'd had crashed before otherwise in dereferecing the function - but testing whether the context pointer is just the function pointer is a nice idea indeed.

when i switch back to the 4.11 branch , I'll write you a patch to inject & try - as Martin pointed out debugging kwin with gdb is less pleasant (though possible) - and you'd likely need a gdwarf/ggdb compilation in order to inspect the stack anyway.
Comment 16 Thomas Lübking 2013-10-07 21:50:13 UTC
Created attachment 82708 [details]
Patch to print what context is created
Comment 17 Diego 2013-10-08 10:38:18 UTC
(In reply to comment #16)
> Created attachment 82708 [details]
> Patch to print what context is created

Thank you. Will try the patch as soon as I can (busy life).
Comment 18 Thomas Lübking 2013-10-10 09:10:42 UTC
Splitting bugs (and preemtively blaming mesa for not returning NULL)
Comment 19 Thomas Lübking 2013-11-19 15:59:46 UTC
more info on the other bug

*** This bug has been marked as a duplicate of bug 327310 ***