VirtualBox

Changeset 32184 in vbox


Ignore:
Timestamp:
Sep 1, 2010 4:37:20 PM (14 years ago)
Author:
vboxsync
Message:

wine: shared render target support; wddm/d3d: aero multi-monitor fixes (still buggy)

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

Legend:

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

    r32148 r32184  
    41064106        {
    41074107            PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SrcSubResourceIndex];
     4108            PVBOXWDDMDISP_SCREEN pPrimaryScreen = &pDevice->aScreens[pDevice->iPrimaryScreen];
     4109            Assert(pPrimaryScreen->pDevice9If);
    41084110            IDirect3DSurface9 *pSecondaryRt;
    41094111            IDirect3DSurface9 *pDataRt = (IDirect3DSurface9*)pAlloc->pSecondaryOpenedD3DIf;
    41104112            Assert(pDataRt);
    41114113            Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE);
    4112             hr = pScreen->pDevice9If->GetRenderTarget(0, &pSecondaryRt);
    4113             Assert(hr == S_OK);
    4114             if (hr == S_OK)
    4115             {
    4116                 hr = pScreen->pDevice9If->StretchRect(pDataRt,
    4117                                     NULL,
    4118                                     pSecondaryRt,
    4119                                     NULL,
    4120                                     D3DTEXF_NONE);
    4121                 pSecondaryRt->Release();
     4114//            do we actually need to do flush here ?
     4115//            hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pPrimaryScreen->pDevice9If);
     4116//            Assert(hr == S_OK);
     4117//            if (hr == S_OK)
     4118            {
     4119                hr = pScreen->pDevice9If->GetRenderTarget(0, &pSecondaryRt);
     4120                Assert(hr == S_OK);
     4121                if (hr == S_OK)
     4122                {
     4123                    hr = pScreen->pDevice9If->StretchRect(pDataRt,
     4124                                        NULL,
     4125                                        pSecondaryRt,
     4126                                        NULL,
     4127                                        D3DTEXF_NONE);
     4128                    pSecondaryRt->Release();
     4129                }
    41224130            }
    41234131        }
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c

    r31868 r32184  
    935935}
    936936
    937 #ifdef VBOXWDDM
    938 HRESULT VBoxWineExD3DDev9CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height,
     937static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height,
    939938        D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface,
    940939        UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality
     940#ifdef VBOXWDDM
    941941        , HANDLE *shared_handle
    942942        , void *pvClientMem
     943#endif
    943944        )
    944945{
     
    960961
    961962    hr = surface_init(object, This, Width, Height, Format, Lockable, Discard,
    962             Level, Usage, Pool, MultiSample, MultisampleQuality,
    963             shared_handle, pvClientMem);
     963            Level, Usage, Pool, MultiSample, MultisampleQuality
     964#ifdef VBOXWDDM
     965            , shared_handle
     966            , pvClientMem
     967#endif
     968            );
    964969    if (FAILED(hr))
    965970    {
     
    973978
    974979    return D3D_OK;
    975 }
    976 #endif
    977 static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height,
    978         D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface,
    979         UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality)
    980 {
    981 #ifdef VBOXWDDM
    982     return VBoxWineExD3DDev9CreateSurface(iface, Width, Height, Format, Lockable, Discard, Level, ppSurface,
    983             Usage, Pool, MultiSample, MultisampleQuality, NULL, NULL);
    984 #else
    985     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
    986     IDirect3DSurface9Impl *object;
    987     HRESULT hr;
    988 
    989     TRACE("iface %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p.\n"
    990             "usage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n",
    991             iface, Width, Height, Format, Lockable, Discard, Level, ppSurface,
    992             Usage, Pool, MultiSample, MultisampleQuality);
    993 
    994     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl));
    995     if (!object)
    996     {
    997         FIXME("Failed to allocate surface memory.\n");
    998         return D3DERR_OUTOFVIDEOMEMORY;
    999     }
    1000 
    1001     hr = surface_init(object, This, Width, Height, Format, Lockable, Discard,
    1002             Level, Usage, Pool, MultiSample, MultisampleQuality);
    1003     if (FAILED(hr))
    1004     {
    1005         WARN("Failed to initialize surface, hr %#x.\n", hr);
    1006         HeapFree(GetProcessHeap(), 0, object);
    1007         return hr;
    1008     }
    1009 
    1010     TRACE("Created surface %p.\n", object);
    1011     *ppSurface = (IDirect3DSurface9 *)object;
    1012 
    1013     return D3D_OK;
    1014 #endif
    1015980}
    1016981
     
    1027992
    1028993    hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */,
    1029             0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, MultisampleQuality);
     994            0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, MultisampleQuality
     995#ifdef VBOXWDDM
     996            , pSharedHandle
     997            , NULL
     998#endif
     999            );
    10301000
    10311001    return hr;
     
    10441014
    10451015    hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, Discard,
    1046             0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, MultisampleQuality);
     1016            0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, MultisampleQuality
     1017#ifdef VBOXWDDM
     1018            , pSharedHandle
     1019            , NULL
     1020#endif
     1021            );
    10471022
    10481023    return hr;
     
    11791154    hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */,
    11801155            0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, (WINED3DPOOL)Pool, D3DMULTISAMPLE_NONE,
    1181             0 /* MultisampleQuality */);
     1156            0 /* MultisampleQuality */
     1157#ifdef VBOXWDDM
     1158            , pSharedHandle
     1159            , NULL
     1160#endif
     1161            );
    11821162
    11831163    return hr;
     
    27562736        lockable = FALSE;
    27572737
    2758 #ifdef VBOXWDDM
    2759     hr = VBoxWineExD3DDev9CreateSurface((IDirect3DDevice9Ex *)This, width, height,
    2760             d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
    2761             (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */
    2762             , shared_handle
    2763             , pvClientMem
    2764             );
    2765 
    2766 #else
    27672738    hr = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)This, width, height,
    27682739            d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
    27692740            (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */
     2741#ifdef VBOXWDDM
     2742            , shared_handle
     2743            , pvClientMem
     2744#endif
    27702745            );
    2771 #endif
    27722746    if (FAILED(hr))
    27732747    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c

    r32061 r32184  
    482482        return hr;
    483483    }
     484
     485#ifdef VBOXWDDM
     486    if (VBOXSHRC_IS_SHARED(surface))
     487    {
     488        Assert(shared_handle);
     489        VBOXSHRC_SET_INITIALIZED(surface);
     490        IWineD3DSurface_LoadLocation(surface, SFLAG_INTEXTURE, NULL);
     491        if (!VBOXSHRC_IS_SHARED_OPENED(surface))
     492        {
     493            Assert(!(*shared_handle));
     494            *shared_handle = VBOXSHRC_GET_SHAREHANDLE(surface);
     495        }
     496        else
     497        {
     498            Assert(*shared_handle);
     499            Assert(*shared_handle == VBOXSHRC_GET_SHAREHANDLE(surface));
     500        }
     501    }
     502    else
     503    {
     504        Assert(!shared_handle);
     505    }
     506#endif
    484507
    485508    return hr;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c

    r32061 r32184  
    590590        hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
    591591                usage, pool, i, WINED3DCUBEMAP_FACE_POSITIVE_X, &texture->surfaces[i]
    592                 , shared_handle
     592                , NULL /* <- we first create a surface in an everage "non-shared" fashion and initialize its share properties later (see below)
     593                        * this is done this way because the surface does not have its parent (texture) setup properly
     594                        * thus we can not initialize texture at this stage */
    593595                , pvClientMem);
    594596
     
    621623        Assert(shared_handle);
    622624        VBOXSHRC_SET_INITIALIZED(texture);
     625        for (i = 0; i < texture->baseTexture.levels; ++i)
     626        {
     627            VBOXSHRC_COPY_SHAREDATA((IWineD3DSurfaceImpl*)texture->surfaces[i], texture);
     628        }
     629#ifdef DEBUG
     630        for (i = 0; i < texture->baseTexture.levels; ++i)
     631        {
     632            Assert(!((IWineD3DSurfaceImpl*)texture->surfaces[i])->texture_name);
     633        }
     634#endif
    623635        IWineD3DSurface_LoadLocation(texture->surfaces[0], SFLAG_INTEXTURE, NULL);
    624636        if (!VBOXSHRC_IS_SHARED_OPENED(texture))
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h

    r32061 r32184  
    2525#define VBOXSHRC_SET_SHAREHANDLE(_o, _h) ((_o)->resource.sharerc_handle = (_h))
    2626#define VBOXSHRC_SET_INITIALIZED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_INITIALIZED)
     27#define VBOXSHRC_COPY_SHAREDATA(_oDst, _oSrc) do { \
     28        VBOXSHRC_GET_SHAREFLAFS(_oDst) = VBOXSHRC_GET_SHAREFLAFS(_oSrc); \
     29        VBOXSHRC_SET_SHAREHANDLE(_oDst, VBOXSHRC_GET_SHAREFLAFS(_oSrc)); \
     30    } while (0)
     31#define VBOXSHRC_SET_SHARED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_SHARED)
     32#define VBOXSHRC_SET_SHARED_OPENED(_o) (VBOXSHRC_GET_SHAREFLAFS(_o) |= VBOXSHRC_F_SHARED_OPENED)
    2733#define VBOXSHRC_IS_SHARED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED))
    2834#define VBOXSHRC_IS_SHARED_OPENED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED_OPENED))
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