Re: [Paracomp-devel] Accessing compositor from multiple threads
Brought to you by:
shreekumar
|
From: Shree K. <shr...@hp...> - 2008-07-25 13:40:59
|
Hi George,
Logically, a host represents a thread of execution. Each host has a
context object(PCcontext). Using the same context object simultaneously
from two threads will not work.
The scenario that you are describing ought to work (with the existing
implementation), since both threads aren't making paracomp calls at the
same time using the same object.
A quick sanity check (just to be sure) -- do you have a mechanism to
pass the FrameID returned by pcFrameBegin() to the display thread ?
---
What version of Paracomp are you using ?
Regards
-- Shree
George Leaver wrote:
> 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
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Paracomp-devel mailing list
> Par...@li...
> https://lists.sourceforge.net/lists/listinfo/paracomp-devel
> .
>
>
|