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.


> In this case would I need
> to lock a mutex or call XInitThreads()/Xlockdisplay()/xunlockdisplay()
> at each instance of a x function call? I really don't want to do that.
> 
> Running multiple processes will alleviate the pain but will make some
> other things difficult in other places. If it is not going to be as
> simple as an embarrassingly parallel thing, then please let me know.
> 

-Brian
_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to