Index: /trunk/include/VBox/VBoxVideo.h
===================================================================
--- /trunk/include/VBox/VBoxVideo.h	(revision 26766)
+++ /trunk/include/VBox/VBoxVideo.h	(revision 26767)
@@ -1172,6 +1172,6 @@
 typedef struct VBOXVDMACMD_DMA_PRESENT_BLT
 {
-    uint64_t phSrc;
-    uint64_t phDst;
+    VBOXVIDEOOFFSET offSrc;
+    VBOXVIDEOOFFSET offDst;
     VBOXVDMA_SURF_DESC srcDesc;
     VBOXVDMA_SURF_DESC dstDesc;
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp	(revision 26766)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp	(revision 26767)
@@ -2464,4 +2464,32 @@
 }
 
+
+BOOLEAN FASTCALL VBoxVideoSetCurrentModePerform(PDEVICE_EXTENSION DeviceExtension,
+        USHORT width, USHORT height, USHORT bpp)
+{
+    /* set the mode characteristics */
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, width);
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES);
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, height);
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP);
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, bpp);
+    /* enable the mode */
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
+    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
+    /** @todo read from the port to see if the mode switch was successful */
+
+    /* Tell the host that we now support graphics in the additions.
+     * @todo: Keep old behaviour, because VBoxVideoResetDevice is called on every graphics
+     *        mode switch and causes an OFF/ON sequence which is not handled by frontends
+     *        (for example Qt GUI debug build asserts when seamless is being enabled).
+     */
+    // VBoxVideoSetGraphicsCap(TRUE);
+
+    return TRUE;
+}
+
+#ifndef VBOXWDDM
+
 /**
  * VBoxVideoSetCurrentMode
@@ -2470,13 +2498,6 @@
  */
 BOOLEAN FASTCALL VBoxVideoSetCurrentMode(PDEVICE_EXTENSION DeviceExtension,
-#ifndef VBOXWDDM
-                                         PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock
-#else
-                                         D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId,
-                                         PVBOXWDDM_SOURCE ModeInfo
-#endif
-                                         )
-{
-#ifndef VBOXWDDM
+                                         PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
+{
     PVIDEO_MODE_INFORMATION ModeInfo;
 
@@ -2499,56 +2520,9 @@
     }
 
-    /* set the mode characteristics */
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->VisScreenWidth);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->VisScreenHeight);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->BitsPerPlane);
-    /* enable the mode */
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
-    /** @todo read from the port to see if the mode switch was successful */
-
-    /* Tell the host that we now support graphics in the additions.
-     * @todo: Keep old behaviour, because VBoxVideoResetDevice is called on every graphics
-     *        mode switch and causes an OFF/ON sequence which is not handled by frontends
-     *        (for example Qt GUI debug build asserts when seamless is being enabled).
-     */
-    // VBoxVideoSetGraphicsCap(TRUE);
-#else
-    Assert(!srcId);
-
-    if (srcId)
-    {
-        dprintf(("VBoxVideo::VBoxVideoSetCurrentMode: Skipping for ? non-primary ? source ? %d\n",
-                srcId));
-        return TRUE;
-    }
-
-    /* set the mode characteristics */
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->pAllocation->u.SurfInfo.width);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->pAllocation->u.SurfInfo.height);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->pAllocation->u.SurfInfo.bpp);
-    /* enable the mode */
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
-    VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
-    /** @todo read from the port to see if the mode switch was successful */
-
-    /* Tell the host that we now support graphics in the additions.
-     * @todo: Keep old behaviour, because VBoxVideoResetDevice is called on every graphics
-     *        mode switch and causes an OFF/ON sequence which is not handled by frontends
-     *        (for example Qt GUI debug build asserts when seamless is being enabled).
-     */
-    // VBoxVideoSetGraphicsCap(TRUE);
-
-#endif
-    return TRUE;
-}
-
-#ifndef VBOXWDDM
+    return VBoxVideoSetCurrentModePerform(DeviceExtension,
+            (USHORT)ModeInfo->VisScreenWidth,
+                    (USHORT)ModeInfo->VisScreenHeight,
+                    (USHORT)ModeInfo->BitsPerPlane);
+}
 
 /*
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h	(revision 26766)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h	(revision 26767)
@@ -573,4 +573,8 @@
 DECLINLINE(ULONG) vboxWddmVramReportedSize(PDEVICE_EXTENSION pDevExt)
 {
+    /* all memory layout info should be initialized */
+    Assert(pDevExt->u.primary.Vdma.CmdHeap.area.offBase);
+    /* page aligned */
+    Assert(!(pDevExt->u.primary.Vdma.CmdHeap.area.offBase & 0xfff));
     return pDevExt->u.primary.Vdma.CmdHeap.area.offBase;
 }
@@ -652,4 +656,14 @@
 #endif
 
+void* vboxHGSMIBufferAlloc(PDEVICE_EXTENSION PrimaryExtension,
+                         HGSMISIZE cbData,
+                         uint8_t u8Ch,
+                         uint16_t u16Op);
+void vboxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer);
+int vboxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer);
+
+BOOLEAN FASTCALL VBoxVideoSetCurrentModePerform(PDEVICE_EXTENSION DeviceExtension,
+        USHORT width, USHORT height, USHORT bpp);
+
 BOOLEAN FASTCALL VBoxVideoSetCurrentMode(
    PDEVICE_EXTENSION DeviceExtension,
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp	(revision 26766)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp	(revision 26767)
@@ -186,5 +186,5 @@
 typedef FNHGSMICALLFINALIZE *PFNHGSMICALLFINALIZE;
 
-void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension,
+void* vboxHGSMIBufferAlloc(PDEVICE_EXTENSION PrimaryExtension,
                          HGSMISIZE cbData,
                          uint8_t u8Ch,
@@ -197,24 +197,13 @@
 }
 
-void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension,
-                         uint8_t u8Ch,
-                         uint16_t u16Op,
-                         HGSMISIZE cbData)
+void vboxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer)
 {
 #ifdef VBOXWDDM
     /* @todo: add synchronization */
 #endif
-    return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op);
-}
-
-void VBoxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer)
-{
-#ifdef VBOXWDDM
-    /* @todo: add synchronization */
-#endif
     HGSMIHeapFree (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer);
 }
 
-int VBoxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer)
+int vboxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer)
 {
     /* Initialize the buffer and get the offset for port IO. */
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp	(revision 26766)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp	(revision 26767)
@@ -47,40 +47,160 @@
 }
 
+//VBOXVIDEOOFFSET vboxWddmVRAMAddressToOffset(PDEVICE_EXTENSION pDevExt, PHYSICAL_ADDRESS phAddress)
+//{
+//    Assert(phAddress.QuadPart >= VBE_DISPI_LFB_PHYSICAL_ADDRESS);
+//    if (phAddress.QuadPart < VBE_DISPI_LFB_PHYSICAL_ADDRESS)
+//        return VBOXVIDEOOFFSET_VOID;
+//
+//    VBOXVIDEOOFFSET off = phAddress.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS;
+//    Assert(off < pDevExt->u.primary.cbVRAM);
+//    if (off >= pDevExt->u.primary.cbVRAM)
+//        return VBOXVIDEOOFFSET_VOID;
+//
+//    return off;
+//}
+
+VBOXVIDEOOFFSET vboxWddmValidatePrimary(PVBOXWDDM_ALLOCATION pAllocation)
+{
+    Assert(pAllocation);
+    if (!pAllocation)
+    {
+        drprintf((__FUNCTION__": no allocation specified for Source\n"));
+        return VBOXVIDEOOFFSET_VOID;
+    }
+
+    Assert(pAllocation->SegmentId);
+    if (!pAllocation->SegmentId)
+    {
+        drprintf((__FUNCTION__": allocation is not paged in\n"));
+        return VBOXVIDEOOFFSET_VOID;
+    }
+
+    VBOXVIDEOOFFSET offVram = pAllocation->offVram;
+    Assert(offVram != VBOXVIDEOOFFSET_VOID);
+    if (offVram == VBOXVIDEOOFFSET_VOID)
+        drprintf((__FUNCTION__": VRAM pffset is not defined\n"));
+
+    return offVram;
+}
+
+NTSTATUS vboxWddmGhDisplayPostInfoScreen (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation)
+{
+    VBOXVIDEOOFFSET offVram = pAllocation->offVram;
+    Assert(offVram != VBOXVIDEOOFFSET_VOID);
+    if (offVram == VBOXVIDEOOFFSET_VOID)
+        return STATUS_INVALID_PARAMETER;
+
+    PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
+    /* Issue the screen info command. */
+    void *p = vboxHGSMIBufferAlloc (pDevExt,
+                                      sizeof (VBVAINFOSCREEN),
+                                      HGSMI_CH_VBVA,
+                                      VBVA_INFO_SCREEN);
+    Assert(p);
+    if (p)
+    {
+        VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;
+
+        pScreen->u32ViewIndex    = pPrimaryInfo->VidPnSourceId;
+        pScreen->i32OriginX      = 0;
+        pScreen->i32OriginY      = 0;
+        pScreen->u32StartOffset  = offVram;
+        pScreen->u32LineSize     = pAllocation->u.SurfInfo.pitch;
+        pScreen->u32Width        = pAllocation->u.SurfInfo.width;
+        pScreen->u32Height       = pAllocation->u.SurfInfo.height;
+        pScreen->u16BitsPerPixel = (uint16_t)pAllocation->u.SurfInfo.bpp;
+        pScreen->u16Flags        = VBVA_SCREEN_F_ACTIVE;
+
+        vboxHGSMIBufferSubmit (pDevExt, p);
+
+        vboxHGSMIBufferFree (pDevExt, p);
+    }
+
+    return STATUS_SUCCESS;
+}
+
+NTSTATUS vboxWddmGhDisplayPostInfoView (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation)
+{
+    VBOXVIDEOOFFSET offVram = pAllocation->offVram;
+    Assert(offVram != VBOXVIDEOOFFSET_VOID);
+    if (offVram == VBOXVIDEOOFFSET_VOID)
+        return STATUS_INVALID_PARAMETER;
+
+    PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
+    /* Issue the screen info command. */
+    void *p = vboxHGSMIBufferAlloc (pDevExt,
+                                      sizeof (VBVAINFOVIEW),
+                                      HGSMI_CH_VBVA,
+                                      VBVA_INFO_VIEW);
+    Assert(p);
+    if (p)
+    {
+        VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p;
+
+        pView->u32ViewIndex     = pPrimaryInfo->VidPnSourceId;
+        pView->u32ViewOffset    = offVram;
+        pView->u32ViewSize      = vboxWddmVramReportedSize(pDevExt)/pDevExt->u.primary.cDisplays;
+
+        pView->u32MaxScreenSize = pView->u32ViewSize;
+
+        vboxHGSMIBufferSubmit (pDevExt, p);
+
+        vboxHGSMIBufferFree (pDevExt, p);
+    }
+
+    return STATUS_SUCCESS;
+}
+
+NTSTATUS vboxWddmGhDisplaySetMode (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation)
+{
+    PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
+    if (pPrimaryInfo->VidPnSourceId)
+        return STATUS_SUCCESS;
+
+    if (VBoxVideoSetCurrentModePerform(pDevExt, pAllocation->u.SurfInfo.width,
+            pAllocation->u.SurfInfo.height, pAllocation->u.SurfInfo.bpp))
+        return STATUS_SUCCESS;
+
+    AssertBreakpoint();
+    drprintf((__FUNCTION__": VBoxVideoSetCurrentModePerform failed\n"));
+    return STATUS_UNSUCCESSFUL;
+}
+
+
+NTSTATUS vboxWddmGhDisplaySetInfo(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource)
+{
+    PVBOXWDDM_ALLOCATION pAllocation = pSource->pAllocation;
+    VBOXVIDEOOFFSET offVram = vboxWddmValidatePrimary(pAllocation);
+    Assert(offVram != VBOXVIDEOOFFSET_VOID);
+    if (offVram == VBOXVIDEOOFFSET_VOID)
+        return STATUS_INVALID_PARAMETER;
+
+    /*
+     * Set the current mode into the hardware.
+     */
+    NTSTATUS Status = vboxWddmGhDisplaySetMode (pDevExt, pAllocation);
+    Assert(Status == STATUS_SUCCESS);
+    if (Status == STATUS_SUCCESS)
+    {
+        Status = vboxWddmGhDisplayPostInfoView (pDevExt, pAllocation);
+        Assert(Status == STATUS_SUCCESS);
+        if (Status == STATUS_SUCCESS)
+        {
+            Status = vboxWddmGhDisplayPostInfoScreen (pDevExt, pAllocation);
+            Assert(Status == STATUS_SUCCESS);
+            if (Status != STATUS_SUCCESS)
+                drprintf((__FUNCTION__": vboxWddmGhDisplayPostInfoScreen failed\n"));
+        }
+        else
+            drprintf((__FUNCTION__": vboxWddmGhDisplayPostInfoView failed\n"));
+    }
+    else
+        drprintf((__FUNCTION__": vboxWddmGhDisplaySetMode failed\n"));
+
+    return Status;
+}
+
 #if 0
-void vboxWddmProcessDisplayInfo (PPDEV ppdev)
-{
-    if (ppdev->bHGSMISupported)
-    {
-        /* Issue the screen info command. */
-        void *p = HGSMIHeapAlloc (&ppdev->hgsmiDisplayHeap,
-                                  sizeof (VBVAINFOSCREEN),
-                                  HGSMI_CH_VBVA,
-                                  VBVA_INFO_SCREEN);
-        if (!p)
-        {
-            DISPDBG((0, "VBoxDISP::VBoxProcessDisplayInfo: HGSMIHeapAlloc failed\n"));
-        }
-        else
-        {
-            VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;
-
-            pScreen->u32ViewIndex    = ppdev->iDevice;
-            pScreen->i32OriginX      = ppdev->ptlDevOrg.x;
-            pScreen->i32OriginY      = ppdev->ptlDevOrg.y;
-            pScreen->u32StartOffset  = 0;
-            pScreen->u32LineSize     = ppdev->lDeltaScreen > 0?ppdev->lDeltaScreen: -ppdev->lDeltaScreen;
-            pScreen->u32Width        = ppdev->cxScreen;
-            pScreen->u32Height       = ppdev->cyScreen;
-            pScreen->u16BitsPerPixel = (uint16_t)ppdev->ulBitCount;
-            pScreen->u16Flags        = VBVA_SCREEN_F_ACTIVE;
-
-            vboxHGSMIBufferSubmit (ppdev, p);
-
-            HGSMIHeapFree (&ppdev->hgsmiDisplayHeap, p);
-        }
-    }
-
-    return;
-}
 
 NTSTATUS vboxWddmGhInitPrimary(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, D3DKMDT_VIDPN_SOURCE_MODE *pVidPnSourceModeInfo)
@@ -1107,5 +1227,5 @@
                 /* make sure the size is page aligned */
                 /* @todo: need to setup VBVA buffers and adjust the mem size here */
-                pQsOut->pSegmentDescriptor->Size = (pContext->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE - pContext->u.primary.cbMiniportHeap) & (~0xfffUL);
+                pQsOut->pSegmentDescriptor->Size = vboxWddmVramReportedSize(pContext);
                 pQsOut->pSegmentDescriptor->NbOfBanks = 0;
                 pQsOut->pSegmentDescriptor->pBankRangeTable = 0;
@@ -1517,8 +1637,8 @@
         Assert(pPatchList->AllocationIndex < pPatch->AllocationListSize);
         const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex];
-        if (pAllocationList->PhysicalAddress.QuadPart)
+        if (pAllocationList->SegmentId)
         {
             Assert(pPatchList->PatchOffset < (pPatch->DmaBufferPrivateDataSubmissionEndOffset - pPatch->DmaBufferPrivateDataSubmissionStartOffset));
-            *((PHYSICAL_ADDRESS*)(pBuf+pPatchList->PatchOffset)) = pAllocationList->PhysicalAddress;
+            *((VBOXVIDEOOFFSET*)(pBuf+pPatchList->PatchOffset)) = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart;
         }
         else
@@ -2079,9 +2199,15 @@
             Assert(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE);
             PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimary = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
-            pAllocation->phAddress = pSetVidPnSourceAddress->PrimaryAddress;
+            pAllocation->offVram = (VBOXVIDEOOFFSET)pSetVidPnSourceAddress->PrimaryAddress.QuadPart;
+            pAllocation->SegmentId = pSetVidPnSourceAddress->PrimarySegment;
+            Assert (pAllocation->SegmentId);
             Assert (!pPrimary->bVisible);
             if (pPrimary->bVisible)
             {
-                /* @todo: should not generally happen, but still inform host*/
+                /* should not generally happen, but still inform host*/
+                Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource);
+                Assert(Status == STATUS_SUCCESS);
+                if (Status != STATUS_SUCCESS)
+                    drprintf((__FUNCTION__": vboxWddmGhDisplaySetInfo failed, Status (0x%x)\n", Status));
             }
         }
@@ -2110,5 +2236,40 @@
     )
 {
-    return STATUS_NOT_IMPLEMENTED;
+    /* DxgkDdiSetVidPnSourceVisibility should be made pageable. */
+    PAGED_CODE();
+
+    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
+
+    NTSTATUS Status = STATUS_SUCCESS;
+    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
+    Assert(pDevExt->cSources > pSetVidPnSourceVisibility->VidPnSourceId);
+    if (pDevExt->cSources > pSetVidPnSourceVisibility->VidPnSourceId)
+    {
+        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId];
+        PVBOXWDDM_ALLOCATION pAllocation = pSource->pAllocation;
+        PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimary = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
+
+        Assert(pPrimary->bVisible != pSetVidPnSourceVisibility->Visible);
+        if (pPrimary->bVisible != pSetVidPnSourceVisibility->Visible)
+        {
+            pPrimary->bVisible = pSetVidPnSourceVisibility->Visible;
+            if (pPrimary->bVisible)
+            {
+                Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource);
+                Assert(Status == STATUS_SUCCESS);
+                if (Status != STATUS_SUCCESS)
+                    drprintf((__FUNCTION__": vboxWddmGhDisplaySetInfo failed, Status (0x%x)\n", Status));
+            }
+        }
+    }
+    else
+    {
+        drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceVisibility->VidPnSourceId, pDevExt->cSources));
+        Status = STATUS_INVALID_PARAMETER;
+    }
+
+    dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
+
+    return Status;
 }
 
@@ -2120,4 +2281,5 @@
     )
 {
+
     return STATUS_NOT_IMPLEMENTED;
 }
@@ -2368,12 +2530,12 @@
                     if (vboxWddmPixFormatConversionSupported(pSrcAlloc->u.SurfInfo.format, pDstAlloc->u.SurfInfo.format))
                     {
-                        memset(pPresent->pPatchLocationListOut, 0, 3*sizeof (D3DDDI_PATCHLOCATIONLIST));
-                        pPresent->pPatchLocationListOut->PatchOffset = 0;
+                        memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST));
+//                        pPresent->pPatchLocationListOut->PatchOffset = 0;
+//                        ++pPresent->pPatchLocationListOut;
+                        pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offSrc);
+                        pPresent->pPatchLocationListOut->AllocationIndex = 0;
                         ++pPresent->pPatchLocationListOut;
-                        pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, phSrc);
-                        pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX;
-                        ++pPresent->pPatchLocationListOut;
-                        pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, phDst);
-                        pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX;
+                        pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offDst);
+                        pPresent->pPatchLocationListOut->AllocationIndex = 1;
                         ++pPresent->pPatchLocationListOut;
 
@@ -2381,6 +2543,6 @@
                         pCmd->u32CmdSpecific = 0;
                         PVBOXVDMACMD_DMA_PRESENT_BLT pTransfer = VBOXVDMACMD_BODY(pCmd, VBOXVDMACMD_DMA_PRESENT_BLT);
-                        pTransfer->phSrc = pSrc->PhysicalAddress.QuadPart;
-                        pTransfer->phDst = pDst->PhysicalAddress.QuadPart;
+                        pTransfer->offSrc = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart;
+                        pTransfer->offDst = (VBOXVIDEOOFFSET)pDst->PhysicalAddress.QuadPart;
                         vboxWddmSurfDescFromAllocation(pSrcAlloc, &pTransfer->srcDesc);
                         vboxWddmSurfDescFromAllocation(pDstAlloc, &pTransfer->dstDesc);
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h	(revision 26766)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h	(revision 26767)
@@ -67,6 +67,6 @@
 {
     VBOXWDDM_ALLOC_TYPE enmType;
-    PHYSICAL_ADDRESS phAddress;
-    BOOLEAN bPagedIn;
+    VBOXVIDEOOFFSET offVram;
+    UINT SegmentId;
     union
     {
