Changeset 95234 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video
- Timestamp:
- Jun 8, 2022 4:31:28 PM (3 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h
r94990 r95234 34 34 #include <VBoxUhgsmi.h> 35 35 #include <VBox/VBoxGuestCoreTypes.h> /* for VBGLIOCHGCMCALL */ 36 37 #if defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) 38 #include <VBoxGaTypes.h> 39 #endif 36 40 37 41 /* One would increase this whenever definitions in this file are changed */ … … 71 75 72 76 73 #if def VBOX_WITH_VMSVGA3D_DX77 #if defined(VBOX_WITH_VMSVGA3D_DX) || defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL) 74 78 /* 75 79 * Structures for the new D3D user mode driver. … … 98 102 struct 99 103 { 100 SVGA3dSurfaceAllFlags surfaceFlags;104 uint64 surfaceFlags; /*SVGA3dSurfaceAllFlags*/ /** @todo Restore types after Mesa update. */ 101 105 SVGA3dSurfaceFormat format; 102 106 uint32 numMipLevels; 103 107 uint32 multisampleCount; 104 SVGA3dMSPattern multisamplePattern;105 SVGA3dMSQualityLevel qualityLevel;108 uint32 multisamplePattern; /*SVGA3dMSPattern*/ 109 uint32 qualityLevel; /*SVGA3dMSQualityLevel*/ 106 110 SVGA3dTextureFilter autogenFilter; 107 111 SVGA3dSize size; … … 122 126 } resourceInfo; 123 127 } VBOXDXALLOCATIONDESC, *PVBOXDXALLOCATIONDESC; 124 #endif /* VBOX_WITH_VMSVGA3D_DX*/128 #endif /* defined(VBOX_WITH_VMSVGA3D_DX) || defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL) */ 125 129 126 130 /* create allocation func */ … … 136 140 , VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC 137 141 , VBOXWDDM_ALLOC_TYPE_UMD_HGSMI_BUFFER 138 #ifdef VBOX_WITH_VMSVGA3D_DX139 142 , VBOXWDDM_ALLOC_TYPE_D3D /* Direct3D UMD driver allocation. Actual type is a VBOXDXALLOCATIONTYPE value. */ 140 #endif /* VBOX_WITH_VMSVGA3D_DX */141 143 } VBOXWDDM_ALLOC_TYPE; 142 144 … … 505 507 #define VBOXESC_GAFENCEWAIT 0xA0000022 506 508 #define VBOXESC_GAFENCEUNREF 0xA0000023 509 #define VBOXESC_SVGAGBSURFACEDEFINE 0xA0010001 510 #define VBOXESC_SVGAGETSID 0xA0010002 507 511 508 512 /* Get Gallium context id (cid) of the WDDM context. */ … … 545 549 /* GASURFSIZE[cSizes] */ 546 550 } VBOXDISPIFESCAPE_GASURFACEDEFINE; 551 552 #if defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL) 553 /* Create a GB host surface. */ 554 typedef struct VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE 555 { 556 VBOXDISPIFESCAPE EscapeHdr; 557 SVGAGBSURFCREATE CreateParms; 558 } VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE; 559 560 /* Get SVGA surface id (sid) of the allocation. */ 561 typedef struct VBOXDISPIFESCAPE_SVGAGETSID 562 { 563 VBOXDISPIFESCAPE EscapeHdr; 564 uint64_t hAllocation; 565 uint32_t u32Sid; 566 } VBOXDISPIFESCAPE_SVGAGETSID; 567 #endif /* defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL) */ 547 568 548 569 /* Delete a host surface. */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/Makefile.kmk
r94584 r95234 161 161 wddm/gallium/VBoxD3DAdapter9.c 162 162 163 ifdef VBOX_WITH_VMSVGA3D_DX 164 VBoxDispD3D_DEFS += VBOX_WITH_VMSVGA3D_DX9 165 endif 166 163 167 ifdef VBOX_WITH_MESA3D_D3DTEST 164 168 VBoxDispD3D_DEFS += VBOX_WITH_MESA3D_D3DTEST -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxD3DIf.h
r93115 r95234 51 51 if (pAlloc->pD3DIf) 52 52 return pAlloc->pD3DIf; 53 54 #ifdef VBOX_WITH_VMSVGA3D_DX9 55 if (pAlloc->enmType == VBOXWDDM_ALLOC_TYPE_D3D) 56 return pAlloc->pRc->pDevice->pfnCreateSharedPrimary(pAlloc); 57 #endif 53 58 54 59 if (pAlloc->enmType != VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
r93115 r95234 245 245 uint32_t hostID; 246 246 #endif 247 #ifdef VBOX_WITH_VMSVGA3D_DX9 248 VBOXDXALLOCATIONDESC AllocDesc; 249 #endif 247 250 } VBOXWDDMDISP_ALLOCATION, *PVBOXWDDMDISP_ALLOCATION; 248 251 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/GaDdi.cpp
r93115 r95234 2147 2147 2148 2148 D3DDDI_OPENALLOCATIONINFO *pOAI = &pResource->pOpenAllocationInfo[i]; 2149 if (pOAI->PrivateDriverDataSize != sizeof (VBOXWDDM_ALLOCINFO)) 2149 if (pOAI->PrivateDriverDataSize == sizeof(VBOXWDDM_ALLOCINFO)) 2150 { 2151 Assert(pOAI->pPrivateDriverData); 2152 PVBOXWDDM_ALLOCINFO pWddmAllocInfo = (PVBOXWDDM_ALLOCINFO)pOAI->pPrivateDriverData; 2153 pAllocation->hAllocation = pOAI->hAllocation; 2154 pAllocation->enmType = pWddmAllocInfo->enmType; 2155 pAllocation->hSharedHandle = (HANDLE)pWddmAllocInfo->hSharedHandle; 2156 pAllocation->SurfDesc = pWddmAllocInfo->SurfDesc; 2157 pAllocation->pvMem = NULL; 2158 2159 Assert(!pAllocation->hSharedHandle == (pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE)); 2160 } 2161 #ifdef VBOX_WITH_VMSVGA3D_DX9 2162 else if (pOAI->PrivateDriverDataSize == sizeof(VBOXDXALLOCATIONDESC)) 2163 { 2164 Assert(pOAI->pPrivateDriverData); 2165 VBOXDXALLOCATIONDESC *pAllocDesc = (VBOXDXALLOCATIONDESC *)pOAI->pPrivateDriverData; 2166 pAllocation->hAllocation = pOAI->hAllocation; 2167 pAllocation->enmType = VBOXWDDM_ALLOC_TYPE_D3D; 2168 pAllocation->hSharedHandle = 0; /* This is should be a sid of the allocation. Not needed here. */ 2169 pAllocation->AllocDesc = *pAllocDesc; 2170 pAllocation->pvMem = NULL; 2171 RT_ZERO(pAllocation->SurfDesc); 2172 pAllocation->SurfDesc.width = pAllocation->AllocDesc.surfaceInfo.size.width; 2173 pAllocation->SurfDesc.height = pAllocation->AllocDesc.surfaceInfo.size.height; 2174 pAllocation->SurfDesc.format = pAllocation->AllocDesc.enmDDIFormat; 2175 pAllocation->SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pAllocation->AllocDesc.enmDDIFormat); 2176 pAllocation->SurfDesc.pitch = vboxWddmCalcPitch(pAllocation->AllocDesc.surfaceInfo.size.width, pAllocation->AllocDesc.enmDDIFormat); 2177 pAllocation->SurfDesc.depth = pAllocation->AllocDesc.surfaceInfo.size.depth; 2178 pAllocation->SurfDesc.slicePitch = 0; 2179 pAllocation->SurfDesc.d3dWidth = pAllocation->SurfDesc.width; 2180 pAllocation->SurfDesc.cbSize = pAllocation->AllocDesc.cbAllocation; 2181 if (pAllocation->AllocDesc.fPrimary) 2182 { 2183 pAllocation->SurfDesc.VidPnSourceId = pAllocation->AllocDesc.PrimaryDesc.VidPnSourceId; 2184 pAllocation->SurfDesc.RefreshRate.Numerator = pAllocDesc->PrimaryDesc.ModeDesc.RefreshRate.Numerator; 2185 pAllocation->SurfDesc.RefreshRate.Denominator = pAllocDesc->PrimaryDesc.ModeDesc.RefreshRate.Denominator; 2186 } 2187 } 2188 #endif 2189 else 2150 2190 { 2151 2191 AssertFailed(); … … 2153 2193 break; 2154 2194 } 2155 Assert(pOAI->pPrivateDriverData);2156 2157 PVBOXWDDM_ALLOCINFO pWddmAllocInfo = (PVBOXWDDM_ALLOCINFO)pOAI->pPrivateDriverData;2158 pAllocation->hAllocation = pOAI->hAllocation;2159 pAllocation->enmType = pWddmAllocInfo->enmType;2160 pAllocation->hSharedHandle = (HANDLE)pWddmAllocInfo->hSharedHandle;2161 pAllocation->SurfDesc = pWddmAllocInfo->SurfDesc;2162 pAllocation->pvMem = NULL;2163 2164 Assert(!pAllocation->hSharedHandle == (pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE));2165 2195 } 2166 2196 … … 2194 2224 Assert(pOAI->pPrivateDriverData); 2195 2225 Assert(pOAI->PrivateDriverDataSize >= sizeof(VBOXWDDM_ALLOCINFO)); 2196 if (pOAI->pPrivateDriverData && pOAI->PrivateDriverDataSize >= sizeof(VBOXWDDM_ALLOCINFO))2226 if (pOAI->pPrivateDriverData && pOAI->PrivateDriverDataSize == sizeof(VBOXWDDM_ALLOCINFO)) 2197 2227 { 2198 2228 PVBOXWDDM_ALLOCINFO pWddmAllocInfo = (PVBOXWDDM_ALLOCINFO)pOAI->pPrivateDriverData; … … 2212 2242 } 2213 2243 } 2244 #ifdef VBOX_WITH_VMSVGA3D_DX9 2245 else if (pOAI->pPrivateDriverData && pOAI->PrivateDriverDataSize == sizeof(VBOXDXALLOCATIONDESC)) 2246 { 2247 VBOXDXALLOCATIONDESC *pAllocDesc = (VBOXDXALLOCATIONDESC *)pOAI->pPrivateDriverData; 2248 pRc->RcDesc.fFlags.Primary = pAllocDesc->fPrimary; 2249 pRc->RcDesc.fFlags.RenderTarget = 1; 2250 //pRc->RcDesc.fFlags.NotLockable = 1; 2251 pRc->RcDesc.enmFormat = pAllocDesc->enmDDIFormat; 2252 if (pAllocDesc->fPrimary) 2253 { 2254 pRc->RcDesc.VidPnSourceId = pAllocDesc->PrimaryDesc.VidPnSourceId; 2255 pRc->RcDesc.RefreshRate.Numerator = pAllocDesc->PrimaryDesc.ModeDesc.RefreshRate.Numerator; 2256 pRc->RcDesc.RefreshRate.Denominator = pAllocDesc->PrimaryDesc.ModeDesc.RefreshRate.Denominator; 2257 } 2258 } 2259 #endif 2214 2260 else 2215 2261 hr = E_INVALIDARG; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/GaDrvEnvWddm.cpp
r93115 r95234 700 700 RTMemFree(pvMap); 701 701 } 702 } 703 704 705 /* static */ DECLCALLBACK(int) 706 GaDrvEnvWddm::gaEnvWddmGBSurfaceDefine(void *pvEnv, 707 SVGAGBSURFCREATE *pCreateParms) 708 { 709 GaDrvEnvWddm *pThis = (GaDrvEnvWddm *)pvEnv; 710 711 HRESULT hr; 712 D3DDDICB_ESCAPE ddiEscape; 713 VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE data; 714 data.EscapeHdr.escapeCode = VBOXESC_SVGAGBSURFACEDEFINE; 715 data.EscapeHdr.u32CmdSpecific = 0; 716 data.CreateParms = *pCreateParms; 717 718 ddiEscape.hDevice = 0; // pThis->mWddmCallbacks.hDevice; 719 ddiEscape.Flags.Value = 0; 720 ddiEscape.Flags.HardwareAccess = 1; // Required, otherwise graphics corruption can happen. No idea why. 721 // Eventually we probably have to create allocations for surfaces, 722 // as a WDDM driver should do. Then the Escape hack will be removed. 723 ddiEscape.pPrivateDriverData = &data; 724 ddiEscape.PrivateDriverDataSize = sizeof(data); 725 ddiEscape.hContext = 0; 726 727 hr = pThis->mWddmCallbacks.DeviceCallbacks.pfnEscapeCb(pThis->mWddmCallbacks.hAdapter, &ddiEscape); 728 if (FAILED(hr)) 729 return -1; 730 731 pCreateParms->gmrid = data.CreateParms.gmrid; 732 pCreateParms->cbGB = data.CreateParms.cbGB; 733 pCreateParms->u64UserAddress = data.CreateParms.u64UserAddress; 734 pCreateParms->u32Sid = data.CreateParms.u32Sid; 735 return 0; 702 736 } 703 737 … … 748 782 mEnv.pfnRegionDestroy = gaEnvWddmRegionDestroy; 749 783 mEnv.pHWInfo = &mHWInfo; 784 /* VGPU10 */ 785 mEnv.pfnGBSurfaceDefine = gaEnvWddmGBSurfaceDefine; 750 786 } 751 787 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/GaDrvEnvWddm.h
r93115 r95234 95 95 uint32_t u32GmrId, 96 96 void *pvMap); 97 98 /* VGPU10 */ 99 static DECLCALLBACK(int) gaEnvWddmGBSurfaceDefine(void *pvEnv, 100 SVGAGBSURFCREATE *pCreateParms); 97 101 }; 98 102 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/GaWddm.cpp
r93115 r95234 389 389 PVBOXWDDMDISP_DEVICE pDevice = pRc->pDevice; 390 390 IDirect3DDevice9 *pDevice9If = VBOXDISP_D3DEV(pDevice); 391 AssertReturn(pDevice9If, E_FAIL); 392 391 393 HRESULT hr = E_FAIL; 392 394 … … 509 511 510 512 } 513 #ifdef VBOX_WITH_VMSVGA3D_DX9 514 else if (pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_D3D) 515 { 516 hr = pDevice9If->CreateRenderTarget(pAllocation->AllocDesc.surfaceInfo.size.width, 517 pAllocation->AllocDesc.surfaceInfo.size.height, 518 d3dFormat, 519 d3dMultiSample, 520 d3dMultisampleQuality, 521 d3dLockable, 522 &pD3D9Surf, 523 NULL); 524 AssertBreak(SUCCEEDED(hr) && pD3D9Surf); 525 } 526 #endif 511 527 else 512 528 { … … 755 771 * In both cases we need a warning, because this is something unusual. 756 772 */ 773 774 #ifndef VBOX_WITH_VMSVGA3D_DX9 757 775 WARN(("another hostId %d is in use, using it instead", usedHostId)); 776 #else 777 /* This is most likely a _D3D surface, which is used as actual destination of the shared primary. */ 778 #endif 758 779 759 780 Assert(hostID != usedHostId); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r95191 r95234 3458 3458 WARN(("failed to get allocation from handle")); 3459 3459 Status = STATUS_INVALID_PARAMETER; 3460 break; 3461 } 3462 3463 if (pAlloc->enmType == VBOXWDDM_ALLOC_TYPE_D3D) 3464 { 3465 pSetHostID->EscapeHdr.u32CmdSpecific = pAlloc->dx.sid; 3466 pSetHostID->rc = VERR_NOT_EQUAL; 3467 Status = STATUS_SUCCESS; 3460 3468 break; 3461 3469 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp
r95158 r95234 89 89 { sizeof(SVGAOTableMobEntry), SVGA3D_MAX_MOBS }, /* SVGA_OTABLE_MOB */ 90 90 { sizeof(SVGAOTableSurfaceEntry), SVGA3D_MAX_SURFACE_IDS }, /* SVGA_OTABLE_SURFACE */ 91 { sizeof(SVGAOTableContextEntry), 0 /* not used */ },/* SVGA_OTABLE_CONTEXT */91 { sizeof(SVGAOTableContextEntry), SVGA3D_MAX_CONTEXT_IDS }, /* SVGA_OTABLE_CONTEXT */ 92 92 { sizeof(SVGAOTableShaderEntry), 0 /* not used */ }, /* SVGA_OTABLE_SHADER */ 93 93 { sizeof(SVGAOTableScreenTargetEntry), 64 /*VBOX_VIDEO_MAX_SCREENS*/ }, /* SVGA_OTABLE_SCREENTARGET */ … … 613 613 } 614 614 615 NTSTATUS SvgaGMRIdAlloc(PVBOXWDDM_EXT_VMSVGA pSvga,616 uint32_t *pu32GMRId)617 {618 return svgaIdAlloc(pSvga, pSvga->pu32GMRBits, pSvga->cbGMRBits,619 pSvga->u32GmrMaxIds, pu32GMRId);620 }621 622 NTSTATUS SvgaGMRIdFree(PVBOXWDDM_EXT_VMSVGA pSvga,623 uint32_t u32GMRId)624 {625 return svgaIdFree(pSvga, pSvga->pu32GMRBits, pSvga->cbGMRBits,626 pSvga->u32GmrMaxIds, u32GMRId);627 }628 629 615 NTSTATUS SvgaContextCreate(PVBOXWDDM_EXT_VMSVGA pSvga, 630 616 uint32_t u32Cid) … … 760 746 AssertReturn(SVGAHOSTOBJECTID(&pSO->ho) == pSO->u32SharedSid, STATUS_INVALID_PARAMETER); 761 747 762 /* The surface object to be mapped to. */ 763 SURFACEOBJECT *pSharedSO = SvgaSurfaceObjectQuery(pSvga, u32SharedSid); 764 AssertReturnStmt(pSharedSO, SvgaSurfaceObjectRelease(pSO), STATUS_INVALID_PARAMETER); 748 /* The surface object to be mapped to. Query it to reference it. 749 * If the surface id (u32SharedSid) is not in the surface objects, then it is OK. 750 * It means that it is most likely from _D3D context. 751 */ 752 SvgaSurfaceObjectQuery(pSvga, u32SharedSid); 765 753 766 754 pSO->u32SharedSid = u32SharedSid; … … 783 771 AssertReturn(SVGAHOSTOBJECTID(&pSO->ho) != pSO->u32SharedSid, STATUS_INVALID_PARAMETER); 784 772 785 /* The shared surface object, which the u32Sid was mapped to. */ 773 /* The shared surface object, which the u32Sid was mapped to. 774 * If the surface id (u32SharedSid) is not in the surface objects, then it is OK. 775 * It means that it is most likely from _D3D context. 776 */ 786 777 SURFACEOBJECT *pSharedSO = SvgaSurfaceObjectQuery(pSvga, pSO->u32SharedSid); 787 AssertReturnStmt(pSharedSO, SvgaSurfaceObjectRelease(pSO), STATUS_INVALID_PARAMETER);788 778 789 779 pSO->u32SharedSid = SVGAHOSTOBJECTID(&pSO->ho); 790 780 791 781 /* Remove the reference which was added by SvgaSharedSidInsert. */ 792 SvgaSurfaceObjectRelease(pSharedSO); 782 if (pSharedSO) 783 SvgaSurfaceObjectRelease(pSharedSO); 793 784 794 785 /* Release both surface objects. */ 795 SvgaSurfaceObjectRelease(pSharedSO); 786 if (pSharedSO) 787 SvgaSurfaceObjectRelease(pSharedSO); 796 788 SvgaSurfaceObjectRelease(pSO); 797 789 return STATUS_SUCCESS; … … 837 829 else 838 830 { 839 GALOGREL(32, ("WDDM: no surface for sid %u\n", u32Sid)); 840 AssertFailed(); 841 /* Ignore the error. */ 831 /* Ignore the error. This is most likely a sid from _D3D context.*/ 842 832 return STATUS_SUCCESS; 843 833 } … … 1020 1010 case SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH: 1021 1011 case SVGA_3D_CMD_COND_BIND_GB_SURFACE: 1022 case SVGA_3D_CMD_UPDATE_GB_SURFACE:1023 1012 case SVGA_3D_CMD_READBACK_GB_SURFACE: 1024 case SVGA_3D_CMD_INVALIDATE_GB_SURFACE:1025 case SVGA_3D_CMD_UPDATE_GB_IMAGE:1026 1013 case SVGA_3D_CMD_READBACK_GB_IMAGE: 1027 1014 case SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL: 1028 case SVGA_3D_CMD_INVALIDATE_GB_IMAGE:1029 1015 case SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL: 1030 1016 case SVGA_3D_CMD_BIND_GB_SCREENTARGET: … … 1035 1021 AssertFailed(); 1036 1022 break; 1023 case SVGA_3D_CMD_UPDATE_GB_IMAGE: 1024 case SVGA_3D_CMD_UPDATE_GB_SURFACE: 1025 case SVGA_3D_CMD_INVALIDATE_GB_IMAGE: 1026 case SVGA_3D_CMD_INVALIDATE_GB_SURFACE: 1027 break; 1028 case SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER: 1029 { 1030 SVGA3dCmdDXSetSingleConstantBuffer *p = (SVGA3dCmdDXSetSingleConstantBuffer *)pCommand; 1031 Status = SvgaProcessSurface(pSvga, &p->sid, pHOA); 1032 } break; 1033 case SVGA_3D_CMD_DX_PRED_COPY_REGION: 1034 { 1035 SVGA3dCmdDXPredCopyRegion *p = (SVGA3dCmdDXPredCopyRegion *)pCommand; 1036 Status = SvgaProcessSurface(pSvga, &p->srcSid, pHOA); 1037 if (Status == STATUS_SUCCESS) 1038 Status = SvgaProcessSurface(pSvga, &p->dstSid, pHOA); 1039 } break; 1037 1040 default: 1038 1041 if (SVGA_3D_CMD_DX_MIN <= u32CmdId && u32CmdId <= SVGA_3D_CMD_DX_MAX) 1039 1042 { 1040 /** @todo Also do not support DX commands for now, they are not supported by the host. */ 1041 AssertFailed(); 1043 /** @todo Implement. */ 1042 1044 } 1043 1045 break; … … 1060 1062 * 1061 1063 * @param pSvga . 1064 * @param pSvgaContext . 1062 1065 * @param pvTarget . 1063 1066 * @param cbTarget . … … 1069 1072 */ 1070 1073 NTSTATUS SvgaRenderCommands(PVBOXWDDM_EXT_VMSVGA pSvga, 1074 struct VMSVGACONTEXT *pSvgaContext, 1071 1075 void *pvTarget, 1072 1076 uint32_t cbTarget, … … 1080 1084 AssertReturn(cbSource % sizeof(uint32_t) == 0, STATUS_ILLEGAL_INSTRUCTION); 1081 1085 1086 NTSTATUS Status = SvgaRenderCommandsD3D(pSvga, 1087 pSvgaContext, 1088 pvTarget, 1089 cbTarget, 1090 pvSource, 1091 cbSource, 1092 pu32TargetLength, 1093 pu32ProcessedLength); 1094 AssertReturn(NT_SUCCESS(Status), Status); 1095 1082 1096 SVGAHOSTOBJECTARRAY *pHO = (SVGAHOSTOBJECTARRAY *)GaMemAlloc(sizeof(SVGAHOSTOBJECTARRAY)); 1083 1097 if (!pHO) … … 1086 1100 pHO->u32Reserved = 0; 1087 1101 1088 NTSTATUS Status = STATUS_SUCCESS; 1089 1090 const uint8_t *pu8Src = (uint8_t *)pvSource; 1091 const uint8_t *pu8SrcEnd = (uint8_t *)pvSource + cbSource; 1092 uint8_t *pu8Dst = (uint8_t *)pvTarget; 1093 uint8_t *pu8DstEnd = (uint8_t *)pvTarget + cbTarget; 1094 1102 uint8_t *pu8Src = (uint8_t *)pvTarget; 1103 uint8_t *pu8SrcEnd = (uint8_t *)pvTarget + (*pu32TargetLength); 1095 1104 while (pu8SrcEnd > pu8Src) 1096 1105 { … … 1119 1128 } 1120 1129 1121 const uint32_t cbDstLeft = pu8DstEnd - pu8Dst; 1122 if (cbCmd > cbDstLeft) 1123 { 1124 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 1125 break; 1126 } 1127 1128 memcpy(pu8Dst, pu8Src, cbCmd); 1129 1130 /* Update the command in dst place if necessary. */ 1131 Status = svgaUpdateCommand(pSvga, u32CmdId, pu8Dst, cbCmd, pHO); 1130 /* Update the command in source place if necessary. */ 1131 Status = svgaUpdateCommand(pSvga, u32CmdId, pu8Src, cbCmd, pHO); 1132 1132 if (Status != STATUS_SUCCESS) 1133 1133 { … … 1137 1137 1138 1138 pu8Src += cbCmd; 1139 pu8Dst += cbCmd;1140 1139 } 1141 1140 … … 1143 1142 || Status == STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER) 1144 1143 { 1145 *pu32TargetLength = pu8Dst - (uint8_t *)pvTarget;1146 *pu32ProcessedLength = pu8Src - (uint8_t *)pvSource;1147 1144 if (pHO->cObjects) 1148 1145 *ppHwRenderData = &pHO->hdr; … … 1793 1790 RTR0PTR pvR0; 1794 1791 RTR3PTR pvR3; 1795 /* The Guest Memory Region ID. */1796 uint32_t u32GmrId;1792 /* A corresponding MOB, which provides the Guest Memory Region ID. */ 1793 PVMSVGAMOB pMob; 1797 1794 /* The allocated size in pages. */ 1798 1795 uint32_t u32NumPages; … … 1801 1798 } GAWDDMREGION; 1802 1799 1800 static void svgaFreeGBMobForGMR(VBOXWDDM_EXT_VMSVGA *pSvga, PVMSVGAMOB pMob) 1801 { 1802 if (pMob) 1803 { 1804 if (RT_BOOL(pSvga->u32Caps & SVGA_CAP_DX)) 1805 { 1806 void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_DESTROY_GB_MOB, sizeof(SVGA3dCmdDestroyGBMob), SVGA3D_INVALID_ID); 1807 if (pvCmd) 1808 { 1809 SVGA3dCmdDestroyGBMob *pCmd = (SVGA3dCmdDestroyGBMob *)pvCmd; 1810 pCmd->mobid = VMSVGAMOB_ID(pMob); 1811 SvgaCmdBufCommit(pSvga, sizeof(SVGA3dCmdDestroyGBMob)); 1812 } 1813 } 1814 1815 SvgaMobFree(pSvga, pMob); 1816 } 1817 } 1818 1819 static NTSTATUS svgaCreateGBMobForGMR(VBOXWDDM_EXT_VMSVGA *pSvga, GAWDDMREGION *pRegion) 1820 { 1821 /* Allocate a new mob. */ 1822 NTSTATUS Status = SvgaMobCreate(pSvga, &pRegion->pMob, pRegion->u32NumPages, 0); 1823 Assert(NT_SUCCESS(Status)); 1824 if (NT_SUCCESS(Status)) 1825 { 1826 Status = SvgaGboFillPageTableForArray(&pRegion->pMob->gbo, pRegion->u32NumPages, pRegion->aPhys); 1827 Assert(NT_SUCCESS(Status)); 1828 if (NT_SUCCESS(Status)) 1829 { 1830 if (RT_BOOL(pSvga->u32Caps & SVGA_CAP_DX)) 1831 { 1832 void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_DEFINE_GB_MOB64, sizeof(SVGA3dCmdDefineGBMob64), SVGA3D_INVALID_ID); 1833 if (pvCmd) 1834 { 1835 SVGA3dCmdDefineGBMob64 *pCmd = (SVGA3dCmdDefineGBMob64 *)pvCmd; 1836 pCmd->mobid = VMSVGAMOB_ID(pRegion->pMob); 1837 pCmd->ptDepth = pRegion->pMob->gbo.enmMobFormat; 1838 pCmd->base = pRegion->pMob->gbo.base; 1839 pCmd->sizeInBytes = pRegion->pMob->gbo.cbGbo; 1840 SvgaCmdBufCommit(pSvga, sizeof(SVGA3dCmdDefineGBMob64)); 1841 } 1842 else 1843 AssertFailedStmt(Status = STATUS_INSUFFICIENT_RESOURCES); 1844 } 1845 1846 if (NT_SUCCESS(Status)) 1847 return STATUS_SUCCESS; 1848 } 1849 } 1850 1851 svgaFreeGBMobForGMR(pSvga, pRegion->pMob); 1852 pRegion->pMob = NULL; 1853 return Status; 1854 } 1855 1856 1803 1857 static void gmrFree(GAWDDMREGION *pRegion) 1804 1858 { … … 1852 1906 Assert(pRegion); 1853 1907 gmrFree(pRegion); 1854 SvgaGMRIdFree(pSvga, pRegion->u32GmrId);1908 svgaFreeGBMobForGMR(pSvga, pRegion->pMob); 1855 1909 GaMemFree(pRegion); 1856 1910 } … … 1873 1927 { 1874 1928 AssertReturn(pCtx->cIds < pCtx->cMaxIds, -1); 1875 pCtx->au32Ids[pCtx->cIds++] = pRegion->u32GmrId;1929 pCtx->au32Ids[pCtx->cIds++] = VMSVGAMOB_ID(pRegion->pMob); 1876 1930 } 1877 1931 return 0; … … 1904 1958 if (pRegion) 1905 1959 { 1906 Assert( pRegion->u32GmrId== pCtx->au32Ids[i]);1960 Assert(VMSVGAMOB_ID(pRegion->pMob) == pCtx->au32Ids[i]); 1907 1961 GALOG(("Deallocate gmrId %d, pv %p, aPhys[0] %RHp\n", 1908 pRegion->u32GmrId, pRegion->pvR3, pRegion->aPhys[0]));1962 VMSVGAMOB_ID(pRegion->pMob), pRegion->pvR3, pRegion->aPhys[0])); 1909 1963 1910 1964 gaRegionFree(pSvga, pRegion); … … 1930 1984 if (pRegion) 1931 1985 { 1932 Assert( pRegion->u32GmrId== u32GmrId);1986 Assert(VMSVGAMOB_ID(pRegion->pMob) == u32GmrId); 1933 1987 GALOG(("Freed gmrId %d, pv %p, aPhys[0] %RHp\n", 1934 pRegion->u32GmrId, pRegion->pvR3, pRegion->aPhys[0]));1988 VMSVGAMOB_ID(pRegion->pMob), pRegion->pvR3, pRegion->aPhys[0])); 1935 1989 gaRegionFree(pSvga, pRegion); 1990 return STATUS_SUCCESS; 1991 } 1992 1993 AssertFailed(); 1994 return STATUS_INVALID_PARAMETER; 1995 } 1996 1997 NTSTATUS SvgaRegionUserAddressAndSize(VBOXWDDM_EXT_VMSVGA *pSvga, 1998 uint32_t u32GmrId, 1999 uint64_t *pu64UserAddress, 2000 uint32_t *pu32Size) 2001 { 2002 AssertReturn(u32GmrId <= pSvga->u32GmrMaxIds, STATUS_INVALID_PARAMETER); 2003 2004 GALOG(("[%p] gmrId %d\n", pSvga, u32GmrId)); 2005 2006 ExAcquireFastMutex(&pSvga->SvgaMutex); 2007 2008 GAWDDMREGION *pRegion = (GAWDDMREGION *)RTAvlU32Get(&pSvga->GMRTree, u32GmrId); 2009 2010 ExReleaseFastMutex(&pSvga->SvgaMutex); 2011 2012 if (pRegion) 2013 { 2014 Assert(VMSVGAMOB_ID(pRegion->pMob) == u32GmrId); 2015 GALOG(("Get gmrId %d, UserAddress 0x%p\n", 2016 VMSVGAMOB_ID(pRegion->pMob), pRegion->pvR3)); 2017 *pu64UserAddress = (uintptr_t)pRegion->pvR3; 2018 *pu32Size = pRegion->u32NumPages * PAGE_SIZE; 1936 2019 return STATUS_SUCCESS; 1937 2020 } … … 1957 2040 if (pRegion) 1958 2041 { 1959 Status = SvgaGMRIdAlloc(pSvga, &pRegion->u32GmrId); 2042 /* Region id and VGPU10+ mobid are the same. So a mob is allocated along with the gmr. 2043 * The mob provides an id and also reported to the host on VGPU10. 2044 */ 2045 pRegion->pvOwner = pvOwner; 2046 pRegion->u32NumPages = u32NumPages; 2047 pRegion->MemObj = NIL_RTR0MEMOBJ; 2048 pRegion->MapObjR3 = NIL_RTR0MEMOBJ; 2049 2050 Status = gmrAlloc(pRegion); 1960 2051 Assert(NT_SUCCESS(Status)); 1961 2052 if (NT_SUCCESS(Status)) 1962 2053 { 1963 if (pRegion->u32GmrId < pSvga->u32GmrMaxIds) 2054 Status = svgaCreateGBMobForGMR(pSvga, pRegion); 2055 Assert(NT_SUCCESS(Status)); 2056 if (NT_SUCCESS(Status)) 1964 2057 { 1965 pRegion->pvOwner = pvOwner; 1966 pRegion->u32NumPages = u32NumPages; 1967 pRegion->MemObj = NIL_RTR0MEMOBJ; 1968 pRegion->MapObjR3 = NIL_RTR0MEMOBJ; 1969 1970 Status = gmrAlloc(pRegion); 1971 Assert(NT_SUCCESS(Status)); 1972 if (NT_SUCCESS(Status)) 2058 if (VMSVGAMOB_ID(pRegion->pMob) < pSvga->u32GmrMaxIds) 1973 2059 { 1974 2060 GALOG(("Allocated gmrId %d, pv %p, aPhys[0] %RHp\n", 1975 pRegion->u32GmrId, pRegion->pvR3, pRegion->aPhys[0]));2061 VMSVGAMOB_ID(pRegion->pMob), pRegion->pvR3, pRegion->aPhys[0])); 1976 2062 1977 2063 /* Report the GMR to the host vmsvga device. */ 1978 2064 Status = SvgaGMRReport(pSvga, 1979 pRegion->u32GmrId,2065 VMSVGAMOB_ID(pRegion->pMob), 1980 2066 SVGA_REMAP_GMR2_PPN32, 1981 2067 pRegion->u32NumPages, … … 1987 2073 ExAcquireFastMutex(&pSvga->SvgaMutex); 1988 2074 1989 pRegion->Core.Key = pRegion->u32GmrId;2075 pRegion->Core.Key = VMSVGAMOB_ID(pRegion->pMob); 1990 2076 RTAvlU32Insert(&pSvga->GMRTree, &pRegion->Core); 1991 2077 1992 2078 ExReleaseFastMutex(&pSvga->SvgaMutex); 1993 2079 1994 *pu32GmrId = pRegion->u32GmrId;2080 *pu32GmrId = VMSVGAMOB_ID(pRegion->pMob); 1995 2081 *pu64UserAddress = (uint64_t)pRegion->pvR3; 1996 2082 … … 1998 2084 return STATUS_SUCCESS; 1999 2085 } 2000 2001 gmrFree(pRegion);2002 2086 } 2087 else 2088 { 2089 AssertFailed(); 2090 Status = STATUS_INSUFFICIENT_RESOURCES; 2091 } 2092 2093 svgaFreeGBMobForGMR(pSvga, pRegion->pMob); 2003 2094 } 2004 else 2005 { 2006 AssertFailed(); 2007 Status = STATUS_INSUFFICIENT_RESOURCES; 2008 } 2009 2010 SvgaGMRIdFree(pSvga, pRegion->u32GmrId); 2095 2096 gmrFree(pRegion); 2011 2097 } 2012 2098 … … 2198 2284 for (unsigned i = 0; i < pGbo->cbGbo >> PAGE_SHIFT; ++i) 2199 2285 paPpnGbo[i] = RTR0MemObjGetPagePhysAddr(hMemObj, i) >> PAGE_SHIFT; 2286 } 2287 return STATUS_SUCCESS; 2288 } 2289 2290 2291 NTSTATUS SvgaGboFillPageTableForArray(PVMSVGAGBO pGbo, 2292 uint32_t u32NumPages, 2293 RTHCPHYS *paPhys) 2294 { 2295 if (pGbo->enmMobFormat == SVGA3D_MOBFMT_PTDEPTH64_0) 2296 { 2297 Assert(u32NumPages == 1); 2298 pGbo->base = paPhys[0] >> PAGE_SHIFT; 2299 } 2300 else 2301 { 2302 /* The first of pages is alway the base. It is either the level 2 page or the single level 1 page */ 2303 pGbo->base = RTR0MemObjGetPagePhysAddr(pGbo->hMemObjPT, 0) >> PAGE_SHIFT; 2304 2305 PPN64 *paPpn = (PPN64 *)RTR0MemObjAddress(pGbo->hMemObjPT); 2306 PPN64 *paPpnGbo; 2307 if (pGbo->enmMobFormat == SVGA3D_MOBFMT_PTDEPTH64_2) 2308 paPpnGbo = &paPpn[PAGE_SIZE / sizeof(PPN64)]; /* Level 1 pages follow the level 2 page. */ 2309 else if (pGbo->enmMobFormat == SVGA3D_MOBFMT_PTDEPTH64_1) 2310 paPpnGbo = paPpn; 2311 else 2312 AssertFailedReturn(STATUS_INVALID_PARAMETER); 2313 2314 /* Store page numbers into the level 1 description pages. */ 2315 for (unsigned i = 0; i < u32NumPages; ++i) 2316 paPpnGbo[i] = paPhys[i] >> PAGE_SHIFT; 2200 2317 } 2201 2318 return STATUS_SUCCESS; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
r95086 r95234 327 327 */ 328 328 uint32_t u32SharedSid; 329 330 uint32_t mobid; 329 331 } SURFACEOBJECT; 330 332 AssertCompile(RT_OFFSETOF(SURFACEOBJECT, ho) == 0); … … 383 385 uint32_t cSizes, 384 386 uint32_t *pu32Sid); 387 NTSTATUS SvgaGBSurfaceCreate(VBOXWDDM_EXT_VMSVGA *pSvga, 388 void *pvOwner, 389 SVGAGBSURFCREATE *pCreateParms); 385 390 NTSTATUS SvgaSurfaceUnref(VBOXWDDM_EXT_VMSVGA *pSvga, 386 391 uint32_t u32Sid); … … 407 412 NTSTATUS SvgaSurfaceIdFree(PVBOXWDDM_EXT_VMSVGA pSvga, 408 413 uint32_t u32Sid); 409 NTSTATUS SvgaGMRIdAlloc(PVBOXWDDM_EXT_VMSVGA pSvga,410 uint32_t *pu32GMRId);411 NTSTATUS SvgaGMRIdFree(PVBOXWDDM_EXT_VMSVGA pSvga,412 uint32_t u32GMRId);413 414 414 415 415 416 NTSTATUS SvgaRenderCommands(PVBOXWDDM_EXT_VMSVGA pSvga, 417 struct VMSVGACONTEXT *pSvgaContext, 416 418 void *pvTarget, 417 419 uint32_t cbTarget, … … 558 560 uint32_t *pu32GmrId, 559 561 uint64_t *pu64UserAddress); 562 NTSTATUS SvgaRegionUserAddressAndSize(VBOXWDDM_EXT_VMSVGA *pSvga, 563 uint32_t u32GmrId, 564 uint64_t *pu64UserAddress, 565 uint32_t *pu32Size); 560 566 NTSTATUS SvgaRegionDestroy(VBOXWDDM_EXT_VMSVGA *pSvga, 561 567 uint32_t u32GmrId); … … 604 610 NTSTATUS SvgaGboFillPageTableForMemObj(PVMSVGAGBO pGbo, 605 611 RTR0MEMOBJ hMemObj); 612 NTSTATUS SvgaGboFillPageTableForArray(PVMSVGAGBO pGbo, 613 uint32_t u32NumPages, 614 RTHCPHYS *paPhys); 606 615 607 616 void SvgaMobFree(VBOXWDDM_EXT_VMSVGA *pSvga, -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/SvgaHostObjects.cpp
r93115 r95234 19 19 20 20 #include "Svga.h" 21 #include "SvgaFifo.h" 21 22 22 23 #include <iprt/asm.h> … … 261 262 uint32_t const u32Sid = pHO->u.avl.core.Key; 262 263 264 SURFACEOBJECT *pSO = (SURFACEOBJECT *)pHO; 265 263 266 /* Delete the surface. */ 264 267 GALOG(("deleted sid=%u\n", u32Sid)); 268 269 if (pSO->mobid != SVGA3D_INVALID_ID) 270 { 271 void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_BIND_GB_SURFACE, sizeof(SVGA3dCmdBindGBSurface), SVGA3D_INVALID_ID); 272 if (pvCmd) 273 { 274 SVGA3dCmdBindGBSurface *pCmd = (SVGA3dCmdBindGBSurface *)pvCmd; 275 pCmd->sid = u32Sid; 276 pCmd->mobid = SVGA3D_INVALID_ID; 277 SvgaCmdBufCommit(pSvga, sizeof(SVGA3dCmdBindGBSurface)); 278 } 279 } 265 280 266 281 NTSTATUS Status = SvgaSurfaceDestroy(pSvga, u32Sid); … … 366 381 { 367 382 pSO->u32SharedSid = u32Sid; /* Initially. The user mode driver can change this for shared surfaces. */ 383 pSO->mobid = SVGA3D_INVALID_ID; 368 384 369 385 Status = svgaHostObjectInit(pSvga, &pSO->ho, SVGA_HOST_OBJECT_SURFACE, u32Sid, svgaSurfaceObjectDestroy); … … 392 408 return Status; 393 409 } 410 411 412 static NTSTATUS svgaGBSurfaceDefine(VBOXWDDM_EXT_VMSVGA *pSvga, 413 uint32_t u32Sid, 414 SVGAGBSURFCREATE *pCreateParms, 415 uint32_t mobid) 416 { 417 void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_DEFINE_GB_SURFACE_V4, sizeof(SVGA3dCmdDefineGBSurface_v4), SVGA3D_INVALID_ID); 418 if (pvCmd) 419 { 420 SVGA3dCmdDefineGBSurface_v4 *pCmd = (SVGA3dCmdDefineGBSurface_v4 *)pvCmd; 421 pCmd->sid = u32Sid; 422 pCmd->surfaceFlags = pCreateParms->s.flags; 423 pCmd->format = pCreateParms->s.format; 424 pCmd->numMipLevels = pCreateParms->s.numMipLevels; 425 pCmd->multisampleCount = pCreateParms->s.sampleCount; 426 pCmd->autogenFilter = SVGA3D_TEX_FILTER_NONE; 427 pCmd->size = pCreateParms->s.size; 428 pCmd->arraySize = pCreateParms->s.numFaces; 429 pCmd->bufferByteStride = 0; 430 SvgaCmdBufCommit(pSvga, sizeof(SVGA3dCmdDefineGBSurface_v4)); 431 } 432 else 433 AssertFailedReturn(STATUS_INSUFFICIENT_RESOURCES); 434 435 pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_BIND_GB_SURFACE, sizeof(SVGA3dCmdBindGBSurface), SVGA3D_INVALID_ID); 436 if (pvCmd) 437 { 438 SVGA3dCmdBindGBSurface *pCmd = (SVGA3dCmdBindGBSurface *)pvCmd; 439 pCmd->sid = u32Sid; 440 pCmd->mobid = mobid; 441 SvgaCmdBufCommit(pSvga, sizeof(SVGA3dCmdBindGBSurface)); 442 } 443 else 444 AssertFailedReturn(STATUS_INSUFFICIENT_RESOURCES); 445 446 return STATUS_SUCCESS; 447 } 448 449 450 static void svgaGBSurfaceDestroy(VBOXWDDM_EXT_VMSVGA *pSvga, uint32_t u32Sid) 451 { 452 SvgaSurfaceDestroy(pSvga, u32Sid); 453 } 454 455 456 NTSTATUS SvgaGBSurfaceCreate(VBOXWDDM_EXT_VMSVGA *pSvga, 457 void *pvOwner, 458 SVGAGBSURFCREATE *pCreateParms) 459 { 460 NTSTATUS Status = svgaHostObjectsProcessPending(pSvga); 461 AssertReturn(Status == STATUS_SUCCESS, Status); 462 463 GALOGG(GALOG_GROUP_SVGA, ("gmrid = %u\n", pCreateParms->gmrid)); 464 465 uint32_t cbGB = 0; 466 uint64_t u64UserAddress = 0; 467 /* Allocate GMR, if not already supplied. */ 468 if (pCreateParms->gmrid == SVGA3D_INVALID_ID) 469 { 470 uint32_t u32NumPages = (pCreateParms->cbGB + PAGE_SIZE - 1) >> PAGE_SHIFT; 471 Status = SvgaRegionCreate(pSvga, pvOwner, u32NumPages, &pCreateParms->gmrid, &u64UserAddress); 472 AssertReturn(NT_SUCCESS(Status), Status); 473 cbGB = u32NumPages * PAGE_SIZE; 474 } 475 else 476 { 477 Status = SvgaRegionUserAddressAndSize(pSvga, pCreateParms->gmrid, &u64UserAddress, &cbGB); 478 AssertReturn(NT_SUCCESS(Status), Status); 479 } 480 481 SURFACEOBJECT *pSO = (SURFACEOBJECT *)GaMemAllocZero(sizeof(SURFACEOBJECT)); 482 if (pSO) 483 { 484 uint32_t u32Sid; 485 Status = SvgaSurfaceIdAlloc(pSvga, &u32Sid); 486 if (NT_SUCCESS(Status)) 487 { 488 Status = svgaGBSurfaceDefine(pSvga, u32Sid, pCreateParms, pCreateParms->gmrid); 489 if (NT_SUCCESS(Status)) 490 { 491 pSO->u32SharedSid = u32Sid; /* Initially. The user mode driver can change this for shared surfaces. */ 492 pSO->mobid = pCreateParms->gmrid; 493 494 Status = svgaHostObjectInit(pSvga, &pSO->ho, SVGA_HOST_OBJECT_SURFACE, u32Sid, svgaSurfaceObjectDestroy); 495 if (NT_SUCCESS(Status)) 496 { 497 pCreateParms->cbGB = cbGB; 498 pCreateParms->u64UserAddress = u64UserAddress; 499 pCreateParms->u32Sid = u32Sid; 500 501 GALOG(("created sid=%u\n", u32Sid)); 502 return STATUS_SUCCESS; 503 } 504 505 AssertFailed(); 506 507 /* 508 * Cleanup on error. 509 */ 510 svgaGBSurfaceDestroy(pSvga, u32Sid); 511 } 512 SvgaSurfaceIdFree(pSvga, u32Sid); 513 } 514 GaMemFree(pSO); 515 } 516 else 517 Status = STATUS_INSUFFICIENT_RESOURCES; 518 519 return Status; 520 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPDX.cpp
r95191 r95234 953 953 *(uint32_t *)pPatchAddress = pAllocation->dx.mobid; 954 954 } 955 else 956 {957 AssertFailed();955 else if ( pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE 956 || pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE) 957 { 958 958 uint32_t *poffVRAM = (uint32_t *)pPatchAddress; 959 959 *poffVRAM = pAllocationListEntry->PhysicalAddress.LowPart + pPatchListEntry->AllocationOffset; 960 960 } 961 else 962 AssertFailed(); 961 963 } 962 964 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp
r95191 r95234 982 982 if (cbTarget > GA_DMA_MIN_SUBMIT_SIZE) 983 983 { 984 Status = SvgaRenderCommands(pGaDevExt->hw.pSvga, p vTarget, cbTarget, pvSource, cbSource,984 Status = SvgaRenderCommands(pGaDevExt->hw.pSvga, pContext->pSvgaContext, pvTarget, cbTarget, pvSource, cbSource, 985 985 &u32TargetLength, &u32ProcessedLength, &pHwRenderData); 986 986 } … … 1960 1960 break; 1961 1961 } 1962 case VBOXESC_SVGAGBSURFACEDEFINE: 1963 { 1964 if (pEscape->PrivateDriverDataSize < sizeof(VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE)) 1965 { 1966 Status = STATUS_INVALID_PARAMETER; 1967 break; 1968 } 1969 1970 VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE *pSurfaceDefine = (VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE *)pEscapeHdr; 1971 1972 VBOXWDDM_EXT_VMSVGA *pSvga = pDevExt->pGa->hw.pSvga; 1973 Status = SvgaGBSurfaceCreate(pSvga, pDevice, &pSurfaceDefine->CreateParms); 1974 break; 1975 } 1976 case VBOXESC_SVGAGETSID: 1977 { 1978 if (pEscape->PrivateDriverDataSize < sizeof(VBOXDISPIFESCAPE_SVGAGETSID)) 1979 { 1980 Status = STATUS_INVALID_PARAMETER; 1981 break; 1982 } 1983 1984 VBOXDISPIFESCAPE_SVGAGETSID *pGetSid = (VBOXDISPIFESCAPE_SVGAGETSID *)pEscapeHdr; 1985 1986 DXGKARGCB_GETHANDLEDATA GetHandleData; 1987 GetHandleData.hObject = (D3DKMT_HANDLE)pGetSid->hAllocation; 1988 GetHandleData.Type = DXGK_HANDLE_ALLOCATION; 1989 GetHandleData.Flags.Value = 0; 1990 1991 PVBOXWDDM_ALLOCATION pAllocation = (PVBOXWDDM_ALLOCATION)pDevExt->u.primary.DxgkInterface.DxgkCbGetHandleData(&GetHandleData); 1992 if (!pAllocation) 1993 { 1994 WARN(("failed to get allocation from handle")); 1995 Status = STATUS_INVALID_PARAMETER; 1996 break; 1997 } 1998 1999 if (pAllocation->enmType != VBOXWDDM_ALLOC_TYPE_D3D) 2000 { 2001 WARN(("Unexpected allocation type %d", pAllocation->enmType)); 2002 Status = STATUS_INVALID_PARAMETER; 2003 break; 2004 } 2005 2006 pGetSid->u32Sid = pAllocation->dx.sid; 2007 Status = STATUS_SUCCESS; 2008 break; 2009 } 1962 2010 default: 1963 2011 break;
Note:
See TracChangeset
for help on using the changeset viewer.