Changeset 30916 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
- Timestamp:
- Jul 19, 2010 8:32:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30885 r30916 1889 1889 HRESULT hr = S_OK; 1890 1890 1891 #ifdef DEBUG_misha1892 uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;1893 vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,1894 NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));1895 #endif1891 //#ifdef DEBUG_misha 1892 // uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations; 1893 // vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf, 1894 // NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n")); 1895 //#endif 1896 1896 1897 1897 if (!pDevice->cStreamSources) … … 1911 1911 Assert(hr == S_OK); 1912 1912 1913 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));1913 // vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n")); 1914 1914 } 1915 1915 else … … 1946 1946 Assert(hr == S_OK); 1947 1947 1948 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));1948 // vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n")); 1949 1949 #if 0 1950 1950 IDirect3DVertexDeclaration9* pDecl; … … 2156 2156 } 2157 2157 2158 #ifdef DEBUG_misha2159 iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;2160 vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,2161 NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));2162 #endif2158 //#ifdef DEBUG_misha 2159 // iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations; 2160 // vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf, 2161 // NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n")); 2162 //#endif 2163 2163 2164 2164 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); … … 2172 2172 Assert(pDevice); 2173 2173 Assert(pDevice->pDevice9If); 2174 #ifdef DEBUG_misha2175 uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;2176 vboxVDbgDumpSurfData((pDevice, ">>>DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,2177 NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));2178 #endif2174 //#ifdef DEBUG_misha 2175 // uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations; 2176 // vboxVDbgDumpSurfData((pDevice, ">>>DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf, 2177 // NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n")); 2178 //#endif 2179 2179 2180 2180 #ifdef DEBUG … … 2210 2210 Assert(hr == S_OK); 2211 2211 2212 #ifdef DEBUG_misha2213 iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;2214 vboxVDbgDumpSurfData((pDevice, "<<<DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,2215 NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));2216 #endif2212 //#ifdef DEBUG_misha 2213 // iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations; 2214 // vboxVDbgDumpSurfData((pDevice, "<<<DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf, 2215 // NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n")); 2216 //#endif 2217 2217 2218 2218 … … 2274 2274 hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount); 2275 2275 #else 2276 #ifdef DEBUG_misha2277 uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;2278 vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,2279 NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));2280 #endif2276 //#ifdef DEBUG_misha 2277 // uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations; 2278 // vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf, 2279 // NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n")); 2280 //#endif 2281 2281 2282 2282 #ifdef DEBUG … … 2298 2298 if (pDevice->aStreamSource[stream]->LockInfo.cLocks) 2299 2299 { 2300 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));2300 // vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n")); 2301 2301 2302 2302 Assert(pLock->fFlags.MightDrawFromLocked && (pLock->fFlags.Discard || pLock->fFlags.NoOverwrite)); … … 2310 2310 else 2311 2311 { 2312 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));2312 // vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n")); 2313 2313 2314 2314 hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount); … … 2324 2324 #endif 2325 2325 2326 #ifdef DEBUG_misha2327 iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;2328 vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,2329 NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));2330 #endif2326 //#ifdef DEBUG_misha 2327 // iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations; 2328 // vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf, 2329 // NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n")); 2330 //#endif 2331 2331 2332 2332 Assert(hr == S_OK); … … 2679 2679 Assert(pLockAlloc->pvMem); 2680 2680 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 2681 2681 #if 0 2682 2682 if (bNeedResynch) 2683 2683 vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, pRect, false /*bool bToLockInfo*/); 2684 #endif 2684 2685 } 2685 2686 } … … 2983 2984 Assert(pD3DIfTex); 2984 2985 /* this is a sysmem texture, update */ 2986 #if 0 2985 2987 if (pLockAlloc->pvMem && !pLockAlloc->LockInfo.fFlags.ReadOnly) 2986 2988 { … … 2989 2991 true /*bool bToLockInfo*/); 2990 2992 } 2993 #endif 2991 2994 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 2992 2995 Assert(hr == S_OK); … … 3407 3410 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0]; 3408 3411 IDirect3DTexture9 *pD3DIfTex; 3412 #if 0 3409 3413 hr = pDevice->pDevice9If->CreateTexture(pSurf->Width, 3410 3414 pSurf->Height, … … 3416 3420 NULL /* HANDLE* pSharedHandle */ 3417 3421 ); 3422 #else 3423 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice->pDevice9If, 3424 pSurf->Width, 3425 pSurf->Height, 3426 pResource->SurfCount, 3427 vboxDDI2D3DUsage(pResource->Flags), 3428 vboxDDI2D3DFormat(pResource->Format), 3429 vboxDDI2D3DPool(pResource->Pool), 3430 &pD3DIfTex, 3431 NULL /* HANDLE* pSharedHandle */, 3432 pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL); 3433 #endif 3418 3434 Assert(hr == S_OK); 3419 3435 if (hr == S_OK) … … 3422 3438 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 3423 3439 pAllocation->pD3DIf = pD3DIfTex; 3440 #if 0 3424 3441 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 3425 3442 { … … 3444 3461 } 3445 3462 } 3463 #endif 3446 3464 } 3447 3465 #ifdef DEBUG … … 4209 4227 Assert(pDstRc->cAllocations > pData->DstSubResourceIndex); 4210 4228 Assert(pSrcRc->cAllocations > pData->SrcSubResourceIndex); 4211 // Assert(pSrcRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM);4212 /* @todo: use UpdateRect in case of Src is a D3DDDIPOOL_SYSTEMMEM */4213 Assert(pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM);4214 4229 Assert(pDstRc != pDevice->pRenderTargetRc || pDevice->iRenderTargetFrontBuf != pData->DstSubResourceIndex); 4215 4230 HRESULT hr = S_OK; … … 4284 4299 { 4285 4300 Assert(pSrcSurfIf); 4286 4287 //#ifdef DEBUG_misha 4288 // vboxVDbgDumpSurfData((pDevice, "Blt-pre Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n")); 4289 // vboxVDbgDumpSurfData((pDevice, "Blt-pre Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n")); 4290 //#endif 4301 #ifdef DEBUG_misha 4302 bool bDo = false; 4303 4304 if (g_VDbgTstDumpEnable) 4305 { 4306 if (g_VDbgTstDumpOnSys2VidSameSizeEnable) 4307 { 4308 if (pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM 4309 && pSrcRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM) 4310 { 4311 D3DSURFACE_DESC SrcDesc; 4312 HRESULT hr = pSrcSurfIf->GetDesc(&SrcDesc); 4313 Assert(hr == S_OK); 4314 if (hr == S_OK) 4315 { 4316 D3DSURFACE_DESC DstDesc; 4317 hr = pDstSurfIf->GetDesc(&DstDesc); 4318 Assert(hr == S_OK); 4319 if (hr == S_OK) 4320 { 4321 if (SrcDesc.Width == DstDesc.Width 4322 && SrcDesc.Height == DstDesc.Height) 4323 { 4324 bDo = true; 4325 } 4326 } 4327 } 4328 } 4329 } 4330 } 4331 4332 if (bDo) 4333 { 4334 vboxVDbgDumpSurfData((pDevice, "Blt-pre Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n")); 4335 vboxVDbgDumpSurfData((pDevice, "Blt-pre Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n")); 4336 } 4337 #endif 4291 4338 /* we support only Point & Linear, we ignore [Begin|Continue|End]PresentToDwm */ 4292 4339 Assert((pData->Flags.Value & (~(0x00000100 | 0x00000200 | 0x00000400 | 0x00000001 | 0x00000002))) == 0); … … 4298 4345 Assert(hr == S_OK); 4299 4346 4300 //#ifdef DEBUG_misha 4301 // vboxVDbgDumpSurfData((pDevice, "Blt-post Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n")); 4302 // vboxVDbgDumpSurfData((pDevice, "Blt-post Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n")); 4303 //#endif 4347 #ifdef DEBUG_misha 4348 if (bDo) 4349 { 4350 vboxVDbgDumpSurfData((pDevice, "Blt-post Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n")); 4351 vboxVDbgDumpSurfData((pDevice, "Blt-post Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n")); 4352 } 4353 #endif 4304 4354 pSrcSurfIf->Release(); 4305 4355 } … … 5369 5419 5370 5420 #ifdef VBOXWDDMDISP_DEBUG 5421 5422 bool g_VDbgTstDumpEnable = false; 5423 bool g_VDbgTstDumpOnSys2VidSameSizeEnable = false; 5424 5371 5425 VOID vboxVDbgDoDumpSurfData(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix) 5372 5426 { … … 5411 5465 { 5412 5466 vboxVDbgMpPrint((pDevice, "%s\n", pSuffix)); 5467 } 5468 } 5469 5470 VOID vboxVDbgDoDumpSurfDataBySurf(const PVBOXWDDMDISP_DEVICE pDevice, IDirect3DSurface9 *pSurf) 5471 { 5472 D3DSURFACE_DESC Desc; 5473 HRESULT hr = pSurf->GetDesc(&Desc); 5474 Assert(hr == S_OK); 5475 if (hr == S_OK) 5476 { 5477 D3DLOCKED_RECT Lr; 5478 hr = pSurf->LockRect(&Lr, NULL, D3DLOCK_READONLY); 5479 Assert(hr == S_OK); 5480 if (hr == S_OK) 5481 { 5482 UINT bpp = vboxWddmCalcBitsPerPixel((D3DDDIFORMAT)Desc.Format); 5483 vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n", 5484 Lr.pBits, Desc.Width, Desc.Height, bpp, Lr.Pitch)); 5485 5486 Assert(0); 5487 5488 hr = pSurf->UnlockRect(); 5489 Assert(hr == S_OK); 5490 } 5413 5491 } 5414 5492 }
Note:
See TracChangeset
for help on using the changeset viewer.