Changeset 42081 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video
- Timestamp:
- Jul 10, 2012 9:47:29 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79022
- 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 520 520 bpp = bpp ? bpp :pExt->CurrentModeBPP; 521 521 #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; 525 525 #endif 526 526 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r41638 r42081 473 473 else if (pSwapchainInfo->SwapchainInfo.cAllocs) 474 474 { 475 pSwapchain = vboxWddmSwapchainCreate(apAlloc[0]-> SurfDesc.width, apAlloc[0]->SurfDesc.height);475 pSwapchain = vboxWddmSwapchainCreate(apAlloc[0]->AllocData.SurfDesc.width, apAlloc[0]->AllocData.SurfDesc.height); 476 476 if (!pSwapchain) 477 477 { … … 2584 2584 if (pPrimary) 2585 2585 { 2586 VBOXVIDEOOFFSET offVram = pPrimary-> offVram;2586 VBOXVIDEOOFFSET offVram = pPrimary->AllocData.Addr.offVram; 2587 2587 if (offVram != VBOXVIDEOOFFSET_VOID) 2588 2588 { … … 2591 2591 /* @todo: !!!this is not correct in case we want source[i]->target[i!=j] mapping */ 2592 2592 notify.CrtcVsync.VidPnTargetId = i; 2593 notify.CrtcVsync.PhysicalAddress.QuadPart = pPrimary->offVram;2593 notify.CrtcVsync.PhysicalAddress.QuadPart = offVram; 2594 2594 /* yes, we can report VSync at dispatch */ 2595 2595 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, ¬ify); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r41638 r42081 87 87 #endif 88 88 89 typedef 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 99 typedef struct VBOXWDDM_ALLOC_DATA 100 { 101 VBOXWDDM_SURFACE_DESC SurfDesc; 102 VBOXWDDM_ADDR Addr; 103 } VBOXWDDM_ALLOC_DATA, *PVBOXWDDM_ALLOC_DATA; 104 89 105 typedef struct VBOXWDDM_SOURCE 90 106 { … … 92 108 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 93 109 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; 96 114 VBOXVBVAINFO Vbva; 97 #endif98 115 #ifdef VBOX_WITH_VIDEOHWACCEL 99 116 /* @todo: in our case this seems more like a target property, … … 125 142 volatile uint32_t cRefs; 126 143 D3DDDI_RESOURCEFLAGS fRcFlags; 127 UINT SegmentId;128 VBOXVIDEOOFFSET offVram;129 144 #ifdef VBOX_WITH_VIDEOHWACCEL 130 145 VBOXVHWA_SURFHANDLE hHostHandle; … … 137 152 BOOLEAN fAssumedDeletion; 138 153 #endif 139 VBOXWDDM_ SURFACE_DESC SurfDesc;154 VBOXWDDM_ALLOC_DATA AllocData; 140 155 struct VBOXWDDM_RESOURCE *pResource; 141 156 /* to return to the Runtime on DxgkDdiCreateAllocation */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r41638 r42081 540 540 { 541 541 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) 544 544 { 545 545 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; 548 548 Assert(bpp); 549 Assert(((bpp * pAlloc-> SurfDesc.width) >> 3) == pAlloc->SurfDesc.pitch);549 Assert(((bpp * pAlloc->AllocData.SurfDesc.width) >> 3) == pAlloc->AllocData.SurfDesc.pitch); 550 550 switch (bpp) 551 551 { … … 558 558 for (LONG ir = pRect->top; ir < pRect->bottom; ++ir) 559 559 { 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)); 561 561 uint32_t cRaw = pRect->right - pRect->left; 562 562 Assert(pRect->left >= 0); 563 Assert(pRect->right <= (LONG)pAlloc-> SurfDesc.width);563 Assert(pRect->right <= (LONG)pAlloc->AllocData.SurfDesc.width); 564 564 Assert(pRect->top >= 0); 565 Assert(pRect->bottom <= (LONG)pAlloc-> SurfDesc.height);565 Assert(pRect->bottom <= (LONG)pAlloc->AllocData.SurfDesc.height); 566 566 for (UINT j = 0; j < cRaw; ++j) 567 567 { … … 584 584 if (Status == STATUS_SUCCESS) 585 585 { 586 if (pAlloc-> SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED586 if (pAlloc->AllocData.SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED 587 587 && pAlloc->bAssigned 588 588 #if 0//def VBOXWDDM_RENDER_FROM_SHADOW … … 595 595 if (!vboxWddmRectIsEmpty(&UnionRect)) 596 596 { 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]; 598 598 uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled); 599 599 if (!cUnlockedVBVADisabled) … … 618 618 } 619 619 620 NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC ATIONpSrcAlloc, RECT* pSrcRect,621 PVBOXWDDM_ALLOC ATIONpDstAlloc, RECT* pDstRect)620 NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pSrcAlloc, RECT* pSrcRect, 621 PVBOXWDDM_ALLOC_DATA pDstAlloc, RECT* pDstRect) 622 622 { 623 623 uint8_t* pvVramBase = pDevExt->pvVisibleVram; … … 629 629 Assert(srcHeight == dstHeight); 630 630 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); 633 633 D3DDDIFORMAT enmSrcFormat, enmDstFormat; 634 634 … … 652 652 if (srcWidth != dstWidth) 653 653 return STATUS_INVALID_PARAMETER; 654 if (pDstAlloc-> offVram == VBOXVIDEOOFFSET_VOID)654 if (pDstAlloc->Addr.offVram == VBOXVIDEOOFFSET_VOID) 655 655 return STATUS_INVALID_PARAMETER; 656 if (pSrcAlloc-> offVram == VBOXVIDEOOFFSET_VOID)656 if (pSrcAlloc->Addr.offVram == VBOXVIDEOOFFSET_VOID) 657 657 return STATUS_INVALID_PARAMETER; 658 658 659 uint8_t *pvDstSurf = p vVramBase + pDstAlloc->offVram;660 uint8_t *pvSrcSurf = p vVramBase + 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; 661 661 662 662 if (pDstAlloc->SurfDesc.width == dstWidth … … 722 722 vboxWddmRectTranslated(&SrcRect, &pBlt->DstRects.UpdateRects.aRects[i], -pBlt->DstRects.ContextRect.left, -pBlt->DstRects.ContextRect.top); 723 723 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]); 726 726 Assert(Status == STATUS_SUCCESS); 727 727 if (Status != STATUS_SUCCESS) … … 731 731 else 732 732 { 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); 735 735 Assert(Status == STATUS_SUCCESS); 736 736 if (Status != STATUS_SUCCESS) … … 772 772 && pDstAlloc->bAssigned) 773 773 { 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); 776 776 Assert(pSource->pPrimaryAllocation == pDstAlloc); 777 777 … … 810 810 Assert(!pFlip->Hdr.fFlags.fRealOp); 811 811 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); 814 814 if (pFlip->Hdr.fFlags.fVisibleRegions) 815 815 { … … 867 867 PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc; 868 868 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); 871 871 872 872 if (pBlt->Hdr.fFlags.fVisibleRegions) … … 901 901 PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlip = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)pDmaCmd; 902 902 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]; 904 904 if (pFlip->Hdr.fFlags.fVisibleRegions) 905 905 { … … 913 913 SrcRect.left = 0; 914 914 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; 917 917 Rects.ContextRect.left = pos.x; 918 918 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; 921 921 Rects.UpdateRects.cRects = 1; 922 922 Rects.UpdateRects.aRects[0] = Rects.ContextRect; … … 1855 1855 return STATUS_INVALID_PARAMETER; 1856 1856 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) 1860 1860 return STATUS_INVALID_PARAMETER; 1861 if (pSource->pShadowAllocation-> offVram == VBOXVIDEOOFFSET_VOID)1861 if (pSource->pShadowAllocation->AllocData.Addr.offVram == VBOXVIDEOOFFSET_VOID) 1862 1862 return STATUS_INVALID_PARAMETER; 1863 1863 1864 NTSTATUS Status = vboxVdmaGgDmaBltPerform(pDevExt, pSource->pShadowAllocation, pRect, pSource->pPrimaryAllocation, pRect);1864 NTSTATUS Status = vboxVdmaGgDmaBltPerform(pDevExt, &pSource->pShadowAllocation->AllocData, pRect, &pSource->pPrimaryAllocation->AllocData, pRect); 1865 1865 Assert(Status == STATUS_SUCCESS); 1866 1866 return Status; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h
r42026 r42081 353 353 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete); 354 354 355 NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATIONpSrcAlloc, RECT* pSrcRect,356 PVBOXWDDM_ALLOCATIONpDstAlloc, RECT* pDstRect);355 NTSTATUS vboxVdmaGgDmaBltPerform(PVBOXMP_DEVEXT pDevExt, struct VBOXWDDM_ALLOC_DATA * pSrcAlloc, RECT* pSrcRect, 356 struct VBOXWDDM_ALLOC_DATA *pDstAlloc, RECT* pDstRect); 357 357 358 358 #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 539 539 memset(pInfo, 0, sizeof(VBOXVHWA_SURFACEDESC)); 540 540 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; 543 543 pInfo->flags |= VBOXVHWA_SD_HEIGHT | VBOXVHWA_SD_WIDTH; 544 544 if (fFlags & VBOXVHWA_SD_PITCH) 545 545 { 546 pInfo->pitch = pSurf-> SurfDesc.pitch;546 pInfo->pitch = pSurf->AllocData.SurfDesc.pitch; 547 547 pInfo->flags |= VBOXVHWA_SD_PITCH; 548 pInfo->sizeX = pSurf-> SurfDesc.cbSize;548 pInfo->sizeX = pSurf->AllocData.SurfDesc.cbSize; 549 549 pInfo->sizeY = 1; 550 550 } … … 563 563 // pInfo->SrcOverlayCK; 564 564 // pInfo->SrcBltCK; 565 int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf-> SurfDesc.format);565 int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf->AllocData.SurfDesc.format); 566 566 AssertRC(rc); 567 567 if (RT_SUCCESS(rc)) … … 570 570 pInfo->surfCaps = fSCaps; 571 571 pInfo->flags |= VBOXVHWA_SD_CAPS; 572 pInfo->offSurface = pSurf-> offVram;572 pInfo->offSurface = pSurf->AllocData.Addr.offVram; 573 573 } 574 574 … … 584 584 /* should be set by host */ 585 585 // 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); 590 590 /* @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); 593 593 } 594 594 else 595 595 { 596 Assert(pSurf-> SurfDesc.cbSize == pInfo->sizeX);596 Assert(pSurf->AllocData.SurfDesc.cbSize == pInfo->sizeX); 597 597 Assert(pInfo->sizeY == 1); 598 Assert(pInfo->pitch == pSurf-> SurfDesc.pitch);599 if (pSurf-> SurfDesc.cbSize != pInfo->sizeX598 Assert(pInfo->pitch == pSurf->AllocData.SurfDesc.pitch); 599 if (pSurf->AllocData.SurfDesc.cbSize != pInfo->sizeX 600 600 || pInfo->sizeY != 1 601 || pInfo->pitch != pSurf-> SurfDesc.pitch)601 || pInfo->pitch != pSurf->AllocData.SurfDesc.pitch) 602 602 { 603 603 rc = VERR_INVALID_PARAMETER; … … 810 810 Assert(pFbSurf); 811 811 Assert(pFbSurf->hHostHandle); 812 Assert(pFbSurf-> offVram != VBOXVIDEOOFFSET_VOID);812 Assert(pFbSurf->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID); 813 813 Assert(pOverlay->pCurentAlloc); 814 814 Assert(pOverlay->pCurentAlloc->pResource == pOverlay->pResource); … … 832 832 pBody->u.in.hTargSurf = pAlloc->hHostHandle; 833 833 pBody->u.in.offTargSurface = pFlipInfo->SrcPhysicalAddress.QuadPart; 834 pAlloc-> offVram = pFlipInfo->SrcPhysicalAddress.QuadPart;834 pAlloc->AllocData.Addr.offVram = pFlipInfo->SrcPhysicalAddress.QuadPart; 835 835 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; 837 837 if (pOurInfo->DirtyRegion.fFlags & VBOXWDDM_DIRTYREGION_F_VALID) 838 838 { … … 842 842 else 843 843 { 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; 846 846 /* top & left are zero-inited with the above memset */ 847 847 } … … 892 892 Assert(pAlloc->hHostHandle); 893 893 Assert(pAlloc->pResource); 894 Assert(pAlloc-> offVram != VBOXVIDEOOFFSET_VOID);894 Assert(pAlloc->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID); 895 895 896 896 int rc; … … 905 905 906 906 pBody->u.in.hSurf = pAlloc->hHostHandle; 907 pBody->u.in.offSurface = pAlloc-> offVram;907 pBody->u.in.offSurface = pAlloc->AllocData.Addr.offVram; 908 908 pBody->u.in.cRects = pCF->ClrFill.Rects.cRects; 909 909 memcpy (pBody->u.in.aRects, pCF->ClrFill.Rects.aRects, pCF->ClrFill.Rects.cRects * sizeof (pCF->ClrFill.Rects.aRects[0])); … … 970 970 Assert(pFbSurf); 971 971 Assert(pFbSurf->hHostHandle); 972 Assert(pFbSurf-> offVram != VBOXVIDEOOFFSET_VOID);972 Assert(pFbSurf->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID); 973 973 int rc = VINF_SUCCESS; 974 974 if (pOverlayInfo->PrivateDriverDataSize == sizeof (VBOXWDDM_OVERLAY_INFO)) … … 986 986 987 987 pBody->u.in.hDstSurf = pFbSurf->hHostHandle; 988 pBody->u.in.offDstSurface = pFbSurf-> offVram;988 pBody->u.in.offDstSurface = pFbSurf->AllocData.Addr.offVram; 989 989 pBody->u.in.dstRect = *(VBOXVHWA_RECTL*)((void*)&pOverlayInfo->DstRect); 990 990 pBody->u.in.hSrcSurf = pAlloc->hHostHandle; 991 991 pBody->u.in.offSrcSurface = pOverlayInfo->PhysicalAddress.QuadPart; 992 pAlloc-> offVram = pOverlayInfo->PhysicalAddress.QuadPart;992 pAlloc->AllocData.Addr.offVram = pOverlayInfo->PhysicalAddress.QuadPart; 993 993 pBody->u.in.srcRect = *(VBOXVHWA_RECTL*)((void*)&pOverlayInfo->SrcRect); 994 994 pBody->u.in.flags |= VBOXVHWA_OVER_SHOW; … … 1014 1014 else 1015 1015 { 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; 1018 1018 /* top & left are zero-inited with the above memset */ 1019 1019 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp
r41319 r42081 2060 2060 { 2061 2061 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; 2062 2072 return STATUS_SUCCESS; 2063 2073 } … … 2127 2137 if (pAllocation) 2128 2138 { 2129 Assert(pAllocation-> SurfDesc.VidPnSourceId == srcId);2139 Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId == srcId); 2130 2140 } 2131 2141 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r42060 r42081 33 33 34 34 DWORD g_VBoxLogUm = 0; 35 #ifdef VBOX_WDDM_WIN8 36 DWORD g_VBoxDisplayOnly = 0; 37 #endif 35 38 36 39 #define VBOXWDDM_MEMTAG 'MDBV' … … 120 123 else 121 124 pInfo->segmentIdAlloc = 0; 122 pInfo->srcId = pAlloc-> SurfDesc.VidPnSourceId;125 pInfo->srcId = pAlloc->AllocData.SurfDesc.VidPnSourceId; 123 126 } 124 127 … … 133 136 else 134 137 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; 160 139 } 161 140 … … 190 169 } 191 170 192 NTSTATUS vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC ATION pAllocation, POINT * pVScreenPos)193 { 194 NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pAlloc ation->SurfDesc, pVScreenPos, VBVA_SCREEN_F_ACTIVE);171 NTSTATUS vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pAllocData, POINT * pVScreenPos) 172 { 173 NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pAllocData->SurfDesc, pVScreenPos, VBVA_SCREEN_F_ACTIVE); 195 174 if (!NT_SUCCESS(Status)) 196 175 WARN(("vboxWddmGhDisplayPostInfoScreenBySDesc failed Status 0x%x", Status)); … … 209 188 } 210 189 211 NTSTATUS vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 212 { 213 VBOXVIDEOOFFSET offVram = pAllocation->offVram; 214 Assert(offVram != VBOXVIDEOOFFSET_VOID); 190 NTSTATUS vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pAllocData) 191 { 192 VBOXVIDEOOFFSET offVram = pAllocData->Addr.offVram; 215 193 if (offVram == VBOXVIDEOOFFSET_VOID) 194 { 195 WARN(("offVram == VBOXVIDEOOFFSET_VOID")); 216 196 return STATUS_INVALID_PARAMETER; 197 } 217 198 218 199 /* Issue the screen info command. */ … … 226 207 VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p; 227 208 228 pView->u32ViewIndex = pAlloc ation->SurfDesc.VidPnSourceId;209 pView->u32ViewIndex = pAllocData->SurfDesc.VidPnSourceId; 229 210 pView->u32ViewOffset = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */ 230 211 pView->u32ViewSize = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/VBoxCommonFromDeviceExt(pDevExt)->cDisplays; … … 240 221 } 241 222 242 NTSTATUS vboxWddmGhDisplaySetMode(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC ATION pAllocation)223 NTSTATUS vboxWddmGhDisplaySetMode(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOC_DATA pAllocData) 243 224 { 244 225 // PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 245 if (/*pPrimaryInfo->*/pAlloc ation->SurfDesc.VidPnSourceId)226 if (/*pPrimaryInfo->*/pAllocData->SurfDesc.VidPnSourceId) 246 227 return STATUS_SUCCESS; 247 228 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; 251 238 ULONG cbLine = VBOXWDDM_ROUNDBOUND(((width * bpp) + 7) / 8, 4); 252 ULONG yOffset = (ULONG)pAlloc ation->offVram / cbLine;253 ULONG xOffset = (ULONG)pAlloc ation->offVram % cbLine;239 ULONG yOffset = (ULONG)pAllocData->Addr.offVram / cbLine; 240 ULONG xOffset = (ULONG)pAllocData->Addr.offVram % cbLine; 254 241 255 242 if (bpp == 4) … … 279 266 pSource->VScreenPos = *pVScreenPos; 280 267 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); 283 269 Assert(Status == STATUS_SUCCESS); 284 270 return Status; … … 287 273 NTSTATUS vboxWddmGhDisplaySetInfo(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 288 274 { 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); 301 276 Assert(Status == STATUS_SUCCESS); 302 277 if (Status == STATUS_SUCCESS) 303 278 { 304 Status = vboxWddmGhDisplayPostInfoView(pDevExt, pAllocation);279 Status = vboxWddmGhDisplayPostInfoView(pDevExt, &pSource->AllocData); 305 280 Assert(Status == STATUS_SUCCESS); 306 281 if (Status == STATUS_SUCCESS) 307 282 { 308 Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, pAllocation, &pSource->VScreenPos);283 Status = vboxWddmGhDisplayPostInfoScreen(pDevExt, &pSource->AllocData, &pSource->VScreenPos); 309 284 Assert(Status == STATUS_SUCCESS); 310 if (Status != STATUS_SUCCESS) 285 if (Status == STATUS_SUCCESS) 286 pSource->bGhSynced; 287 else 311 288 WARN(("vboxWddmGhDisplayPostInfoScreen failed")); 312 289 } … … 338 315 } 339 316 340 Assert(pToAllocation-> offVram != VBOXVIDEOOFFSET_VOID);341 Assert(pFromAllocation-> offVram != VBOXVIDEOOFFSET_VOID);342 if (pToAllocation-> offVram != VBOXVIDEOOFFSET_VOID343 && 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) 344 321 { 345 322 RECT Rect; 346 323 Rect.left = 0; 347 324 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); 352 329 } 353 330 354 331 /* ensure we issue resize command on next update */ 355 pSource-> offVram = VBOXVIDEOOFFSET_VOID;332 pSource->bGhSynced = FALSE; 356 333 } 357 334 } … … 396 373 } 397 374 398 DECLINLINE(VOID) vboxWddmAllocUpdateAddress(PVBOXWDDM_ALLOCATION pAllocation, UINT SegmentId, VBOXVIDEOOFFSET offVram)399 {400 pAllocation->SegmentId = SegmentId;401 pAllocation->offVram = offVram;402 }403 404 375 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 405 376 bool vboxWddmCheckUpdateFramebufferAddress(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) … … 407 378 if (pSource->pPrimaryAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC) 408 379 { 409 Assert(pSource-> offVram == VBOXVIDEOOFFSET_VOID);380 Assert(pSource->bGhSynced == FALSE); 410 381 return false; 411 382 } 412 383 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) 417 387 return false; 418 pSource->offVram = pAllocation->offVram;419 388 420 389 NTSTATUS Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, VidPnSourceId); 421 if ( Status != STATUS_SUCCESS)390 if (!NT_SUCCESS(Status)) 422 391 WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status)); 423 392 … … 839 808 for (int i = 0; i < RT_ELEMENTS(pDevExt->aSources); ++i) 840 809 { 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; 842 813 } 843 814 #endif … … 1133 1104 Status = pDevExt->u.primary.DxgkInterface.DxgkCbAcquirePostDisplayOwnership(pDevExt->u.primary.DxgkInterface.DeviceHandle, 1134 1105 &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 1136 1126 { 1137 1127 WARN(("DxgkCbAcquirePostDisplayOwnership failed, Status 0x%x", Status)); … … 1446 1436 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i]; 1447 1437 PVBOXWDDM_ALLOCATION pPrimary = pSource->pPrimaryAllocation; 1448 if (pPrimary && pPrimary-> offVram != VBOXVIDEOOFFSET_VOID)1438 if (pPrimary && pPrimary->AllocData.Addr.offVram != VBOXVIDEOOFFSET_VOID) 1449 1439 { 1450 1440 memset(¬ify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA)); … … 1452 1442 /* @todo: !!!this is not correct in case we want source[i]->target[i!=j] mapping */ 1453 1443 notify.CrtcVsync.VidPnTargetId = i; 1454 notify.CrtcVsync.PhysicalAddress.QuadPart = pPrimary-> offVram;1444 notify.CrtcVsync.PhysicalAddress.QuadPart = pPrimary->AllocData.Addr.offVram; 1455 1445 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, ¬ify); 1456 1446 … … 1783 1773 DXGK_DRIVERCAPS *pCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData; 1784 1774 1775 #ifdef VBOX_WDDM_WIN8 1785 1776 memset(pCaps, 0, sizeof (*pCaps)); 1777 #endif 1786 1778 1787 1779 pCaps->HighestAcceptableAddress.QuadPart = ~((uintptr_t)0); 1788 #ifndef VBOX_WDDM_WIN8 1780 #ifdef VBOX_WDDM_WIN8 1781 if (!g_VBoxDisplayOnly) 1782 #endif 1783 { 1789 1784 pCaps->MaxAllocationListSlotId = 16; 1790 1785 pCaps->ApertureSegmentCommitLimit = 0; … … 1820 1815 /* @todo: this correlates with pCaps->SchedulingCaps.MultiEngineAware */ 1821 1816 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 } 1824 1826 #endif 1825 1827 break; 1826 1828 } 1827 #ifndef VBOX_WDDM_WIN81828 1829 case DXGKQAITYPE_QUERYSEGMENT: 1829 1830 { 1831 #ifdef VBOX_WDDM_WIN8 1832 if (!g_VBoxDisplayOnly) 1833 #endif 1834 { 1830 1835 /* no need for DXGK_QUERYSEGMENTIN as it contains AGP aperture info, which (AGP aperture) we do not support 1831 1836 * DXGK_QUERYSEGMENTIN *pQsIn = (DXGK_QUERYSEGMENTIN*)pQueryAdapterInfo->pInputData; */ … … 1879 1884 pQsOut->PagingBufferPrivateDataSize = 0; /* @todo: do we need a private buffer ? */ 1880 1885 } 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 1881 1895 break; 1882 1896 } 1883 1897 case DXGKQAITYPE_UMDRIVERPRIVATE: 1898 #ifdef VBOX_WDDM_WIN8 1899 if (!g_VBoxDisplayOnly) 1900 #endif 1901 { 1884 1902 Assert (pQueryAdapterInfo->OutputDataSize >= sizeof (VBOXWDDM_QI)); 1885 1903 if (pQueryAdapterInfo->OutputDataSize >= sizeof (VBOXWDDM_QI)) … … 1901 1919 Status = STATUS_BUFFER_TOO_SMALL; 1902 1920 } 1921 } 1922 #ifdef VBOX_WDDM_WIN8 1923 else 1924 { 1925 WARN(("unsupported Type (%d)", pQueryAdapterInfo->Type)); 1926 Status = STATUS_NOT_SUPPORTED; 1927 } 1928 #endif 1903 1929 break; 1904 #endif /* #ifndef VBOX_WDDM_WIN8 */1905 1930 default: 1906 1931 WARN(("unsupported Type (%d)", pQueryAdapterInfo->Type)); … … 2008 2033 { 2009 2034 /* @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); 2011 2036 } 2012 2037 break; … … 2017 2042 if (pAllocation->bAssigned) 2018 2043 { 2019 Assert(pAllocation-> SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED);2044 Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId != D3DDDI_ID_UNINITIALIZED); 2020 2045 /* @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); 2022 2047 } 2023 2048 break; … … 2136 2161 2137 2162 pAllocation->enmType = pAllocInfo->enmType; 2138 pAllocation->offVram = VBOXVIDEOOFFSET_VOID; 2163 pAllocation->AllocData.Addr.SegmentId = 0; 2164 pAllocation->AllocData.Addr.offVram = VBOXVIDEOOFFSET_VOID; 2139 2165 pAllocation->cRefs = 1; 2140 2166 pAllocation->bVisible = FALSE; … … 2151 2177 { 2152 2178 pAllocation->fRcFlags = pAllocInfo->fFlags; 2153 pAllocation-> SurfDesc = pAllocInfo->SurfDesc;2179 pAllocation->AllocData.SurfDesc = pAllocInfo->SurfDesc; 2154 2180 2155 2181 pAllocationInfo->Size = pAllocInfo->SurfDesc.cbSize; … … 2180 2206 pAllocationInfo->Flags.Overlay = 1; 2181 2207 pAllocationInfo->Flags.CpuVisible = 1; 2182 pAllocationInfo->Size = pAllocation-> SurfDesc.cbSize;2208 pAllocationInfo->Size = pAllocation->AllocData.SurfDesc.cbSize; 2183 2209 2184 2210 pAllocationInfo->AllocationPriority = D3DDDI_ALLOCATIONPRIORITY_HIGH; … … 2190 2216 #endif 2191 2217 { 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); 2195 2221 if (!pAllocInfo->fFlags.SharedResource) 2196 2222 { … … 2222 2248 pAllocation->UsageHint.v1.SwizzledFormat = 0; 2223 2249 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; 2227 2253 pAllocation->UsageHint.v1.Depth = 0; 2228 2254 pAllocation->UsageHint.v1.SlicePitch = 0; … … 2238 2264 pAllocationInfo->Size = pAllocInfo->cbBuffer; 2239 2265 pAllocation->fUhgsmiType = pAllocInfo->fUhgsmiType; 2240 pAllocation-> SurfDesc.cbSize = pAllocInfo->cbBuffer;2266 pAllocation->AllocData.SurfDesc.cbSize = pAllocInfo->cbBuffer; 2241 2267 pAllocationInfo->Flags.CpuVisible = 1; 2242 2268 // pAllocationInfo->Flags.SynchronousPaging = 1; … … 2417 2443 2418 2444 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; 2422 2448 memset (&pDescribeAllocation->MultisampleMethod, 0, sizeof (pDescribeAllocation->MultisampleMethod)); 2423 2449 pDescribeAllocation->RefreshRate.Numerator = 60000; … … 2904 2930 PVBOXWDDM_ALLOCATION pSrcAlloc = pS2P->Shadow2Primary.ShadowAlloc.pAlloc; 2905 2931 vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pS2P->Shadow2Primary.VidPnSourceId); 2906 vboxWddmA llocUpdateAddress(pSrcAlloc, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc);2932 vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc); 2907 2933 fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL); 2908 2934 vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pS2P->Shadow2Primary.VidPnSourceId); … … 2927 2953 PVBOXWDDM_ALLOCATION pDstAlloc = pBlt->Blt.DstAlloc.pAlloc; 2928 2954 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 vboxWddmA llocUpdateAddress(pDstAlloc, pBlt->Blt.DstAlloc.segmentIdAlloc, pBlt->Blt.DstAlloc.offAlloc);2934 vboxWddmA llocUpdateAddress(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); 2935 2961 2936 2962 uint32_t cContexts3D = ASMAtomicReadU32(&pDevExt->cContexts3D); … … 2945 2971 { 2946 2972 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); 2948 2974 fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL); 2949 2975 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D 2950 2976 || pDstAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC) 2951 vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pDstAlloc-> SurfDesc.VidPnSourceId);2977 vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pDstAlloc->AllocData.SurfDesc.VidPnSourceId); 2952 2978 } 2953 2979 else if (pSrcAlloc->bAssigned && … … 2957 2983 { 2958 2984 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); 2960 2986 fRenderFromSharedDisabled = vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL); 2961 2987 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D 2962 2988 || pSrcAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC) 2963 vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pSrcAlloc-> SurfDesc.VidPnSourceId);2989 vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource, pSrcAlloc->AllocData.SurfDesc.VidPnSourceId); 2964 2990 } 2965 2991 … … 3117 3143 { 3118 3144 VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip = (VBOXWDDM_DMA_PRIVATEDATA_FLIP*)pPrivateDataBase; 3119 vboxWddmA llocUpdateAddress(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); 3120 3146 PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlipCmd = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)vboxVdmaGgCmdCreate(pDevExt, 3121 3147 VBOXVDMAPIPE_CMD_TYPE_DMACMD, sizeof (VBOXVDMAPIPE_CMD_DMACMD_FLIP)); … … 3145 3171 { 3146 3172 PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL pCF = (PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL)pPrivateDataBase; 3147 vboxWddmA llocUpdateAddress(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); 3148 3174 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCFCmd = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)vboxVdmaGgCmdCreate(pDevExt, 3149 3175 VBOXVDMAPIPE_CMD_TYPE_DMACMD, RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, ClrFill.Rects.aRects[pCF->ClrFill.Rects.cRects])); … … 4522 4548 Status = STATUS_SUCCESS; 4523 4549 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); 4574 4565 } 4575 4566 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 4580 4604 4581 4605 LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter)); … … 4607 4631 Status = STATUS_SUCCESS; 4608 4632 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 4657 4656 } 4658 4657 … … 4736 4735 } 4737 4736 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 */ 4739 4738 Status = vboxVidPnEnumTargetsForSource(pDevExt, hVidPnTopology, pVidPnTopologyInterface, 4740 4739 pCommitVidPnArg->AffectedVidPnSourceId, … … 5118 5117 /* we have queried host for some surface info, like pitch & size, 5119 5118 * need to return it back to the UMD (User Mode Drive) */ 5120 pAllocInfo->SurfDesc = pAllocation-> SurfDesc;5119 pAllocInfo->SurfDesc = pAllocation->AllocData.SurfDesc; 5121 5120 /* success, just continue */ 5122 5121 } … … 5346 5345 DECLINLINE(VOID) vboxWddmSurfDescFromAllocation(PVBOXWDDM_ALLOCATION pAllocation, PVBOXVDMA_SURF_DESC pDesc) 5347 5346 { 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; 5353 5352 pDesc->fFlags = 0; 5354 5353 } … … 5439 5438 { 5440 5439 #ifdef VBOX_WITH_VIDEOHWACCEL 5441 // if (vboxVhwaHlpOverlayListIsEmpty(pDevExt, pDstAlloc-> SurfDesc.VidPnSourceId))5440 // if (vboxVhwaHlpOverlayListIsEmpty(pDevExt, pDstAlloc->AllocData.SurfDesc.VidPnSourceId)) 5442 5441 #endif 5443 5442 { … … 5479 5478 // vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst); 5480 5479 pS2P->Shadow2Primary.SrcRect = rect; 5481 pS2P->Shadow2Primary.VidPnSourceId = pDstAlloc-> SurfDesc.VidPnSourceId;5480 pS2P->Shadow2Primary.VidPnSourceId = pDstAlloc->AllocData.SurfDesc.VidPnSourceId; 5482 5481 break; 5483 5482 } … … 5555 5554 if (cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()) 5556 5555 { 5557 if (vboxWddmPixFormatConversionSupported(pSrcAlloc-> SurfDesc.format, pDstAlloc->SurfDesc.format))5556 if (vboxWddmPixFormatConversionSupported(pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format)) 5558 5557 { 5559 5558 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); … … 5600 5599 { 5601 5600 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)); 5603 5602 Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT; 5604 5603 } … … 5646 5645 if (pDstAlloc) 5647 5646 { 5648 if (vboxWddmPixFormatConversionSupported(pSrcAlloc-> SurfDesc.format, pDstAlloc->SurfDesc.format))5647 if (vboxWddmPixFormatConversionSupported(pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format)) 5649 5648 { 5650 5649 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); … … 5690 5689 { 5691 5690 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)); 5693 5692 Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT; 5694 5693 } … … 5929 5928 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 5930 5929 { 5931 pDevExt->aSources[i]. offVram = VBOXVIDEOOFFSET_VOID;5930 pDevExt->aSources[i].bGhSynced = FALSE; 5932 5931 NTSTATUS tmpStatus= vboxWddmDisplaySettingsQueryPos(pDevExt, i, &pDevExt->aSources[i].VScreenPos); 5933 5932 Assert(tmpStatus == STATUS_SUCCESS); … … 6175 6174 { 6176 6175 LOGF(("ENTER, hAdapter(0x%x)", hAdapter)); 6177 vboxVDbgBreakF v();6176 vboxVDbgBreakF(); 6178 6177 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 6179 6238 LOGF(("LEAVE, hAdapter(0x%x)", hAdapter)); 6180 6239 return STATUS_SUCCESS; … … 6457 6516 ULONG major, minor, build; 6458 6517 BOOLEAN checkedBuild = PsGetVersion(&major, &minor, &build, NULL); 6459 BOOLEAN f3D required = FALSE;6518 BOOLEAN f3DCheckRequired = FALSE; 6460 6519 6461 6520 LOGREL(("OsVersion( %d, %d, %d )", major, minor, build)); … … 6468 6527 if (major > 6) 6469 6528 { 6470 WARN(("Unknow win version, newer major release, assuming 3D is required"));6471 f3D required = TRUE;6529 WARN(("Unknow win version, newer major release, assuming 3D check is required")); 6530 f3DCheckRequired = TRUE; 6472 6531 } 6473 6532 else if (major == 6) … … 6475 6534 if (minor > 2) 6476 6535 { 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 } 6481 6539 else if (minor == 2) 6482 6540 { 6483 LOG(("3D is required!")); 6484 f3Drequired = TRUE; 6485 } 6486 #endif 6541 LOG(("3D check is required!")); 6542 f3DCheckRequired = TRUE; 6543 } 6487 6544 else 6488 6545 { 6489 6546 LOG(("3D is NOT required!")); 6490 f3D required = FALSE;6547 f3DCheckRequired = FALSE; 6491 6548 } 6492 6549 } … … 6494 6551 { 6495 6552 WARN(("Unsupported OLDER win version, ignore and assume 3D is NOT required")); 6496 f3D required = FALSE;6553 f3DCheckRequired = FALSE; 6497 6554 } 6498 6555 6499 6556 Status = STATUS_SUCCESS; 6500 6557 6501 if (f3D required)6558 if (f3DCheckRequired) 6502 6559 { 6503 6560 LOG(("3D is required, doing the 3D check..")); 6504 6561 if (!VBoxMpCrCtlConIs3DSupported()) 6505 6562 { 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..")); 6507 6568 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 6510 6577 6511 6578 if (NT_SUCCESS(Status)) … … 6515 6582 { 6516 6583 #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 6521 6594 if (NT_SUCCESS(Status)) 6522 6595 return Status; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h
r41638 r42081 35 35 #define VBOXWDDM_CFG_STR_LOG_UM L"VBoxLogUm" 36 36 extern DWORD g_VBoxLogUm; 37 extern DWORD g_VBoxDisplayOnly; 37 38 38 39 RT_C_DECLS_BEGIN … … 75 76 } 76 77 78 DECLINLINE(VOID) vboxWddmAddrSetVram(PVBOXWDDM_ADDR pAddr, UINT SegmentId, VBOXVIDEOOFFSET offVram) 79 { 80 pAddr->SegmentId = SegmentId; 81 pAddr->offVram = offVram; 82 } 83 84 DECLINLINE(bool) vboxWddmAddrVramEqual(PVBOXWDDM_ADDR pAddr1, PVBOXWDDM_ADDR pAddr2) 85 { 86 return pAddr1->SegmentId == pAddr2->SegmentId && pAddr1->offVram == pAddr2->offVram; 87 } 88 89 DECLINLINE(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 77 96 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 78 97 DECLINLINE(void) vboxWddmAssignShadow(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId) … … 90 109 pOldAlloc->bVisible = FALSE; 91 110 pOldAlloc->bAssigned = FALSE; 92 Assert(pOldAlloc-> SurfDesc.VidPnSourceId == srcId);111 Assert(pOldAlloc->AllocData.SurfDesc.VidPnSourceId == srcId); 93 112 /* release the shadow surface */ 94 pOldAlloc-> SurfDesc.VidPnSourceId = D3DDDI_ID_UNINITIALIZED;113 pOldAlloc->AllocData.SurfDesc.VidPnSourceId = D3DDDI_ID_UNINITIALIZED; 95 114 } 96 115 … … 101 120 pAllocation->bVisible = FALSE; 102 121 /* 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; 105 124 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; 109 128 } 110 129 … … 125 144 pOldAlloc->bVisible = FALSE; 126 145 pOldAlloc->bAssigned = FALSE; 127 Assert(pOldAlloc-> SurfDesc.VidPnSourceId == srcId);146 Assert(pOldAlloc->AllocData.SurfDesc.VidPnSourceId == srcId); 128 147 129 148 vboxWddmAllocationRelease(pOldAlloc); … … 133 152 { 134 153 pAllocation->bVisible = FALSE; 135 Assert(pAllocation-> SurfDesc.VidPnSourceId == srcId);154 Assert(pAllocation->AllocData.SurfDesc.VidPnSourceId == srcId); 136 155 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; 137 160 138 161 vboxWddmAllocationRetain(pAllocation); … … 157 180 } 158 181 159 160 182 #define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry))) 161 183 162 184 #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 164 190 #else 165 191 # define VBOXWDDM_FB_ALLOCATION(_pDevExt, _pSrc) ((_pSrc)->pPrimaryAllocation)
Note:
See TracChangeset
for help on using the changeset viewer.