[Paracomp-devel] Accessing compositor from multiple threads
Brought to you by:
shreekumar
|
From: George L. <geo...@ma...> - 2008-07-25 12:20:57
|
Hi,
Is it safe to make calls to the compositor from multiple threads?
The scenario is to have two threads: one for rendering, one for
display (if a display node):
Thread 1 (render). All nodes have this thread.
----------------------------------------------
pcSystemInitialize()
pcSessionCreate()
pcContextCreateMaster() (or pcContextCreate())
while(1) {
wait for render request
do_opengl_render();
if ( visible_framelet ) {
pcFrameBegin( one framelet x,y,w,h );
pcFrameAddFramelet( cbuf, zbuf );
pcFrameEnd();
}
else {
pcFrameBegin( no framelets );
pcFrameEnd();
}
if ( master )
request display (release thread 0)
}
Thread 0 (display). Only master node has this thread.
-----------------------------------------------------
while(1) {
build scene graph
request render (release thread 1)
block until display requested
glClear();
pcFrameResultChannel( ... &channelOut );
glDrawPixels( ..., channelOut.address );
}
The display thread can also use the pcFrameWaitOutputHP() extension to
loop over framelets.
The problem we are seeing is that the compositor is freeing invalid
memory blocks in core.cpp: Core::StartFrame() line 290:
if (*iter2)
free(*iter2)
This doesn't happen in the paracomp samples but they make all calls
from the same main thread. I know the above thread scheme is a little
contrived but we require a render/display thread model. Is it safe to
make pcFrameResultChannel calls from a thread that isn't doing the
pcFrameBegin/End() calls?
Thanks in advance
George
--
George Leaver
Research Computing Services
University of Manchester, UK.
http://www.rcs.manchester.ac.uk
|