Xlib/GLX multiple displays and threads

Rohit Garg rpg.314 at gmail.com
Tue Mar 3 01:08:07 PST 2009


On Tue, Mar 3, 2009 at 1:12 AM, Brian Paul <brianp at vmware.com> wrote:
> Rohit Garg wrote:
>> Hi,
>>
>> I am writing an app that needs to render different stuff to different
>> windows (not full screen). Windows (the correct X name for that is
>> display right?) are completely independent and share no data and have
>> no communication. Naturally, I want to use multiple threads to do it.
>> Ie, each thread has some local data and renders to it's window,
>> blissfully unaware of what other thread does in the other window. All
>> manipulation is via keyboard/mouse input. IE, no toolbars/widgets to
>> bother with.
>>
>> Can Xlib+glx+opengl be used in this manner?
>
> It should work in principle.  In practice it may not.
>
> In the past when I've tried to use Xlib from multiple threads I've run into bugs.  Depending on the version of Xlib I've seen X protocol/sequence errors or mutex deadlocks.  Using XInitThreads(), XLock/UnlockDisplay(), etc. didn't seem to help much.  However, I haven't tried the latest/greatest version of Xlib w/ XCB.
>
> Also, while OpenGL supports multiple rendering threads, some drivers probably haven't been exercised in that area.
>
> There's a Mesa test (progs/xdemos/glthreads.c) that tests rendering from multiple threads.  You might grab that and give it a try on your system.  There's a few command-line options that might be of interest.

Thanks a lot for that. The program seems just what I was looking for.
I will be using nvidia drivers(closed source). I think it is pointless
to ask here, but does anyone have any experience with them?

-- 
Rohit Garg

http://rpg-314.blogspot.com/

Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay



More information about the xorg mailing list