Changeset 94975 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video
- Timestamp:
- May 10, 2022 7:36:42 AM (3 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r94927 r94975 5070 5070 DriverInitializationData.DxgkDdiQueryCurrentFence = GaDxgkDdiQueryCurrentFence; 5071 5071 DriverInitializationData.DxgkDdiRender = GaDxgkDdiRender; 5072 DriverInitializationData.DxgkDdiPresent = GaDxgkDdiPresent;5072 DriverInitializationData.DxgkDdiPresent = SvgaDxgkDdiPresent; 5073 5073 } 5074 5074 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPDX.cpp
r94927 r94975 580 580 581 581 582 NTSTATUS APIENTRY DxgkDdiDXPresent(const HANDLE hContext, DXGKARG_PRESENT *pPresent)583 {584 NTSTATUS Status = STATUS_SUCCESS;585 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext;586 PVBOXWDDM_DEVICE pDevice = pContext->pDevice;587 PVBOXMP_DEVEXT pDevExt = pDevice->pAdapter;588 589 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX];590 //DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX];591 592 if (pPresent->Flags.Blt)593 {594 //PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pSrc);595 //PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDst);596 597 //GALOGG(GALOG_GROUP_PRESENT, ("Blt: sid=%x -> sid=%x\n", pSrcAlloc->AllocData.hostID, pDstAlloc->AllocData.hostID));598 599 DEBUG_BREAKPOINT_TEST();600 601 /* Generate empty DMA buffer.602 * Store the command buffer descriptor to pDmaBufferPrivateData.603 */604 GARENDERDATA *pRenderData = NULL;605 uint32_t u32TargetLength = 0;606 uint32_t cbPrivateData = 0;607 608 if (pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA))609 {610 /* Fill RenderData description in any case, it will be ignored if the above code failed. */611 pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData;612 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT;613 pRenderData->cbData = u32TargetLength;614 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */615 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer;616 pRenderData->pHwRenderData = NULL;617 cbPrivateData = sizeof(GARENDERDATA);618 }619 else620 {621 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;622 }623 624 switch (Status)625 {626 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER:627 if (pRenderData == NULL)628 {629 /* Not enough space in pDmaBufferPrivateData. */630 break;631 }632 RT_FALL_THRU();633 case STATUS_SUCCESS:634 {635 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + u32TargetLength;636 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + cbPrivateData;637 } break;638 default: break;639 }640 }641 else if (pPresent->Flags.Flip)642 {643 PVBOXWDDM_OPENALLOCATION pOa = (PVBOXWDDM_OPENALLOCATION)pSrc->hDeviceSpecificAllocation;644 PVBOXWDDM_ALLOCATION pSrcAllocation = pOa->pAllocation;645 Assert(pSrcAllocation->dx.desc.fPrimary);646 647 GALOGG(GALOG_GROUP_PRESENT, ("Flip: sid=%u %dx%d\n",648 pSrcAllocation->dx.sid, pSrcAllocation->dx.desc.surfaceInfo.size.width, pSrcAllocation->dx.desc.surfaceInfo.size.height));649 650 /* Generate DMA buffer containing the present commands.651 * Store the command buffer descriptor to pDmaBufferPrivateData.652 */653 GARENDERDATA *pRenderData = NULL;654 uint32_t u32TargetLength = 0;655 uint32_t cbPrivateData = 0;656 657 if (pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA))658 {659 void *pvTarget = pPresent->pDmaBuffer;660 const uint32_t cbTarget = pPresent->DmaSize;661 /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */662 RECT rect;663 rect.left = 0;664 rect.top = 0;665 rect.right = pSrcAllocation->dx.desc.surfaceInfo.size.width;666 rect.bottom = pSrcAllocation->dx.desc.surfaceInfo.size.height;667 uint32_t const cInClipRects = pPresent->SubRectCnt - pPresent->MultipassOffset;668 uint32_t cOutClipRects = 0;669 Status = SvgaGenBlitSurfaceToScreen(pDevExt->pGa->hw.pSvga,670 pSrcAllocation->dx.sid,671 &rect,672 pSrcAllocation->dx.desc.PrimaryDesc.VidPnSourceId,673 &rect,674 cInClipRects,675 pPresent->pDstSubRects + pPresent->MultipassOffset,676 pvTarget, cbTarget, &u32TargetLength, &cOutClipRects);677 if (Status == STATUS_BUFFER_OVERFLOW)678 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;679 680 if (Status == STATUS_SUCCESS)681 {682 if (cOutClipRects < cInClipRects)683 {684 /* Not all rectangles were copied. */685 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;686 }687 688 /* Advance the current rectangle index. */689 pPresent->MultipassOffset += cOutClipRects;690 }691 692 /* Fill RenderData description in any case, it will be ignored if the above code failed. */693 pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData;694 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT;695 pRenderData->cbData = u32TargetLength;696 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */697 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer;698 pRenderData->pHwRenderData = NULL;699 cbPrivateData = sizeof(GARENDERDATA);700 }701 else702 {703 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;704 }705 706 switch (Status)707 {708 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER:709 if (pRenderData == NULL)710 {711 /* Not enough space in pDmaBufferPrivateData. */712 break;713 }714 RT_FALL_THRU();715 case STATUS_SUCCESS:716 {717 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + u32TargetLength;718 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + cbPrivateData;719 } break;720 default: break;721 }722 }723 else if (pPresent->Flags.ColorFill)724 {725 LogRelMax(16, ("ColorFill is not implemented\n"));726 AssertFailed();727 728 /* Generate empty DMA buffer.729 * Store the command buffer descriptor to pDmaBufferPrivateData.730 */731 GARENDERDATA *pRenderData = NULL;732 uint32_t u32TargetLength = 0;733 uint32_t cbPrivateData = 0;734 735 if (pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA))736 {737 /* Fill RenderData description in any case, it will be ignored if the above code failed. */738 pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData;739 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT;740 pRenderData->cbData = u32TargetLength;741 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */742 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer;743 pRenderData->pHwRenderData = NULL;744 cbPrivateData = sizeof(GARENDERDATA);745 }746 else747 {748 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;749 }750 751 switch (Status)752 {753 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER:754 if (pRenderData == NULL)755 {756 /* Not enough space in pDmaBufferPrivateData. */757 break;758 }759 RT_FALL_THRU();760 case STATUS_SUCCESS:761 {762 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + u32TargetLength;763 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + cbPrivateData;764 } break;765 default: break;766 }767 }768 else769 {770 WARN(("cmd NOT IMPLEMENTED!! Flags(0x%x)", pPresent->Flags.Value));771 Status = STATUS_NOT_SUPPORTED;772 }773 774 return Status;775 }776 777 778 582 static NTSTATUS svgaPagingFill(PVBOXMP_DEVEXT pDevExt, DXGKARG_BUILDPAGINGBUFFER *pBuildPagingBuffer, uint32_t *pcbCommands) 779 583 { … … 1107 911 { 1108 912 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: 1109 AssertFailed(); /** @todo test */913 DEBUG_BREAKPOINT_TEST(); 1110 914 RT_FALL_THRU(); 1111 915 case STATUS_SUCCESS: -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp
r94902 r94975 452 452 AssertCompile(GA_DMA_MIN_SUBMIT_SIZE < sizeof(SVGA3dCmdHeader)); 453 453 454 DECLINLINE(PVBOXWDDM_ALLOCATION) vboxWddmGetAllocationFromAllocList(DXGK_ALLOCATIONLIST *pAllocList)455 { 456 PVBOXWDDM_OPENALLOCATION pO a = (PVBOXWDDM_OPENALLOCATION)pAllocList->hDeviceSpecificAllocation;457 return pO a? pOa->pAllocation: NULL;454 DECLINLINE(PVBOXWDDM_ALLOCATION) getAllocationFromAllocationListEntry(DXGK_ALLOCATIONLIST *pAllocationListEntry) 455 { 456 PVBOXWDDM_OPENALLOCATION pOA = (PVBOXWDDM_OPENALLOCATION)pAllocationListEntry->hDeviceSpecificAllocation; 457 return pOA? pOA->pAllocation: NULL; 458 458 } 459 459 … … 461 461 PVBOXWDDM_EXT_VMSVGA pSvga, 462 462 uint32_t idxAllocation, 463 DXGK_ALLOCATIONLIST *pAllocationList ,463 DXGK_ALLOCATIONLIST *pAllocationListEntry, 464 464 PVBOXWDDM_ALLOCATION pAllocation, 465 465 uint8_t *pu8Target, uint32_t cbTarget, uint32_t *pu32TargetOut) 466 466 { 467 uint32_t Pitch; 468 if ( pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE 469 || pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE) 470 Pitch = pAllocation->AllocData.SurfDesc.pitch; 471 else 472 AssertFailedReturn(STATUS_INVALID_PARAMETER); 473 467 474 NTSTATUS Status = SvgaGenDefineGMRFB(pSvga, 468 pAllocationList ->SegmentId != 0 ?469 pAllocationList ->PhysicalAddress.LowPart : 0,470 pAllocation->AllocData.SurfDesc.pitch,475 pAllocationListEntry->SegmentId != 0 ? 476 pAllocationListEntry->PhysicalAddress.LowPart : 0, 477 Pitch, 471 478 pu8Target, cbTarget, pu32TargetOut); 472 479 if (Status == STATUS_SUCCESS) … … 574 581 pu8Target, cbTarget, &cbCmd); 575 582 } 576 else if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC) 583 else if ( pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC 584 #ifdef VBOX_WITH_VMSVGA3D_DX 585 || pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_D3D 586 #endif 587 ) 577 588 { 578 589 /* From a surface. */ 590 #ifdef VBOX_WITH_VMSVGA3D_DX 591 uint32_t const sid = pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_D3D 592 ? pSrcAlloc->dx.sid 593 : pSrcAlloc->AllocData.hostID; 594 #else 595 uint32_t const sid = pSrcAlloc->AllocData.hostID; 596 #endif 597 579 598 GALOGG(GALOG_GROUP_PRESENT, ("Blt: surface sid=%u -> SHAREDPRIMARYSURFACE 0x%08X\n", 580 pSrcAlloc->AllocData.hostID, pDst->PhysicalAddress.LowPart));599 sid, pDst->PhysicalAddress.LowPart)); 581 600 582 601 RECT const dstRect = pPresent->pDstSubRects[iSubRect]; … … 588 607 RECT clipRect = dstRect; 589 608 Status = SvgaGenBlitSurfaceToScreen(pSvga, 590 pSrcAlloc->AllocData.hostID,609 sid, 591 610 &srcRect, 592 611 pDstAlloc->AllocData.SurfDesc.VidPnSourceId, … … 621 640 pu8Target, cbTarget, &cbCmd); 622 641 } 623 else if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC) 642 else if ( pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC 643 #ifdef VBOX_WITH_VMSVGA3D_DX 644 || pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_D3D 645 #endif 646 ) 624 647 { 625 648 /* From a surface. */ 649 #ifdef VBOX_WITH_VMSVGA3D_DX 650 uint32_t const sid = pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_D3D 651 ? pSrcAlloc->dx.sid 652 : pSrcAlloc->AllocData.hostID; 653 #else 654 uint32_t const sid = pSrcAlloc->AllocData.hostID; 655 #endif 656 626 657 GALOGG(GALOG_GROUP_PRESENT, ("Blt: surface sid=%u -> %s(%d) %d:0x%08X\n", 627 pSrcAlloc->AllocData.hostID,658 sid, 628 659 vboxWddmAllocTypeString(pDstAlloc), 629 660 pDstAlloc->enmType, pDst->SegmentId, pDst->PhysicalAddress.LowPart)); … … 635 666 636 667 SVGA3dSurfaceImageId surfId; 637 surfId.sid = pSrcAlloc->AllocData.hostID;668 surfId.sid = sid; 638 669 surfId.face = 0; 639 670 surfId.mipmap = 0; … … 691 722 } 692 723 693 static NTSTATUS APIENTRY gaPresentGA3D(const HANDLE hContext, 694 DXGKARG_PRESENT *pPresent); 695 696 NTSTATUS APIENTRY GaDxgkDdiPresent(const HANDLE hContext, 697 DXGKARG_PRESENT *pPresent) 724 static NTSTATUS svgaPresentBlt(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, DXGKARG_PRESENT *pPresent, uint32_t *pcbCommands) 725 { 726 RT_NOREF(pContext); 727 728 DXGK_ALLOCATIONLIST *pSrcAllocationListEntry = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 729 DXGK_ALLOCATIONLIST *pDstAllocationListEntry = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 730 731 PVBOXWDDM_ALLOCATION pSrcAllocation = getAllocationFromAllocationListEntry(pSrcAllocationListEntry); 732 PVBOXWDDM_ALLOCATION pDstAllocation = getAllocationFromAllocationListEntry(pDstAllocationListEntry); 733 734 NTSTATUS Status; 735 Status = gaPresentBlt(pPresent, pDevExt->pGa->hw.pSvga, pSrcAllocationListEntry, pSrcAllocation, 736 pDstAllocationListEntry, pDstAllocation, 737 (uint8_t *)pPresent->pDmaBuffer, pPresent->DmaSize, pcbCommands); 738 return Status; 739 } 740 741 742 static NTSTATUS svgaPresentFlip(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, DXGKARG_PRESENT *pPresent, uint32_t *pcbCommands) 743 { 744 RT_NOREF(pContext); 745 746 NTSTATUS Status; 747 748 uint32_t sid; 749 uint32_t width; 750 uint32_t height; 751 uint32_t VidPnSourceId; 752 753 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 754 PVBOXWDDM_ALLOCATION pSrcAllocation = getAllocationFromAllocationListEntry(pSrc); 755 if (pSrcAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC) 756 { 757 sid = pSrcAllocation->AllocData.hostID; 758 width = pSrcAllocation->AllocData.SurfDesc.width; 759 height = pSrcAllocation->AllocData.SurfDesc.height; 760 VidPnSourceId = pSrcAllocation->AllocData.SurfDesc.VidPnSourceId; 761 } 762 #ifdef VBOX_WITH_VMSVGA3D_DX 763 else if (pSrcAllocation->enmType == VBOXWDDM_ALLOC_TYPE_D3D) 764 { 765 Assert(pSrcAllocation->dx.desc.fPrimary); 766 sid = pSrcAllocation->dx.sid; 767 width = pSrcAllocation->dx.desc.surfaceInfo.size.width; 768 height = pSrcAllocation->dx.desc.surfaceInfo.size.height; 769 VidPnSourceId = pSrcAllocation->dx.desc.PrimaryDesc.VidPnSourceId; 770 } 771 #endif 772 else 773 AssertFailedReturn(STATUS_INVALID_PARAMETER); 774 775 GALOGG(GALOG_GROUP_PRESENT, ("Flip: sid=%u %dx%d\n", sid, width, height)); 776 777 /* 778 * Generate DMA buffer containing the present commands. 779 */ 780 /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */ 781 RECT rect; 782 rect.left = 0; 783 rect.top = 0; 784 rect.right = width; 785 rect.bottom = height; 786 uint32_t const cInClipRects = pPresent->SubRectCnt - pPresent->MultipassOffset; 787 uint32_t cOutClipRects = 0; 788 Status = SvgaGenBlitSurfaceToScreen(pDevExt->pGa->hw.pSvga, 789 sid, 790 &rect, 791 VidPnSourceId, 792 &rect, 793 cInClipRects, 794 pPresent->pDstSubRects + pPresent->MultipassOffset, 795 pPresent->pDmaBuffer, pPresent->DmaSize, pcbCommands, &cOutClipRects); 796 if (Status == STATUS_SUCCESS) 797 { 798 pPresent->MultipassOffset += cOutClipRects; /* Advance the current rectangle index. */ 799 if (cOutClipRects < cInClipRects) 800 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; /* Not all rectangles were copied. */ 801 } 802 else if (Status == STATUS_BUFFER_OVERFLOW) 803 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 804 805 return Status; 806 } 807 808 809 static NTSTATUS svgaPresentColorFill(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, DXGKARG_PRESENT *pPresent, uint32_t *pcbCommands) 810 { 811 RT_NOREF(pDevExt, pContext, pPresent, pcbCommands); 812 813 LogRelMax(16, ("ColorFill is not implemented\n")); 814 815 DEBUG_BREAKPOINT_TEST(); 816 return STATUS_SUCCESS; 817 } 818 819 820 NTSTATUS APIENTRY SvgaDxgkDdiPresent(const HANDLE hContext, 821 DXGKARG_PRESENT *pPresent) 698 822 { 699 823 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext; … … 713 837 i, pPresent->pDstSubRects[i].left, pPresent->pDstSubRects[i].top, pPresent->pDstSubRects[i].right, pPresent->pDstSubRects[i].bottom)); 714 838 715 #ifdef VBOX_WITH_VMSVGA3D_DX 716 if (pContext->enmType == VBOXWDDM_CONTEXT_TYPE_VMSVGA_D3D) 717 return DxgkDdiDXPresent(pContext, pPresent); 718 #endif 719 return gaPresentGA3D(pContext, pPresent); 720 } 721 722 static NTSTATUS APIENTRY gaPresentGA3D(const HANDLE hContext, 723 DXGKARG_PRESENT *pPresent) 724 { 725 NTSTATUS Status = STATUS_SUCCESS; 726 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext; 727 PVBOXWDDM_DEVICE pDevice = pContext->pDevice; 728 PVBOXMP_DEVEXT pDevExt = pDevice->pAdapter; 729 730 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 731 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 732 839 AssertReturn(pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA), STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER); 840 841 uint32_t cbCommands = 0; 842 NTSTATUS Status; 733 843 if (pPresent->Flags.Blt) 734 { 735 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pSrc); 736 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDst); 737 738 GALOGG(GALOG_GROUP_PRESENT, ("Blt: sid=%x -> sid=%x\n", pSrcAlloc->AllocData.hostID, pDstAlloc->AllocData.hostID)); 739 740 /** @todo Review standard allocations (DxgkDdiGetStandardAllocationDriverData, etc). 741 * Probably can be used more naturally with VMSVGA. 742 */ 743 744 /** @todo Merge common code for all branches (Blt, Flip, ColorFill) */ 745 746 /* Generate DMA buffer containing the SVGA_CMD_BLIT_GMRFB_TO_SCREEN commands. 747 * Store the command buffer descriptor to pDmaBufferPrivateData. 748 */ 749 GARENDERDATA *pRenderData = NULL; 750 uint32_t u32TargetLength = 0; 751 uint32_t cbPrivateData = 0; 752 753 if (pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA)) 754 { 755 uint8_t *pu8Target = (uint8_t *)pPresent->pDmaBuffer; 756 uint32_t cbTarget = pPresent->DmaSize; 757 758 Status = gaPresentBlt(pPresent, pDevExt->pGa->hw.pSvga, pSrc, pSrcAlloc, pDst, pDstAlloc, 759 pu8Target, cbTarget, &u32TargetLength); 760 761 /* Fill RenderData description in any case, it will be ignored if the above code failed. */ 762 pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData; 763 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT; 764 pRenderData->cbData = u32TargetLength; 765 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */ 766 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer; 767 pRenderData->pHwRenderData = NULL; 768 cbPrivateData = sizeof(GARENDERDATA); 769 } 770 else 771 { 772 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 773 } 774 775 switch (Status) 776 { 777 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: 778 if (pRenderData == NULL) 779 { 780 /* Not enough space in pDmaBufferPrivateData. */ 781 break; 782 } 783 RT_FALL_THRU(); 784 case STATUS_SUCCESS: 785 { 786 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + u32TargetLength; 787 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + cbPrivateData; 788 } break; 789 default: break; 790 } 791 } 844 Status = svgaPresentBlt(pDevExt, pContext, pPresent, &cbCommands); 792 845 else if (pPresent->Flags.Flip) 793 { 794 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pSrc); 795 796 GALOGG(GALOG_GROUP_PRESENT, ("Flip: %s sid=%u %dx%d\n", 797 vboxWddmAllocTypeString(pSrcAlloc), 798 pSrcAlloc->AllocData.hostID, pSrcAlloc->AllocData.SurfDesc.width, pSrcAlloc->AllocData.SurfDesc.height)); 799 800 /* Generate DMA buffer containing the present commands. 801 * Store the command buffer descriptor to pDmaBufferPrivateData. 802 */ 803 GARENDERDATA *pRenderData = NULL; 804 uint32_t u32TargetLength = 0; 805 uint32_t cbPrivateData = 0; 806 807 if (pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA)) 808 { 809 void *pvTarget = pPresent->pDmaBuffer; 810 const uint32_t cbTarget = pPresent->DmaSize; 811 if (cbTarget > GA_DMA_MIN_SUBMIT_SIZE) 812 { 813 #if 1 814 /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */ 815 RECT rect; 816 rect.left = 0; 817 rect.top = 0; 818 rect.right = pSrcAlloc->AllocData.SurfDesc.width; 819 rect.bottom = pSrcAlloc->AllocData.SurfDesc.height; 820 uint32_t const cInClipRects = pPresent->SubRectCnt - pPresent->MultipassOffset; 821 uint32_t cOutClipRects = 0; 822 Status = SvgaGenBlitSurfaceToScreen(pDevExt->pGa->hw.pSvga, 823 pSrcAlloc->AllocData.hostID, 824 &rect, 825 pSrcAlloc->AllocData.SurfDesc.VidPnSourceId, 826 &rect, 827 cInClipRects, 828 pPresent->pDstSubRects + pPresent->MultipassOffset, 829 pvTarget, cbTarget, &u32TargetLength, &cOutClipRects); 830 if (Status == STATUS_BUFFER_OVERFLOW) 831 { 832 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 833 } 834 835 if (Status == STATUS_SUCCESS) 836 { 837 if (cOutClipRects < cInClipRects) 838 { 839 /* Not all rectangles were copied. */ 840 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 841 } 842 843 /* Advance the current rectangle index. */ 844 pPresent->MultipassOffset += cOutClipRects; 845 } 846 #else 847 /* This tests the SVGA_3D_CMD_PRESENT command. */ 848 RT_NOREF(pDevExt); 849 Status = SvgaGenPresent(pSrcAlloc->AllocData.hostID, 850 pSrcAlloc->AllocData.SurfDesc.width, 851 pSrcAlloc->AllocData.SurfDesc.height, 852 pvTarget, cbTarget, &u32TargetLength); 853 if (Status == STATUS_BUFFER_OVERFLOW) 854 { 855 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 856 } 857 #endif 858 } 859 else 860 { 861 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 862 } 863 864 /* Fill RenderData description in any case, it will be ignored if the above code failed. */ 865 pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData; 866 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT; 867 pRenderData->cbData = u32TargetLength; 868 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */ 869 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer; 870 pRenderData->pHwRenderData = NULL; 871 cbPrivateData = sizeof(GARENDERDATA); 872 } 873 else 874 { 875 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 876 } 877 878 switch (Status) 879 { 880 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: 881 if (pRenderData == NULL) 882 { 883 /* Not enough space in pDmaBufferPrivateData. */ 884 break; 885 } 886 RT_FALL_THRU(); 887 case STATUS_SUCCESS: 888 { 889 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + u32TargetLength; 890 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + cbPrivateData; 891 } break; 892 default: break; 893 } 894 } 846 Status = svgaPresentFlip(pDevExt, pContext, pPresent, &cbCommands); 895 847 else if (pPresent->Flags.ColorFill) 896 { 897 LogRelMax(16, ("ColorFill is not implemented\n")); 898 AssertFailed(); 899 900 /* Generate empty DMA buffer. 901 * Store the command buffer descriptor to pDmaBufferPrivateData. 902 */ 903 GARENDERDATA *pRenderData = NULL; 904 uint32_t u32TargetLength = 0; 905 uint32_t cbPrivateData = 0; 906 907 if (pPresent->DmaBufferPrivateDataSize >= sizeof(GARENDERDATA)) 908 { 909 /* Fill RenderData description in any case, it will be ignored if the above code failed. */ 910 pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData; 911 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT; 912 pRenderData->cbData = u32TargetLength; 913 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */ 914 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer; 915 pRenderData->pHwRenderData = NULL; 916 cbPrivateData = sizeof(GARENDERDATA); 917 } 918 else 919 { 920 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 921 } 922 923 switch (Status) 924 { 925 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: 926 if (pRenderData == NULL) 927 { 928 /* Not enough space in pDmaBufferPrivateData. */ 929 break; 930 } 931 RT_FALL_THRU(); 932 case STATUS_SUCCESS: 933 { 934 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + u32TargetLength; 935 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + cbPrivateData; 936 } break; 937 default: break; 938 } 939 } 848 Status = svgaPresentColorFill(pDevExt, pContext, pPresent, &cbCommands); 940 849 else 941 { 942 WARN(("cmd NOT IMPLEMENTED!! Flags(0x%x)", pPresent->Flags.Value)); 943 Status = STATUS_NOT_SUPPORTED; 850 AssertFailedStmt(Status = STATUS_NOT_IMPLEMENTED); 851 852 /* Fill RenderData description in any case, it will be ignored if the above code failed. */ 853 GARENDERDATA *pRenderData = (GARENDERDATA *)pPresent->pDmaBufferPrivateData; 854 pRenderData->u32DataType = GARENDERDATA_TYPE_PRESENT; 855 pRenderData->cbData = cbCommands; 856 pRenderData->pFenceObject = NULL; /* Not a user request, so no user accessible fence object. */ 857 pRenderData->pvDmaBuffer = pPresent->pDmaBuffer; 858 pRenderData->pHwRenderData = NULL; 859 860 switch (Status) 861 { 862 case STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: 863 DEBUG_BREAKPOINT_TEST(); 864 RT_FALL_THRU(); 865 case STATUS_SUCCESS: 866 { 867 pPresent->pDmaBuffer = (uint8_t *)pPresent->pDmaBuffer + cbCommands; 868 pPresent->pDmaBufferPrivateData = (uint8_t *)pPresent->pDmaBufferPrivateData + sizeof(GARENDERDATA); 869 } break; 870 default: break; 944 871 } 945 872 946 873 return Status; 947 874 } 875 948 876 949 877 static NTSTATUS gaRenderGA3D(PVBOXWDDM_CONTEXT pContext, DXGKARG_RENDER *pRender); … … 1321 1249 return STATUS_SUCCESS; 1322 1250 1251 #ifdef VBOX_WITH_VMSVGA3D_DX 1323 1252 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pPatch->hContext; 1324 1325 #ifdef VBOX_WITH_VMSVGA3D_DX1326 1253 if (pContext->enmType == VBOXWDDM_CONTEXT_TYPE_VMSVGA_D3D) 1327 1254 return DxgkDdiDXPatch(pDevExt, pPatch); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.h
r94881 r94975 82 82 NTSTATUS APIENTRY GaDxgkDdiPresentDisplayOnly(const HANDLE hAdapter, 83 83 const DXGKARG_PRESENT_DISPLAYONLY *pPresentDisplayOnly); 84 NTSTATUS APIENTRY GaDxgkDdiPresent(const HANDLE hContext,85 DXGKARG_PRESENT *pPresent);84 NTSTATUS APIENTRY SvgaDxgkDdiPresent(const HANDLE hContext, 85 DXGKARG_PRESENT *pPresent); 86 86 NTSTATUS APIENTRY GaDxgkDdiRender(const HANDLE hContext, 87 87 DXGKARG_RENDER *pRender);
Note:
See TracChangeset
for help on using the changeset viewer.