VirtualBox

Changeset 22408 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 24, 2009 10:59:45 AM (15 years ago)
Author:
vboxsync
Message:

video hw accel: properly handle synch vhwa command completion

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Display
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c

    r22247 r22408  
    701701                }
    702702            }
    703             vboxVHWACommandFree(pDev, pCmd);
     703            vbvaVHWACommandRelease(pDev, pCmd);
    704704        }
    705705        return DDHAL_DRIVER_NOTHANDLED;
     
    830830                lpCanCreateSurface->ddRVal = DDERR_GENERIC;
    831831            }
    832             vboxVHWACommandFree(pDev, pCmd);
     832            vbvaVHWACommandRelease(pDev, pCmd);
    833833        }
    834834        else
     
    10911091                /* wait for the surface to be locked and memory buffer updated */
    10921092                vboxVHWACommandSubmit(pDev, pCmd);
    1093                 vboxVHWACommandFree(pDev, pCmd);
     1093                vbvaVHWACommandRelease(pDev, pCmd);
    10941094                vboxVHWARegionClear(&pDesc->NonupdatedMemRegion);
    10951095                lpLock->ddRVal = DD_OK;
     
    25072507    ASMAtomicDecU32(&pDestDesc->cPendingBltsDst);
    25082508
    2509     vboxVHWACommandFree(ppdev, pCmd);
     2509    vbvaVHWACommandRelease(ppdev, pCmd);
    25102510}
    25112511
     
    25192519    ASMAtomicDecU32(&pTargDesc->cPendingFlipsTarg);
    25202520
    2521     vboxVHWACommandFree(ppdev, pCmd);
     2521    vbvaVHWACommandRelease(ppdev, pCmd);
    25222522}
    25232523
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h

    r22247 r22408  
    318318VBOXVHWACMD* vboxVHWACommandCreate (PPDEV ppdev, VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd);
    319319void vboxVHWACommandFree (PPDEV ppdev, VBOXVHWACMD* pCmd);
     320DECLINLINE(void) vbvaVHWACommandRelease (PPDEV ppdev, VBOXVHWACMD* pCmd)
     321{
     322    uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs);
     323    Assert(cRefs < UINT32_MAX / 2);
     324    if(!cRefs)
     325    {
     326        vboxVHWACommandFree(ppdev, pCmd);
     327    }
     328}
     329
     330DECLINLINE(void) vbvaVHWACommandRetain (PPDEV ppdev, VBOXVHWACMD* pCmd)
     331{
     332    ASMAtomicIncU32(&pCmd->cRefs);
     333}
     334
    320335BOOL vboxVHWACommandSubmit (PPDEV ppdev, VBOXVHWACMD* pCmd);
    321336void vboxVHWACommandSubmitAsynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext);
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/vbox.c

    r22274 r22408  
    710710        pHdr->rc = VERR_GENERAL_FAILURE;
    711711        pHdr->enmCmd = enmCmd;
     712        pHdr->cRefs = 1;
    712713    }
    713714
     
    784785    pCmd->GuestVBVAReserved1 = (uintptr_t)pEvent;
    785786    pCmd->GuestVBVAReserved2 = 0;
     787    /* ensure the command is not removed until we're processing it */
     788    vbvaVHWACommandRetain(ppdev, pCmd);
    786789
    787790    /* complete it asynchronously by setting event */
    788791    pCmd->Flags |= VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT;
    789792    vboxHGSMIBufferSubmit (ppdev, pCmd);
    790     //TODO: dbg
    791 #if 0
     793
    792794    if(!(ASMAtomicReadU32((volatile uint32_t *)&pCmd->Flags)  & VBOXVHWACMD_FLAG_HG_ASYNCH))
    793795    {
     
    795797        EngSetEvent(pEvent);
    796798    }
    797 #endif
     799
     800    vbvaVHWACommandRelease(ppdev, pCmd);
    798801}
    799802
     
    827830    pCmd->GuestVBVAReserved1 = (uintptr_t)pfnCompletion;
    828831    pCmd->GuestVBVAReserved2 = (uintptr_t)pContext;
     832    vbvaVHWACommandRetain(ppdev, pCmd);
    829833
    830834    vboxHGSMIBufferSubmit (ppdev, pCmd);
    831     //TODO: dbg
    832 #if 0
     835
    833836    if(!(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH))
    834837    {
     
    836839        pfnCompletion(ppdev, pCmd, pContext);
    837840    }
    838 #endif
     841
     842    vbvaVHWACommandRelease(ppdev, pCmd);
    839843}
    840844
    841845static DECLCALLBACK(void) vboxVHWAFreeCmdCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext)
    842846{
    843     vboxVHWACommandFree(ppdev, pCmd);
     847    vbvaVHWACommandRelease(ppdev, pCmd);
    844848}
    845849
     
    849853    pCmd->GuestVBVAReserved1 = (uintptr_t)vboxVHWAFreeCmdCompletion;
    850854
     855    vbvaVHWACommandRetain(ppdev, pCmd);
     856
    851857    pCmd->Flags |= VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION;
    852858
    853859    vboxHGSMIBufferSubmit (ppdev, pCmd);
    854     //TODO: dbg
    855 #if 0
     860
    856861    if(!(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH)
    857862            || pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED)
     
    860865        vboxVHWAFreeCmdCompletion(ppdev, pCmd, NULL);
    861866    }
    862 #endif
     867
     868    vbvaVHWACommandRelease(ppdev, pCmd);
    863869}
    864870
     
    866872{
    867873    VBOXVHWACMD* pCmd = VBOXVHWACMD_HEAD(pInfo);
    868     vboxVHWACommandFree (ppdev, pCmd);
     874    vbvaVHWACommandRelease (ppdev, pCmd);
    869875}
    870876
     
    872878{
    873879    VBOXVHWACMD* pCmd = VBOXVHWACMD_HEAD(pInfo);
    874     vboxVHWACommandFree (ppdev, pCmd);
     880    vbvaVHWACommandRelease (ppdev, pCmd);
    875881}
    876882
     
    905911    }
    906912
    907     vboxVHWACommandFree (ppdev, pCmd);
     913    vbvaVHWACommandRelease (ppdev, pCmd);
    908914    return NULL;
    909915}
     
    933939    }
    934940
    935     vboxVHWACommandFree (ppdev, pCmd);
     941    vbvaVHWACommandRelease (ppdev, pCmd);
    936942    return NULL;
    937943}
     
    10001006    }
    10011007
    1002     vboxVHWACommandFree (ppdev, pCmd);
     1008    vbvaVHWACommandRelease (ppdev, pCmd);
    10031009    return rc;
    10041010}
     
    10221028    }
    10231029
    1024     vboxVHWACommandFree (ppdev, pCmd);
     1030    vbvaVHWACommandRelease (ppdev, pCmd);
    10251031
    10261032    vboxVHWACommandCheckHostCmds(ppdev);
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