Changeset 46662 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
- Timestamp:
- Jun 19, 2013 2:22:29 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r46606 r46662 4104 4104 bool bIssueCreateResource = false; 4105 4105 bool bCreateKMResource = false; 4106 bool bSetHostID = false; 4106 4107 4107 4108 pRc->hResource = pResource->hResource; … … 4185 4186 { 4186 4187 bIssueCreateResource = true; 4188 bSetHostID = true; 4187 4189 } 4188 4190 … … 4236 4238 pAllocInfo->hSharedHandle = (uint64_t)pAllocation->hSharedHandle; 4237 4239 pAllocInfo->SurfDesc = pAllocation->SurfDesc; 4240 if (bSetHostID) 4241 { 4242 IDirect3DSurface9 *pSurfIf = NULL; 4243 hr = VBoxD3DIfSurfGet(pRc, i, &pSurfIf); 4244 if (SUCCEEDED(hr)) 4245 { 4246 hr = pAdapter->D3D.D3D.pfnVBoxWineExD3DSurf9GetHostId(pSurfIf, &pAllocInfo->hostID); 4247 if (SUCCEEDED(hr)) 4248 { 4249 Assert(pAllocInfo->hostID); 4250 } 4251 else 4252 { 4253 WARN(("pfnVBoxWineExD3DSurf9GetHostId failed, hr 0x%x", hr)); 4254 break; 4255 } 4256 } 4257 else 4258 { 4259 WARN(("VBoxD3DIfSurfGet failed, hr 0x%x", hr)); 4260 break; 4261 } 4262 } 4263 else 4264 pAllocInfo->hostID = 0; 4238 4265 } 4239 4266 … … 4242 4269 Assert(pRc->fFlags.Generic); 4243 4270 4244 if (bCreateKMResource) 4245 { 4246 Assert(pRc->fFlags.KmResource); 4247 4248 hr = pDevice->RtCallbacks.pfnAllocateCb(pDevice->hDevice, pDdiAllocate); 4249 Assert(hr == S_OK); 4250 Assert(pDdiAllocate->hKMResource 4251 || pResource->Flags.SharedResource /* for some reason shared resources 4252 * are created with zero km resource handle on Win7+ */ 4253 ); 4254 } 4255 else 4256 { 4257 Assert(!pRc->fFlags.KmResource); 4258 4259 pDdiAllocate->hResource = NULL; 4260 pDdiAllocate->NumAllocations = 1; 4261 pDdiAllocate->PrivateDriverDataSize = 0; 4262 pDdiAllocate->pPrivateDriverData = NULL; 4263 D3DDDI_ALLOCATIONINFO *pDdiAllocIBase = pDdiAllocate->pAllocationInfo; 4264 4265 for (UINT i = 0; i < pResource->SurfCount; ++i) 4266 { 4267 pDdiAllocate->pAllocationInfo = &pDdiAllocIBase[i]; 4271 if (SUCCEEDED(hr)) 4272 { 4273 if (bCreateKMResource) 4274 { 4275 Assert(pRc->fFlags.KmResource); 4276 4268 4277 hr = pDevice->RtCallbacks.pfnAllocateCb(pDevice->hDevice, pDdiAllocate); 4269 4278 Assert(hr == S_OK); 4270 Assert(!pDdiAllocate->hKMResource); 4271 if (SUCCEEDED(hr)) 4279 Assert(pDdiAllocate->hKMResource 4280 || pResource->Flags.SharedResource /* for some reason shared resources 4281 * are created with zero km resource handle on Win7+ */ 4282 ); 4283 } 4284 else 4285 { 4286 Assert(!pRc->fFlags.KmResource); 4287 4288 pDdiAllocate->hResource = NULL; 4289 pDdiAllocate->NumAllocations = 1; 4290 pDdiAllocate->PrivateDriverDataSize = 0; 4291 pDdiAllocate->pPrivateDriverData = NULL; 4292 D3DDDI_ALLOCATIONINFO *pDdiAllocIBase = pDdiAllocate->pAllocationInfo; 4293 4294 for (UINT i = 0; i < pResource->SurfCount; ++i) 4272 4295 { 4273 Assert(pDdiAllocate->pAllocationInfo->hAllocation); 4296 pDdiAllocate->pAllocationInfo = &pDdiAllocIBase[i]; 4297 hr = pDevice->RtCallbacks.pfnAllocateCb(pDevice->hDevice, pDdiAllocate); 4298 Assert(hr == S_OK); 4299 Assert(!pDdiAllocate->hKMResource); 4300 if (SUCCEEDED(hr)) 4301 { 4302 Assert(pDdiAllocate->pAllocationInfo->hAllocation); 4303 } 4304 else 4305 { 4306 for (UINT j = 0; i < j; ++j) 4307 { 4308 D3DDDI_ALLOCATIONINFO * pCur = &pDdiAllocIBase[i]; 4309 D3DDDICB_DEALLOCATE Dealloc; 4310 Dealloc.hResource = 0; 4311 Dealloc.NumAllocations = 1; 4312 Dealloc.HandleList = &pCur->hAllocation; 4313 HRESULT tmpHr = pDevice->RtCallbacks.pfnDeallocateCb(pDevice->hDevice, &Dealloc); 4314 Assert(tmpHr == S_OK); 4315 } 4316 break; 4317 } 4274 4318 } 4275 else 4319 4320 pDdiAllocate->pAllocationInfo = pDdiAllocIBase; 4321 } 4322 4323 if (SUCCEEDED(hr)) 4324 { 4325 pRc->hKMResource = pDdiAllocate->hKMResource; 4326 4327 for (UINT i = 0; i < pResource->SurfCount; ++i) 4276 4328 { 4277 for (UINT j = 0; i < j; ++j) 4329 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 4330 D3DDDI_ALLOCATIONINFO *pDdiAllocI = &pDdiAllocate->pAllocationInfo[i]; 4331 PVBOXWDDM_ALLOCINFO pAllocInfo = (PVBOXWDDM_ALLOCINFO)pDdiAllocI->pPrivateDriverData; 4332 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 4333 pAllocation->hAllocation = pDdiAllocI->hAllocation; 4334 pAllocation->enmType = VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC; 4335 pAllocation->pvMem = (void*)pSurf->pSysMem; 4336 pAllocation->SurfDesc = pAllocInfo->SurfDesc; 4337 4338 if (pResource->Flags.SharedResource) 4278 4339 { 4279 D3DDDI_ALLOCATIONINFO * pCur = &pDdiAllocIBase[i]; 4280 D3DDDICB_DEALLOCATE Dealloc; 4281 Dealloc.hResource = 0; 4282 Dealloc.NumAllocations = 1; 4283 Dealloc.HandleList = &pCur->hAllocation; 4284 HRESULT tmpHr = pDevice->RtCallbacks.pfnDeallocateCb(pDevice->hDevice, &Dealloc); 4285 Assert(tmpHr == S_OK); 4340 #ifdef VBOXWDDMDISP_DEBUG_PRINT_SHARED_CREATE 4341 Assert(VBOXWDDMDISP_IS_TEXTURE(pResource->Flags)); 4342 vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared CREATED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), " 4343 "Handle(0x%x), (0n%d) \n***********\n\n", 4344 GetCurrentProcessId(), GetCurrentProcessId(), 4345 pAllocation, pRc->hKMResource, pAllocation->hAllocation, 4346 pAllocation->hSharedHandle, pAllocation->hSharedHandle 4347 )); 4348 #endif 4286 4349 } 4287 break;4288 4350 } 4289 } 4290 4291 pDdiAllocate->pAllocationInfo = pDdiAllocIBase; 4292 } 4293 4294 if (SUCCEEDED(hr)) 4295 { 4296 pRc->hKMResource = pDdiAllocate->hKMResource; 4297 4298 for (UINT i = 0; i < pResource->SurfCount; ++i) 4299 { 4300 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 4301 D3DDDI_ALLOCATIONINFO *pDdiAllocI = &pDdiAllocate->pAllocationInfo[i]; 4302 PVBOXWDDM_ALLOCINFO pAllocInfo = (PVBOXWDDM_ALLOCINFO)pDdiAllocI->pPrivateDriverData; 4303 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 4304 pAllocation->hAllocation = pDdiAllocI->hAllocation; 4305 pAllocation->enmType = VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC; 4306 pAllocation->pvMem = (void*)pSurf->pSysMem; 4307 pAllocation->SurfDesc = pAllocInfo->SurfDesc; 4308 4309 if (pResource->Flags.SharedResource) 4310 { 4311 #ifdef VBOXWDDMDISP_DEBUG_PRINT_SHARED_CREATE 4312 Assert(VBOXWDDMDISP_IS_TEXTURE(pResource->Flags)); 4313 vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared CREATED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), " 4314 "Handle(0x%x), (0n%d) \n***********\n\n", 4315 GetCurrentProcessId(), GetCurrentProcessId(), 4316 pAllocation, pRc->hKMResource, pAllocation->hAllocation, 4317 pAllocation->hSharedHandle, pAllocation->hSharedHandle 4318 )); 4319 #endif 4320 } 4321 } 4322 4323 VBOXVDBG_CREATE_CHECK_SWAPCHAIN(); 4351 4352 VBOXVDBG_CREATE_CHECK_SWAPCHAIN(); 4353 } 4324 4354 } 4325 4355
Note:
See TracChangeset
for help on using the changeset viewer.