VirtualBox

Ignore:
Timestamp:
Jul 19, 2010 8:32:01 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: Aero: fix gdi-backend textures update, avoid extra memcpy for sysmem textures Lock/Unlock

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r30885 r30916  
    18891889    HRESULT hr = S_OK;
    18901890
    1891 #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
     1891//#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
    18961896
    18971897    if (!pDevice->cStreamSources)
     
    19111911            Assert(hr == S_OK);
    19121912
    1913             vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     1913//            vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
    19141914        }
    19151915        else
     
    19461946        Assert(hr == S_OK);
    19471947
    1948         vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
     1948//        vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
    19491949#if 0
    19501950        IDirect3DVertexDeclaration9* pDecl;
     
    21562156    }
    21572157
    2158 #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
     2158//#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
    21632163
    21642164    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
     
    21722172    Assert(pDevice);
    21732173    Assert(pDevice->pDevice9If);
    2174 #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
     2174//#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
    21792179
    21802180#ifdef DEBUG
     
    22102210    Assert(hr == S_OK);
    22112211
    2212 #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
     2212//#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
    22172217
    22182218
     
    22742274    hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount);
    22752275#else
    2276 #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
     2276//#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
    22812281
    22822282#ifdef DEBUG
     
    22982298            if (pDevice->aStreamSource[stream]->LockInfo.cLocks)
    22992299            {
    2300                 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     2300//                vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
    23012301
    23022302                Assert(pLock->fFlags.MightDrawFromLocked && (pLock->fFlags.Discard || pLock->fFlags.NoOverwrite));
     
    23102310            else
    23112311            {
    2312                 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
     2312//                vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
    23132313
    23142314                hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount);
     
    23242324#endif
    23252325
    2326 #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
     2326//#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
    23312331
    23322332    Assert(hr == S_OK);
     
    26792679                    Assert(pLockAlloc->pvMem);
    26802680                    Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM);
    2681 
     2681#if 0
    26822682                    if (bNeedResynch)
    26832683                        vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, pRect, false /*bool bToLockInfo*/);
     2684#endif
    26842685                }
    26852686            }
     
    29832984                Assert(pD3DIfTex);
    29842985                /* this is a sysmem texture, update  */
     2986#if 0
    29852987                if (pLockAlloc->pvMem && !pLockAlloc->LockInfo.fFlags.ReadOnly)
    29862988                {
     
    29892991                            true /*bool bToLockInfo*/);
    29902992                }
     2993#endif
    29912994                hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex);
    29922995                Assert(hr == S_OK);
     
    34073410                CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0];
    34083411                IDirect3DTexture9 *pD3DIfTex;
     3412#if 0
    34093413                hr = pDevice->pDevice9If->CreateTexture(pSurf->Width,
    34103414                                            pSurf->Height,
     
    34163420                                            NULL /* HANDLE* pSharedHandle */
    34173421                                            );
     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
    34183434                Assert(hr == S_OK);
    34193435                if (hr == S_OK)
     
    34223438                    pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
    34233439                    pAllocation->pD3DIf = pD3DIfTex;
     3440#if 0
    34243441                    if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
    34253442                    {
     
    34443461                        }
    34453462                    }
     3463#endif
    34463464                }
    34473465#ifdef DEBUG
     
    42094227    Assert(pDstRc->cAllocations > pData->DstSubResourceIndex);
    42104228    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);
    42144229    Assert(pDstRc != pDevice->pRenderTargetRc || pDevice->iRenderTargetFrontBuf != pData->DstSubResourceIndex);
    42154230    HRESULT hr = S_OK;
     
    42844299            {
    42854300                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
    42914338                /* we support only Point & Linear, we ignore [Begin|Continue|End]PresentToDwm */
    42924339                Assert((pData->Flags.Value & (~(0x00000100 | 0x00000200 | 0x00000400 | 0x00000001  | 0x00000002))) == 0);
     
    42984345                Assert(hr == S_OK);
    42994346
    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
    43044354                pSrcSurfIf->Release();
    43054355            }
     
    53695419
    53705420#ifdef VBOXWDDMDISP_DEBUG
     5421
     5422bool g_VDbgTstDumpEnable = false;
     5423bool g_VDbgTstDumpOnSys2VidSameSizeEnable = false;
     5424
    53715425VOID vboxVDbgDoDumpSurfData(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix)
    53725426{
     
    54115465    {
    54125466        vboxVDbgMpPrint((pDevice, "%s\n", pSuffix));
     5467    }
     5468}
     5469
     5470VOID 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        }
    54135491    }
    54145492}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DCmn.h

    r30885 r30916  
    3838# define VBOXWDDMDISP_DEBUG
    3939# define VBOXWDDMDISP_DEBUG_FLOW
    40 //# define VBOXWDDMDISP_DEBUG_DUMPSURFDATA
     40# define VBOXWDDMDISP_DEBUG_DUMPSURFDATA
    4141#endif
    4242
     
    5757
    5858#ifdef VBOXWDDMDISP_DEBUG
     59extern bool g_VDbgTstDumpEnable;
     60extern bool g_VDbgTstDumpOnSys2VidSameSizeEnable;
     61
    5962VOID vboxVDbgDoDumpSurfData(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix);
    6063void vboxVDbgDoMpPrintRect(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const RECT *pRect, const char * pSuffix);
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DIf.cpp

    r30685 r30916  
    3434        Assert(pD3D->pfnDirect3DCreate9Ex);
    3535        if (pD3D->pfnDirect3DCreate9Ex)
    36             return S_OK;
     36        {
     37            pD3D->pfnVBoxWineExD3DDev9CreateTexture = (PFNVBOXWINEEXD3DDEV9_CREATETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateTexture");
     38            Assert(pD3D->pfnVBoxWineExD3DDev9CreateTexture);
     39            if (pD3D->pfnVBoxWineExD3DDev9CreateTexture)
     40            {
     41                return S_OK;
     42            }
     43        }
    3744        else
    3845        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DIf.h

    r30038 r30916  
    2222#include <D3D9.h>
    2323
     24#include "../../Wine/vbox/VBoxWineEx.h"
     25
    2426/* D3D functionality the VBOXDISPD3D provides */
    2527typedef HRESULT WINAPI FNVBOXDISPD3DCREATE9EX(UINT SDKVersion, IDirect3D9Ex **ppD3D);
     
    3032    /* D3D functionality the VBOXDISPD3D provides */
    3133    PFNVBOXDISPD3DCREATE9EX pfnDirect3DCreate9Ex;
     34
     35    PFNVBOXWINEEXD3DDEV9_CREATETEXTURE pfnVBoxWineExD3DDev9CreateTexture;
    3236
    3337    /* module handle */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette