Hi all,

my situation is as follws: My program (using Xlib) has an X window. Widgets are drawn inside the window using the XRender extension (in the main thread). Inside the window, there is a small sub-window. The sub-window has an OpenGL(R) context (glX, compatibillity-profile) and renders a single triangle (for demonstration purposes). The triangle is redrawn whenever an expose event is received for the sub-window (also in the main thread, the conext is made current for redrawing and immediately released afterwards). So far so good. Now I added a second sub-window with an equivalent OpenGL(R) context. A thread is created that makes the context of the second sub-window current and continuosly redraws the scene in a loop. A single mutex is used to ensure that only one thread at a time makes Xlib or glX calls. Using ConnectionNumber( ) and select( ), I made sure that the mutex is unlocked when waiting for XEvents in the main thread.

When using an nvidia GPU with their proprietary libgl implementation, everything works as expected. When using Mesa with an Intel GPU (optimus system), the second sub-window doesn't display anything (only whatever was at that screen location before), two CPU cores go to 100% and when draging the main window around, it lags behind the mouse cursor.

I know that the glXMakeContextCurrent call in the second thread returns. I also know that the thread drawing loop is executed and glXSwapBuffers returns. I don't get any errors. After reading the glX specification, I can't find any obvious issues (obvios to me that is). Google didn't bring up anything related to my question.

Does the discription sound like any obvious synchronisation (or whatever) problem? I can show any part of source code on request; I just didn't post any, because we are talking about some blob of widget toolkit library here. Also, I could retry it using an AMD card with their proprietary implementation sometime this week.

I'm thankfull in advance for any insights on the issue.