Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.cpp	(revision 42150)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.cpp	(revision 42151)
@@ -32,9 +32,9 @@
  * to simplify things we just insert breaks for the case of intensive debugging WDDM driver*/
 #ifndef VBOX_WDDM_WIN8
-bool g_bVBoxVDbgBreakF = false;
-bool g_bVBoxVDbgBreakFv = false;
+int g_bVBoxVDbgBreakF = false;
+int g_bVBoxVDbgBreakFv = false;
 #else
-bool g_bVBoxVDbgBreakF = true;
-bool g_bVBoxVDbgBreakFv = true;
+int g_bVBoxVDbgBreakF = false;
+int g_bVBoxVDbgBreakFv = false;
 #endif
 #endif
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.h	(revision 42150)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.h	(revision 42151)
@@ -126,6 +126,6 @@
  * windbg seems to have some issues when there is a lot ( >~50) of sw breakpoints defined
  * to simplify things we just insert breaks for the case of intensive debugging WDDM driver*/
-extern bool g_bVBoxVDbgBreakF;
-extern bool g_bVBoxVDbgBreakFv;
+extern int g_bVBoxVDbgBreakF;
+extern int g_bVBoxVDbgBreakFv;
 #define vboxVDbgBreakF() do { if (g_bVBoxVDbgBreakF) AssertBreakpoint(); } while (0)
 #define vboxVDbgBreakFv() do { if (g_bVBoxVDbgBreakFv) AssertBreakpoint(); } while (0)
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp	(revision 42150)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp	(revision 42151)
@@ -272,19 +272,17 @@
 }
 
-NTSTATUS vboxWddmGhDisplaySetInfo(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
-{
-    NTSTATUS Status = vboxWddmGhDisplaySetMode(pDevExt, &pSource->AllocData);
+NTSTATUS vboxWddmGhDisplaySetInfo(PVBOXMP_DEVEXT pDevExt, const PVBOXWDDM_ALLOC_DATA pAllocData, const POINT * pVScreenPos)
+{
+    NTSTATUS Status = vboxWddmGhDisplaySetMode(pDevExt, pAllocData);
     Assert(Status == STATUS_SUCCESS);
     if (Status == STATUS_SUCCESS)
     {
-        Status = vboxWddmGhDisplayPostInfoView(pDevExt, &pSource->AllocData);
+        Status = vboxWddmGhDisplayPostInfoView(pDevExt, pAllocData);
         Assert(Status == STATUS_SUCCESS);
         if (Status == STATUS_SUCCESS)
         {
-            Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, &pSource->AllocData, &pSource->VScreenPos);
+            Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, pAllocData, pVScreenPos);
             Assert(Status == STATUS_SUCCESS);
-            if (Status == STATUS_SUCCESS)
-                pSource->bGhSynced = TRUE;
-            else
+            if (!NT_SUCCESS(Status))
                 WARN(("vboxWddmGhDisplayPostInfoScreen failed"));
         }
@@ -296,4 +294,32 @@
 
     return Status;
+}
+
+bool vboxWddmGhDisplayCheckSetInfoFromSource(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource)
+{
+    Assert(VBOXVIDEOOFFSET_VOID != pSource->AllocData.Addr.offVram);
+
+    if (pSource->bGhSynced)
+        return false;
+
+    PVBOXWDDM_ALLOCATION pFbAlloc = VBOXWDDM_FB_ALLOCATION(pDevExt, pSource);
+
+#ifdef VBOX_WDDM_WIN8
+    Assert(!g_VBoxDisplayOnly == !!pFbAlloc);
+#else
+    Assert(pFbAlloc);
+#endif
+#ifndef VBOXWDDM_RENDER_FROM_SHADOW
+    Assert(!pFbAlloc || pFbAlloc->AllocData.Addr.offVram == pSource->AllocData.Addr.offVram);
+#endif
+    Assert(!pFbAlloc || pFbAlloc->AllocData.Addr.SegmentId == pSource->AllocData.Addr.SegmentId);
+
+    NTSTATUS Status = vboxWddmGhDisplaySetInfo(pDevExt, pFbAlloc ? &pFbAlloc->AllocData : &pSource->AllocData, &pSource->VScreenPos);
+    if (NT_SUCCESS(Status))
+        pSource->bGhSynced = TRUE;
+    else
+        WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
+
+    return true;
 }
 
@@ -375,5 +401,5 @@
 
 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
-bool vboxWddmCheckUpdateFramebufferAddress(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
+bool vboxWddmCheckUpdateFramebufferAddress(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource)
 {
     if (pSource->pPrimaryAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
@@ -383,14 +409,5 @@
     }
 
-    Assert(VBOXVIDEOOFFSET_VOID != pSource->AllocData.Addr.offVram);
-
-    if (pSource->bGhSynced)
-        return false;
-
-    NTSTATUS Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, VidPnSourceId);
-    if (!NT_SUCCESS(Status))
-        WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
-
-    return true;
+    return vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
 }
 #endif
@@ -2964,5 +2981,5 @@
             vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pS2P->Shadow2Primary.VidPnSourceId);
             fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
-            vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pS2P->Shadow2Primary.VidPnSourceId);
+            vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
             uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled);
             if (!cUnlockedVBVADisabled)
@@ -3007,5 +3024,5 @@
                 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
                         || pDstAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
-                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pDstAlloc->AllocData.SurfDesc.VidPnSourceId);
+                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
             }
             else if (pSrcAlloc->bAssigned &&
@@ -3019,5 +3036,5 @@
                 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
                         || pSrcAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
-                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pSrcAlloc->AllocData.SurfDesc.VidPnSourceId);
+                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
             }
 
@@ -4627,14 +4644,18 @@
     pSource->bGhSynced = FALSE; /* force guest->host notification */
 
-#if defined(VBOXWDDM_RENDER_FROM_SHADOW) && defined(VBOX_WDDM_WIN8)
-    if (g_VBoxDisplayOnly && !pSource->bGhSynced && pSource->bVisible)
-    {
-        Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceAddress->VidPnSourceId);
-        if (!NT_SUCCESS(Status))
-        {
-            WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
-        }
-    }
-#endif
+    if (pSource->bVisible
+#if defined(VBOXWDDM_RENDER_FROM_SHADOW)
+            && (
+# if defined(VBOX_WDDM_WIN8)
+            g_VBoxDisplayOnly
+                    ||
+# endif
+                    pDevExt->fRenderToShadowDisabled
+                    )
+#endif
+            )
+    {
+        vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
+    }
 
     LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter));
@@ -4679,14 +4700,18 @@
     {
         pSource->bVisible = pSetVidPnSourceVisibility->Visible;
-#if defined(VBOXWDDM_RENDER_FROM_SHADOW) && defined(VBOX_WDDM_WIN8)
-        if (g_VBoxDisplayOnly && pSource->bVisible)
-        {
-            Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceVisibility->VidPnSourceId);
-            if (!NT_SUCCESS(Status))
-            {
-                WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
-            }
-        }
-#endif
+        if (pSource->bVisible
+#if defined(VBOXWDDM_RENDER_FROM_SHADOW)
+                && (
+# if defined(VBOX_WDDM_WIN8)
+                g_VBoxDisplayOnly
+                        ||
+# endif
+                        pDevExt->fRenderToShadowDisabled
+                        )
+#endif
+                )
+        {
+            vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
+        }
     }
 
