VirtualBox

Ignore:
Timestamp:
Nov 2, 2010 11:36:10 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: CrHgsmi cleanup, free resources correctly; 2D fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp

    r33540 r33714  
    920920}
    921921
     922static void vboxVhwaHlpOverlayListAdd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_OVERLAY pOverlay)
     923{
     924    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pOverlay->VidPnSourceId];
     925    KIRQL OldIrql;
     926    KeAcquireSpinLock(&pSource->OverlayListLock, &OldIrql);
     927    ASMAtomicIncU32(&pSource->cOverlays);
     928    InsertHeadList(&pSource->OverlayList, &pOverlay->ListEntry);
     929    KeReleaseSpinLock(&pSource->OverlayListLock, OldIrql);
     930}
     931
     932static void vboxVhwaHlpOverlayListRemove(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_OVERLAY pOverlay)
     933{
     934    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pOverlay->VidPnSourceId];
     935    KIRQL OldIrql;
     936    KeAcquireSpinLock(&pSource->OverlayListLock, &OldIrql);
     937    ASMAtomicDecU32(&pSource->cOverlays);
     938    RemoveEntryList(&pOverlay->ListEntry);
     939    KeReleaseSpinLock(&pSource->OverlayListLock, OldIrql);
     940}
     941
    922942AssertCompile(sizeof (RECT) == sizeof (VBOXVHWA_RECTL));
    923943AssertCompile(RT_SIZEOFMEMB(RECT, left) == RT_SIZEOFMEMB(VBOXVHWA_RECTL, left));
     
    930950AssertCompile(RT_OFFSETOF(RECT, bottom) == RT_OFFSETOF(VBOXVHWA_RECTL, bottom));
    931951
    932 int vboxVhwaHlpOverlayUpdate(PVBOXWDDM_OVERLAY pOverlay, const DXGK_OVERLAYINFO *pOverlayInfo)
     952int vboxVhwaHlpOverlayUpdate(PVBOXWDDM_OVERLAY pOverlay, const DXGK_OVERLAYINFO *pOverlayInfo, RECT * pDstUpdateRect)
    933953{
    934954    PVBOXWDDM_ALLOCATION pAlloc = (PVBOXWDDM_ALLOCATION)pOverlayInfo->hAllocation;
     
    9821002            if (pOurInfo->DirtyRegion.fFlags & VBOXWDDM_DIRTYREGION_F_VALID)
    9831003            {
    984                 pBody->u.in.xUpdatedSrcMemValid = 1;
    9851004                if (pOurInfo->DirtyRegion.fFlags & VBOXWDDM_DIRTYREGION_F_RECT_VALID)
    9861005                    pBody->u.in.xUpdatedSrcMemRect = *(VBOXVHWA_RECTL*)((void*)&pOurInfo->DirtyRegion.Rect);
     
    9931012            }
    9941013
     1014            if (pDstUpdateRect)
     1015            {
     1016                pBody->u.in.xUpdatedDstMemRect = *(VBOXVHWA_RECTL*)((void*)pDstUpdateRect);
     1017            }
     1018
    9951019            /* we're not interested in completion, just send the command */
    9961020            vboxVhwaCommandSubmitAsynchAndComplete(pOverlay->pDevExt, pCmd);
     
    10111035}
    10121036
     1037int vboxVhwaHlpOverlayUpdate(PVBOXWDDM_OVERLAY pOverlay, const DXGK_OVERLAYINFO *pOverlayInfo)
     1038{
     1039    return vboxVhwaHlpOverlayUpdate(pOverlay, pOverlayInfo, NULL);
     1040}
     1041
    10131042int vboxVhwaHlpOverlayDestroy(PVBOXWDDM_OVERLAY pOverlay)
    10141043{
    10151044    int rc = VINF_SUCCESS;
     1045
     1046    vboxVhwaHlpOverlayListRemove(pOverlay->pDevExt, pOverlay);
     1047
    10161048    for (uint32_t i = 0; i < pOverlay->pResource->cAllocations; ++i)
    10171049    {
     
    10661098            pOverlay->pResource = pRc;
    10671099            pOverlay->VidPnSourceId = VidPnSourceId;
    1068             rc = vboxVhwaHlpOverlayUpdate(pOverlay, pOverlayInfo);
     1100
     1101            vboxVhwaHlpOverlayListAdd(pDevExt, pOverlay);
     1102#ifdef VBOXWDDM_RENDER_FROM_SHADOW
     1103            RECT DstRect;
     1104            vboxVhwaHlpOverlayDstRectGet(pDevExt, pOverlay, &DstRect);
     1105            NTSTATUS Status = vboxVdmaHlpUpdatePrimary(pDevExt, VidPnSourceId, &DstRect);
     1106            Assert(Status == STATUS_SUCCESS);
     1107            /* ignore primary update failure */
     1108            Status = STATUS_SUCCESS;
     1109#endif
     1110            rc = vboxVhwaHlpOverlayUpdate(pOverlay, pOverlayInfo, &DstRect);
    10691111            if (!RT_SUCCESS(rc))
    10701112            {
     
    10891131    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnSourceId];
    10901132    return !ASMAtomicReadU32(&pSource->cOverlays);
    1091 }
    1092 
    1093 void vboxVhwaHlpOverlayListAdd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_OVERLAY pOverlay)
    1094 {
    1095     PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pOverlay->VidPnSourceId];
    1096     KIRQL OldIrql;
    1097     KeAcquireSpinLock(&pSource->OverlayListLock, &OldIrql);
    1098     ASMAtomicIncU32(&pSource->cOverlays);
    1099     InsertHeadList(&pSource->OverlayList, &pOverlay->ListEntry);
    1100     KeReleaseSpinLock(&pSource->OverlayListLock, OldIrql);
    1101 }
    1102 
    1103 void vboxVhwaHlpOverlayListRemove(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_OVERLAY pOverlay)
    1104 {
    1105     PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pOverlay->VidPnSourceId];
    1106     KIRQL OldIrql;
    1107     KeAcquireSpinLock(&pSource->OverlayListLock, &OldIrql);
    1108     ASMAtomicDecU32(&pSource->cOverlays);
    1109     RemoveEntryList(&pOverlay->ListEntry);
    1110     KeReleaseSpinLock(&pSource->OverlayListLock, OldIrql);
    11111133}
    11121134
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