VirtualBox

Ignore:
Timestamp:
Mar 4, 2013 5:24:56 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: fix renderspu cleanup

Location:
trunk/src/VBox/HostServices/SharedOpenGL/render
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r44908 r44913  
    507507    /* ensure no concurrent draws can take place */
    508508    renderspuVBoxCompositorSet(window, NULL);
     509    renderspuVBoxPresentBlitterCleanup(window);
    509510    renderspu_SystemDestroyWindow( window );
    510511    RTCritSectDelete(&window->CompositorLock);
     
    693694        }
    694695    }
     696}
     697
     698void renderspuVBoxPresentBlitterCleanup( WindowInfo *window )
     699{
     700    if (!window->pBlitter)
     701        return;
     702
     703    if (render_spu.blitterTable)
     704    {
     705        CR_BLITTER_WINDOW * pBltInfo = CrBltMuralGetCurrent(window->pBlitter);
     706        if (pBltInfo == &window->BltInfo)
     707        {
     708            CrBltMuralSetCurrent(window->pBlitter, NULL);
     709        }
     710    }
     711    else
     712    {
     713        CRASSERT(CrBltMuralGetCurrent(window->pBlitter) == &window->BltInfo);
     714        CrBltMuralSetCurrent(window->pBlitter, NULL);
     715        CrBltTerm(window->pBlitter);
     716    }
     717    window->pBlitter = NULL;
    695718}
    696719
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h

    r44908 r44913  
    400400extern void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, struct VBOXVR_SCR_COMPOSITOR * pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry );
    401401extern PCR_BLITTER renderspuVBoxPresentBlitterGet( WindowInfo *window );
     402void renderspuVBoxPresentBlitterCleanup( WindowInfo *window );
    402403extern int renderspuVBoxPresentBlitterEnter( PCR_BLITTER pBlitter );
    403404extern PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window );
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c

    r44908 r44913  
    195195    render_spu.windowTable = crAllocHashtableEx(1, INT32_MAX);
    196196
    197     pcpwSetting = crGetenv("CR_RENDER_ENABLE_PRESENT_CONTEXT_PER_WINDOW");
     197    pcpwSetting = crGetenv("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT");
    198198    if (pcpwSetting)
    199199    {
     
    201201            pcpwSetting = NULL;
    202202    }
    203     else
    204     {
    205         /* default is enable for OSX */
    206 #if 0 //defined(DARWIN) && defined(VBOX_WITH_COCOA_QT)
    207         pcpwSetting = (char*)1;
    208 #endif
    209 
    210     }
    211 
    212203
    213204    if (pcpwSetting)
    214205    {
     206        /* TODO: need proper blitter synchronization, do not use so far!
     207         * the problem is that rendering can be done in multiple thread: the main command (hgcm) thread and the redraw thread
     208         * we currently use per-window synchronization, while we'll need a per-blitter synchronization if one blitter is used for multiple windows
     209         * this is not done currently */
     210        crWarning("TODO: need proper blitter synchronization, do not use so far!");
    215211        render_spu.blitterTable = crAllocHashtable();
    216212        CRASSERT(render_spu.blitterTable);
     
    428424}
    429425
     426static void renderspuBlitterCleanupCB(unsigned long key, void *data1, void *data2)
     427{
     428    WindowInfo *window = (WindowInfo *) data1;
     429    CRASSERT(window);
     430
     431    renderspuVBoxPresentBlitterCleanup( window );
     432}
     433
    430434static int renderSPUCleanup(void)
    431435{
    432436    renderspuVBoxCompositorClearAll();
     437
     438    if (render_spu.blitterTable)
     439    {
     440        crFreeHashtable(render_spu.blitterTable, DeleteBlitterCallback);
     441        render_spu.blitterTable = NULL;
     442    }
     443    else
     444    {
     445        crHashtableWalk(render_spu.windowTable, renderspuBlitterCleanupCB, NULL);
     446    }
     447
    433448    crFreeHashtable(render_spu.contextTable, DeleteContextCallback);
    434449    render_spu.contextTable = NULL;
     
    437452    crFreeHashtable(render_spu.barrierHash, crFree);
    438453    render_spu.barrierHash = NULL;
    439 
    440     if (render_spu.blitterTable)
    441         crFreeHashtable(render_spu.blitterTable, DeleteBlitterCallback);
    442454
    443455#ifdef RT_OS_DARWIN
     
    527539}
    528540
     541#ifdef RT_OS_DARWIN
    529542static void renderspuWindowVisibleRegionCB(unsigned long key, void *data1, void *data2)
    530543{
     
    534547    renderspu_SystemWindowApplyVisibleRegion(window);
    535548}
     549#endif
    536550
    537551DECLEXPORT(void) renderspuSetRootVisibleRegion(GLint cRects, GLint *pRects)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette