yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #00913
multiple 3d views & global GL lock
-
To:
Yade Development Group <yade-dev@xxxxxxxxxxxxxxxxxxx>
-
From:
Václav Šmilauer <eudoxos@xxxxxxxx>
-
Date:
Sat, 31 Jan 2009 09:20:27 +0100
-
User-agent:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.19) Gecko/20090105 Lightning/0.8 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666
Hi,
I just commited code that among other introduces GL mutex the allows GL
manipulation from other threads. In brief, paintGL (which is called
periodically and contains preDraw, draw and postDraw methods) tries to
lock the mutex, but returns if it fails (no deadlock).
Other threads, like from within simulation or from python, should lock
the mutex and wait until it is available. I created class GLLock (in
GLViewer.hpp) which is just instantiated and given the GL view it is
locking.
I was experimenting with many different options, like per-view mutexes
(GL context can be accessed only once at time, but multiple contexts may
be accessed simultaneously) or global mutex (only one GL context can be
accessed once at any time) and the latter seems to be the winner.
I still get hardlock (meachine freezes) if I create 2 views and
manipulate both of them, even with the global GL lock and proper
makeCurrent()/doneCurrent() before/after each gl calls. Can someone
reproduce that? Have a look at scripts/gl-test.py and change the "if
False:" to "if True:" to crash your machine.
It is possible that locking GL will decrease framerate on very fast
graphics cards, but I cannot confirm that with my hardware. I think that
even in that case the lock should be there, we're not gamers to go for
the highest fps possible at all costs...
Regards, Vaclav