VirtualBox

Ignore:
Timestamp:
Jul 10, 2012 9:47:29 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79022
Message:

wddm/display-only: more imple and fixes

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp

    r41835 r42081  
    520520        bpp  = bpp  ? bpp :pExt->CurrentModeBPP;
    521521#else
    522         xres = xres ? xres:pExt->aSources[iDisplay].pPrimaryAllocation->SurfDesc.width;
    523         yres = yres ? yres:pExt->aSources[iDisplay].pPrimaryAllocation->SurfDesc.height;
    524         bpp  = bpp  ? bpp :pExt->aSources[iDisplay].pPrimaryAllocation->SurfDesc.bpp;
     522        xres = xres ? xres:pExt->aSources[iDisplay].pPrimaryAllocation->AllocData.SurfDesc.width;
     523        yres = yres ? yres:pExt->aSources[iDisplay].pPrimaryAllocation->AllocData.SurfDesc.height;
     524        bpp  = bpp  ? bpp :pExt->aSources[iDisplay].pPrimaryAllocation->AllocData.SurfDesc.bpp;
    525525#endif
    526526    }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp

    r41638 r42081  
    473473        else if (pSwapchainInfo->SwapchainInfo.cAllocs)
    474474        {
    475             pSwapchain = vboxWddmSwapchainCreate(apAlloc[0]->SurfDesc.width, apAlloc[0]->SurfDesc.height);
     475            pSwapchain = vboxWddmSwapchainCreate(apAlloc[0]->AllocData.SurfDesc.width, apAlloc[0]->AllocData.SurfDesc.height);
    476476            if (!pSwapchain)
    477477            {
     
    25842584        if (pPrimary)
    25852585        {
    2586             VBOXVIDEOOFFSET offVram = pPrimary->offVram;
     2586            VBOXVIDEOOFFSET offVram = pPrimary->AllocData.Addr.offVram;
    25872587            if (offVram != VBOXVIDEOOFFSET_VOID)
    25882588            {
     
    25912591                /* @todo: !!!this is not correct in case we want source[i]->target[i!=j] mapping */
    25922592                notify.CrtcVsync.VidPnTargetId = i;
    2593                 notify.CrtcVsync.PhysicalAddress.QuadPart = pPrimary->offVram;
     2593                notify.CrtcVsync.PhysicalAddress.QuadPart = offVram;
    25942594                /* yes, we can report VSync at dispatch */
    25952595                pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, &notify);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r41638 r42081  
    8787#endif
    8888
     89typedef struct VBOXWDDM_ADDR
     90{
     91    /* if SegmentId == NULL - the sysmem data is presented with pvMem */
     92    UINT SegmentId;
     93    union {
     94        VBOXVIDEOOFFSET offVram;
     95        void * pvMem;
     96    };
     97} VBOXWDDM_ADDR, *PVBOXWDDM_ADDR;
     98
     99typedef struct VBOXWDDM_ALLOC_DATA
     100{
     101    VBOXWDDM_SURFACE_DESC SurfDesc;
     102    VBOXWDDM_ADDR Addr;
     103} VBOXWDDM_ALLOC_DATA, *PVBOXWDDM_ALLOC_DATA;
     104
    89105typedef struct VBOXWDDM_SOURCE
    90106{
     
    92108#ifdef VBOXWDDM_RENDER_FROM_SHADOW
    93109    struct VBOXWDDM_ALLOCATION * pShadowAllocation;
    94     VBOXVIDEOOFFSET offVram;
    95     VBOXWDDM_SURFACE_DESC SurfDesc;
     110#endif
     111    VBOXWDDM_ALLOC_DATA AllocData;
     112    BOOLEAN bVisible;
     113    BOOLEAN bGhSynced;
    96114    VBOXVBVAINFO Vbva;
    97 #endif
    98115#ifdef VBOX_WITH_VIDEOHWACCEL
    99116    /* @todo: in our case this seems more like a target property,
     
    125142    volatile uint32_t cRefs;
    126143    D3DDDI_RESOURCEFLAGS fRcFlags;
    127     UINT SegmentId;
    128     VBOXVIDEOOFFSET offVram;
    129144#ifdef VBOX_WITH_VIDEOHWACCEL
    130145    VBOXVHWA_SURFHANDLE hHostHandle;
     
    137152    BOOLEAN fAssumedDeletion;
    138153#endif
    139     VBOXWDDM_SURFACE_DESC SurfDesc;
     154    VBOXWDDM_ALLOC_DATA AllocData;
    140155    struct VBOXWDDM_RESOURCE *pResource;
    141156    /* to return to the Runtime on DxgkDdiCreateAllocation */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp

    r41638 r42081  
    540540    {
    541541        PVBOXWDDM_ALLOCATION pAlloc = pCF->ClrFill.Alloc.pAlloc;
    542         Assert(pAlloc->offVram != VBOXVIDEOOFFSET_VOID);
    543         if (pAlloc->offVram != VBOXVIDEOOFFSET_VOID)
     542        Assert(pAlloc->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
     543        if (pAlloc->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID)
    544544        {
    545545            RECT UnionRect = {0};
    546             uint8_t *pvMem = pDevExt->pvVisibleVram + pAlloc->offVram;
    547             UINT bpp = pAlloc->SurfDesc.bpp;
     546            uint8_t *pvMem = pDevExt->pvVisibleVram + pAlloc->AllocData.Addr.offVram;
     547            UINT bpp = pAlloc->AllocData.SurfDesc.bpp;
    548548            Assert(bpp);
    549             Assert(((bpp * pAlloc->SurfDesc.width) >> 3) == pAlloc->SurfDesc.pitch);
     549            Assert(((bpp * pAlloc->AllocData.SurfDesc.width) >> 3) == pAlloc->AllocData.SurfDesc.pitch);
    550550            switch (bpp)
    551551            {
     
    558558                        for (LONG ir = pRect->top; ir < pRect->bottom; ++ir)
    559559                        {
    560                             uint32_t * pvU32Mem = (uint32_t*)(pvMem + (ir * pAlloc->SurfDesc.pitch) + (pRect->left * bytestPP));
     560                            uint32_t * pvU32Mem = (uint32_t*)(pvMem + (ir * pAlloc->AllocData.SurfDesc.pitch) + (pRect->left * bytestPP));
    561561                            uint32_t cRaw = pRect->right - pRect->left;
    562562                            Assert(pRect->left >= 0);
    563                             Assert(pRect->right <= (LONG)pAlloc->SurfDesc.width);
     563                            Assert(pRect->right <= (LONG)pAlloc->AllocData.SurfDesc.width);
    564564                            Assert(pRect->top >= 0);
    565                             Assert(pRect->bottom <= (LONG)pAlloc->SurfDesc.height);
     565                            Assert(pRect->bottom <= (LONG)pAlloc->AllocData.SurfDesc.height);
    566566                            for (UINT j = 0; j < cRaw; ++j)
    567567                            {
     
    584584            if (Status == STATUS_SUCCESS)
    585585            {
    586                 if (pAlloc->SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED
     586                if (pAlloc->AllocData.SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED
    587587                        && pAlloc->bAssigned
    588588#if 0//def VBOXWDDM_RENDER_FROM_SHADOW
     
    595595                    if (!vboxWddmRectIsEmpty(&UnionRect))
    596596                    {
    597                         PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pCF->ClrFill.Alloc.pAlloc->SurfDesc.VidPnSourceId];
     597                        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pCF->ClrFill.Alloc.pAlloc->AllocData.SurfDesc.VidPnSourceId];
    598598                        uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled);
    599599                        if (!cUnlockedVBVADisabled)
     
    618618}
    619619
    620 NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pSrcAlloc, RECT* pSrcRect,
    621         PVBOXWDDM_ALLOCATION pDstAlloc, RECT* pDstRect)
     620NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pSrcAlloc, RECT* pSrcRect,
     621        PVBOXWDDM_ALLOC_DATA pDstAlloc, RECT* pDstRect)
    622622{
    623623    uint8_t* pvVramBase = pDevExt->pvVisibleVram;
     
    629629    Assert(srcHeight == dstHeight);
    630630    Assert(dstWidth == srcWidth);
    631     Assert(pDstAlloc->offVram != VBOXVIDEOOFFSET_VOID);
    632     Assert(pSrcAlloc->offVram != VBOXVIDEOOFFSET_VOID);
     631    Assert(pDstAlloc->Addr.offVram != VBOXVIDEOOFFSET_VOID);
     632    Assert(pSrcAlloc->Addr.offVram != VBOXVIDEOOFFSET_VOID);
    633633    D3DDDIFORMAT enmSrcFormat, enmDstFormat;
    634634
     
    652652    if (srcWidth != dstWidth)
    653653            return STATUS_INVALID_PARAMETER;
    654     if (pDstAlloc->offVram == VBOXVIDEOOFFSET_VOID)
     654    if (pDstAlloc->Addr.offVram == VBOXVIDEOOFFSET_VOID)
    655655        return STATUS_INVALID_PARAMETER;
    656     if (pSrcAlloc->offVram == VBOXVIDEOOFFSET_VOID)
     656    if (pSrcAlloc->Addr.offVram == VBOXVIDEOOFFSET_VOID)
    657657        return STATUS_INVALID_PARAMETER;
    658658
    659     uint8_t *pvDstSurf = pvVramBase + pDstAlloc->offVram;
    660     uint8_t *pvSrcSurf = pvVramBase + pSrcAlloc->offVram;
     659    uint8_t *pvDstSurf = pDstAlloc->Addr.SegmentId ? pvVramBase + pDstAlloc->Addr.offVram : (uint8_t*)pDstAlloc->Addr.pvMem;
     660    uint8_t *pvSrcSurf = pSrcAlloc->Addr.SegmentId ? pvVramBase + pSrcAlloc->Addr.offVram : (uint8_t*)pSrcAlloc->Addr.pvMem;
    661661
    662662    if (pDstAlloc->SurfDesc.width == dstWidth
     
    722722            vboxWddmRectTranslated(&SrcRect, &pBlt->DstRects.UpdateRects.aRects[i], -pBlt->DstRects.ContextRect.left, -pBlt->DstRects.ContextRect.top);
    723723
    724             Status = vboxVdmaGgDmaBltPerform(pDevExt, pBlt->SrcAlloc.pAlloc, &SrcRect,
    725                     pBlt->DstAlloc.pAlloc, &pBlt->DstRects.UpdateRects.aRects[i]);
     724            Status = vboxVdmaGgDmaBltPerform(pDevExt, &pBlt->SrcAlloc.pAlloc->AllocData, &SrcRect,
     725                    &pBlt->DstAlloc.pAlloc->AllocData, &pBlt->DstRects.UpdateRects.aRects[i]);
    726726            Assert(Status == STATUS_SUCCESS);
    727727            if (Status != STATUS_SUCCESS)
     
    731731    else
    732732    {
    733         Status = vboxVdmaGgDmaBltPerform(pDevExt, pBlt->SrcAlloc.pAlloc, &pBlt->SrcRect,
    734                 pBlt->DstAlloc.pAlloc, &pBlt->DstRects.ContextRect);
     733        Status = vboxVdmaGgDmaBltPerform(pDevExt, &pBlt->SrcAlloc.pAlloc->AllocData, &pBlt->SrcRect,
     734                &pBlt->DstAlloc.pAlloc->AllocData, &pBlt->DstRects.ContextRect);
    735735        Assert(Status == STATUS_SUCCESS);
    736736        if (Status != STATUS_SUCCESS)
     
    772772                        && pDstAlloc->bAssigned)
    773773                {
    774                     VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->SurfDesc.VidPnSourceId];
    775                     Assert(pDstAlloc->SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
     774                    VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
     775                    Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
    776776                    Assert(pSource->pPrimaryAllocation == pDstAlloc);
    777777
     
    810810            Assert(!pFlip->Hdr.fFlags.fRealOp);
    811811            PVBOXWDDM_ALLOCATION pAlloc = pFlip->Flip.Alloc.pAlloc;
    812             VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAlloc->SurfDesc.VidPnSourceId];
    813             vboxWddmAssignPrimary(pDevExt, pSource, pAlloc, pAlloc->SurfDesc.VidPnSourceId);
     812            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAlloc->AllocData.SurfDesc.VidPnSourceId];
     813            vboxWddmAssignPrimary(pDevExt, pSource, pAlloc, pAlloc->AllocData.SurfDesc.VidPnSourceId);
    814814            if (pFlip->Hdr.fFlags.fVisibleRegions)
    815815            {
     
    867867            PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc;
    868868            BOOLEAN bComplete = TRUE;
    869             VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->SurfDesc.VidPnSourceId];
    870             Assert(pDstAlloc->SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
     869            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
     870            Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
    871871
    872872            if (pBlt->Hdr.fFlags.fVisibleRegions)
     
    901901            PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlip = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)pDmaCmd;
    902902            PVBOXWDDM_ALLOCATION pAlloc = pFlip->Flip.Alloc.pAlloc;
    903             VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAlloc->SurfDesc.VidPnSourceId];
     903            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAlloc->AllocData.SurfDesc.VidPnSourceId];
    904904            if (pFlip->Hdr.fFlags.fVisibleRegions)
    905905            {
     
    913913                    SrcRect.left = 0;
    914914                    SrcRect.top = 0;
    915                     SrcRect.right = pAlloc->SurfDesc.width;
    916                     SrcRect.bottom = pAlloc->SurfDesc.height;
     915                    SrcRect.right = pAlloc->AllocData.SurfDesc.width;
     916                    SrcRect.bottom = pAlloc->AllocData.SurfDesc.height;
    917917                    Rects.ContextRect.left = pos.x;
    918918                    Rects.ContextRect.top = pos.y;
    919                     Rects.ContextRect.right = pAlloc->SurfDesc.width + pos.x;
    920                     Rects.ContextRect.bottom = pAlloc->SurfDesc.height + pos.y;
     919                    Rects.ContextRect.right = pAlloc->AllocData.SurfDesc.width + pos.x;
     920                    Rects.ContextRect.bottom = pAlloc->AllocData.SurfDesc.height + pos.y;
    921921                    Rects.UpdateRects.cRects = 1;
    922922                    Rects.UpdateRects.aRects[0] = Rects.ContextRect;
     
    18551855        return STATUS_INVALID_PARAMETER;
    18561856
    1857     Assert(pSource->pPrimaryAllocation->offVram != VBOXVIDEOOFFSET_VOID);
    1858     Assert(pSource->pShadowAllocation->offVram != VBOXVIDEOOFFSET_VOID);
    1859     if (pSource->pPrimaryAllocation->offVram == VBOXVIDEOOFFSET_VOID)
     1857    Assert(pSource->pPrimaryAllocation->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
     1858    Assert(pSource->pShadowAllocation->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
     1859    if (pSource->pPrimaryAllocation->AllocData.Addr.offVram == VBOXVIDEOOFFSET_VOID)
    18601860        return STATUS_INVALID_PARAMETER;
    1861     if (pSource->pShadowAllocation->offVram == VBOXVIDEOOFFSET_VOID)
     1861    if (pSource->pShadowAllocation->AllocData.Addr.offVram == VBOXVIDEOOFFSET_VOID)
    18621862        return STATUS_INVALID_PARAMETER;
    18631863
    1864     NTSTATUS Status = vboxVdmaGgDmaBltPerform(pDevExt, pSource->pShadowAllocation, pRect, pSource->pPrimaryAllocation, pRect);
     1864    NTSTATUS Status = vboxVdmaGgDmaBltPerform(pDevExt, &pSource->pShadowAllocation->AllocData, pRect, &pSource->pPrimaryAllocation->AllocData, pRect);
    18651865    Assert(Status == STATUS_SUCCESS);
    18661866    return Status;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h

    r42026 r42081  
    353353        PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete);
    354354
    355 NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pSrcAlloc, RECT* pSrcRect,
    356         PVBOXWDDM_ALLOCATION pDstAlloc, RECT* pDstRect);
     355NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_ALLOC_DATA * pSrcAlloc, RECT* pSrcRect,
     356        struct VBOXWDDM_ALLOC_DATA *pDstAlloc, RECT* pDstRect);
    357357
    358358#define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd)))
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVhwa.cpp

    r39981 r42081  
    539539    memset(pInfo, 0, sizeof(VBOXVHWA_SURFACEDESC));
    540540
    541     pInfo->height = pSurf->SurfDesc.height;
    542     pInfo->width = pSurf->SurfDesc.width;
     541    pInfo->height = pSurf->AllocData.SurfDesc.height;
     542    pInfo->width = pSurf->AllocData.SurfDesc.width;
    543543    pInfo->flags |= VBOXVHWA_SD_HEIGHT | VBOXVHWA_SD_WIDTH;
    544544    if (fFlags & VBOXVHWA_SD_PITCH)
    545545    {
    546         pInfo->pitch = pSurf->SurfDesc.pitch;
     546        pInfo->pitch = pSurf->AllocData.SurfDesc.pitch;
    547547        pInfo->flags |= VBOXVHWA_SD_PITCH;
    548         pInfo->sizeX = pSurf->SurfDesc.cbSize;
     548        pInfo->sizeX = pSurf->AllocData.SurfDesc.cbSize;
    549549        pInfo->sizeY = 1;
    550550    }
     
    563563//                        pInfo->SrcOverlayCK;
    564564//                        pInfo->SrcBltCK;
    565     int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf->SurfDesc.format);
     565    int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf->AllocData.SurfDesc.format);
    566566    AssertRC(rc);
    567567    if (RT_SUCCESS(rc))
     
    570570        pInfo->surfCaps = fSCaps;
    571571        pInfo->flags |= VBOXVHWA_SD_CAPS;
    572         pInfo->offSurface = pSurf->offVram;
     572        pInfo->offSurface = pSurf->AllocData.Addr.offVram;
    573573    }
    574574
     
    584584        /* should be set by host */
    585585//        Assert(pInfo->flags & VBOXVHWA_SD_PITCH);
    586         pSurf->SurfDesc.cbSize = pInfo->sizeX * pInfo->sizeY;
    587         Assert(pSurf->SurfDesc.cbSize);
    588         pSurf->SurfDesc.pitch = pInfo->pitch;
    589         Assert(pSurf->SurfDesc.pitch);
     586        pSurf->AllocData.SurfDesc.cbSize = pInfo->sizeX * pInfo->sizeY;
     587        Assert(pSurf->AllocData.SurfDesc.cbSize);
     588        pSurf->AllocData.SurfDesc.pitch = pInfo->pitch;
     589        Assert(pSurf->AllocData.SurfDesc.pitch);
    590590        /* @todo: make this properly */
    591         pSurf->SurfDesc.bpp = pSurf->SurfDesc.pitch * 8 / pSurf->SurfDesc.width;
    592         Assert(pSurf->SurfDesc.bpp);
     591        pSurf->AllocData.SurfDesc.bpp = pSurf->AllocData.SurfDesc.pitch * 8 / pSurf->AllocData.SurfDesc.width;
     592        Assert(pSurf->AllocData.SurfDesc.bpp);
    593593    }
    594594    else
    595595    {
    596         Assert(pSurf->SurfDesc.cbSize ==  pInfo->sizeX);
     596        Assert(pSurf->AllocData.SurfDesc.cbSize ==  pInfo->sizeX);
    597597        Assert(pInfo->sizeY == 1);
    598         Assert(pInfo->pitch == pSurf->SurfDesc.pitch);
    599         if (pSurf->SurfDesc.cbSize !=  pInfo->sizeX
     598        Assert(pInfo->pitch == pSurf->AllocData.SurfDesc.pitch);
     599        if (pSurf->AllocData.SurfDesc.cbSize !=  pInfo->sizeX
    600600                || pInfo->sizeY != 1
    601                 || pInfo->pitch != pSurf->SurfDesc.pitch)
     601                || pInfo->pitch != pSurf->AllocData.SurfDesc.pitch)
    602602        {
    603603            rc = VERR_INVALID_PARAMETER;
     
    810810    Assert(pFbSurf);
    811811    Assert(pFbSurf->hHostHandle);
    812     Assert(pFbSurf->offVram != VBOXVIDEOOFFSET_VOID);
     812    Assert(pFbSurf->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
    813813    Assert(pOverlay->pCurentAlloc);
    814814    Assert(pOverlay->pCurentAlloc->pResource == pOverlay->pResource);
     
    832832            pBody->u.in.hTargSurf = pAlloc->hHostHandle;
    833833            pBody->u.in.offTargSurface = pFlipInfo->SrcPhysicalAddress.QuadPart;
    834             pAlloc->offVram = pFlipInfo->SrcPhysicalAddress.QuadPart;
     834            pAlloc->AllocData.Addr.offVram = pFlipInfo->SrcPhysicalAddress.QuadPart;
    835835            pBody->u.in.hCurrSurf = pOverlay->pCurentAlloc->hHostHandle;
    836             pBody->u.in.offCurrSurface = pOverlay->pCurentAlloc->offVram;
     836            pBody->u.in.offCurrSurface = pOverlay->pCurentAlloc->AllocData.Addr.offVram;
    837837            if (pOurInfo->DirtyRegion.fFlags & VBOXWDDM_DIRTYREGION_F_VALID)
    838838            {
     
    842842                else
    843843                {
    844                     pBody->u.in.xUpdatedTargMemRect.right = pAlloc->SurfDesc.width;
    845                     pBody->u.in.xUpdatedTargMemRect.bottom = pAlloc->SurfDesc.height;
     844                    pBody->u.in.xUpdatedTargMemRect.right = pAlloc->AllocData.SurfDesc.width;
     845                    pBody->u.in.xUpdatedTargMemRect.bottom = pAlloc->AllocData.SurfDesc.height;
    846846                    /* top & left are zero-inited with the above memset */
    847847                }
     
    892892    Assert(pAlloc->hHostHandle);
    893893    Assert(pAlloc->pResource);
    894     Assert(pAlloc->offVram != VBOXVIDEOOFFSET_VOID);
     894    Assert(pAlloc->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
    895895
    896896    int rc;
     
    905905
    906906        pBody->u.in.hSurf = pAlloc->hHostHandle;
    907         pBody->u.in.offSurface = pAlloc->offVram;
     907        pBody->u.in.offSurface = pAlloc->AllocData.Addr.offVram;
    908908        pBody->u.in.cRects = pCF->ClrFill.Rects.cRects;
    909909        memcpy (pBody->u.in.aRects, pCF->ClrFill.Rects.aRects, pCF->ClrFill.Rects.cRects * sizeof (pCF->ClrFill.Rects.aRects[0]));
     
    970970    Assert(pFbSurf);
    971971    Assert(pFbSurf->hHostHandle);
    972     Assert(pFbSurf->offVram != VBOXVIDEOOFFSET_VOID);
     972    Assert(pFbSurf->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
    973973    int rc = VINF_SUCCESS;
    974974    if (pOverlayInfo->PrivateDriverDataSize == sizeof (VBOXWDDM_OVERLAY_INFO))
     
    986986
    987987            pBody->u.in.hDstSurf = pFbSurf->hHostHandle;
    988             pBody->u.in.offDstSurface = pFbSurf->offVram;
     988            pBody->u.in.offDstSurface = pFbSurf->AllocData.Addr.offVram;
    989989            pBody->u.in.dstRect = *(VBOXVHWA_RECTL*)((void*)&pOverlayInfo->DstRect);
    990990            pBody->u.in.hSrcSurf = pAlloc->hHostHandle;
    991991            pBody->u.in.offSrcSurface = pOverlayInfo->PhysicalAddress.QuadPart;
    992             pAlloc->offVram = pOverlayInfo->PhysicalAddress.QuadPart;
     992            pAlloc->AllocData.Addr.offVram = pOverlayInfo->PhysicalAddress.QuadPart;
    993993            pBody->u.in.srcRect = *(VBOXVHWA_RECTL*)((void*)&pOverlayInfo->SrcRect);
    994994            pBody->u.in.flags |= VBOXVHWA_OVER_SHOW;
     
    10141014                else
    10151015                {
    1016                     pBody->u.in.xUpdatedSrcMemRect.right = pAlloc->SurfDesc.width;
    1017                     pBody->u.in.xUpdatedSrcMemRect.bottom = pAlloc->SurfDesc.height;
     1016                    pBody->u.in.xUpdatedSrcMemRect.right = pAlloc->AllocData.SurfDesc.width;
     1017                    pBody->u.in.xUpdatedSrcMemRect.bottom = pAlloc->AllocData.SurfDesc.height;
    10181018                    /* top & left are zero-inited with the above memset */
    10191019                }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp

    r41319 r42081  
    20602060{
    20612061    vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, srcId);
     2062    pSource->AllocData.SurfDesc.width = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx;
     2063    pSource->AllocData.SurfDesc.height = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
     2064    pSource->AllocData.SurfDesc.format = pVidPnSourceModeInfo->Format.Graphics.PixelFormat;
     2065    pSource->AllocData.SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat);
     2066    pSource->AllocData.SurfDesc.pitch = pVidPnSourceModeInfo->Format.Graphics.Stride;
     2067    pSource->AllocData.SurfDesc.depth = 1;
     2068    pSource->AllocData.SurfDesc.slicePitch = pVidPnSourceModeInfo->Format.Graphics.Stride;
     2069    pSource->AllocData.SurfDesc.cbSize = pVidPnSourceModeInfo->Format.Graphics.Stride * pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
     2070    Assert(pSource->AllocData.SurfDesc.VidPnSourceId == srcId);
     2071    pSource->bGhSynced = FALSE;
    20622072    return STATUS_SUCCESS;
    20632073}
     
    21272137    if (pAllocation)
    21282138    {
    2129         Assert(pAllocation->SurfDesc.VidPnSourceId == srcId);
     2139        Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId == srcId);
    21302140    }
    21312141#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r42060 r42081  
    3333
    3434DWORD g_VBoxLogUm = 0;
     35#ifdef VBOX_WDDM_WIN8
     36DWORD g_VBoxDisplayOnly = 0;
     37#endif
    3538
    3639#define VBOXWDDM_MEMTAG 'MDBV'
     
    120123    else
    121124        pInfo->segmentIdAlloc = 0;
    122     pInfo->srcId = pAlloc->SurfDesc.VidPnSourceId;
     125    pInfo->srcId = pAlloc->AllocData.SurfDesc.VidPnSourceId;
    123126}
    124127
     
    133136    else
    134137        pInfo->segmentIdAlloc = 0;
    135     pInfo->srcId = pAlloc->SurfDesc.VidPnSourceId;
    136 }
    137 
    138 VBOXVIDEOOFFSET vboxWddmValidatePrimary(PVBOXWDDM_ALLOCATION pAllocation)
    139 {
    140     Assert(pAllocation);
    141     if (!pAllocation)
    142     {
    143         WARN(("no allocation specified for Source"));
    144         return VBOXVIDEOOFFSET_VOID;
    145     }
    146 
    147     Assert(pAllocation->SegmentId);
    148     if (!pAllocation->SegmentId)
    149     {
    150         WARN(("allocation is not paged in"));
    151         return VBOXVIDEOOFFSET_VOID;
    152     }
    153 
    154     VBOXVIDEOOFFSET offVram = pAllocation->offVram;
    155     Assert(offVram != VBOXVIDEOOFFSET_VOID);
    156     if (offVram == VBOXVIDEOOFFSET_VOID)
    157         WARN(("VRAM pffset is not defined"));
    158 
    159     return offVram;
     138    pInfo->srcId = pAlloc->AllocData.SurfDesc.VidPnSourceId;
    160139}
    161140
     
    190169}
    191170
    192 NTSTATUS vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAllocation, POINT * pVScreenPos)
    193 {
    194     NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pAllocation->SurfDesc, pVScreenPos, VBVA_SCREEN_F_ACTIVE);
     171NTSTATUS vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pAllocData, POINT * pVScreenPos)
     172{
     173    NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pAllocData->SurfDesc, pVScreenPos, VBVA_SCREEN_F_ACTIVE);
    195174    if (!NT_SUCCESS(Status))
    196175        WARN(("vboxWddmGhDisplayPostInfoScreenBySDesc failed Status 0x%x", Status));
     
    209188}
    210189
    211 NTSTATUS vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAllocation)
    212 {
    213     VBOXVIDEOOFFSET offVram = pAllocation->offVram;
    214     Assert(offVram != VBOXVIDEOOFFSET_VOID);
     190NTSTATUS vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pAllocData)
     191{
     192    VBOXVIDEOOFFSET offVram = pAllocData->Addr.offVram;
    215193    if (offVram == VBOXVIDEOOFFSET_VOID)
     194    {
     195        WARN(("offVram == VBOXVIDEOOFFSET_VOID"));
    216196        return STATUS_INVALID_PARAMETER;
     197    }
    217198
    218199    /* Issue the screen info command. */
     
    226207        VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p;
    227208
    228         pView->u32ViewIndex     = pAllocation->SurfDesc.VidPnSourceId;
     209        pView->u32ViewIndex     = pAllocData->SurfDesc.VidPnSourceId;
    229210        pView->u32ViewOffset    = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    230211        pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
     
    240221}
    241222
    242 NTSTATUS vboxWddmGhDisplaySetMode(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAllocation)
     223NTSTATUS vboxWddmGhDisplaySetMode(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pAllocData)
    243224{
    244225//    PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
    245     if (/*pPrimaryInfo->*/pAllocation->SurfDesc.VidPnSourceId)
     226    if (/*pPrimaryInfo->*/pAllocData->SurfDesc.VidPnSourceId)
    246227        return STATUS_SUCCESS;
    247228
    248     USHORT width  = pAllocation->SurfDesc.width;
    249     USHORT height = pAllocation->SurfDesc.height;
    250     USHORT bpp    = pAllocation->SurfDesc.bpp;
     229    if (pAllocData->Addr.offVram == VBOXVIDEOOFFSET_VOID)
     230    {
     231        WARN(("pAllocData->Addr.offVram == VBOXVIDEOOFFSET_VOID"));
     232        return STATUS_UNSUCCESSFUL;
     233    }
     234
     235    USHORT width  = pAllocData->SurfDesc.width;
     236    USHORT height = pAllocData->SurfDesc.height;
     237    USHORT bpp    = pAllocData->SurfDesc.bpp;
    251238    ULONG cbLine  = VBOXWDDM_ROUNDBOUND(((width * bpp) + 7) / 8, 4);
    252     ULONG yOffset = (ULONG)pAllocation->offVram / cbLine;
    253     ULONG xOffset = (ULONG)pAllocation->offVram % cbLine;
     239    ULONG yOffset = (ULONG)pAllocData->Addr.offVram / cbLine;
     240    ULONG xOffset = (ULONG)pAllocData->Addr.offVram % cbLine;
    254241
    255242    if (bpp == 4)
     
    279266    pSource->VScreenPos = *pVScreenPos;
    280267
    281     PVBOXWDDM_ALLOCATION pAllocation = VBOXWDDM_FB_ALLOCATION(pDevExt, pSource);
    282     NTSTATUS Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, pAllocation, &pSource->VScreenPos);
     268    NTSTATUS Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, &pSource->AllocData, &pSource->VScreenPos);
    283269    Assert(Status == STATUS_SUCCESS);
    284270    return Status;
     
    287273NTSTATUS vboxWddmGhDisplaySetInfo(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
    288274{
    289     PVBOXWDDM_ALLOCATION pAllocation = VBOXWDDM_FB_ALLOCATION(pDevExt, pSource);
    290     VBOXVIDEOOFFSET offVram = vboxWddmValidatePrimary(pAllocation);
    291     Assert(offVram != VBOXVIDEOOFFSET_VOID);
    292     if (offVram == VBOXVIDEOOFFSET_VOID)
    293         return STATUS_INVALID_PARAMETER;
    294 
    295     /*
    296      * Set the current mode into the hardware.
    297      */
    298 //    NTSTATUS Status= vboxWddmDisplaySettingsQueryPos(pDevExt, VidPnSourceId, &pSource->VScreenPos);
    299 //    Assert(Status == STATUS_SUCCESS);
    300     NTSTATUS Status = vboxWddmGhDisplaySetMode(pDevExt, pAllocation);
     275    NTSTATUS Status = vboxWddmGhDisplaySetMode(pDevExt, &pSource->AllocData);
    301276    Assert(Status == STATUS_SUCCESS);
    302277    if (Status == STATUS_SUCCESS)
    303278    {
    304         Status = vboxWddmGhDisplayPostInfoView(pDevExt, pAllocation);
     279        Status = vboxWddmGhDisplayPostInfoView(pDevExt, &pSource->AllocData);
    305280        Assert(Status == STATUS_SUCCESS);
    306281        if (Status == STATUS_SUCCESS)
    307282        {
    308             Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, pAllocation, &pSource->VScreenPos);
     283            Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, &pSource->AllocData, &pSource->VScreenPos);
    309284            Assert(Status == STATUS_SUCCESS);
    310             if (Status != STATUS_SUCCESS)
     285            if (Status == STATUS_SUCCESS)
     286                pSource->bGhSynced;
     287            else
    311288                WARN(("vboxWddmGhDisplayPostInfoScreen failed"));
    312289        }
     
    338315        }
    339316
    340         Assert(pToAllocation->offVram != VBOXVIDEOOFFSET_VOID);
    341         Assert(pFromAllocation->offVram != VBOXVIDEOOFFSET_VOID);
    342         if (pToAllocation->offVram != VBOXVIDEOOFFSET_VOID
    343                 && pFromAllocation->offVram != VBOXVIDEOOFFSET_VOID)
     317        Assert(pToAllocation->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
     318        Assert(pFromAllocation->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID);
     319        if (pToAllocation->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID
     320                && pFromAllocation->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID)
    344321        {
    345322            RECT Rect;
    346323            Rect.left = 0;
    347324            Rect.top = 0;
    348             Rect.right = pToAllocation->SurfDesc.width;
    349             Rect.bottom = pToAllocation->SurfDesc.height;
    350             vboxVdmaGgDmaBltPerform(pDevExt, pFromAllocation, &Rect,
    351                     pToAllocation, &Rect);
     325            Rect.right = pToAllocation->AllocData.SurfDesc.width;
     326            Rect.bottom = pToAllocation->AllocData.SurfDesc.height;
     327            vboxVdmaGgDmaBltPerform(pDevExt, &pFromAllocation->AllocData, &Rect,
     328                    &pToAllocation->AllocData, &Rect);
    352329        }
    353330
    354331        /* ensure we issue resize command on next update */
    355         pSource->offVram = VBOXVIDEOOFFSET_VOID;
     332        pSource->bGhSynced = FALSE;
    356333    }
    357334}
     
    396373}
    397374
    398 DECLINLINE(VOID) vboxWddmAllocUpdateAddress(PVBOXWDDM_ALLOCATION pAllocation, UINT SegmentId, VBOXVIDEOOFFSET offVram)
    399 {
    400     pAllocation->SegmentId = SegmentId;
    401     pAllocation->offVram = offVram;
    402 }
    403 
    404375#ifdef VBOXWDDM_RENDER_FROM_SHADOW
    405376bool vboxWddmCheckUpdateFramebufferAddress(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
     
    407378    if (pSource->pPrimaryAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
    408379    {
    409         Assert(pSource->offVram == VBOXVIDEOOFFSET_VOID);
     380        Assert(pSource->bGhSynced == FALSE);
    410381        return false;
    411382    }
    412383
    413     PVBOXWDDM_ALLOCATION pAllocation = VBOXWDDM_FB_ALLOCATION(pDevExt, pSource);
    414     Assert(VBOXVIDEOOFFSET_VOID != pAllocation->offVram);
    415 
    416     if (pSource->offVram == pAllocation->offVram)
     384    Assert(VBOXVIDEOOFFSET_VOID != pSource->AllocData.Addr.offVram);
     385
     386    if (pSource->bGhSynced)
    417387        return false;
    418     pSource->offVram = pAllocation->offVram;
    419388
    420389    NTSTATUS Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, VidPnSourceId);
    421     if (Status != STATUS_SUCCESS)
     390    if (!NT_SUCCESS(Status))
    422391        WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
    423392
     
    839808    for (int i = 0; i < RT_ELEMENTS(pDevExt->aSources); ++i)
    840809    {
    841         pDevExt->aSources[i].offVram = VBOXVIDEOOFFSET_VOID;
     810        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i];
     811        pSource->AllocData.SurfDesc.VidPnSourceId = i;
     812        pSource->AllocData.Addr.offVram = VBOXVIDEOOFFSET_VOID;
    842813    }
    843814#endif
     
    11331104                    Status = pDevExt->u.primary.DxgkInterface.DxgkCbAcquirePostDisplayOwnership(pDevExt->u.primary.DxgkInterface.DeviceHandle,
    11341105                            &DisplayInfo);
    1135                     if (!NT_SUCCESS(Status))
     1106                    if (NT_SUCCESS(Status))
     1107                    {
     1108                        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[0];
     1109                        pSource->AllocData.SurfDesc.width = DisplayInfo.Width;
     1110                        pSource->AllocData.SurfDesc.height = DisplayInfo.Height;
     1111                        pSource->AllocData.SurfDesc.format = DisplayInfo.ColorFormat;
     1112                        pSource->AllocData.SurfDesc.bpp = vboxWddmCalcBitsPerPixel(DisplayInfo.ColorFormat);
     1113                        pSource->AllocData.SurfDesc.pitch = DisplayInfo.Pitch;
     1114                        pSource->AllocData.SurfDesc.depth = 1;
     1115                        pSource->AllocData.SurfDesc.slicePitch = DisplayInfo.Pitch;
     1116                        pSource->AllocData.SurfDesc.cbSize = DisplayInfo.Pitch * DisplayInfo.Height;
     1117                        pSource->AllocData.SurfDesc.VidPnSourceId = 0;
     1118                        pSource->AllocData.SurfDesc.RefreshRate.Numerator = 60000;
     1119                        pSource->AllocData.SurfDesc.RefreshRate.Denominator = 1000;
     1120
     1121                        /* the address here is not a VRAM offset! so convert it to offset */
     1122                        vboxWddmAddrSetVram(&pSource->AllocData.Addr, 1,
     1123                                vboxWddmVramAddrToOffset(pDevExt, DisplayInfo.PhysicAddress));
     1124                    }
     1125                    else
    11361126                    {
    11371127                        WARN(("DxgkCbAcquirePostDisplayOwnership failed, Status 0x%x", Status));
     
    14461436                    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i];
    14471437                    PVBOXWDDM_ALLOCATION pPrimary = pSource->pPrimaryAllocation;
    1448                     if (pPrimary && pPrimary->offVram != VBOXVIDEOOFFSET_VOID)
     1438                    if (pPrimary && pPrimary->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID)
    14491439                    {
    14501440                        memset(&notify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA));
     
    14521442                        /* @todo: !!!this is not correct in case we want source[i]->target[i!=j] mapping */
    14531443                        notify.CrtcVsync.VidPnTargetId = i;
    1454                         notify.CrtcVsync.PhysicalAddress.QuadPart = pPrimary->offVram;
     1444                        notify.CrtcVsync.PhysicalAddress.QuadPart = pPrimary->AllocData.Addr.offVram;
    14551445                        pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, &notify);
    14561446
     
    17831773            DXGK_DRIVERCAPS *pCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData;
    17841774
     1775#ifdef VBOX_WDDM_WIN8
    17851776            memset(pCaps, 0, sizeof (*pCaps));
     1777#endif
    17861778
    17871779            pCaps->HighestAcceptableAddress.QuadPart = ~((uintptr_t)0);
    1788 #ifndef VBOX_WDDM_WIN8
     1780#ifdef VBOX_WDDM_WIN8
     1781            if (!g_VBoxDisplayOnly)
     1782#endif
     1783            {
    17891784            pCaps->MaxAllocationListSlotId = 16;
    17901785            pCaps->ApertureSegmentCommitLimit = 0;
     
    18201815            /* @todo: this correlates with pCaps->SchedulingCaps.MultiEngineAware */
    18211816            pCaps->GpuEngineTopology.NbAsymetricProcessingNodes = VBOXWDDM_NUM_NODES;
    1822 #else
    1823             pCaps->WDDMVersion = DXGKDDI_WDDMv1_2;
     1817#ifdef VBOX_WDDM_WIN8
     1818            pCaps->WDDMVersion = DXGKDDI_WDDMv1;
     1819#endif
     1820            }
     1821#ifdef VBOX_WDDM_WIN8
     1822            else
     1823            {
     1824                pCaps->WDDMVersion = DXGKDDI_WDDMv1_2;
     1825            }
    18241826#endif
    18251827            break;
    18261828        }
    1827 #ifndef VBOX_WDDM_WIN8
    18281829        case DXGKQAITYPE_QUERYSEGMENT:
    18291830        {
     1831#ifdef VBOX_WDDM_WIN8
     1832            if (!g_VBoxDisplayOnly)
     1833#endif
     1834            {
    18301835            /* no need for DXGK_QUERYSEGMENTIN as it contains AGP aperture info, which (AGP aperture) we do not support
    18311836             * DXGK_QUERYSEGMENTIN *pQsIn = (DXGK_QUERYSEGMENTIN*)pQueryAdapterInfo->pInputData; */
     
    18791884                pQsOut->PagingBufferPrivateDataSize = 0; /* @todo: do we need a private buffer ? */
    18801885            }
     1886            }
     1887#ifdef VBOX_WDDM_WIN8
     1888            else
     1889            {
     1890                WARN(("unsupported Type (%d)", pQueryAdapterInfo->Type));
     1891                Status = STATUS_NOT_SUPPORTED;
     1892            }
     1893#endif
     1894
    18811895            break;
    18821896        }
    18831897        case DXGKQAITYPE_UMDRIVERPRIVATE:
     1898#ifdef VBOX_WDDM_WIN8
     1899            if (!g_VBoxDisplayOnly)
     1900#endif
     1901            {
    18841902            Assert (pQueryAdapterInfo->OutputDataSize >= sizeof (VBOXWDDM_QI));
    18851903            if (pQueryAdapterInfo->OutputDataSize >= sizeof (VBOXWDDM_QI))
     
    19011919                Status = STATUS_BUFFER_TOO_SMALL;
    19021920            }
     1921            }
     1922#ifdef VBOX_WDDM_WIN8
     1923            else
     1924            {
     1925                WARN(("unsupported Type (%d)", pQueryAdapterInfo->Type));
     1926                Status = STATUS_NOT_SUPPORTED;
     1927            }
     1928#endif
    19031929            break;
    1904 #endif /* #ifndef VBOX_WDDM_WIN8 */
    19051930        default:
    19061931            WARN(("unsupported Type (%d)", pQueryAdapterInfo->Type));
     
    20082033            {
    20092034                /* @todo: do we need to notify host? */
    2010                 vboxWddmAssignPrimary(pDevExt, &pDevExt->aSources[pAllocation->SurfDesc.VidPnSourceId], NULL, pAllocation->SurfDesc.VidPnSourceId);
     2035                vboxWddmAssignPrimary(pDevExt, &pDevExt->aSources[pAllocation->AllocData.SurfDesc.VidPnSourceId], NULL, pAllocation->AllocData.SurfDesc.VidPnSourceId);
    20112036            }
    20122037            break;
     
    20172042            if (pAllocation->bAssigned)
    20182043            {
    2019                 Assert(pAllocation->SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED);
     2044                Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED);
    20202045                /* @todo: do we need to notify host? */
    2021                 vboxWddmAssignShadow(pDevExt, &pDevExt->aSources[pAllocation->SurfDesc.VidPnSourceId], NULL, pAllocation->SurfDesc.VidPnSourceId);
     2046                vboxWddmAssignShadow(pDevExt, &pDevExt->aSources[pAllocation->AllocData.SurfDesc.VidPnSourceId], NULL, pAllocation->AllocData.SurfDesc.VidPnSourceId);
    20222047            }
    20232048            break;
     
    21362161
    21372162            pAllocation->enmType = pAllocInfo->enmType;
    2138             pAllocation->offVram = VBOXVIDEOOFFSET_VOID;
     2163            pAllocation->AllocData.Addr.SegmentId = 0;
     2164            pAllocation->AllocData.Addr.offVram = VBOXVIDEOOFFSET_VOID;
    21392165            pAllocation->cRefs = 1;
    21402166            pAllocation->bVisible = FALSE;
     
    21512177                {
    21522178                    pAllocation->fRcFlags = pAllocInfo->fFlags;
    2153                     pAllocation->SurfDesc = pAllocInfo->SurfDesc;
     2179                    pAllocation->AllocData.SurfDesc = pAllocInfo->SurfDesc;
    21542180
    21552181                    pAllocationInfo->Size = pAllocInfo->SurfDesc.cbSize;
     
    21802206                                    pAllocationInfo->Flags.Overlay = 1;
    21812207                                    pAllocationInfo->Flags.CpuVisible = 1;
    2182                                     pAllocationInfo->Size = pAllocation->SurfDesc.cbSize;
     2208                                    pAllocationInfo->Size = pAllocation->AllocData.SurfDesc.cbSize;
    21832209
    21842210                                    pAllocationInfo->AllocationPriority = D3DDDI_ALLOCATIONPRIORITY_HIGH;
     
    21902216#endif
    21912217                            {
    2192                                 Assert(pAllocation->SurfDesc.bpp);
    2193                                 Assert(pAllocation->SurfDesc.pitch);
    2194                                 Assert(pAllocation->SurfDesc.cbSize);
     2218                                Assert(pAllocation->AllocData.SurfDesc.bpp);
     2219                                Assert(pAllocation->AllocData.SurfDesc.pitch);
     2220                                Assert(pAllocation->AllocData.SurfDesc.cbSize);
    21952221                                if (!pAllocInfo->fFlags.SharedResource)
    21962222                                {
     
    22222248                        pAllocation->UsageHint.v1.SwizzledFormat = 0;
    22232249                        pAllocation->UsageHint.v1.ByteOffset = 0;
    2224                         pAllocation->UsageHint.v1.Width = pAllocation->SurfDesc.width;
    2225                         pAllocation->UsageHint.v1.Height = pAllocation->SurfDesc.height;
    2226                         pAllocation->UsageHint.v1.Pitch = pAllocation->SurfDesc.pitch;
     2250                        pAllocation->UsageHint.v1.Width = pAllocation->AllocData.SurfDesc.width;
     2251                        pAllocation->UsageHint.v1.Height = pAllocation->AllocData.SurfDesc.height;
     2252                        pAllocation->UsageHint.v1.Pitch = pAllocation->AllocData.SurfDesc.pitch;
    22272253                        pAllocation->UsageHint.v1.Depth = 0;
    22282254                        pAllocation->UsageHint.v1.SlicePitch = 0;
     
    22382264                    pAllocationInfo->Size = pAllocInfo->cbBuffer;
    22392265                    pAllocation->fUhgsmiType = pAllocInfo->fUhgsmiType;
    2240                     pAllocation->SurfDesc.cbSize = pAllocInfo->cbBuffer;
     2266                    pAllocation->AllocData.SurfDesc.cbSize = pAllocInfo->cbBuffer;
    22412267                    pAllocationInfo->Flags.CpuVisible = 1;
    22422268//                    pAllocationInfo->Flags.SynchronousPaging = 1;
     
    24172443
    24182444    PVBOXWDDM_ALLOCATION pAllocation = (PVBOXWDDM_ALLOCATION)pDescribeAllocation->hAllocation;
    2419     pDescribeAllocation->Width = pAllocation->SurfDesc.width;
    2420     pDescribeAllocation->Height = pAllocation->SurfDesc.height;
    2421     pDescribeAllocation->Format = pAllocation->SurfDesc.format;
     2445    pDescribeAllocation->Width = pAllocation->AllocData.SurfDesc.width;
     2446    pDescribeAllocation->Height = pAllocation->AllocData.SurfDesc.height;
     2447    pDescribeAllocation->Format = pAllocation->AllocData.SurfDesc.format;
    24222448    memset (&pDescribeAllocation->MultisampleMethod, 0, sizeof (pDescribeAllocation->MultisampleMethod));
    24232449    pDescribeAllocation->RefreshRate.Numerator = 60000;
     
    29042930            PVBOXWDDM_ALLOCATION pSrcAlloc = pS2P->Shadow2Primary.ShadowAlloc.pAlloc;
    29052931            vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pS2P->Shadow2Primary.VidPnSourceId);
    2906             vboxWddmAllocUpdateAddress(pSrcAlloc, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc);
     2932            vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc);
    29072933            fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
    29082934            vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pS2P->Shadow2Primary.VidPnSourceId);
     
    29272953            PVBOXWDDM_ALLOCATION pDstAlloc = pBlt->Blt.DstAlloc.pAlloc;
    29282954            PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc;
    2929             VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->SurfDesc.VidPnSourceId];
    2930 
    2931             Assert(pDstAlloc->SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
    2932 
    2933             vboxWddmAllocUpdateAddress(pDstAlloc, pBlt->Blt.DstAlloc.segmentIdAlloc, pBlt->Blt.DstAlloc.offAlloc);
    2934             vboxWddmAllocUpdateAddress(pSrcAlloc, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc);
     2955            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
     2956
     2957            Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
     2958
     2959            vboxWddmAddrSetVram(&pDstAlloc->AllocData.Addr, pBlt->Blt.DstAlloc.segmentIdAlloc, pBlt->Blt.DstAlloc.offAlloc);
     2960            vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc);
    29352961
    29362962            uint32_t cContexts3D = ASMAtomicReadU32(&pDevExt->cContexts3D);
     
    29452971            {
    29462972                if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)
    2947                     vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pDstAlloc->SurfDesc.VidPnSourceId);
     2973                    vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pDstAlloc->AllocData.SurfDesc.VidPnSourceId);
    29482974                fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
    29492975                if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
    29502976                        || pDstAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
    2951                     vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pDstAlloc->SurfDesc.VidPnSourceId);
     2977                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pDstAlloc->AllocData.SurfDesc.VidPnSourceId);
    29522978            }
    29532979            else if (pSrcAlloc->bAssigned &&
     
    29572983            {
    29582984                if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)
    2959                     vboxWddmAssignShadow(pDevExt, pSource, pDstAlloc, pSrcAlloc->SurfDesc.VidPnSourceId);
     2985                    vboxWddmAssignShadow(pDevExt, pSource, pDstAlloc, pSrcAlloc->AllocData.SurfDesc.VidPnSourceId);
    29602986                fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
    29612987                if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
    29622988                        || pSrcAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
    2963                     vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pSrcAlloc->SurfDesc.VidPnSourceId);
     2989                    vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pSrcAlloc->AllocData.SurfDesc.VidPnSourceId);
    29642990            }
    29652991
     
    31173143        {
    31183144            VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip = (VBOXWDDM_DMA_PRIVATEDATA_FLIP*)pPrivateDataBase;
    3119             vboxWddmAllocUpdateAddress(pFlip->Flip.Alloc.pAlloc, pFlip->Flip.Alloc.segmentIdAlloc, pFlip->Flip.Alloc.offAlloc);
     3145            vboxWddmAddrSetVram(&pFlip->Flip.Alloc.pAlloc->AllocData.Addr, pFlip->Flip.Alloc.segmentIdAlloc, pFlip->Flip.Alloc.offAlloc);
    31203146            PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlipCmd = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)vboxVdmaGgCmdCreate(pDevExt,
    31213147                    VBOXVDMAPIPE_CMD_TYPE_DMACMD, sizeof (VBOXVDMAPIPE_CMD_DMACMD_FLIP));
     
    31453171        {
    31463172            PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL pCF = (PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL)pPrivateDataBase;
    3147             vboxWddmAllocUpdateAddress(pCF->ClrFill.Alloc.pAlloc, pCF->ClrFill.Alloc.segmentIdAlloc, pCF->ClrFill.Alloc.offAlloc);
     3173            vboxWddmAddrSetVram(&pCF->ClrFill.Alloc.pAlloc->AllocData.Addr, pCF->ClrFill.Alloc.segmentIdAlloc, pCF->ClrFill.Alloc.offAlloc);
    31483174            PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCFCmd = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)vboxVdmaGgCmdCreate(pDevExt,
    31493175                    VBOXVDMAPIPE_CMD_TYPE_DMACMD, RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, ClrFill.Rects.aRects[pCF->ClrFill.Rects.cRects]));
     
    45224548    Status = STATUS_SUCCESS;
    45234549
    4524     if ((UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays > pSetVidPnSourceAddress->VidPnSourceId)
    4525     {
    4526         PVBOXWDDM_ALLOCATION pAllocation;
    4527         Assert(pSetVidPnSourceAddress->hAllocation);
    4528         Assert(pSetVidPnSourceAddress->hAllocation || pSource->pPrimaryAllocation);
    4529         Assert (pSetVidPnSourceAddress->Flags.Value < 2); /* i.e. 0 or 1 (ModeChange) */
    4530         if (pSetVidPnSourceAddress->hAllocation)
    4531         {
    4532             pAllocation = (PVBOXWDDM_ALLOCATION)pSetVidPnSourceAddress->hAllocation;
    4533             vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, pSetVidPnSourceAddress->VidPnSourceId);
    4534         }
    4535         else
    4536             pAllocation = pSource->pPrimaryAllocation;
    4537 
    4538         Assert(pAllocation);
    4539         Assert(pAllocation->SurfDesc.VidPnSourceId == pSetVidPnSourceAddress->VidPnSourceId);
    4540 
    4541         if (pAllocation)
    4542         {
    4543 //            Assert(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE);
    4544             vboxWddmAllocUpdateAddress(pAllocation, pSetVidPnSourceAddress->PrimarySegment, (VBOXVIDEOOFFSET)pSetVidPnSourceAddress->PrimaryAddress.QuadPart);
    4545             Assert (pAllocation->SegmentId);
    4546             Assert (!pAllocation->bVisible);
    4547             Assert(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE
    4548                     || pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC);
    4549 
    4550             if (
    4551 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
    4552                     /* this is the case of full-screen d3d, ensure we notify host */
    4553                     pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC &&
    4554 #endif
    4555                     pAllocation->bVisible)
    4556             {
    4557 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
    4558                 /* to ensure the resize request gets issued in case we exit a full-screen D3D mode */
    4559                 pSource->offVram = VBOXVIDEOOFFSET_VOID;
    4560 #else
    4561                 /* should not generally happen, but still inform host*/
    4562                 Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceAddress->VidPnSourceId);
    4563                 Assert(Status == STATUS_SUCCESS);
    4564                 if (Status != STATUS_SUCCESS)
    4565                     LOGREL(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
    4566 #endif
    4567             }
    4568         }
    4569         else
    4570         {
    4571             WARN(("no allocation data available!!"));
    4572             Status = STATUS_INVALID_PARAMETER;
    4573         }
     4550    if ((UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays <= pSetVidPnSourceAddress->VidPnSourceId)
     4551    {
     4552        WARN(("invalid VidPnSourceId (%d), for displays(%d)", pSetVidPnSourceAddress->VidPnSourceId, VBoxCommonFromDeviceExt(pDevExt)->cDisplays));
     4553        return STATUS_INVALID_PARAMETER;
     4554    }
     4555
     4556    PVBOXWDDM_ALLOCATION pAllocation;
     4557    Assert(pSetVidPnSourceAddress->hAllocation);
     4558    Assert(pSetVidPnSourceAddress->hAllocation || pSource->pPrimaryAllocation);
     4559    Assert (pSetVidPnSourceAddress->Flags.Value < 2); /* i.e. 0 or 1 (ModeChange) */
     4560
     4561    if (pSetVidPnSourceAddress->hAllocation)
     4562    {
     4563        pAllocation = (PVBOXWDDM_ALLOCATION)pSetVidPnSourceAddress->hAllocation;
     4564        vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, pSetVidPnSourceAddress->VidPnSourceId);
    45744565    }
    45754566    else
    4576     {
    4577         WARN(("invalid VidPnSourceId (%d), should be smaller than (%d)", pSetVidPnSourceAddress->VidPnSourceId, VBoxCommonFromDeviceExt(pDevExt)->cDisplays));
    4578         Status = STATUS_INVALID_PARAMETER;
    4579     }
     4567        pAllocation = pSource->pPrimaryAllocation;
     4568
     4569    if (pAllocation)
     4570    {
     4571        vboxWddmAddrSetVram(&pAllocation->AllocData.Addr, pSetVidPnSourceAddress->PrimarySegment, (VBOXVIDEOOFFSET)pSetVidPnSourceAddress->PrimaryAddress.QuadPart);
     4572    }
     4573
     4574#ifdef VBOX_WDDM_WIN8
     4575    if (g_VBoxDisplayOnly && !pAllocation)
     4576    {
     4577        /* the VRAM here is an absolute address, nto an offset!
     4578         * convert to offset since all internal VBox functionality is offset-based */
     4579        vboxWddmAddrSetVram(&pSource->AllocData.Addr, pSetVidPnSourceAddress->PrimarySegment,
     4580                vboxWddmVramAddrToOffset(pDevExt, pSetVidPnSourceAddress->PrimaryAddress));
     4581    }
     4582    else
     4583#endif
     4584    {
     4585#ifdef VBOX_WDDM_WIN8
     4586        Assert(!g_VBoxDisplayOnly);
     4587#endif
     4588        vboxWddmAddrSetVram(&pSource->AllocData.Addr, pSetVidPnSourceAddress->PrimarySegment,
     4589                                                    pSetVidPnSourceAddress->PrimaryAddress.QuadPart);
     4590    }
     4591
     4592    pSource->bGhSynced = FALSE; /* force guest->host notification */
     4593
     4594#if defined(VBOXWDDM_RENDER_FROM_SHADOW) && defined(VBOX_WDDM_WIN8)
     4595    if (g_VBoxDisplayOnly && !pSource->bGhSynced && pSource->bVisible)
     4596    {
     4597        Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceAddress->VidPnSourceId);
     4598        if (!NT_SUCCESS(Status))
     4599        {
     4600            WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
     4601        }
     4602    }
     4603#endif
    45804604
    45814605    LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter));
     
    46074631    Status = STATUS_SUCCESS;
    46084632
    4609     if ((UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays > pSetVidPnSourceVisibility->VidPnSourceId)
    4610     {
    4611         PVBOXWDDM_ALLOCATION pAllocation = pSource->pPrimaryAllocation;
    4612         if (pAllocation)
    4613         {
    4614             Assert(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE
    4615                     || pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC);
    4616 
    4617             Assert(pAllocation->bVisible != pSetVidPnSourceVisibility->Visible);
    4618             if (pAllocation->bVisible != pSetVidPnSourceVisibility->Visible)
    4619             {
    4620                 pAllocation->bVisible = pSetVidPnSourceVisibility->Visible;
    4621                 if (pAllocation->bVisible)
    4622                 {
    4623 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
    4624                     if (/* this is the case of full-screen d3d, ensure we notify host */
    4625                         pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC
    4626                     )
    4627 #endif
    4628                     {
    4629 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
    4630                         /* to ensure the resize request gets issued in case we exit a full-screen D3D mode */
    4631                         pSource->offVram = VBOXVIDEOOFFSET_VOID;
    4632 #else
    4633                         Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceVisibility->VidPnSourceId);
    4634                         Assert(Status == STATUS_SUCCESS);
    4635                         if (Status != STATUS_SUCCESS)
    4636                             LOGREL(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
    4637 #endif
    4638                     }
    4639                 }
    4640 #ifdef VBOX_WITH_VDMA
    4641                 else
    4642                 {
    4643                     vboxVdmaFlush (pDevExt, &pDevExt->u.primary.Vdma);
    4644                 }
    4645 #endif
    4646             }
    4647         }
    4648         else
    4649         {
    4650             Assert(!pSetVidPnSourceVisibility->Visible);
    4651         }
    4652     }
    4653     else
    4654     {
    4655         LOGREL(("invalid VidPnSourceId (%d), should be smaller than (%d)", pSetVidPnSourceVisibility->VidPnSourceId, VBoxCommonFromDeviceExt(pDevExt)->cDisplays));
    4656         Status = STATUS_INVALID_PARAMETER;
     4633    if ((UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays <= pSetVidPnSourceVisibility->VidPnSourceId)
     4634    {
     4635        WARN(("invalid VidPnSourceId (%d), for displays(%d)", pSetVidPnSourceVisibility->VidPnSourceId, VBoxCommonFromDeviceExt(pDevExt)->cDisplays));
     4636        return STATUS_INVALID_PARAMETER;
     4637    }
     4638
     4639    PVBOXWDDM_ALLOCATION pAllocation = pSource->pPrimaryAllocation;
     4640    if (pAllocation)
     4641        pAllocation->bVisible = pSetVidPnSourceVisibility->Visible;
     4642
     4643    if (pSource->bVisible != pSetVidPnSourceVisibility->Visible)
     4644    {
     4645        pSource->bVisible = pSetVidPnSourceVisibility->Visible;
     4646#if defined(VBOXWDDM_RENDER_FROM_SHADOW) && defined(VBOX_WDDM_WIN8)
     4647        if (g_VBoxDisplayOnly && pSource->bVisible)
     4648        {
     4649            Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceVisibility->VidPnSourceId);
     4650            if (!NT_SUCCESS(Status))
     4651            {
     4652                WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
     4653            }
     4654        }
     4655#endif
    46574656    }
    46584657
     
    47364735                }
    47374736
    4738                 /* this will sero up visible height for all targets of the fiven source, see above comment */
     4737                /* this will zero up visible height for all targets of the fiven source, see above comment */
    47394738                Status = vboxVidPnEnumTargetsForSource(pDevExt, hVidPnTopology, pVidPnTopologyInterface,
    47404739                                pCommitVidPnArg->AffectedVidPnSourceId,
     
    51185117                    /* we have queried host for some surface info, like pitch & size,
    51195118                     * need to return it back to the UMD (User Mode Drive) */
    5120                     pAllocInfo->SurfDesc = pAllocation->SurfDesc;
     5119                    pAllocInfo->SurfDesc = pAllocation->AllocData.SurfDesc;
    51215120                    /* success, just continue */
    51225121                }
     
    53465345DECLINLINE(VOID) vboxWddmSurfDescFromAllocation(PVBOXWDDM_ALLOCATION pAllocation, PVBOXVDMA_SURF_DESC pDesc)
    53475346{
    5348     pDesc->width = pAllocation->SurfDesc.width;
    5349     pDesc->height = pAllocation->SurfDesc.height;
    5350     pDesc->format = vboxWddmFromPixFormat(pAllocation->SurfDesc.format);
    5351     pDesc->bpp = pAllocation->SurfDesc.bpp;
    5352     pDesc->pitch = pAllocation->SurfDesc.pitch;
     5347    pDesc->width = pAllocation->AllocData.SurfDesc.width;
     5348    pDesc->height = pAllocation->AllocData.SurfDesc.height;
     5349    pDesc->format = vboxWddmFromPixFormat(pAllocation->AllocData.SurfDesc.format);
     5350    pDesc->bpp = pAllocation->AllocData.SurfDesc.bpp;
     5351    pDesc->pitch = pAllocation->AllocData.SurfDesc.pitch;
    53535352    pDesc->fFlags = 0;
    53545353}
     
    54395438                            {
    54405439#ifdef VBOX_WITH_VIDEOHWACCEL
    5441 //                                if (vboxVhwaHlpOverlayListIsEmpty(pDevExt, pDstAlloc->SurfDesc.VidPnSourceId))
     5440//                                if (vboxVhwaHlpOverlayListIsEmpty(pDevExt, pDstAlloc->AllocData.SurfDesc.VidPnSourceId))
    54425441#endif
    54435442                                {
     
    54795478//                                        vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst);
    54805479                                        pS2P->Shadow2Primary.SrcRect = rect;
    5481                                         pS2P->Shadow2Primary.VidPnSourceId = pDstAlloc->SurfDesc.VidPnSourceId;
     5480                                        pS2P->Shadow2Primary.VidPnSourceId = pDstAlloc->AllocData.SurfDesc.VidPnSourceId;
    54825481                                        break;
    54835482                                    }
     
    55555554                    if (cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE())
    55565555                    {
    5557                         if (vboxWddmPixFormatConversionSupported(pSrcAlloc->SurfDesc.format, pDstAlloc->SurfDesc.format))
     5556                        if (vboxWddmPixFormatConversionSupported(pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format))
    55585557                        {
    55595558                            memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST));
     
    56005599                        {
    56015600                            AssertBreakpoint();
    5602                             LOGREL(("unsupported format conversion from(%d) to (%d)",pSrcAlloc->SurfDesc.format, pDstAlloc->SurfDesc.format));
     5601                            LOGREL(("unsupported format conversion from(%d) to (%d)",pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format));
    56035602                            Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT;
    56045603                        }
     
    56465645                if (pDstAlloc)
    56475646                {
    5648                     if (vboxWddmPixFormatConversionSupported(pSrcAlloc->SurfDesc.format, pDstAlloc->SurfDesc.format))
     5647                    if (vboxWddmPixFormatConversionSupported(pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format))
    56495648                    {
    56505649                        memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST));
     
    56905689                    {
    56915690                        AssertBreakpoint();
    5692                         LOGREL(("unsupported format conversion from(%d) to (%d)",pSrcAlloc->SurfDesc.format, pDstAlloc->SurfDesc.format));
     5691                        LOGREL(("unsupported format conversion from(%d) to (%d)",pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format));
    56935692                        Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT;
    56945693                    }
     
    59295928            for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
    59305929            {
    5931                 pDevExt->aSources[i].offVram = VBOXVIDEOOFFSET_VOID;
     5930                pDevExt->aSources[i].bGhSynced = FALSE;
    59325931                NTSTATUS tmpStatus= vboxWddmDisplaySettingsQueryPos(pDevExt, i, &pDevExt->aSources[i].VScreenPos);
    59335932                Assert(tmpStatus == STATUS_SUCCESS);
     
    61756174{
    61766175    LOGF(("ENTER, hAdapter(0x%x)", hAdapter));
    6177     vboxVDbgBreakFv();
     6176    vboxVDbgBreakF();
    61786177    AssertBreakpoint();
     6178
     6179    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter;
     6180    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pPresentDisplayOnly->VidPnSourceId];
     6181    Assert(pSource->AllocData.Addr.SegmentId);
     6182    VBOXWDDM_ALLOC_DATA SrcAllocData;
     6183    SrcAllocData.SurfDesc.width = pPresentDisplayOnly->Pitch * pPresentDisplayOnly->BytesPerPixel;
     6184    SrcAllocData.SurfDesc.height = ~0UL;
     6185    switch (pPresentDisplayOnly->BytesPerPixel)
     6186    {
     6187        case 4:
     6188            SrcAllocData.SurfDesc.format = D3DDDIFMT_A8R8G8B8;
     6189            break;
     6190        case 3:
     6191            SrcAllocData.SurfDesc.format = D3DDDIFMT_R8G8B8;
     6192            break;
     6193        case 2:
     6194            SrcAllocData.SurfDesc.format = D3DDDIFMT_R5G6B5;
     6195            break;
     6196        case 1:
     6197            SrcAllocData.SurfDesc.format = D3DDDIFMT_P8;
     6198            break;
     6199        default:
     6200            WARN(("Unknown format"));
     6201            SrcAllocData.SurfDesc.format = D3DDDIFMT_UNKNOWN;
     6202            break;
     6203    }
     6204    SrcAllocData.SurfDesc.bpp = pPresentDisplayOnly->BytesPerPixel >> 3;
     6205    SrcAllocData.SurfDesc.pitch = pPresentDisplayOnly->Pitch;
     6206    SrcAllocData.SurfDesc.depth = 1;
     6207    SrcAllocData.SurfDesc.slicePitch = pPresentDisplayOnly->Pitch;
     6208    SrcAllocData.SurfDesc.cbSize =  ~0UL;
     6209    SrcAllocData.Addr.SegmentId = 0;
     6210    SrcAllocData.Addr.pvMem = pPresentDisplayOnly->pSource;
     6211
     6212    RECT UpdateRect;
     6213    BOOLEAN bUpdateRectInited = FALSE;
     6214
     6215    for (UINT i = 0; i < pPresentDisplayOnly->NumMoves; ++i)
     6216    {
     6217        if (!bUpdateRectInited)
     6218            UpdateRect = pPresentDisplayOnly->pMoves[i].DestRect;
     6219        else
     6220            vboxWddmRectUnite(&UpdateRect, &pPresentDisplayOnly->pMoves[i].DestRect);
     6221        vboxVdmaGgDmaBltPerform(pDevExt, &SrcAllocData, &pPresentDisplayOnly->pMoves[i].DestRect, &pSource->AllocData, &pPresentDisplayOnly->pMoves[i].DestRect);
     6222    }
     6223
     6224    for (UINT i = 0; i < pPresentDisplayOnly->NumDirtyRects; ++i)
     6225    {
     6226        vboxVdmaGgDmaBltPerform(pDevExt, &SrcAllocData, &pPresentDisplayOnly->pDirtyRect[i], &pSource->AllocData, &pPresentDisplayOnly->pDirtyRect[i]);
     6227        if (!bUpdateRectInited)
     6228            UpdateRect = pPresentDisplayOnly->pDirtyRect[i];
     6229        else
     6230            vboxWddmRectUnite(&UpdateRect, &pPresentDisplayOnly->pDirtyRect[i]);
     6231    }
     6232
     6233    if (bUpdateRectInited)
     6234    {
     6235        VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
     6236    }
     6237
    61796238    LOGF(("LEAVE, hAdapter(0x%x)", hAdapter));
    61806239    return STATUS_SUCCESS;
     
    64576516    ULONG major, minor, build;
    64586517    BOOLEAN checkedBuild = PsGetVersion(&major, &minor, &build, NULL);
    6459     BOOLEAN f3Drequired = FALSE;
     6518    BOOLEAN f3DCheckRequired = FALSE;
    64606519
    64616520    LOGREL(("OsVersion( %d, %d, %d )", major, minor, build));
     
    64686527        if (major > 6)
    64696528        {
    6470             WARN(("Unknow win version, newer major release, assuming 3D is required"));
    6471             f3Drequired = TRUE;
     6529            WARN(("Unknow win version, newer major release, assuming 3D check is required"));
     6530            f3DCheckRequired = TRUE;
    64726531        }
    64736532        else if (major == 6)
     
    64756534            if (minor > 2)
    64766535            {
    6477                 WARN(("Unknow win version, newer minor release, assuming 3D is required"));
    6478                 f3Drequired = TRUE;
    6479             }
    6480 #ifndef VBOX_WDDM_WIN8
     6536                WARN(("Unknow win version, newer minor release, assuming 3D check is required"));
     6537                f3DCheckRequired = TRUE;
     6538            }
    64816539            else if (minor == 2)
    64826540            {
    6483                 LOG(("3D is required!"));
    6484                 f3Drequired = TRUE;
    6485             }
    6486 #endif
     6541                LOG(("3D check is required!"));
     6542                f3DCheckRequired = TRUE;
     6543            }
    64876544            else
    64886545            {
    64896546                LOG(("3D is NOT required!"));
    6490                 f3Drequired = FALSE;
     6547                f3DCheckRequired = FALSE;
    64916548            }
    64926549        }
     
    64946551        {
    64956552            WARN(("Unsupported OLDER win version, ignore and assume 3D is NOT required"));
    6496             f3Drequired = FALSE;
     6553            f3DCheckRequired = FALSE;
    64976554        }
    64986555
    64996556        Status = STATUS_SUCCESS;
    65006557
    6501         if (f3Drequired)
     6558        if (f3DCheckRequired)
    65026559        {
    65036560            LOG(("3D is required, doing the 3D check.."));
    65046561            if (!VBoxMpCrCtlConIs3DSupported())
    65056562            {
    6506                 LOGREL(("3D is NOT supported by the host, but is required for the current guest version.."));
     6563#ifdef VBOX_WDDM_WIN8
     6564                LOGREL(("3D is NOT supported by the host, falling back to display-only mode.."));
     6565                g_VBoxDisplayOnly = 1;
     6566#else
     6567                LOGREL(("3D is NOT supported by the host, but is required for the current guest version using this driver.."));
    65076568                Status = STATUS_UNSUCCESSFUL;
    6508             }
    6509         }
     6569#endif
     6570            }
     6571        }
     6572
     6573#ifdef VBOX_WDDM_WIN8
     6574        LOGREL(("Current win8 video driver only supports display-only mode no matter whether or not host 3D is enabled!"));
     6575        g_VBoxDisplayOnly = 1;
     6576#endif
    65106577
    65116578        if (NT_SUCCESS(Status))
     
    65156582            {
    65166583#ifdef VBOX_WDDM_WIN8
    6517                 Status = vboxWddmInitDisplayOnlyDriver(DriverObject, RegistryPath);
    6518 #else
    6519                 Status = vboxWddmInitFullGraphicsDriver(DriverObject, RegistryPath);
    6520 #endif
     6584                if (g_VBoxDisplayOnly)
     6585                {
     6586                    Status = vboxWddmInitDisplayOnlyDriver(DriverObject, RegistryPath);
     6587                }
     6588                else
     6589#endif
     6590                {
     6591                    Status = vboxWddmInitFullGraphicsDriver(DriverObject, RegistryPath);
     6592                }
     6593
    65216594                if (NT_SUCCESS(Status))
    65226595                    return Status;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h

    r41638 r42081  
    3535#define VBOXWDDM_CFG_STR_LOG_UM L"VBoxLogUm"
    3636extern DWORD g_VBoxLogUm;
     37extern DWORD g_VBoxDisplayOnly;
    3738
    3839RT_C_DECLS_BEGIN
     
    7576}
    7677
     78DECLINLINE(VOID) vboxWddmAddrSetVram(PVBOXWDDM_ADDR pAddr, UINT SegmentId, VBOXVIDEOOFFSET offVram)
     79{
     80    pAddr->SegmentId = SegmentId;
     81    pAddr->offVram = offVram;
     82}
     83
     84DECLINLINE(bool) vboxWddmAddrVramEqual(PVBOXWDDM_ADDR pAddr1, PVBOXWDDM_ADDR pAddr2)
     85{
     86    return pAddr1->SegmentId == pAddr2->SegmentId && pAddr1->offVram == pAddr2->offVram;
     87}
     88
     89DECLINLINE(VBOXVIDEOOFFSET) vboxWddmVramAddrToOffset(PVBOXMP_DEVEXT pDevExt, PHYSICAL_ADDRESS Addr)
     90{
     91    PVBOXMP_COMMON pCommon = VBoxCommonFromDeviceExt(pDevExt);
     92    AssertRelease(pCommon->phVRAM.QuadPart < Addr.QuadPart);
     93    return (VBOXVIDEOOFFSET)Addr.QuadPart - pCommon->phVRAM.QuadPart;
     94}
     95
    7796#ifdef VBOXWDDM_RENDER_FROM_SHADOW
    7897DECLINLINE(void) vboxWddmAssignShadow(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
     
    90109        pOldAlloc->bVisible = FALSE;
    91110        pOldAlloc->bAssigned = FALSE;
    92         Assert(pOldAlloc->SurfDesc.VidPnSourceId == srcId);
     111        Assert(pOldAlloc->AllocData.SurfDesc.VidPnSourceId == srcId);
    93112        /* release the shadow surface */
    94         pOldAlloc->SurfDesc.VidPnSourceId = D3DDDI_ID_UNINITIALIZED;
     113        pOldAlloc->AllocData.SurfDesc.VidPnSourceId = D3DDDI_ID_UNINITIALIZED;
    95114    }
    96115
     
    101120        pAllocation->bVisible = FALSE;
    102121        /* this check ensures the shadow is not used for other source simultaneously */
    103         Assert(pAllocation->SurfDesc.VidPnSourceId == D3DDDI_ID_UNINITIALIZED);
    104         pAllocation->SurfDesc.VidPnSourceId = srcId;
     122        Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId == D3DDDI_ID_UNINITIALIZED);
     123        pAllocation->AllocData.SurfDesc.VidPnSourceId = srcId;
    105124        pAllocation->bAssigned = TRUE;
    106         if (!vboxWddmCmpSurfDescsBase(&pSource->SurfDesc, &pAllocation->SurfDesc))
    107             pSource->offVram = VBOXVIDEOOFFSET_VOID; /* force guest->host notification */
    108         pSource->SurfDesc = pAllocation->SurfDesc;
     125        if(!vboxWddmAddrVramEqual(&pSource->AllocData.Addr, &pAllocation->AllocData.Addr))
     126            pSource->bGhSynced = FALSE; /* force guest->host notification */
     127        pSource->AllocData.Addr = pAllocation->AllocData.Addr;
    109128    }
    110129
     
    125144        pOldAlloc->bVisible = FALSE;
    126145        pOldAlloc->bAssigned = FALSE;
    127         Assert(pOldAlloc->SurfDesc.VidPnSourceId == srcId);
     146        Assert(pOldAlloc->AllocData.SurfDesc.VidPnSourceId == srcId);
    128147
    129148        vboxWddmAllocationRelease(pOldAlloc);
     
    133152    {
    134153        pAllocation->bVisible = FALSE;
    135         Assert(pAllocation->SurfDesc.VidPnSourceId == srcId);
     154        Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId == srcId);
    136155        pAllocation->bAssigned = TRUE;
     156
     157        if(!vboxWddmAddrVramEqual(&pSource->AllocData.Addr, &pAllocation->AllocData.Addr))
     158            pSource->bGhSynced = FALSE; /* force guest->host notification */
     159        pSource->AllocData.Addr = pAllocation->AllocData.Addr;
    137160
    138161        vboxWddmAllocationRetain(pAllocation);
     
    157180}
    158181
    159 
    160182#define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry)))
    161183
    162184#ifdef VBOXWDDM_RENDER_FROM_SHADOW
    163 # define VBOXWDDM_FB_ALLOCATION(_pDevExt, _pSrc) ((_pDevExt)->fRenderToShadowDisabled ? (_pSrc)->pPrimaryAllocation : (_pSrc)->pShadowAllocation)
     185# ifdef VBOX_WDDM_WIN8
     186#  define VBOXWDDM_FB_ALLOCATION(_pDevExt, _pSrc) ( (g_VBoxDisplayOnly || (_pDevExt)->fRenderToShadowDisabled) ? (_pSrc)->pPrimaryAllocation : (_pSrc)->pShadowAllocation)
     187# else
     188#  define VBOXWDDM_FB_ALLOCATION(_pDevExt, _pSrc) ((_pDevExt)->fRenderToShadowDisabled ? (_pSrc)->pPrimaryAllocation : (_pSrc)->pShadowAllocation)
     189# endif
    164190#else
    165191# define VBOXWDDM_FB_ALLOCATION(_pDevExt, _pSrc) ((_pSrc)->pPrimaryAllocation)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette