Changeset 28322 in vbox
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideo.h
r28228 r28322 1149 1149 VBOXVDMACMD_TYPE_DMA_PRESENT_BLT = 1, 1150 1150 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER = 2, 1151 VBOXVDMACMD_TYPE_DMA_BPB_FILL = 3 1151 VBOXVDMACMD_TYPE_DMA_BPB_FILL = 3, 1152 VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY = 4, 1152 1153 } VBOXVDMACMD_TYPE; 1153 1154 … … 1218 1219 } VBOXVDMACMD_DMA_PRESENT_BLT, *PVBOXVDMACMD_DMA_PRESENT_BLT; 1219 1220 1221 typedef struct VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY 1222 { 1223 VBOXVDMA_RECTL Rect; 1224 } VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY, *PVBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY; 1225 1220 1226 typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER 1221 1227 { -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r28264 r28322 483 483 484 484 /* does the host like that mode? */ 485 #ifndef VBOXWDDM 485 486 if (!vboxLikesVideoMode(DeviceExtension->iDevice, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 8)) 487 #else 488 if (!vboxLikesVideoMode(0 /* @todo: */, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 8)) 489 #endif 486 490 { 487 491 ++matrixIndex; … … 545 549 546 550 /* does the host like that mode? */ 551 #ifndef VBOXWDDM 547 552 if (!vboxLikesVideoMode(DeviceExtension->iDevice, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 16)) 553 #else 554 if (!vboxLikesVideoMode(0 /* @todo: */, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 16)) 555 #endif 556 548 557 { 549 558 ++matrixIndex; … … 605 614 606 615 /* does the host like that mode? */ 616 #ifndef VBOXWDDM 607 617 if (!vboxLikesVideoMode(DeviceExtension->iDevice, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 24)) 618 #else 619 if (!vboxLikesVideoMode(0, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 24)) 620 #endif 608 621 { 609 622 ++matrixIndex; … … 665 678 666 679 /* does the host like that mode? */ 680 #ifndef VBOXWDDM 667 681 if (!vboxLikesVideoMode(DeviceExtension->iDevice, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 32)) 682 #else 683 if (!vboxLikesVideoMode(0, resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 32)) 684 #endif 668 685 { 669 686 ++matrixIndex; … … 749 766 750 767 /* third test: does the host like the video mode? */ 768 #ifndef VBOXWDDM 751 769 if (!vboxLikesVideoMode(DeviceExtension->iDevice, xres, yres, bpp)) 770 #else 771 if (!vboxLikesVideoMode(0, xres, yres, bpp)) 772 #endif 752 773 break; 753 774 … … 981 1002 982 1003 /* does the host like that mode? */ 1004 #ifndef VBOXWDDM 983 1005 if (vboxLikesVideoMode(DeviceExtension->iDevice, xres, yres, bpp)) 1006 #else 1007 if (vboxLikesVideoMode(0, xres, yres, bpp)) 1008 #endif 984 1009 { 985 1010 /* we must have a valid video mode by now and it must fit within the VRAM */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r28228 r28322 84 84 VBOXVIDEOOFFSET offVram = pAllocation->offVram; 85 85 Assert(offVram != VBOXVIDEOOFFSET_VOID); 86 if (offVram == VBOXVIDEOOFFSET_VOID)87 return STATUS_INVALID_PARAMETER;86 // if (offVram == VBOXVIDEOOFFSET_VOID) 87 // return STATUS_INVALID_PARAMETER; 88 88 89 89 // PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); … … 101 101 pScreen->i32OriginX = 0; 102 102 pScreen->i32OriginY = 0; 103 pScreen->u32StartOffset = (uint32_t)offVram;103 pScreen->u32StartOffset = 0; //(uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */ 104 104 pScreen->u32LineSize = pAllocation->u.SurfInfo.pitch; 105 105 pScreen->u32Width = pAllocation->u.SurfInfo.width; … … 116 116 } 117 117 118 /* all views have a zero offset */119 118 NTSTATUS vboxWddmGhDisplayPostInfoView (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 120 119 { 121 //VBOXVIDEOOFFSET offVram = pAllocation->offVram;122 //Assert(offVram != VBOXVIDEOOFFSET_VOID);123 //if (offVram == VBOXVIDEOOFFSET_VOID)124 //return STATUS_INVALID_PARAMETER;120 VBOXVIDEOOFFSET offVram = pAllocation->offVram; 121 Assert(offVram != VBOXVIDEOOFFSET_VOID); 122 if (offVram == VBOXVIDEOOFFSET_VOID) 123 return STATUS_INVALID_PARAMETER; 125 124 126 125 // PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); … … 136 135 137 136 pView->u32ViewIndex = /*pPrimaryInfo->*/VidPnSourceId; 138 pView->u32ViewOffset = 0;//(uint32_t)offVram;137 pView->u32ViewOffset = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */ 139 138 pView->u32ViewSize = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/pDevExt->cSources; 140 139 … … 1800 1799 * we do not expect any other flags to be set here */ 1801 1800 // Assert(pPatch->Flags.Value == 2 || pPatch->Flags.Value == 4); 1802 #ifdef VBOXWDDM_RENDER_FROM_SHADOW1803 1801 Assert(pPatch->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATE_DATA)); 1804 1802 Assert(pPatch->DmaBufferPrivateDataSubmissionEndOffset - pPatch->DmaBufferPrivateDataSubmissionStartOffset >= sizeof (VBOXWDDM_DMA_PRIVATE_DATA)); … … 1806 1804 { 1807 1805 PVBOXWDDM_DMA_PRIVATE_DATA pPrivateData = (PVBOXWDDM_DMA_PRIVATE_DATA)((uint8_t*)pPatch->pDmaBufferPrivateData + pPatch->DmaBufferPrivateDataSubmissionStartOffset); 1808 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[0]; 1809 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_SOURCE_INDEX); 1810 Assert(pPatchList->PatchOffset == 0); 1811 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1812 Assert(pAllocationList->SegmentId); 1813 pPrivateData->segmentIdShadow = pAllocationList->SegmentId; 1814 pPrivateData->offShadow = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart; 1806 switch (pPrivateData->enmCmd) 1807 { 1808 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 1809 case VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY: 1810 { 1811 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[0]; 1812 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_SOURCE_INDEX); 1813 Assert(pPatchList->PatchOffset == 0); 1814 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1815 Assert(pAllocationList->SegmentId); 1816 pPrivateData->segmentIdShadow = pAllocationList->SegmentId; 1817 pPrivateData->offShadow = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart; 1818 break; 1819 } 1820 #endif 1821 default: 1822 { 1823 uint8_t *pBuf = ((uint8_t *)pPatch->pDmaBuffer) + pPatch->DmaBufferSubmissionStartOffset; 1824 for (UINT i = pPatch->PatchLocationListSubmissionStart; i < pPatch->PatchLocationListSubmissionLength; ++i) 1825 { 1826 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[i]; 1827 Assert(pPatchList->AllocationIndex < pPatch->AllocationListSize); 1828 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1829 if (pAllocationList->SegmentId) 1830 { 1831 Assert(pPatchList->PatchOffset < (pPatch->DmaBufferSubmissionEndOffset - pPatch->DmaBufferSubmissionStartOffset)); 1832 *((VBOXVIDEOOFFSET*)(pBuf+pPatchList->PatchOffset)) = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart; 1833 } 1834 else 1835 { 1836 /* sanity */ 1837 if (pPatch->Flags.Value == 2 || pPatch->Flags.Value == 4) 1838 Assert(i == 0); 1839 } 1840 } 1841 break; 1842 } 1843 } 1815 1844 } 1816 1845 else … … 1822 1851 return STATUS_INVALID_PARAMETER; 1823 1852 } 1824 #else1825 uint8_t *pBuf = ((uint8_t *)pPatch->pDmaBuffer) + pPatch->DmaBufferSubmissionStartOffset;1826 for (UINT i = pPatch->PatchLocationListSubmissionStart; i < pPatch->PatchLocationListSubmissionLength; ++i)1827 {1828 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[i];1829 Assert(pPatchList->AllocationIndex < pPatch->AllocationListSize);1830 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex];1831 if (pAllocationList->SegmentId)1832 {1833 Assert(pPatchList->PatchOffset < (pPatch->DmaBufferSubmissionEndOffset - pPatch->DmaBufferSubmissionStartOffset));1834 *((VBOXVIDEOOFFSET*)(pBuf+pPatchList->PatchOffset)) = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart;1835 }1836 else1837 {1838 /* sanity */1839 if (pPatch->Flags.Value == 2 || pPatch->Flags.Value == 4)1840 Assert(i == 0);1841 }1842 }1843 #endif1844 1853 1845 1854 dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", hAdapter)); … … 1910 1919 PVBOXWDDM_DMA_PRIVATE_DATA pPrivateData = (PVBOXWDDM_DMA_PRIVATE_DATA)((uint8_t*)pSubmitCommand->pDmaBufferPrivateData + pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset); 1911 1920 Assert(pPrivateData); 1921 switch (pPrivateData->enmCmd) 1922 { 1912 1923 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 1913 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->srcId]; 1914 BOOLEAN bRet; 1915 vboxWddmCheckUpdateShadowAddress(pDevExt, pSource, pPrivateData->segmentIdShadow, pPrivateData->offShadow); 1916 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &pPrivateData->rect); 1917 /* get DPC data at IRQL */ 1918 1919 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; 1920 context.pDevExt = pDevExt; 1921 context.pTransactionData = pPrivateData; 1922 context.SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 1923 Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 1924 pDevExt->u.primary.DxgkInterface.DeviceHandle, 1925 vboxWddmNotifyShadowUpdateCompletion, 1926 &context, 1927 0, /* IN ULONG MessageNumber */ 1928 &bRet); 1929 #else 1930 PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate (&pDevExt->u.primary.Vdma, 0); 1931 if (!pDr) 1932 { 1933 /* @todo: try flushing.. */ 1934 drprintf((__FUNCTION__": vboxVdmaCBufDrCreate returned NULL\n")); 1935 return STATUS_INSUFFICIENT_RESOURCES; 1936 } 1937 // vboxVdmaCBufDrCreate zero initializes the pDr 1938 //pDr->fFlags = 0; 1939 pDr->cbBuf = pSubmitCommand->DmaBufferSubmissionEndOffset - pSubmitCommand->DmaBufferSubmissionStartOffset; 1940 pDr->u32FenceId = pSubmitCommand->SubmissionFenceId; 1941 pDr->rc = VERR_NOT_IMPLEMENTED; 1942 if (pPrivateData) 1943 pDr->u64GuestContext = (uint64_t)pPrivateData->pContext; 1944 // else // vboxVdmaCBufDrCreate zero initializes the pDr 1945 // pDr->u64GuestContext = NULL; 1946 pDr->Location.phBuf = pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset; 1947 1948 vboxVdmaCBufDrSubmit (pDevExt, &pDevExt->u.primary.Vdma, pDr); 1924 case VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY: 1925 { 1926 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->srcId]; 1927 BOOLEAN bRet; 1928 vboxWddmCheckUpdateShadowAddress(pDevExt, pSource, pPrivateData->segmentIdShadow, pPrivateData->offShadow); 1929 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &pPrivateData->rect); 1930 /* get DPC data at IRQL */ 1931 1932 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; 1933 context.pDevExt = pDevExt; 1934 context.pTransactionData = pPrivateData; 1935 context.SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 1936 Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 1937 pDevExt->u.primary.DxgkInterface.DeviceHandle, 1938 vboxWddmNotifyShadowUpdateCompletion, 1939 &context, 1940 0, /* IN ULONG MessageNumber */ 1941 &bRet); 1942 break; 1943 } 1949 1944 #endif 1945 default: 1946 { 1947 PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate (&pDevExt->u.primary.Vdma, 0); 1948 if (!pDr) 1949 { 1950 /* @todo: try flushing.. */ 1951 drprintf((__FUNCTION__": vboxVdmaCBufDrCreate returned NULL\n")); 1952 return STATUS_INSUFFICIENT_RESOURCES; 1953 } 1954 // vboxVdmaCBufDrCreate zero initializes the pDr 1955 //pDr->fFlags = 0; 1956 pDr->cbBuf = pSubmitCommand->DmaBufferSubmissionEndOffset - pSubmitCommand->DmaBufferSubmissionStartOffset; 1957 pDr->u32FenceId = pSubmitCommand->SubmissionFenceId; 1958 pDr->rc = VERR_NOT_IMPLEMENTED; 1959 if (pPrivateData) 1960 pDr->u64GuestContext = (uint64_t)pPrivateData->pContext; 1961 // else // vboxVdmaCBufDrCreate zero initializes the pDr 1962 // pDr->u64GuestContext = NULL; 1963 pDr->Location.phBuf = pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset; 1964 1965 vboxVdmaCBufDrSubmit (pDevExt, &pDevExt->u.primary.Vdma, pDr); 1966 break; 1967 } 1968 } 1950 1969 // dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", hAdapter)); 1951 1970 … … 3326 3345 { 3327 3346 Assert(pPresent->Flags.Value == 1); /* only Blt is set, we do not support anything else for now */ 3328 #ifndef VBOXWDDM_RENDER_FROM_SHADOW 3347 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 3348 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 3349 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc); 3350 Assert(pSrcAlloc); 3351 if (pSrcAlloc) 3352 { 3353 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 3354 Assert(pDstAlloc); 3355 if (pDstAlloc) 3356 { 3357 do 3358 { 3359 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 3360 Assert (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE); 3361 Assert (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE); 3362 if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 3363 && pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) 3364 { 3365 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pDstAlloc, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 3366 Assert(pPrimaryInfo->bAssigned); 3367 Assert(pPrimaryInfo->bVisible); 3368 if (pPrimaryInfo->bAssigned 3369 && pPrimaryInfo->bVisible) 3370 { 3371 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrimaryInfo->VidPnSourceId]; 3372 vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pPrimaryInfo->VidPnSourceId); 3373 Assert(pPresent->SrcRect.left == pPresent->DstRect.left); 3374 Assert(pPresent->SrcRect.right == pPresent->DstRect.right); 3375 Assert(pPresent->SrcRect.top == pPresent->DstRect.top); 3376 Assert(pPresent->SrcRect.bottom == pPresent->DstRect.bottom); 3377 RECT rect; 3378 if (pPresent->SubRectCnt) 3379 { 3380 rect = pPresent->pDstSubRects[0]; 3381 for (UINT i = 1; i < pPresent->SubRectCnt; ++i) 3382 { 3383 vboxWddmRectUnited(&rect, &rect, &pPresent->pDstSubRects[i]); 3384 } 3385 } 3386 else 3387 rect = pPresent->SrcRect; 3388 3389 // if (pSrc->SegmentId) 3390 // { 3391 // vboxWddmCheckUpdateShadowAddress(pDevExt, pSource, pSrc->SegmentId, (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart); 3392 // VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect); 3393 // } 3394 // else 3395 { 3396 #define VBOXWDDM_DUMMY_DMABUFFER_SIZE sizeof(RECT) 3397 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 3398 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + sizeof (VBOXWDDM_DMA_PRIVATE_DATA); 3399 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 3400 Assert(pPresent->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATE_DATA)); 3401 if (pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE 3402 && pPresent->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATE_DATA)) 3403 { 3404 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 3405 // pPresent->pPatchLocationListOut->PatchOffset = 0; 3406 // ++pPresent->pPatchLocationListOut; 3407 pPresent->pPatchLocationListOut->PatchOffset = 0; 3408 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 3409 ++pPresent->pPatchLocationListOut; 3410 pPresent->pPatchLocationListOut->PatchOffset = 4; 3411 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 3412 ++pPresent->pPatchLocationListOut; 3413 3414 /* we do not know the shadow address yet, perform dummy DMA cycle */ 3415 pPrivateData->rect = rect; 3416 pPrivateData->srcId = pPrimaryInfo->VidPnSourceId; 3417 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY; 3418 if (pSrc->SegmentId) 3419 { 3420 pPrivateData->segmentIdShadow = pSrc->SegmentId; 3421 pPrivateData->offShadow = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart; 3422 } 3423 } 3424 else 3425 { 3426 /* this should not happen actually */ 3427 // drprintf((__FUNCTION__": cbCmd too small!! (%d)\n", cbCmd)); 3428 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 3429 } 3430 } 3431 break; 3432 } 3433 } 3434 3435 /* we're here because this is NOT a shadow->primary update */ 3436 #endif 3437 UINT cbCmd = pPresent->DmaSize; 3438 3439 Assert(pPresent->SubRectCnt); 3440 UINT cmdSize = VBOXVDMACMD_DMA_PRESENT_BLT_SIZE(pPresent->SubRectCnt - pPresent->MultipassOffset); 3441 PVBOXVDMACMD pCmd = (PVBOXVDMACMD)pPresent->pDmaBuffer; 3442 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + cmdSize; 3443 Assert(cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()); 3444 if (cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()) 3445 { 3446 if (vboxWddmPixFormatConversionSupported(pSrcAlloc->u.SurfInfo.format, pDstAlloc->u.SurfInfo.format)) 3447 { 3448 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 3449 // pPresent->pPatchLocationListOut->PatchOffset = 0; 3450 // ++pPresent->pPatchLocationListOut; 3451 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offSrc); 3452 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 3453 ++pPresent->pPatchLocationListOut; 3454 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offDst); 3455 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 3456 ++pPresent->pPatchLocationListOut; 3457 3458 pCmd->enmType = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 3459 pCmd->u32CmdSpecific = 0; 3460 PVBOXVDMACMD_DMA_PRESENT_BLT pTransfer = VBOXVDMACMD_BODY(pCmd, VBOXVDMACMD_DMA_PRESENT_BLT); 3461 pTransfer->offSrc = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart; 3462 pTransfer->offDst = (VBOXVIDEOOFFSET)pDst->PhysicalAddress.QuadPart; 3463 vboxWddmSurfDescFromAllocation(pSrcAlloc, &pTransfer->srcDesc); 3464 vboxWddmSurfDescFromAllocation(pDstAlloc, &pTransfer->dstDesc); 3465 vboxWddmRectlFromRect(&pPresent->SrcRect, &pTransfer->srcRectl); 3466 vboxWddmRectlFromRect(&pPresent->DstRect, &pTransfer->dstRectl); 3467 UINT i = 0; 3468 cbCmd -= VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, aDstSubRects); 3469 Assert(cbCmd >= sizeof (VBOXVDMA_RECTL)); 3470 Assert(cbCmd < pPresent->DmaSize); 3471 for (; i < pPresent->SubRectCnt; ++i) 3472 { 3473 if (cbCmd < sizeof (VBOXVDMA_RECTL)) 3474 { 3475 Assert(i); 3476 pPresent->MultipassOffset += i; 3477 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 3478 break; 3479 } 3480 vboxWddmRectlFromRect(&pPresent->pDstSubRects[i + pPresent->MultipassOffset], &pTransfer->aDstSubRects[i]); 3481 cbCmd -= sizeof (VBOXVDMA_RECTL); 3482 } 3483 Assert(i); 3484 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 3485 pTransfer->cDstSubRects = i; 3486 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + sizeof(VBOXWDDM_DMA_PRIVATE_DATA); 3487 } 3488 else 3489 { 3490 AssertBreakpoint(); 3491 drprintf((__FUNCTION__": unsupported format conversion from(%d) to (%d)\n",pSrcAlloc->u.SurfInfo.format, pDstAlloc->u.SurfInfo.format)); 3492 Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT; 3493 } 3494 } 3495 else 3496 { 3497 /* this should not happen actually */ 3498 drprintf((__FUNCTION__": cbCmd too small!! (%d)\n", cbCmd)); 3499 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 3500 } 3501 } while(0); 3502 } 3503 else 3504 { 3505 /* this should not happen actually */ 3506 drprintf((__FUNCTION__": failed to get Dst Allocation info for hDeviceSpecificAllocation(0x%x)\n",pDst->hDeviceSpecificAllocation)); 3507 Status = STATUS_INVALID_HANDLE; 3508 } } 3509 else 3510 { 3511 /* this should not happen actually */ 3512 drprintf((__FUNCTION__": failed to get Src Allocation info for hDeviceSpecificAllocation(0x%x)\n",pSrc->hDeviceSpecificAllocation)); 3513 Status = STATUS_INVALID_HANDLE; 3514 } 3515 #if 0 3329 3516 UINT cbCmd = pPresent->DmaSize; 3330 3517 … … 3414 3601 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 3415 3602 } 3416 #else3417 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX];3418 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX];3419 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc);3420 Assert(pSrcAlloc);3421 if (pSrcAlloc)3422 {3423 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst);3424 Assert(pDstAlloc);3425 if (pDstAlloc)3426 {3427 Assert (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE);3428 Assert (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE);3429 if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE)3430 {3431 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pDstAlloc, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);3432 Assert(pPrimaryInfo->bAssigned);3433 Assert(pPrimaryInfo->bVisible);3434 if (pPrimaryInfo->bAssigned3435 && pPrimaryInfo->bVisible)3436 {3437 if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)3438 {3439 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrimaryInfo->VidPnSourceId];3440 vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pPrimaryInfo->VidPnSourceId);3441 Assert(pPresent->SrcRect.left == pPresent->DstRect.left);3442 Assert(pPresent->SrcRect.right == pPresent->DstRect.right);3443 Assert(pPresent->SrcRect.top == pPresent->DstRect.top);3444 Assert(pPresent->SrcRect.bottom == pPresent->DstRect.bottom);3445 RECT rect;3446 if (pPresent->SubRectCnt)3447 {3448 rect = pPresent->pDstSubRects[0];3449 for (UINT i = 1; i < pPresent->SubRectCnt; ++i)3450 {3451 vboxWddmRectUnited(&rect, &rect, &pPresent->pDstSubRects[i]);3452 }3453 }3454 else3455 rect = pPresent->SrcRect;3456 3457 // if (pSrc->SegmentId)3458 // {3459 // vboxWddmCheckUpdateShadowAddress(pDevExt, pSource, pSrc->SegmentId, (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart);3460 // VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect);3461 // }3462 // else3463 {3464 #define VBOXWDDM_DUMMY_DMABUFFER_SIZE sizeof(RECT)3465 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE;3466 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + sizeof (VBOXWDDM_DMA_PRIVATE_DATA);3467 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE);3468 Assert(pPresent->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATE_DATA));3469 if (pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE3470 && pPresent->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATE_DATA))3471 {3472 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST));3473 // pPresent->pPatchLocationListOut->PatchOffset = 0;3474 // ++pPresent->pPatchLocationListOut;3475 pPresent->pPatchLocationListOut->PatchOffset = 0;3476 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX;3477 ++pPresent->pPatchLocationListOut;3478 pPresent->pPatchLocationListOut->PatchOffset = 4;3479 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX;3480 ++pPresent->pPatchLocationListOut;3481 3482 /* we do not know the shadow address yet, perform dummy DMA cycle */3483 pPrivateData->rect = rect;3484 pPrivateData->srcId = pPrimaryInfo->VidPnSourceId;3485 if (pSrc->SegmentId)3486 {3487 pPrivateData->segmentIdShadow = pSrc->SegmentId;3488 pPrivateData->offShadow = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart;3489 }3490 }3491 else3492 {3493 /* this should not happen actually */3494 // drprintf((__FUNCTION__": cbCmd too small!! (%d)\n", cbCmd));3495 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;3496 }3497 }3498 }3499 }3500 }3501 }3502 }3503 3603 #endif 3504 3604 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r28228 r28322 29 29 #define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K) 30 30 31 #define VBOXWDDM_RENDER_FROM_SHADOW 31 #ifdef VBOXWDDM_WITH_VBVA 32 # define VBOXWDDM_RENDER_FROM_SHADOW 33 #endif 32 34 33 35 #define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1)) … … 152 154 { 153 155 PVBOXWDDM_CONTEXT pContext; 156 VBOXVDMACMD_TYPE enmCmd; 154 157 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 155 158 RECT rect;
Note:
See TracChangeset
for help on using the changeset viewer.