VirtualBox

Changeset 37870 in vbox for trunk


Ignore:
Timestamp:
Jul 11, 2011 1:17:25 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72767
Message:

wddm/wine: ie9 black screen fix, shared rc fixes & performance enhancements

Location:
trunk/src/VBox/Additions/WINNT/Graphics
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispDbg.cpp

    r37840 r37870  
    186186    Assert(pAlloc->hAllocation);
    187187
     188    HANDLE hSharedHandle = pAlloc->hSharedHandle;
     189
     190    vboxVDbgPrint(("SharedHandle: (0x%p)\n", hSharedHandle));
     191
    188192    D3DDDICB_LOCK LockData;
    189193    LockData.hAllocation = pAlloc->hAllocation;
     
    203207    {
    204208        UINT bpp = vboxWddmCalcBitsPerPixel(pAlloc->SurfDesc.format);
    205         vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     209        vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>, ( !vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d )\n",
     210                LockData.pData, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, pAlloc->SurfDesc.pitch,
    206211                LockData.pData, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, pAlloc->SurfDesc.pitch));
    207212        if (pRect)
     
    210215            Assert(pRect->bottom > pRect->top);
    211216            vboxVDbgDoPrintRect("rect: ", pRect, "\n");
    212             vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
     217            vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>, ( !vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d )\n",
     218                    ((uint8_t*)LockData.pData) + (pRect->top * pAlloc->SurfDesc.pitch) + ((pRect->left * bpp) >> 3),
     219                    pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, pAlloc->SurfDesc.pitch,
    213220                    ((uint8_t*)LockData.pData) + (pRect->top * pAlloc->SurfDesc.pitch) + ((pRect->left * bpp) >> 3),
    214221                    pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, pAlloc->SurfDesc.pitch));
     
    263270        {
    264271            UINT bpp = vboxWddmCalcBitsPerPixel((D3DDDIFORMAT)Desc.Format);
    265             vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     272            vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>, ( !vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d )\n",
     273                    Lr.pBits, Desc.Width, Desc.Height, bpp, Lr.Pitch,
    266274                    Lr.pBits, Desc.Width, Desc.Height, bpp, Lr.Pitch));
    267275            if (pRect)
     
    270278                Assert(pRect->bottom > pRect->top);
    271279                vboxVDbgDoPrintRect("rect: ", pRect, "\n");
    272                 vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
     280                vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>, ( !vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d )\n",
     281                        ((uint8_t*)Lr.pBits) + (pRect->top * Lr.Pitch) + ((pRect->left * bpp) >> 3),
     282                        pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, Lr.Pitch,
    273283                        ((uint8_t*)Lr.pBits) + (pRect->top * Lr.Pitch) + ((pRect->left * bpp) >> 3),
    274284                        pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, Lr.Pitch));
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispDbg.h

    r37845 r37870  
    168168                ) \
    169169        { \
    170             vboxVDbgDoDumpRcRectByRc("== "__FUNCTION__": Texture Dump\n", _pRc, NULL, "\n"); \
     170            vboxVDbgPrint(("== "__FUNCTION__": Texture Dump, SharedHandle(0x%p)\n", (_pRc)->aAllocations[0].hSharedHandle)); \
     171            vboxVDbgDoDumpRcRectByRc("", _pRc, NULL, "\n"); \
    171172        } \
    172173    } while (0)
     
    204205                ) \
    205206        { \
    206             vboxVDbgDoDumpSurfRect("==>"__FUNCTION__" Src:\n", (_pSrcSurf), (_pSrcRect), "\n", true); \
    207             vboxVDbgDoDumpSurfRect("==>"__FUNCTION__" Dst:\n", (_pDstSurf), (_pDstRect), "\n", true); \
     207            vboxVDbgPrint(("==>"__FUNCTION__" Src: SharedHandle(0x%p)\n", (_pSrcRc)->aAllocations[0].hSharedHandle)); \
     208            vboxVDbgDoDumpSurfRect("", (_pSrcSurf), (_pSrcRect), "\n", true); \
     209            vboxVDbgPrint(("==>"__FUNCTION__" Dst: SharedHandle(0x%p)\n", (_pDstRc)->aAllocations[0].hSharedHandle)); \
     210            vboxVDbgDoDumpSurfRect("", (_pDstSurf), (_pDstRect), "\n", true); \
    208211        } \
    209212    } while (0)
     
    215218                ) \
    216219        { \
    217             vboxVDbgDoDumpSurfRect("<=="__FUNCTION__" Src:\n", (_pSrcSurf), (_pSrcRect), "\n", true); \
    218             vboxVDbgDoDumpSurfRect("<=="__FUNCTION__" Dst:\n", (_pDstSurf), (_pDstRect), "\n", true); \
     220            vboxVDbgPrint(("<=="__FUNCTION__" Src: SharedHandle(0x%p)\n", (_pSrcRc)->aAllocations[0].hSharedHandle)); \
     221            vboxVDbgDoDumpSurfRect("", (_pSrcSurf), (_pSrcRect), "\n", true); \
     222            vboxVDbgPrint(("<=="__FUNCTION__" Dst: SharedHandle(0x%p)\n", (_pDstRc)->aAllocations[0].hSharedHandle)); \
     223            vboxVDbgDoDumpSurfRect("", (_pDstSurf), (_pDstRect), "\n", true); \
    219224        } \
    220225    } while (0)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/cubetexture.c

    r35650 r37870  
    574574    {
    575575        Assert(shared_handle);
    576         VBOXSHRC_SET_INITIALIZED(texture);
    577576        for (i = 0; i < texture->baseTexture.levels; ++i)
    578577        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c

    r37394 r37870  
    4646#define GLINFO_LOCATION (*gl_info)
    4747
     48#ifdef VBOX_WITH_WDDM
     49void surface_shrc_lock_surf(IWineD3DSurfaceImpl *This)
     50{
     51    VBOXSHRC_LOCK(This);
     52}
     53
     54void surface_shrc_unlock_surf(IWineD3DSurfaceImpl *This)
     55{
     56    VBOXSHRC_UNLOCK(This);
     57    if (VBOXSHRC_IS_LOCKED(This))
     58        return;
     59
     60    /* perform data->texture synchronization */
     61    IWineD3DSurface_LoadLocation((IWineD3DSurface*)This, SFLAG_INTEXTURE, NULL);
     62}
     63
     64void surface_shrc_lock(IWineD3DSurfaceImpl *This)
     65{
     66    if (!VBOXSHRC_IS_SHARED(This))
     67        return;
     68
     69    surface_shrc_lock_surf(This);
     70}
     71
     72void surface_shrc_unlock(IWineD3DSurfaceImpl *This)
     73{
     74    if (!VBOXSHRC_IS_SHARED(This))
     75        return;
     76    surface_shrc_unlock_surf(This);
     77}
     78#endif
     79
    4880static void surface_cleanup(IWineD3DSurfaceImpl *This)
    4981{
     
    410442    }
    411443
     444#ifdef VBOX_WITH_WDDM
     445    /* this will be a nop for the non-shared resource,
     446     * for the shared resource this will ensure the surface is initialized properly */
     447    surface_shrc_lock(surface);
     448#endif
     449
    412450    /* "Standalone" surface. */
    413451    IWineD3DSurface_SetContainer((IWineD3DSurface *)surface, NULL);
     
    487525    {
    488526        Assert(shared_handle);
    489         VBOXSHRC_SET_INITIALIZED(surface);
    490         IWineD3DSurface_LoadLocation((IWineD3DSurface*)surface, SFLAG_INTEXTURE, NULL);
     527        surface_shrc_unlock(surface);
    491528        if (!VBOXSHRC_IS_SHARED_OPENED(surface))
    492529        {
     
    514551
    515552#if defined(DEBUG_misha) && defined (VBOX_WITH_WDDM)
    516     if (VBOXSHRC_IS_INITIALIZED(This))
     553    if (VBOXSHRC_IS_SHARED_UNLOCKED(This))
    517554    {
    518555        Assert(0);
     
    18031840    IWineD3DDeviceImpl *myDevice = This->resource.device;
    18041841    const RECT *pass_rect = pRect;
     1842    HRESULT hr = S_OK;
    18051843
    18061844    TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
     
    18141852        return WINED3DERR_INVALIDCALL;
    18151853    }
     1854
     1855#ifdef VBOX_WITH_WDDM
     1856    surface_shrc_lock(This);
     1857#endif
     1858
    18161859    This->Flags |= SFLAG_LOCKED;
    18171860
     
    18991942    }
    19001943
    1901     return IWineD3DBaseSurfaceImpl_LockRect(iface, pLockedRect, pRect, Flags);
     1944    hr = IWineD3DBaseSurfaceImpl_LockRect(iface, pLockedRect, pRect, Flags);
     1945#ifdef VBOX_WITH_WDDM
     1946    if (FAILED(hr))
     1947    {
     1948        WARN("IWineD3DBaseSurfaceImpl_LockRect failed, hr (%d)\n", hr);
     1949        surface_shrc_unlock(This);
     1950    }
     1951    /* if lock succeeded, we keep the shrc locked until unlock */
     1952#endif
     1953    return hr;
    19021954}
    19031955
     
    21082160        IWineD3DSurface_DrawOverlay(iface);
    21092161    }
     2162
     2163#ifdef VBOX_WITH_WDDM
     2164        surface_shrc_unlock(This);
     2165#endif
     2166
    21102167    return WINED3D_OK;
    21112168}
     
    41464203    IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
    41474204    IWineD3DDeviceImpl *myDevice = This->resource.device;
     4205    HRESULT hr = WINED3D_OK;
    41484206
    41494207    TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx);
     
    41554213        return WINEDDERR_SURFACEBUSY;
    41564214    }
     4215
     4216#ifdef VBOX_WITH_WDDM
     4217    surface_shrc_lock(This);
     4218    surface_shrc_lock(Src);
     4219#endif
    41574220
    41584221    /* Accessing the depth stencil is supposed to fail between a BeginScene and EndScene pair,
     
    41624225        if(myDevice->inScene && !(Flags & WINEDDBLT_DEPTHFILL)) {
    41634226            TRACE("Attempt to access the depth stencil surface in a BeginScene / EndScene pair, returning WINED3DERR_INVALIDCALL\n");
    4164             return WINED3DERR_INVALIDCALL;
     4227            hr = WINED3DERR_INVALIDCALL;
     4228            goto end;
    41654229        } else if(IWineD3DSurfaceImpl_BltZ(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx) == WINED3D_OK) {
    41664230            TRACE("Z Blit override handled the blit\n");
    4167             return WINED3D_OK;
     4231            hr = WINED3D_OK;
     4232            goto end;
    41684233        }
    41694234    }
     
    41724237    if( (This->resource.usage & WINED3DUSAGE_RENDERTARGET) ||
    41734238        ( Src && (Src->resource.usage & WINED3DUSAGE_RENDERTARGET) )) {
    4174         if(IWineD3DSurfaceImpl_BltOverride(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter) == WINED3D_OK) return WINED3D_OK;
     4239        if(IWineD3DSurfaceImpl_BltOverride(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter) == WINED3D_OK)
     4240        {
     4241            hr = WINED3D_OK;
     4242            goto end;
     4243        }
    41754244    }
    41764245
    41774246#ifdef VBOX_WITH_WDDM
    4178     if (IWineD3DSurfaceImpl_BltSys2Vram(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter) == WINED3D_OK) return WINED3D_OK;
     4247    if (IWineD3DSurfaceImpl_BltSys2Vram(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter) == WINED3D_OK)
     4248    {
     4249        hr = WINED3D_OK;
     4250        goto end;
     4251    }
    41794252#endif
    41804253
     
    41834256     * other Blts are rather rare
    41844257     */
    4185     return IWineD3DBaseSurfaceImpl_Blt(iface, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter);
     4258    hr = IWineD3DBaseSurfaceImpl_Blt(iface, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter);
     4259end:
     4260#ifdef VBOX_WITH_WDDM
     4261    surface_shrc_unlock(This);
     4262    surface_shrc_unlock(Src);
     4263#endif
     4264    return hr;
    41864265}
    41874266
     
    41924271    IWineD3DSurfaceImpl *srcImpl = (IWineD3DSurfaceImpl *) Source;
    41934272    IWineD3DDeviceImpl *myDevice = This->resource.device;
     4273    HRESULT hr = WINED3D_OK;
    41944274
    41954275    TRACE("(%p)->(%d, %d, %p, %p, %08x\n", iface, dstx, dsty, Source, rsrc, trans);
     
    42074287        return WINED3DERR_INVALIDCALL;
    42084288    }
     4289
     4290#ifdef VBOX_WITH_WDDM
     4291    surface_shrc_lock(This);
     4292    surface_shrc_lock(srcImpl);
     4293#endif
    42094294
    42104295    /* Special cases for RenderTargets */
     
    42324317            Flags |= WINEDDBLT_DONOTWAIT;
    42334318
    4234         if(IWineD3DSurfaceImpl_BltOverride(This, &DstRect, Source, &SrcRect, Flags, NULL, WINED3DTEXF_POINT) == WINED3D_OK) return WINED3D_OK;
    4235     }
    4236 
    4237 
    4238     return IWineD3DBaseSurfaceImpl_BltFast(iface, dstx, dsty, Source, rsrc, trans);
     4319        if(IWineD3DSurfaceImpl_BltOverride(This, &DstRect, Source, &SrcRect, Flags, NULL, WINED3DTEXF_POINT) == WINED3D_OK)
     4320        {
     4321            hr = WINED3D_OK;
     4322            goto end;
     4323        }
     4324    }
     4325
     4326
     4327    hr = IWineD3DBaseSurfaceImpl_BltFast(iface, dstx, dsty, Source, rsrc, trans);
     4328end:
     4329#ifdef VBOX_WITH_WDDM
     4330    surface_shrc_unlock(This);
     4331    surface_shrc_unlock(srcImpl);
     4332#endif
     4333    return hr;
    42394334}
    42404335
     
    46144709
    46154710#ifdef VBOX_WITH_WDDM
    4616     if(VBOXSHRC_IS_INITIALIZED(This)) {
     4711    if(VBOXSHRC_IS_SHARED_UNLOCKED(This)) {
    46174712        /* with the shared resource only texture can be considered valid
    46184713         * to make sure changes done to the resource in the other device context are visible
     
    47314826    if(This->Flags & flag) {
    47324827        TRACE("Location already up to date\n");
     4828#ifdef VBOX_WITH_WDDM
     4829        goto post_process;
     4830#else
    47334831        return WINED3D_OK;
     4832#endif
    47344833    }
    47354834
     
    49335032
    49345033#ifdef VBOX_WITH_WDDM
    4935     if (VBOXSHRC_IS_INITIALIZED(This))
     5034post_process:
     5035
     5036    if (VBOXSHRC_IS_SHARED_UNLOCKED(This))
    49365037    {
    49375038        /* with the shared resource only texture can be considered valid
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c

    r35650 r37870  
    622622    {
    623623        Assert(shared_handle);
    624         VBOXSHRC_SET_INITIALIZED(texture);
    625624        for (i = 0; i < texture->baseTexture.levels; ++i)
    626625        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h

    r37840 r37870  
    1919#define VBOXSHRC_F_SHARED              0x00000001 /* shared rc */
    2020#define VBOXSHRC_F_SHARED_OPENED       0x00000002 /* if set shared rc is opened, otherwise it is created */
    21 #define VBOXSHRC_F_INITIALIZED         0x00000004 /* set once shared rc is initialized */
    2221
    2322#define VBOXSHRC_GET_SHAREFLAFS(_o) ((_o)->resource.sharerc_flags)
    24 #define VBOXSHRC_GET_SHAREHANDLE(_o) ((_o)->resource.sharerc_handle)
    25 #define VBOXSHRC_SET_SHAREHANDLE(_o, _h) ((_o)->resource.sharerc_handle = (_h))
    26 #define VBOXSHRC_SET_INITIALIZED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_INITIALIZED)
     23#define VBOXSHRC_GET_SHAREHANDLE(_o) ((HANDLE)(_o)->resource.sharerc_handle)
     24#define VBOXSHRC_SET_SHAREHANDLE(_o, _h) ((_o)->resource.sharerc_handle = (DWORD)(_h))
    2725#define VBOXSHRC_COPY_SHAREDATA(_oDst, _oSrc) do { \
    2826        VBOXSHRC_GET_SHAREFLAFS(_oDst) = VBOXSHRC_GET_SHAREFLAFS(_oSrc); \
     
    3331#define VBOXSHRC_IS_SHARED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED))
    3432#define VBOXSHRC_IS_SHARED_OPENED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED_OPENED))
    35 #define VBOXSHRC_IS_INITIALIZED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_INITIALIZED))
     33#define VBOXSHRC_IS_SHARED_UNLOCKED(_o) (VBOXSHRC_IS_SHARED(_o) && !VBOXSHRC_IS_LOCKED(_o))
    3634
     35#define VBOXSHRC_LOCK(_o) do{ \
     36        Assert(VBOXSHRC_IS_SHARED(_o)); \
     37        ++(_o)->resource.sharerc_locks; \
     38    } while (0)
     39#define VBOXSHRC_UNLOCK(_o) do{ \
     40        Assert(VBOXSHRC_IS_SHARED(_o)); \
     41        --(_o)->resource.sharerc_locks; \
     42        Assert((_o)->resource.sharerc_locks < UINT32_MAX/2); \
     43    } while (0)
     44#define VBOXSHRC_IS_LOCKED(_o) ( \
     45        !!((_o)->resource.sharerc_locks) \
     46        )
    3747#ifdef VBOX_WINE_WITH_IPRT
    3848# include <iprt/assert.h>
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h

    r37550 r37870  
    18411841#ifdef VBOX_WITH_WDDM
    18421842    DWORD                   sharerc_flags; /* shared resource flags */
    1843     DWORD                   sharerc_handle;
     1843    DWORD                   sharerc_handle; /* shared resource handle */
     1844    DWORD                   sharerc_locks; /* lock count */
    18441845#endif
    18451846    struct list             privateData;
Note: See TracChangeset for help on using the changeset viewer.

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