Hi List,

My main question: is it supported to do simultaneous [QCRenderer renderAtTime:arguments:] with different renderers on different threads? Because this is what we are trying to do.

We have a background rendering thread rendering QCCompositions all the time, and we have some main thread views rendering different compositions (although the contextst are shared, and we use the same CVImageBufferRef as image inputs in the compositions.

If it is supported then this seems to be a bug. If it isn't supported then we'd like to know if there are other options than locking all the rendering of patches.

here are 2 of our deadlocking backtraces of 2 different occasions, the deadlocks don't hang report themselves as deadlocks. Note also that we have the calls wrapped in a CGLLockContext and CGLUnlockContext call since we do some other opengl rendering inside it.

Does renderAtTime:arguments: automatically lock its openglcontext, so a

CGLUnlockContext()
[QCRenderer renderAtTime:arguments:]
CGLLockContext()

would also remedy our problem?

Backtrace 1 (gdb):
==================

Thread 14 (process 397 thread 0x10103):
#0  0x9057dbce in __semwait_signal ()
#1  0x905a8ee6 in _pthread_cond_wait ()
#2  0x905a88cd in pthread_cond_wait$UNIX2003 ()
#3 0x901b091b in -[QCImageConversionSequence applyWithManager:buffer:transformation:bounds:options:] () #4 0x901ae922 in -[QCImageManager(Internal) _createImageBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] () #5 0x901936e1 in -[QCImageManager createTextureBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] () #6 0x9018fc77 in -[QCImageManager(Internal) _createImageBufferFromProvider:withFormat:target:transformation:bounds:colorSpace:options :] () #7 0x9018da57 in -[QCImageManager createTextureBufferFromProvider:withFormat:target:transformation:bounds:colorSpace:options :] () #8 0x9023bce2 in -[QCOpenGLPort_Image setOnOpenGLContext:unit:withBounds:transformation:target:mipmappingLevels:matrix :] () #9 0x9018cb6f in -[QCOpenGLPort_Image setOnOpenGLContext:unit:fromBounds:withTarget:mipmappingLevels:matrix :] ()
#10 0x9017e629 in -[QCBillboard execute:time:arguments:] ()
#11 0x90160648 in -[QCPatch(Private) _execute:arguments:] ()
#12 0x901608d7 in -[QCPatch(Extensions) executeSubpatches:arguments:] ()
#13 0x90160648 in -[QCPatch(Private) _execute:arguments:] ()
#14 0x901608d7 in -[QCPatch(Extensions) executeSubpatches:arguments:] ()
#15 0x90160648 in -[QCPatch(Private) _execute:arguments:] ()
#16 0x9015ecbc in -[QCContext renderPatch:time:arguments:] ()
#17 0x9015ea0e in -[QCGraphicsContext renderPatch:time:arguments:] ()
#18 0x9015d914 in -[QCOpenGLContext renderPatch:time:arguments:] ()
#19 0x9015d7b3 in -[QCPatch(Runtime) render:arguments:] ()
#20 0x0000fd87 in -[TVLayer renderAtTime:arguments:] (self=0x21b02e70, _cmd=0x9036f1ac, time=152.45474299788475, arguments=0x0) at /Users/dom/ Data/Work/Boinx/BoinxTV-Trunk/BoinxTV/Source/TVLayer.m:681 #21 0x0003341d in -[TVRenderingEngine renderLayers:atTime:] (self=0x4ad0d0, _cmd=0x6155e, inLayers=0x486bc0, time=152.45474299788475) at /Users/dom/Data/Work/Boinx/BoinxTV-Trunk/ BoinxTV/Source/TVRenderingEngine.m:655 #22 0x000327a2 in -[TVRenderingEngine renderOutputAtTime:] (self=0x4ad0d0, _cmd=0x61504, inTime=152.45474299788475) at /Users/dom/ Data/Work/Boinx/BoinxTV-Trunk/BoinxTV/Source/TVRenderingEngine.m:433 #23 0x00032a5f in -[TVRenderingEngine generateFrame:] (self=0x4ad0d0, _cmd=0x61518, timer=0x21bc2310) at /Users/dom/Data/Work/Boinx/BoinxTV- Trunk/BoinxTV/Source/TVRenderingEngine.m:487
#24 0x95351bc3 in __NSFireTimer ()
#25 0x93401b5e in CFRunLoopRunSpecific ()
#26 0x93401d18 in CFRunLoopRunInMode ()
#27 0x95351b15 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#28 0x9535dc34 in -[NSRunLoop(NSRunLoop) run] ()
#29 0x000321c1 in -[TVRenderingEngine startRunning] (self=0x4ad0d0, _cmd=0x90318410) at /Users/dom/Data/Work/Boinx/BoinxTV-Trunk/BoinxTV/ Source/TVRenderingEngine.m:333
#30 0x9531d5ad in -[NSThread main] ()
#31 0x9531d154 in __NSThread__main__ ()
#32 0x905a7c55 in _pthread_start ()
#33 0x905a7b12 in thread_start ()


Thread 1 (process 397 local thread 0x2d03):
#0  0x90576a2e in semaphore_wait_signal_trap ()
#1  0x9057e505 in pthread_mutex_lock ()
#2  0x940c278f in CGLCreateContext ()
#3  0x927df403 in allocate_context_with_pixel_format ()
#4  0x927ddd0a in fe_cgl_create_context ()
#5  0x927ddaef in create_context ()
#6  0x927deff7 in fe_accel_context_ ()
#7  0x927def05 in fe_accel_context ()
#8  0x927dedbc in fe_gl_buffer_format_p ()
#9  0x92798752 in fe_context_buffer_format_p ()
#10 0x92798704 in fe_context_promote_format ()
#11 0x927986b5 in fe_tree_expand_2 ()
#12 0x92798686 in fe_tree_expand_2 ()
#13 0x92798686 in fe_tree_expand_2 ()
#14 0x92795016 in fe_tree_prepare_tree_ ()
#15 0x92793960 in fe_tree_render_image ()
#16 0x9279320c in fe_image_render_ ()
#17 0x927ec055 in fe_image_render ()
#18 0x928a12ee in renderImage ()
#19 0x927ea6db in -[CIOpenGLContextImpl renderWithBounds:matrix:function:info:] ()
#20 0x927ea602 in -[CIContextImpl render:] ()
#21 0x92790898 in -[CIContext drawImage:inRect:fromRect:] ()
#22 0x927902ff in -[CIContext drawImage:atPoint:fromRect:] ()
#23 0x901def6f in -[QCConverter_CoreImage createTextureBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] () #24 0x901b0a2e in -[QCImageConversionSequence applyWithManager:buffer:transformation:bounds:options:] () #25 0x901ae922 in -[QCImageManager(Internal) _createImageBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] () #26 0x901936e1 in -[QCImageManager createTextureBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] () #27 0x9018fc77 in -[QCImageManager(Internal) _createImageBufferFromProvider:withFormat:target:transformation:bounds:colorSpace:options :] () #28 0x9018da57 in -[QCImageManager createTextureBufferFromProvider:withFormat:target:transformation:bounds:colorSpace:options :] () #29 0x9023bce2 in -[QCOpenGLPort_Image setOnOpenGLContext:unit:withBounds:transformation:target:mipmappingLevels:matrix :] () #30 0x9018cb6f in -[QCOpenGLPort_Image setOnOpenGLContext:unit:fromBounds:withTarget:mipmappingLevels:matrix :] ()
#31 0x9017e629 in -[QCBillboard execute:time:arguments:] ()
#32 0x90160648 in -[QCPatch(Private) _execute:arguments:] ()
#33 0x901608d7 in -[QCPatch(Extensions) executeSubpatches:arguments:] ()
#34 0x90160648 in -[QCPatch(Private) _execute:arguments:] ()
#35 0x9015ecbc in -[QCContext renderPatch:time:arguments:] ()
#36 0x9015ea0e in -[QCGraphicsContext renderPatch:time:arguments:] ()
#37 0x9015d914 in -[QCOpenGLContext renderPatch:time:arguments:] ()
#38 0x9015d7b3 in -[QCPatch(Runtime) render:arguments:] ()
#39 0x000237f4 in -[TVImageParameterView drawRect:] (self=0x1d049290, _cmd=0x903ce630, inRect={origin = {x = 0, y = 0}, size = {width = 64, height = 48}}) at /Users/dom/Data/Work/Boinx/BoinxTV-Trunk/BoinxTV/ Source/TVImageParameterView.m:117
#40 0x909e8bbe in -[NSView _drawRect:clip:] ()
#41 0x909e7751 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #42 0x909e60b4 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #43 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #44 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #45 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #46 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #47 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #48 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #49 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #50 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #51 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #52 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #53 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #54 0x909e6f05 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #55 0x909e59f7 in -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] () #56 0x909e252d in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#57 0x90922f09 in -[NSView displayIfNeeded] ()
#58 0x90922ab9 in -[NSWindow displayIfNeeded] ()
#59 0x909228e0 in _handleWindowNeedsDisplay ()
#60 0x933ff9c2 in __CFRunLoopDoObservers ()
#61 0x93400d25 in CFRunLoopRunSpecific ()
#62 0x93401d18 in CFRunLoopRunInMode ()
#63 0x9241c6a0 in RunCurrentEventLoopInMode ()
#64 0x9241c4b9 in ReceiveNextEventCommon ()
#65 0x9241c32d in BlockUntilNextEventMatchingListInMode ()
#66 0x909207d9 in _DPSNextEvent ()
#67 0x9092008e in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#68 0x909190c5 in -[NSApplication run] ()
#69 0x908e630a in NSApplicationMain ()
#70 0x00009fba in main (argc=1, argv=0xbffff75c) at /Users/dom/Data/ Work/Boinx/BoinxTV-Trunk/BoinxTV/Source/main.m:15


Backtrace 2 (from sampler):
===========================

 Thread id:      77af8b8
  User stack:
    47 _thread_start + 34 (in libSystem.B.dylib) [0x97032b12]
    47 __pthread_start + 321 (in libSystem.B.dylib) [0x97032c55]
    47 ___NSThread__main__ + 308 (in Foundation) [0x93437154]
    47 -[NSThread main] + 45 (in Foundation) [0x934375ad]
    47 -[TVRenderingEngine startRunning] + 718 (in BoinxTV) [0x32261]
    47 -[NSRunLoop(NSRunLoop) run] + 84 (in Foundation) [0x93477c34]
47 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 213 (in Foundation) [0x9346bb15]
    47 _CFRunLoopRunInMode + 88 (in CoreFoundation) [0x95e64d18]
    47 _CFRunLoopRunSpecific + 4494 (in CoreFoundation) [0x95e64b5e]
    47 ___NSFireTimer + 147 (in Foundation) [0x9346bbc3]
    47 -[TVRenderingEngine generateFrame:] + 380 (in BoinxTV) [0x32aff]
47 -[TVRenderingEngine renderOutputAtTime:] + 266 (in BoinxTV) [0x32842] 47 -[TVRenderingEngine renderLayers:atTime:] + 2255 (in BoinxTV) [0x334bd]
    47 -[TVLayer renderAtTime:arguments:] + 71 (in BoinxTV) [0xfe27]
47 -[QCPatch(Runtime) render:arguments:] + 92 (in QuartzComposer) [0x9376d7b3] 47 -[QCOpenGLContext renderPatch:time:arguments:] + 334 (in QuartzComposer) [0x9376d914] 47 -[QCGraphicsContext renderPatch:time:arguments:] + 91 (in QuartzComposer) [0x9376ea0e] 47 -[QCContext renderPatch:time:arguments:] + 650 (in QuartzComposer) [0x9376ecbc] 47 -[QCPatch(Private) _execute:arguments:] + 1231 (in QuartzComposer) [0x93770648] 47 -[QCPatch(Extensions) executeSubpatches:arguments:] + 312 (in QuartzComposer) [0x937708d7] 47 -[QCPatch(Private) _execute:arguments:] + 1231 (in QuartzComposer) [0x93770648] 47 -[QCBillboard execute:time:arguments:] + 10933 (in QuartzComposer) [0x9378e629] 47 -[QCOpenGLPort_Image setOnOpenGLContext:unit:fromBounds:withTarget:mipmappingLevels:matrix :] + 109 (in QuartzComposer) [0x9379cb6f] 47 -[QCOpenGLPort_Image setOnOpenGLContext:unit:withBounds:transformation:target:mipmappingLevels:matrix :] + 1798 (in QuartzComposer) [0x9384bce2] 47 -[QCImageManager createTextureBufferFromProvider:withFormat:target:transformation:bounds:colorSpace:options :] + 2537 (in QuartzComposer) [0x9379da57] 47 -[QCImageManager(Internal) _createImageBufferFromProvider:withFormat:target:transformation:bounds:colorSpace:options :] + 8720 (in QuartzComposer) [0x9379fc77] 47 -[QCImageManager createTextureBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] + 1707 (in QuartzComposer) [0x937a36e1] 47 -[QCImageManager(Internal) _createImageBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] + 5763 (in QuartzComposer) [0x937be922] 47 -[QCImageConversionSequence applyWithManager:buffer:transformation:bounds:options:] + 810 (in QuartzComposer) [0x937c0a2e] 47 -[QCConverter_CoreImage createTextureBufferFromImageBuffer:withFormat:target:transformation:bounds:colorSpace:options :] + 251 (in QuartzComposer) [0x937ee90b] 47 -[QCImageManager createTextureBufferFromImageBuffer:target:sourceBounds:options:] + 2920 (in QuartzComposer) [0x937a4a1a] 47 _semaphore_wait_signal_trap + 10 (in libSystem.B.dylib) [0x97001a2e]

  Thread id:      949fb58
  User stack:
    47 start + 54 (in BoinxTV) [0x2ba6]
    47 _main + 139 (in BoinxTV) [0xa05a]
    47 _NSApplicationMain + 574 (in AppKit) [0x9209a30a]
    47 -[NSApplication run] + 795 (in AppKit) [0x920cd0c5]
47 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128 (in AppKit) [0x920d408e]
    47 __DPSNextEvent + 657 (in AppKit) [0x920d47d9]
47 _BlockUntilNextEventMatchingListInMode + 106 (in HIToolbox) [0x95f5532d]
    47 _ReceiveNextEventCommon + 374 (in HIToolbox) [0x95f554b9]
    47 _RunCurrentEventLoopInMode + 283 (in HIToolbox) [0x95f556a0]
    47 _CFRunLoopRunInMode + 88 (in CoreFoundation) [0x95e64d18]
    47 _CFRunLoopRunSpecific + 853 (in CoreFoundation) [0x95e63d25]
    47 ___CFRunLoopDoObservers + 466 (in CoreFoundation) [0x95e629c2]
    47 __handleWindowNeedsDisplay + 436 (in AppKit) [0x920d68e0]
    47 -[NSWindow displayIfNeeded] + 189 (in AppKit) [0x920d6ab9]
    47 -[NSView displayIfNeeded] + 933 (in AppKit) [0x920d6f09]
47 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3090 (in AppKit) [0x9219652d] 47 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 306 (in AppKit) [0x921999f7] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 4424 (in AppKit) [0x9219af05] 47 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 759 (in AppKit) [0x9219a0b4] 47 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1050 (in AppKit) [0x9219b751]
    47 -[NSView _drawRect:clip:] + 3765 (in AppKit) [0x9219cbbe]
    47 -[TVImageParameterView drawRect:] + 308 (in BoinxTV) [0x23894]
47 -[QCPatch(Runtime) render:arguments:] + 92 (in QuartzComposer) [0x9376d7b3] 47 -[QCOpenGLContext renderPatch:time:arguments:] + 334 (in QuartzComposer) [0x9376d914] 47 -[QCGraphicsContext renderPatch:time:arguments:] + 114 (in QuartzComposer) [0x9376ea25] 47 -[QCImageManager reclaimResources] + 212 (in QuartzComposer) [0x9376c280] 47 -[QCImageManager optimizeCaches] + 1590 (in QuartzComposer) [0x9376c9df] 47 -[QCCache(Private) _collectResourcesForSize] + 78 (in QuartzComposer) [0x9376d397] 47 -[QCCache(Internal) _runGarbageCollectionForSize] + 264 (in QuartzComposer) [0x93768c9b] 47 -[QCImageTextureBuffer setPurgeable:] + 260 (in QuartzComposer) [0x937a6b0b] 47 -[QCCGLContext createMinimalSharedContext] + 50 (in QuartzComposer) [0x937678ef] 47 -[QCCGLContext createMinimalSharedContextWithAdditionalAttributes:recycleWhenDone:] + 88 (in QuartzComposer) [0x937679e2] 47 -[QCCGLContext createMinimalSharedContextWithAdditionalAttributes:recycleWhenDone:] + 578 (in QuartzComposer) [0x93767bcc]
    47 __CreateGLContext + 772 (in QuartzComposer) [0x9383b208]
47 _semaphore_wait_signal_trap + 10 (in libSystem.B.dylib) [0x97001a2e]


--
Dominik Wagner          Mail: [EMAIL PROTECTED]
TheCodingMonkeys        http://www.codingmonkeys.de/
Blog - DasGenie: !Scrap http://scrap.dasgenie.com/


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to