Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp	(revision 47062)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp	(revision 47063)
@@ -1124,52 +1124,68 @@
 }
 
-NTSTATUS vboxVdmaProcessBltCmd(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_CONTEXT *pContext, VBOXWDDM_DMA_PRIVATEDATA_BLT *pBlt, VBOXVDMAPIPE_FLAGS_DMACMD fBltFlags)
+static void vboxVdmaBltDirtyRectsUpdate(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_SOURCE *pSource, uint32_t cRects, const RECT *paRects)
+{
+    if (!cRects)
+    {
+        WARN(("vboxVdmaBltDirtyRectsUpdate: no rects specified"));
+        return;
+    }
+
+    RECT rect;
+    rect = paRects[0];
+    for (UINT i = 1; i < cRects; ++i)
+    {
+        vboxWddmRectUnited(&rect, &rect, &paRects[i]);
+    }
+
+    uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled);
+    if (!cUnlockedVBVADisabled)
+    {
+        VBOXVBVA_OP(ReportDirtyRect, pDevExt, pSource, &rect);
+    }
+    else
+    {
+        VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, pSource, &rect);
+    }
+}
+
+NTSTATUS vboxVdmaProcessBltCmd(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_CONTEXT *pContext, VBOXWDDM_DMA_PRIVATEDATA_BLT *pBlt)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-
-    if (fBltFlags.fRealOp)
-    {
-        PVBOXWDDM_ALLOCATION pDstAlloc = pBlt->Blt.DstAlloc.pAlloc;
-        PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc;
-
+    PVBOXWDDM_ALLOCATION pDstAlloc = pBlt->Blt.DstAlloc.pAlloc;
+    PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc;
+    BOOLEAN fRenderFromSharedDisabled = pDevExt->fRenderToShadowDisabled;
+    BOOLEAN fVRAMUpdated = FALSE;
+
+    if (!pDstAlloc->AllocData.hostID && !pSrcAlloc->AllocData.hostID)
+    {
+        /* the allocations contain a real data in VRAM, do blitting */
         vboxVdmaGgDmaBlt(pDevExt, &pBlt->Blt);
-
-        if (VBOXWDDM_IS_FB_ALLOCATION(pDevExt, pDstAlloc)
-                        && pDstAlloc->bVisible)
-        {
-            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
-            Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
-            Assert(pSource->pPrimaryAllocation == pDstAlloc);
-
-            RECT UpdateRect;
-            UpdateRect = pBlt->Blt.DstRects.UpdateRects.aRects[0];
-            for (UINT i = 1; i < pBlt->Blt.DstRects.UpdateRects.cRects; ++i)
-            {
-                vboxWddmRectUnite(&UpdateRect, &pBlt->Blt.DstRects.UpdateRects.aRects[i]);
-            }
-
-            uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled);
-            if (!cUnlockedVBVADisabled)
-            {
-                VBOXVBVA_OP(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
-            }
-            else
-            {
-                VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
-            }
-        }
-    }
-
-    if (fBltFlags.fVisibleRegions)
-    {
-        Status = vboxVdmaProcessVRegCmd(pDevExt, pContext, &pBlt->Blt.SrcAlloc, &pBlt->Blt.DstAlloc, &pBlt->Blt.SrcRect, &pBlt->Blt.DstRects);
-        if (!NT_SUCCESS(Status))
-            WARN(("vboxVdmaProcessVRegCmd failed Status 0x%x", Status));
-    }
-
-    return Status;
-}
-
-NTSTATUS vboxVdmaProcessFlipCmd(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_CONTEXT *pContext, VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip, VBOXVDMAPIPE_FLAGS_DMACMD fFlags)
+        fVRAMUpdated = TRUE;
+    }
+
+    if (VBOXWDDM_IS_REAL_FB_ALLOCATION(pDevExt, pDstAlloc)
+            && pDstAlloc->bVisible)
+    {
+        VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
+        Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
+        Assert(pSource->pPrimaryAllocation == pDstAlloc);
+
+
+        if (fVRAMUpdated)
+            vboxVdmaBltDirtyRectsUpdate(pDevExt, pSource, pBlt->Blt.DstRects.UpdateRects.cRects, pBlt->Blt.DstRects.UpdateRects.aRects);
+
+        if (pSrcAlloc->AllocData.hostID || pSource->fHas3DVrs)
+        {
+            Status = vboxVdmaProcessVRegCmd(pDevExt, pContext, &pBlt->Blt.SrcAlloc, &pBlt->Blt.DstAlloc, &pBlt->Blt.SrcRect, &pBlt->Blt.DstRects);
+            if (!NT_SUCCESS(Status))
+                WARN(("vboxVdmaProcessVRegCmd failed Status 0x%x", Status));
+        }
+    }
+
+    return Status;
+}
+
+NTSTATUS vboxVdmaProcessFlipCmd(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_CONTEXT *pContext, VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip)
 {
     NTSTATUS Status = STATUS_SUCCESS;
@@ -1177,6 +1193,5 @@
     VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAlloc->AllocData.SurfDesc.VidPnSourceId];
     vboxWddmAssignPrimary(pDevExt, pSource, pAlloc, pAlloc->AllocData.SurfDesc.VidPnSourceId);
-    Assert(!fFlags.fRealOp);
-    if (fFlags.fVisibleRegions)
+    if (pAlloc->AllocData.hostID)
     {
         RECT SrcRect;
@@ -1203,10 +1218,10 @@
 }
 
-NTSTATUS vboxVdmaProcessClrFillCmd(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_CONTEXT *pContext, VBOXWDDM_DMA_PRIVATEDATA_CLRFILL *pCF, VBOXVDMAPIPE_FLAGS_DMACMD fFlags)
+NTSTATUS vboxVdmaProcessClrFillCmd(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_CONTEXT *pContext, VBOXWDDM_DMA_PRIVATEDATA_CLRFILL *pCF)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    Assert(!fFlags.fVisibleRegions);
-
-    if (fFlags.fRealOp)
+    PVBOXWDDM_ALLOCATION pAlloc = pCF->ClrFill.Alloc.pAlloc;
+
+    if (!pAlloc->AllocData.hostID)
     {
         Status = vboxVdmaGgDmaColorFill(pDevExt, &pCF->ClrFill);
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h	(revision 47062)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h	(revision 47063)
@@ -212,17 +212,4 @@
 } VBOXVDMAPIPE_CMD_CANCEL, *PVBOXVDMAPIPE_CMD_CANCEL;
 
-typedef struct VBOXVDMAPIPE_FLAGS_DMACMD
-{
-    union
-    {
-        struct
-        {
-            UINT fRealOp             : 1;
-            UINT fVisibleRegions     : 1;
-            UINT Reserved            : 30;
-        };
-        UINT Value;
-    };
-} VBOXVDMAPIPE_FLAGS_DMACMD, *PVBOXVDMAPIPE_FLAGS_DMACMD;
 typedef struct VBOXVDMAPIPE_CMD_DMACMD
 {
@@ -233,5 +220,5 @@
     PVBOXWDDM_CONTEXT pContext;
     VBOXVDMACMD_TYPE enmCmd;
-    VBOXVDMAPIPE_FLAGS_DMACMD fFlags;
+//    VBOXVDMAPIPE_FLAGS_DMACMD fFlags;
 } VBOXVDMAPIPE_CMD_DMACMD, *PVBOXVDMAPIPE_CMD_DMACMD;
 
@@ -343,7 +330,7 @@
 #define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd)))
 
-NTSTATUS vboxVdmaProcessBltCmd(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_CONTEXT *pContext, struct VBOXWDDM_DMA_PRIVATEDATA_BLT *pBlt, struct VBOXVDMAPIPE_FLAGS_DMACMD fBltFlags);
-NTSTATUS vboxVdmaProcessFlipCmd(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_CONTEXT *pContext, struct VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip, struct VBOXVDMAPIPE_FLAGS_DMACMD fFlags);
-NTSTATUS vboxVdmaProcessClrFillCmd(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_CONTEXT *pContext, struct VBOXWDDM_DMA_PRIVATEDATA_CLRFILL *pCF, struct VBOXVDMAPIPE_FLAGS_DMACMD fFlags);
+NTSTATUS vboxVdmaProcessBltCmd(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_CONTEXT *pContext, struct VBOXWDDM_DMA_PRIVATEDATA_BLT *pBlt);
+NTSTATUS vboxVdmaProcessFlipCmd(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_CONTEXT *pContext, struct VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip);
+NTSTATUS vboxVdmaProcessClrFillCmd(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_CONTEXT *pContext, struct VBOXWDDM_DMA_PRIVATEDATA_CLRFILL *pCF);
 
 NTSTATUS vboxVdmaTexPresentSetAlloc(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData);
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp	(revision 47062)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp	(revision 47063)
@@ -2972,6 +2972,4 @@
         vboxWddmModeRenderFromShadowDisableRegister(pDevExt, pContext);
 
-    BOOLEAN fRenderFromSharedDisabled = pDevExt->fRenderToShadowDisabled;
-
     switch (enmCmd)
     {
@@ -2984,5 +2982,5 @@
             vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc);
             vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pS2P->Shadow2Primary.VidPnSourceId);
-            fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
+            vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
             vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
             if (pSrcAlloc->bVisible)
@@ -3012,12 +3010,7 @@
             vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc);
 
-            uint32_t cContexts3D = ASMAtomicReadU32(&pDevExt->cContexts3D);
-
-            VBOXVDMAPIPE_FLAGS_DMACMD fBltFlags;
-            fBltFlags.Value = 0;
-
             if (pDstAlloc->bAssigned &&
                     (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE
-                        || pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE)
+                        || pDstAlloc->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D)
                     )
             {
@@ -3027,119 +3020,15 @@
                 if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)
                     vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pDstAlloc->AllocData.SurfDesc.VidPnSourceId);
-                fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
+                vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
                 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
                         || pDstAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
                     vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
             }
-            else if (pSrcAlloc->bAssigned &&
-                    (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE
-                        || pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE)
-                    )
-            {
-                VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
-                Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
-
-                if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)
-                    vboxWddmAssignShadow(pDevExt, pSource, pDstAlloc, pSrcAlloc->AllocData.SurfDesc.VidPnSourceId);
-                fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
-                if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
-                        || pSrcAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
-                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
-            }
-
-            if (pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D && fRenderFromSharedDisabled)
-                fBltFlags.fRealOp = 1;
-
-            switch (pDstAlloc->enmType)
-            {
-                case VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE:
-                case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC:
-                {
-                    if (pDstAlloc->bAssigned)
-                    {
-//                        Assert(pSource->pPrimaryAllocation == pDstAlloc);
-
-                        switch (pSrcAlloc->enmType)
-                        {
-                            case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE:
-                            {
-                                fBltFlags.fVisibleRegions = !!cContexts3D;
-                                Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM);
-                                VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
-                                Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
-
-                                if (pSource->fHas3DVrs)
-                                    fBltFlags.fVisibleRegions = 1;
-
-                                if (!fRenderFromSharedDisabled && pSource->bVisible)
-                                {
-                                    RECT rect;
-                                    if (pBlt->Blt.DstRects.UpdateRects.cRects)
-                                    {
-                                        rect = pBlt->Blt.DstRects.UpdateRects.aRects[0];
-                                        for (UINT i = 1; i < pBlt->Blt.DstRects.UpdateRects.cRects; ++i)
-                                        {
-                                            vboxWddmRectUnited(&rect, &rect, &pBlt->Blt.DstRects.UpdateRects.aRects[i]);
-                                        }
-                                    }
-                                    else
-                                        rect = pBlt->Blt.DstRects.ContextRect;
-
-                                    uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled);
-                                    if (!cUnlockedVBVADisabled)
-                                    {
-                                        VBOXVBVA_OP(ReportDirtyRect, pDevExt, pSource, &rect);
-                                    }
-                                    else
-                                    {
-                                        VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, pSource, &rect);
-                                    }
-                                }
-
-                                break;
-                            }
-                            case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC:
-                            {
-                                if(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D)
-                                {
-                                    Assert(pSrcAlloc->fRcFlags.RenderTarget);
-                                    if (pSrcAlloc->fRcFlags.RenderTarget)
-                                        fBltFlags.fVisibleRegions = 1;
-                                }
-                                break;
-                            }
-                            default:
-                            {
-                                AssertBreakpoint();
-                                break;
-                            }
-                        }
-                    }
-
-                    break;
-                }
-                case VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE:
-                {
-//                    Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D);
-                    Assert(pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC);
-                    Assert(pSrcAlloc->fRcFlags.RenderTarget);
-                    Assert(vboxWddmRectIsEqual(&pBlt->Blt.SrcRect, &pBlt->Blt.DstRects.ContextRect));
-                    Assert(pBlt->Blt.DstRects.UpdateRects.cRects == 1);
-                    Assert(vboxWddmRectIsEqual(&pBlt->Blt.SrcRect, pBlt->Blt.DstRects.UpdateRects.aRects));
-                    break;
-                }
-                case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE:
-                {
-                    Assert(pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE);
-                    Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM);
-                    break;
-                }
-                default:
-                    AssertBreakpoint();
-                    break;
-            }
-
-            if (fBltFlags.Value)
-                Status = vboxVdmaProcessBltCmd(pDevExt, pContext, pBlt, fBltFlags);
+            else
+                vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
+
+            Status = vboxVdmaProcessBltCmd(pDevExt, pContext, pBlt);
+            if (!NT_SUCCESS(Status))
+                WARN(("vboxVdmaProcessBltCmd failed, Status 0x%x", Status));
 
             Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId,
@@ -3204,14 +3093,8 @@
             VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip = (VBOXWDDM_DMA_PRIVATEDATA_FLIP*)pPrivateDataBase;
             vboxWddmAddrSetVram(&pFlip->Flip.Alloc.pAlloc->AllocData.Addr, pFlip->Flip.Alloc.segmentIdAlloc, pFlip->Flip.Alloc.offAlloc);
-            VBOXVDMAPIPE_FLAGS_DMACMD fFlags;
-            fFlags.Value = 0;
-
-            if (pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D)
-                fFlags.fVisibleRegions = 1;
-            else
-                WARN(("unexpected flip cmd"));
-
-            if (fFlags.Value)
-                Status = vboxVdmaProcessFlipCmd(pDevExt, pContext, pFlip, fFlags);
+
+            Status = vboxVdmaProcessFlipCmd(pDevExt, pContext, pFlip);
+            if (!NT_SUCCESS(Status))
+                WARN(("vboxVdmaProcessFlipCmd failed, Status 0x%x", Status));
 
             Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId,
@@ -3223,10 +3106,8 @@
             PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL pCF = (PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL)pPrivateDataBase;
             vboxWddmAddrSetVram(&pCF->ClrFill.Alloc.pAlloc->AllocData.Addr, pCF->ClrFill.Alloc.segmentIdAlloc, pCF->ClrFill.Alloc.offAlloc);
-            VBOXVDMAPIPE_FLAGS_DMACMD fFlags;
-            fFlags.Value = 0;
-            fFlags.fRealOp = 1;
-
-            if (fFlags.Value)
-                Status = vboxVdmaProcessClrFillCmd(pDevExt, pContext, pCF, fFlags);
+
+            Status = vboxVdmaProcessClrFillCmd(pDevExt, pContext, pCF);
+            if (!NT_SUCCESS(Status))
+                WARN(("vboxVdmaProcessClrFillCmd failed, Status 0x%x", Status));
 
             Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId,
@@ -5551,5 +5432,4 @@
     PVBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR pPrivateData = (PVBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR)pPresent->pDmaBufferPrivateData;
     pPrivateData->BaseHdr.fFlags.Value = 0;
-    uint32_t cContexts3D = ASMAtomicReadU32(&pDevExt->cContexts3D);
     uint32_t cContexts2D = ASMAtomicReadU32(&pDevExt->cContexts2D);
 #define VBOXWDDM_DUMMY_DMABUFFER_SIZE sizeof(RECT)
@@ -5584,7 +5464,7 @@
                     }
 #endif
-                    /* issue VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE ONLY in case there are no 3D contexts currently
+                    /* issue VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE ONLY in case there are no 3D Visible Regions currently
                      * otherwise we would need info about all rects being updated on primary for visible rect reporting */
-                    if (!cContexts3D && !cContexts2D && !pSource->fHas3DVrs)
+                    if (!cContexts2D && !pSource->fHas3DVrs)
                     {
                         if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE
@@ -5882,5 +5762,5 @@
         if (pSrcAlloc)
         {
-            Assert(cContexts3D);
+            Assert(pDevExt->cContexts3D);
             pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP;
             PVBOXWDDM_DMA_PRIVATEDATA_FLIP pFlip = (PVBOXWDDM_DMA_PRIVATEDATA_FLIP)pPrivateData;
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h	(revision 47062)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h	(revision 47063)
@@ -194,18 +194,23 @@
 #define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry)))
 
+#ifdef VBOX_WDDM_WIN8
+# define VBOXWDDM_IS_DISPLAYONLY() (g_VBoxDisplayOnly)
+#else
+# define VBOXWDDM_IS_DISPLAYONLY() (FALSE)
+#endif
+
 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
-# ifdef VBOX_WDDM_WIN8
-#  define VBOXWDDM_IS_FB_ALLOCATION(_pDevExt, _pAlloc) ( (_pAlloc)->bAssigned \
+
+# define VBOXWDDM_IS_FB_ALLOCATION(_pDevExt, _pAlloc) ( (_pAlloc)->bAssigned \
         && (  (_pAlloc)->AllocData.hostID \
            || (_pAlloc)->enmType == \
-               ((g_VBoxDisplayOnly || (_pDevExt)->fRenderToShadowDisabled) ? VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE : VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) \
+               ((VBOXWDDM_IS_DISPLAYONLY() || (_pDevExt)->fRenderToShadowDisabled) ? VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE : VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) \
                ))
-# else
-#  define VBOXWDDM_IS_FB_ALLOCATION(_pDevExt, _pAlloc) ( (_pAlloc)->bAssigned \
+
+# define VBOXWDDM_IS_REAL_FB_ALLOCATION(_pDevExt, _pAlloc) ( (_pAlloc)->bAssigned \
         && (  (_pAlloc)->AllocData.hostID \
-           || (_pAlloc)->enmType == \
-               (((_pDevExt)->fRenderToShadowDisabled) ? VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE : VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) \
+           || (_pAlloc)->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE \
                ))
-# endif
+
 # define VBOXWDDM_FB_ALLOCATION(_pDevExt, _pSrc) ( ((_pSrc)->pPrimaryAllocation && VBOXWDDM_IS_FB_ALLOCATION(_pDevExt, (_pSrc)->pPrimaryAllocation)) ? \
                 (_pSrc)->pPrimaryAllocation : ( \
