Changeset 76790 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Jan 12, 2019 11:08:29 AM (6 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r76553 r76790 5195 5195 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 5196 5196 { 5197 #ifdef VBOX_WITH_MESA3D 5198 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA) 5199 { 5200 GaVidPnSourceCheckPos(pDevExt, i); 5201 continue; 5202 } 5203 #endif 5204 5197 5205 vboxWddmDisplaySettingsCheckPos(pDevExt, i); 5198 5206 } … … 5446 5454 5447 5455 LOGF(("ENTER, context(0x%x)", hAdapter)); 5456 LOG(("id %d, seg %d, addr 0x%RX64, hAllocation %p, ctx cnt %d, f 0x%x", 5457 pSetVidPnSourceAddress->VidPnSourceId, 5458 pSetVidPnSourceAddress->PrimarySegment, 5459 pSetVidPnSourceAddress->PrimaryAddress.QuadPart, 5460 pSetVidPnSourceAddress->hAllocation, 5461 pSetVidPnSourceAddress->ContextCount, 5462 pSetVidPnSourceAddress->Flags.Value)); 5448 5463 5449 5464 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; … … 5454 5469 } 5455 5470 5471 #ifdef VBOX_WITH_MESA3D 5472 if (pDevExt->enmHwType != VBOXVIDEO_HWTYPE_VMSVGA) 5473 #endif 5456 5474 vboxWddmDisplaySettingsCheckPos(pDevExt, pSetVidPnSourceAddress->VidPnSourceId); 5457 5475 5458 5476 NTSTATUS Status = STATUS_SUCCESS; 5459 5477 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceAddress->VidPnSourceId]; 5460 #ifdef VBOX_WITH_MESA3D 5461 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA) 5462 { 5463 GaScreenDefine(pDevExt->pGa, (uint32_t)pSetVidPnSourceAddress->PrimaryAddress.QuadPart, 5464 pSetVidPnSourceAddress->VidPnSourceId, 5465 pSource->VScreenPos.x, pSource->VScreenPos.y, 5466 pSource->AllocData.SurfDesc.width, pSource->AllocData.SurfDesc.height); 5467 return STATUS_SUCCESS; 5468 } 5469 #endif 5470 5478 5479 /* 5480 * Update the source VRAM address. 5481 */ 5471 5482 PVBOXWDDM_ALLOCATION pAllocation; 5472 5483 Assert(pSetVidPnSourceAddress->hAllocation); … … 5502 5513 5503 5514 pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; 5515 5516 /* 5517 * Report the source. 5518 */ 5519 #ifdef VBOX_WITH_MESA3D 5520 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA) 5521 { 5522 /* Query the position of the screen to make sure it is up to date. */ 5523 vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceAddress->VidPnSourceId, &pSource->VScreenPos); 5524 5525 GaVidPnSourceReport(pDevExt, pSource); 5526 return STATUS_SUCCESS; 5527 } 5528 #endif 5504 5529 5505 5530 vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource); … … 5532 5557 } 5533 5558 5559 #ifdef VBOX_WITH_MESA3D 5560 if (pDevExt->enmHwType != VBOXVIDEO_HWTYPE_VMSVGA) 5561 #endif 5534 5562 vboxWddmDisplaySettingsCheckPos(pDevExt, pSetVidPnSourceVisibility->VidPnSourceId); 5535 5563 … … 5553 5581 } 5554 5582 5583 #ifdef VBOX_WITH_MESA3D 5584 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA) 5585 { 5586 GaVidPnSourceCheckPos(pDevExt, pSetVidPnSourceVisibility->VidPnSourceId); 5587 } 5588 #endif 5589 5555 5590 LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter)); 5556 5591 … … 5639 5674 VBoxDumpSourceTargetArrays(paSources, paTargets, VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 5640 5675 5676 #ifdef VBOX_WITH_MESA3D 5677 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA) 5678 { 5679 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 5680 { 5681 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[i]; 5682 5683 LOG(("Source [%d]: visible %d, blanked %d", i, pSource->bVisible, pSource->bBlankedByPowerOff)); 5684 5685 /* Update positions of all screens. */ 5686 vboxWddmDisplaySettingsQueryPos(pDevExt, i, &pSource->VScreenPos); 5687 5688 GaVidPnSourceReport(pDevExt, pSource); 5689 } 5690 5691 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 5692 { 5693 VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[i]; 5694 Assert(pTarget->u32Id == i); 5695 if (pTarget->VidPnSourceId != D3DDDI_ID_UNINITIALIZED) 5696 { 5697 continue; 5698 } 5699 5700 LOG(("Target [%d]: blanked %d", i, pTarget->fBlankedByPowerOff)); 5701 5702 if (pTarget->fBlankedByPowerOff) 5703 { 5704 GaScreenDefine(pDevExt->pGa, 0, pTarget->u32Id, 0, 0, 0, 0, true); 5705 } 5706 else 5707 { 5708 GaScreenDestroy(pDevExt->pGa, pTarget->u32Id); 5709 } 5710 } 5711 5712 break; 5713 } 5714 #endif 5641 5715 vboxWddmGhDisplayCheckSetInfo(pDevExt); 5642 5716 } while (0); … … 7080 7154 Assert(pCreateContext->Flags.Value <= 2); /* 2 is a GDI context in Win7 */ 7081 7155 pContext->enmType = VBOXWDDM_CONTEXT_TYPE_SYSTEM; 7082 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)7083 {7084 vboxWddmDisplaySettingsCheckPos(pDevExt, i);7085 }7086 7156 7087 7157 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VBOX) 7088 7158 { 7159 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 7160 { 7161 vboxWddmDisplaySettingsCheckPos(pDevExt, i); 7162 } 7163 7089 7164 #ifdef VBOX_WITH_CROGL 7090 7165 if (!VBOXWDDM_IS_DISPLAYONLY() && pDevExt->f3DEnabled) … … 7444 7519 7445 7520 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 7521 #ifdef VBOX_WITH_MESA3D 7522 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA) 7523 { 7524 return GaDxgkDdiPresentDisplayOnly(hAdapter, pPresentDisplayOnly); 7525 } 7526 #endif 7446 7527 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pPresentDisplayOnly->VidPnSourceId]; 7447 7528 Assert(pSource->AllocData.Addr.SegmentId == 1); … … 7518 7599 if (bUpdateRectInited && pSource->bVisible) 7519 7600 { 7520 #ifdef VBOX_WITH_MESA3D7521 if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA)7522 {7523 /** @todo BLIT_GMRFB_TO_SCREEN */7524 GaUpdate(pDevExt->pGa,7525 UpdateRect.left,7526 UpdateRect.top,7527 UpdateRect.right - UpdateRect.left,7528 UpdateRect.bottom - UpdateRect.top);7529 }7530 else7531 #endif7532 7601 VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect); 7533 7602 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp
r76553 r76790 216 216 int32_t yOrigin, 217 217 uint32_t u32Width, 218 uint32_t u32Height) 218 uint32_t u32Height, 219 bool fBlank) 219 220 { 220 221 NTSTATUS Status = STATUS_SUCCESS; 221 222 222 223 const uint32_t cbSubmit = sizeof(uint32_t) 223 + sizeof(SVGAScreenObject) 224 + sizeof(uint32_t) 225 + sizeof(SVGAFifoCmdDefineGMRFB); 224 + sizeof(SVGAScreenObject); 226 225 void *pvCmd = SvgaFifoReserve(pSvga, cbSubmit); 227 226 if (pvCmd) … … 229 228 SvgaCmdDefineScreen(pvCmd, u32ScreenId, true, 230 229 xOrigin, yOrigin, u32Width, u32Height, 231 /* fPrimary = */ false, u32Offset, /* fBlank = */ false); 232 pvCmd = (uint8_t *)pvCmd + sizeof(uint32_t) + sizeof(SVGAScreenObject); 233 234 uint32_t u32BytesPerLine = u32Width * 4; 235 /* Start at offset 0, because we use it to address entire VRAM. */ 236 SvgaCmdDefineGMRFB(pvCmd, 0, u32BytesPerLine); 230 /* fPrimary = */ false, u32Offset, fBlank); 237 231 SvgaFifoCommit(pSvga, cbSubmit); 238 239 /* Save the screen offset. */240 pSvga->u32ScreenOffset = u32Offset;241 pSvga->cbScreenPitch = u32BytesPerLine;242 232 } 243 233 else … … 260 250 { 261 251 SvgaCmdDestroyScreen(pvCmd, u32ScreenId); 252 SvgaFifoCommit(pSvga, cbSubmit); 262 253 } 263 254 else … … 764 755 uint32_t u32Width, 765 756 uint32_t u32Height, 757 uint32_t u32VRAMOffset, 766 758 void *pvDst, 767 759 uint32_t cbDst, 768 760 uint32_t *pcbOut) 769 761 { 762 RT_NOREF(pSvga); 763 770 764 const uint32_t cbCmdSurfaceDMAToFB = sizeof(SVGA3dCmdHeader) 771 765 + sizeof(SVGA3dCmdSurfaceDMA) … … 786 780 } 787 781 788 Svga3dCmdSurfaceDMAToFB(pvDst, u32Sid, u32Width, u32Height, pSvga->u32ScreenOffset);782 Svga3dCmdSurfaceDMAToFB(pvDst, u32Sid, u32Width, u32Height, u32VRAMOffset); 789 783 SvgaCmdUpdate((uint8_t *)pvDst + cbCmdSurfaceDMAToFB, 0, 0, u32Width, u32Height); 790 784 … … 795 789 uint32_t u32Sid, 796 790 uint32_t u32Width, 797 uint32_t u32Height) 791 uint32_t u32Height, 792 uint32_t u32VRAMOffset) 798 793 { 799 794 NTSTATUS Status = STATUS_SUCCESS; 800 795 801 796 uint32_t cbSubmit = 0; 802 SvgaGenPresentVRAM(pSvga, 0, 0, 0, NULL, 0, &cbSubmit);797 SvgaGenPresentVRAM(pSvga, 0, 0, 0, 0, NULL, 0, &cbSubmit); 803 798 804 799 void *pvCmd = SvgaFifoReserve(pSvga, cbSubmit); 805 800 if (pvCmd) 806 801 { 807 Status = SvgaGenPresentVRAM(pSvga, u32Sid, u32Width, u32Height, pvCmd, cbSubmit, NULL);802 Status = SvgaGenPresentVRAM(pSvga, u32Sid, u32Width, u32Height, u32VRAMOffset, pvCmd, cbSubmit, NULL); 808 803 Assert(Status == STATUS_SUCCESS); 809 804 SvgaFifoCommit(pSvga, cbSubmit); … … 878 873 879 874 return STATUS_SUCCESS; 875 } 876 877 NTSTATUS SvgaBlitGMRFBToScreen(PVBOXWDDM_EXT_VMSVGA pSvga, 878 uint32_t idDstScreen, 879 int32_t xSrc, 880 int32_t ySrc, 881 RECT const *pDstRect) 882 { 883 NTSTATUS Status = STATUS_SUCCESS; 884 885 uint32_t cbSubmit = 0; 886 SvgaGenBlitGMRFBToScreen(pSvga, idDstScreen, xSrc, ySrc, pDstRect, 887 NULL, 0, &cbSubmit); 888 889 void *pvCmd = SvgaFifoReserve(pSvga, cbSubmit); 890 if (pvCmd) 891 { 892 Status = SvgaGenBlitGMRFBToScreen(pSvga, idDstScreen, xSrc, ySrc, pDstRect, 893 pvCmd, cbSubmit, NULL); 894 Assert(Status == STATUS_SUCCESS); 895 SvgaFifoCommit(pSvga, cbSubmit); 896 } 897 else 898 { 899 Status = STATUS_INSUFFICIENT_RESOURCES; 900 } 901 902 return Status; 880 903 } 881 904 … … 1021 1044 NTSTATUS SvgaDefineGMRFB(PVBOXWDDM_EXT_VMSVGA pSvga, 1022 1045 uint32_t u32Offset, 1023 uint32_t u32BytesPerLine) 1046 uint32_t u32BytesPerLine, 1047 bool fForce) 1024 1048 { 1025 1049 NTSTATUS Status = STATUS_SUCCESS; 1050 1051 ExAcquireFastMutex(&pSvga->SvgaMutex); 1052 if ( !fForce 1053 && pSvga->lastGMRFB.u32Offset == u32Offset 1054 && pSvga->lastGMRFB.u32BytesPerLine == u32BytesPerLine) 1055 { 1056 ExReleaseFastMutex(&pSvga->SvgaMutex); 1057 return VINF_SUCCESS; 1058 } 1059 ExReleaseFastMutex(&pSvga->SvgaMutex); 1026 1060 1027 1061 uint32_t cbSubmit = 0; … … 1040 1074 { 1041 1075 Status = STATUS_INSUFFICIENT_RESOURCES; 1076 } 1077 1078 if (Status == STATUS_SUCCESS) 1079 { 1080 ExAcquireFastMutex(&pSvga->SvgaMutex); 1081 pSvga->lastGMRFB.u32Offset = u32Offset; 1082 pSvga->lastGMRFB.u32BytesPerLine = u32BytesPerLine; 1083 ExReleaseFastMutex(&pSvga->SvgaMutex); 1042 1084 } 1043 1085 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
r76563 r76790 86 86 VMSVGAFIFO fifo; 87 87 88 /** Offset of the screen relative to VRAM start. */89 uint32_t u32ScreenOffset;90 91 /** Scanline width in bytes of the screen. */92 uint32_t cbScreenPitch;93 94 88 /** For atomic hardware access. */ 95 89 KSPIN_LOCK HwSpinLock; … … 104 98 /** SVGA data access. */ 105 99 FAST_MUTEX SvgaMutex; 100 101 struct 102 { 103 uint32_t u32Offset; 104 uint32_t u32BytesPerLine; 105 } lastGMRFB; 106 106 107 107 /** AVL tree for mapping sids to the original sid for shared resources. */ … … 135 135 int32_t yOrigin, 136 136 uint32_t u32Width, 137 uint32_t u32Height); 137 uint32_t u32Height, 138 bool fBlank); 138 139 NTSTATUS SvgaScreenDestroy(PVBOXWDDM_EXT_VMSVGA pSvga, 139 140 uint32_t u32ScreenId); … … 208 209 uint32_t u32Width, 209 210 uint32_t u32Height, 211 uint32_t u32VRAMOffset, 210 212 void *pvDst, 211 213 uint32_t cbDst, … … 214 216 uint32_t u32Sid, 215 217 uint32_t u32Width, 216 uint32_t u32Height); 218 uint32_t u32Height, 219 uint32_t u32VRAMOffset); 217 220 218 221 NTSTATUS SvgaGenSurfaceDMA(PVBOXWDDM_EXT_VMSVGA pSvga, … … 242 245 uint32_t *pcbOut); 243 246 247 NTSTATUS SvgaBlitGMRFBToScreen(PVBOXWDDM_EXT_VMSVGA pSvga, 248 uint32_t idDstScreen, 249 int32_t xSrc, 250 int32_t ySrc, 251 RECT const *pDstRect); 252 244 253 NTSTATUS SvgaGenBlitSurfaceToScreen(PVBOXWDDM_EXT_VMSVGA pSvga, 245 254 uint32_t sid, … … 266 275 uint32_t cbDst, 267 276 uint32_t *pcbOut); 277 278 NTSTATUS SvgaDefineGMRFB(PVBOXWDDM_EXT_VMSVGA pSvga, 279 uint32_t u32Offset, 280 uint32_t u32BytesPerLine, 281 bool fForce); 268 282 269 283 NTSTATUS SvgaGenGMRReport(PVBOXWDDM_EXT_VMSVGA pSvga, -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp
r76553 r76790 17 17 18 18 #include "VBoxMPGaWddm.h" 19 #include "../VBoxMPVidPn.h" 19 20 20 21 #include "Svga.h" … … 472 473 int32_t yOrigin, 473 474 uint32_t u32Width, 474 uint32_t u32Height) 475 { 476 return SvgaScreenDefine(pGaDevExt->hw.pSvga, u32Offset, u32ScreenId, xOrigin, yOrigin, u32Width, u32Height); 475 uint32_t u32Height, 476 bool fBlank) 477 { 478 return SvgaScreenDefine(pGaDevExt->hw.pSvga, u32Offset, u32ScreenId, xOrigin, yOrigin, u32Width, u32Height, fBlank); 477 479 } 478 480 … … 652 654 uint32_t u32Sid, 653 655 uint32_t u32Width, 654 uint32_t u32Height) 655 { 656 return SvgaPresentVRAM(pGaDevExt->hw.pSvga, u32Sid, u32Width, u32Height); 656 uint32_t u32Height, 657 uint32_t u32VRAMOffset) 658 { 659 return SvgaPresentVRAM(pGaDevExt->hw.pSvga, u32Sid, u32Width, u32Height, u32VRAMOffset); 657 660 } 658 661 … … 878 881 pu8Target, cbTarget, &cbCmd); 879 882 } 880 else881 {882 /* Define GMRFB to point to the start of VRAM. */883 /** @todo This is a workaround for current BlitSurfaceToScreen host implementation884 * expecting that GMRFB will be at the start of VRAM.885 */886 Status = SvgaGenDefineGMRFB(pSvga, 0, pSvga->cbScreenPitch,887 pu8Target, cbTarget, &cbCmd);888 }889 883 890 884 if (Status == STATUS_BUFFER_OVERFLOW) … … 1017 1011 pu8Target += cbCmd; 1018 1012 cbTarget -= cbCmd; 1019 }1020 1021 if (Status == STATUS_SUCCESS)1022 {1023 if (iSubRect == pPresent->SubRectCnt)1024 {1025 /** @todo No more rects. Have to reset the GMRFB, some code expects this. */1026 Status = SvgaGenDefineGMRFB(pSvga, 0, pSvga->cbScreenPitch,1027 pu8Target, cbTarget, &cbCmd);1028 if (Status == STATUS_BUFFER_OVERFLOW)1029 {1030 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;1031 }1032 else1033 {1034 pu8Target += cbCmd;1035 cbTarget -= cbCmd;1036 }1037 }1038 1013 } 1039 1014 … … 1988 1963 1989 1964 VBOXDISPIFESCAPE_GAPRESENT *pGaPresent = (VBOXDISPIFESCAPE_GAPRESENT *)pEscapeHdr; 1990 Status = gaPresent(pDevExt->pGa, pGaPresent->u32Sid, pGaPresent->u32Width, pGaPresent->u32Height); 1965 /** @todo This always writes to the start of VRAM. This is a debug function 1966 * and is not used for normal operations anymore. 1967 */ 1968 Status = gaPresent(pDevExt->pGa, pGaPresent->u32Sid, pGaPresent->u32Width, pGaPresent->u32Height, 0); 1991 1969 break; 1992 1970 } … … 2106 2084 return Status; 2107 2085 } 2086 2087 DECLINLINE(VBOXVIDEOOFFSET) vboxWddmAddrVRAMOffset(VBOXWDDM_ADDR const *pAddr) 2088 { 2089 return (pAddr->offVram != VBOXVIDEOOFFSET_VOID && pAddr->SegmentId) ? 2090 (pAddr->SegmentId == 1 ? pAddr->offVram : 0) : 2091 VBOXVIDEOOFFSET_VOID; 2092 } 2093 2094 static void vboxWddmRectCopy(void *pvDst, uint32_t cbDstBytesPerPixel, uint32_t cbDstPitch, 2095 void const *pvSrc, uint32_t cbSrcBytesPerPixel, uint32_t cbSrcPitch, 2096 RECT const *pRect) 2097 { 2098 uint8_t *pu8Dst = (uint8_t *)pvDst; 2099 pu8Dst += pRect->top * cbDstPitch + pRect->left * cbDstBytesPerPixel; 2100 2101 uint8_t const *pu8Src = (uint8_t *)pvSrc; 2102 pu8Src += pRect->top * cbSrcPitch + pRect->left * cbSrcBytesPerPixel; 2103 2104 uint32_t const cbLine = (pRect->right - pRect->left) * cbDstBytesPerPixel; 2105 for (INT y = pRect->top; y < pRect->bottom; ++y) 2106 { 2107 memcpy(pu8Dst, pu8Src, cbLine); 2108 pu8Dst += cbDstPitch; 2109 pu8Src += cbSrcPitch; 2110 } 2111 } 2112 2113 static NTSTATUS gaSourceBlitToScreen(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_SOURCE *pSource, RECT const *pRect) 2114 { 2115 NTSTATUS Status = STATUS_SUCCESS; 2116 PVBOXWDDM_EXT_VMSVGA pSvga = pDevExt->pGa->hw.pSvga; 2117 2118 VBOXWDDM_TARGET_ITER Iter; 2119 VBoxVidPnStTIterInit(pSource, pDevExt->aTargets, VBoxCommonFromDeviceExt(pDevExt)->cDisplays, &Iter); 2120 for (PVBOXWDDM_TARGET pTarget = VBoxVidPnStTIterNext(&Iter); 2121 pTarget; 2122 pTarget = VBoxVidPnStTIterNext(&Iter)) 2123 { 2124 Status = SvgaBlitGMRFBToScreen(pSvga, 2125 pTarget->u32Id, 2126 pRect->left, 2127 pRect->top, 2128 pRect); 2129 AssertBreak(Status == STATUS_SUCCESS); 2130 } 2131 2132 return Status; 2133 } 2134 2135 NTSTATUS APIENTRY GaDxgkDdiPresentDisplayOnly(const HANDLE hAdapter, 2136 const DXGKARG_PRESENT_DISPLAYONLY *pPresentDisplayOnly) 2137 { 2138 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 2139 2140 LOG(("VidPnSourceId %d, pSource %p, BytesPerPixel %d, Pitch %d, Flags 0x%x, NumMoves %d, NumDirtyRects %d, pfn %p\n", 2141 pPresentDisplayOnly->VidPnSourceId, 2142 pPresentDisplayOnly->pSource, 2143 pPresentDisplayOnly->BytesPerPixel, 2144 pPresentDisplayOnly->Pitch, 2145 pPresentDisplayOnly->Flags.Value, 2146 pPresentDisplayOnly->NumMoves, 2147 pPresentDisplayOnly->NumDirtyRects, 2148 pPresentDisplayOnly->pDirtyRect, 2149 pPresentDisplayOnly->pfnPresentDisplayOnlyProgress)); 2150 2151 /* 2152 * Copy the image to the corresponding VidPn source allocation. 2153 */ 2154 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pPresentDisplayOnly->VidPnSourceId]; 2155 AssertReturn(pSource->AllocData.Addr.SegmentId == 1, STATUS_SUCCESS); /* Ignore such VidPn sources. */ 2156 2157 VBOXVIDEOOFFSET const offVRAM = vboxWddmAddrVRAMOffset(&pSource->AllocData.Addr); 2158 AssertReturn(offVRAM != VBOXVIDEOOFFSET_VOID, STATUS_SUCCESS); /* Ignore such VidPn sources. */ 2159 2160 for (ULONG i = 0; i < pPresentDisplayOnly->NumMoves; ++i) 2161 { 2162 RECT *pRect = &pPresentDisplayOnly->pMoves[i].DestRect; 2163 vboxWddmRectCopy(pDevExt->pvVisibleVram + offVRAM, // dst pointer 2164 pSource->AllocData.SurfDesc.bpp / 8, // dst bytes per pixel 2165 pSource->AllocData.SurfDesc.pitch, // dst pitch 2166 pPresentDisplayOnly->pSource, // src pointer 2167 pPresentDisplayOnly->BytesPerPixel, // src bytes per pixel 2168 pPresentDisplayOnly->Pitch, // src pitch 2169 pRect); 2170 } 2171 2172 for (ULONG i = 0; i < pPresentDisplayOnly->NumDirtyRects; ++i) 2173 { 2174 RECT *pRect = &pPresentDisplayOnly->pDirtyRect[i]; 2175 if (pRect->left >= pRect->right || pRect->top >= pRect->bottom) 2176 { 2177 continue; 2178 } 2179 2180 vboxWddmRectCopy(pDevExt->pvVisibleVram + offVRAM, // dst pointer 2181 pSource->AllocData.SurfDesc.bpp / 8, // dst bytes per pixel 2182 pSource->AllocData.SurfDesc.pitch, // dst pitch 2183 pPresentDisplayOnly->pSource, // src pointer 2184 pPresentDisplayOnly->BytesPerPixel, // src bytes per pixel 2185 pPresentDisplayOnly->Pitch, // src pitch 2186 pRect); 2187 } 2188 2189 NTSTATUS Status = STATUS_SUCCESS; 2190 if (pSource->bVisible) /// @todo Does/should this have any effect? 2191 { 2192 PVBOXWDDM_EXT_VMSVGA pSvga = pDevExt->pGa->hw.pSvga; 2193 Status = SvgaDefineGMRFB(pSvga, (uint32_t)offVRAM, pSource->AllocData.SurfDesc.pitch, false); 2194 if (Status == STATUS_SUCCESS) 2195 { 2196 for (ULONG i = 0; i < pPresentDisplayOnly->NumMoves; ++i) 2197 { 2198 RECT *pRect = &pPresentDisplayOnly->pMoves[i].DestRect; 2199 Status = gaSourceBlitToScreen(pDevExt, pSource, pRect); 2200 AssertBreak(Status == STATUS_SUCCESS); 2201 } 2202 } 2203 2204 if (Status == STATUS_SUCCESS) 2205 { 2206 for (ULONG i = 0; i < pPresentDisplayOnly->NumDirtyRects; ++i) 2207 { 2208 RECT *pRect = &pPresentDisplayOnly->pDirtyRect[i]; 2209 Status = gaSourceBlitToScreen(pDevExt, pSource, pRect); 2210 AssertBreak(Status == STATUS_SUCCESS); 2211 } 2212 } 2213 } 2214 2215 return Status; 2216 } 2217 2218 NTSTATUS GaVidPnSourceReport(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_SOURCE *pSource) 2219 { 2220 NTSTATUS Status = STATUS_SUCCESS; 2221 2222 VBOXVIDEOOFFSET offVRAM = vboxWddmAddrVRAMOffset(&pSource->AllocData.Addr); 2223 if (offVRAM == VBOXVIDEOOFFSET_VOID) 2224 return STATUS_SUCCESS; /* Ignore such VidPn sources. */ 2225 2226 VBOXWDDM_TARGET_ITER Iter; 2227 VBoxVidPnStTIterInit(pSource, pDevExt->aTargets, VBoxCommonFromDeviceExt(pDevExt)->cDisplays, &Iter); 2228 for (PVBOXWDDM_TARGET pTarget = VBoxVidPnStTIterNext(&Iter); 2229 pTarget; 2230 pTarget = VBoxVidPnStTIterNext(&Iter)) 2231 { 2232 Status = GaScreenDefine(pDevExt->pGa, 2233 (uint32_t)offVRAM, 2234 pTarget->u32Id, 2235 pSource->VScreenPos.x, pSource->VScreenPos.y, 2236 pSource->AllocData.SurfDesc.width, pSource->AllocData.SurfDesc.height, 2237 RT_BOOL(pSource->bBlankedByPowerOff)); 2238 AssertBreak(Status == STATUS_SUCCESS); 2239 } 2240 2241 return Status; 2242 } 2243 2244 NTSTATUS GaVidPnSourceCheckPos(PVBOXMP_DEVEXT pDevExt, UINT iSource) 2245 { 2246 POINT Pos = {0}; 2247 NTSTATUS Status = vboxWddmDisplaySettingsQueryPos(pDevExt, iSource, &Pos); 2248 if (NT_SUCCESS(Status)) 2249 { 2250 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[iSource]; 2251 if (memcmp(&pSource->VScreenPos, &Pos, sizeof(Pos))) 2252 { 2253 pSource->VScreenPos = Pos; 2254 Status = GaVidPnSourceReport(pDevExt, pSource); 2255 } 2256 } 2257 return Status; 2258 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.h
r76563 r76790 37 37 int32_t yOrigin, 38 38 uint32_t u32Width, 39 uint32_t u32Height); 39 uint32_t u32Height, 40 bool fBlank); 40 41 NTSTATUS GaScreenDestroy(PVBOXWDDM_EXT_GA pGaDevExt, 41 42 uint32_t u32ScreenId); … … 59 60 NTSTATUS APIENTRY GaDxgkDdiBuildPagingBuffer(const HANDLE hAdapter, 60 61 DXGKARG_BUILDPAGINGBUFFER *pBuildPagingBuffer); 62 NTSTATUS APIENTRY GaDxgkDdiPresentDisplayOnly(const HANDLE hAdapter, 63 const DXGKARG_PRESENT_DISPLAYONLY *pPresentDisplayOnly); 61 64 NTSTATUS APIENTRY GaDxgkDdiPresent(const HANDLE hContext, 62 65 DXGKARG_PRESENT *pPresent); … … 87 90 } 88 91 92 NTSTATUS GaVidPnSourceReport(PVBOXMP_DEVEXT pDevExt, VBOXWDDM_SOURCE *pSource); 93 NTSTATUS GaVidPnSourceCheckPos(PVBOXMP_DEVEXT pDevExt, UINT iSource); 94 89 95 #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_gallium_VBoxMPGaWddm_h */
Note:
See TracChangeset
for help on using the changeset viewer.