mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199361 - Add texture memory reporters for YCbCr TextureClients. r=jrmuizel
This commit is contained in:
parent
bea8f74710
commit
d3ec907229
@ -270,28 +270,11 @@ IMFYCbCrImage::GetTextureClient(CompositableClient* aClient)
|
||||
mData.mCbCrStride, mData.mCbCrStride * mData.mCbCrSize.height);
|
||||
}
|
||||
|
||||
RefPtr<IDXGIResource> resource;
|
||||
|
||||
HANDLE shareHandleY;
|
||||
textureY->QueryInterface((IDXGIResource**)byRef(resource));
|
||||
hr = resource->GetSharedHandle(&shareHandleY);
|
||||
|
||||
HANDLE shareHandleCb;
|
||||
textureCb->QueryInterface((IDXGIResource**)byRef(resource));
|
||||
hr = resource->GetSharedHandle(&shareHandleCb);
|
||||
|
||||
HANDLE shareHandleCr;
|
||||
textureCr->QueryInterface((IDXGIResource**)byRef(resource));
|
||||
hr = resource->GetSharedHandle(&shareHandleCr);
|
||||
|
||||
mTextureClient = DXGIYCbCrTextureClient::Create(aClient->GetForwarder(),
|
||||
TextureFlags::DEFAULT,
|
||||
textureY,
|
||||
textureCb,
|
||||
textureCr,
|
||||
shareHandleY,
|
||||
shareHandleCb,
|
||||
shareHandleCr,
|
||||
GetSize(),
|
||||
mData.mYSize,
|
||||
mData.mCbCrSize);
|
||||
|
@ -667,9 +667,9 @@ DXGIYCbCrTextureClient::~DXGIYCbCrTextureClient()
|
||||
already_AddRefed<DXGIYCbCrTextureClient>
|
||||
DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
|
||||
TextureFlags aFlags,
|
||||
IUnknown* aTextureY,
|
||||
IUnknown* aTextureCb,
|
||||
IUnknown* aTextureCr,
|
||||
IDirect3DTexture9* aTextureY,
|
||||
IDirect3DTexture9* aTextureCb,
|
||||
IDirect3DTexture9* aTextureCr,
|
||||
HANDLE aHandleY,
|
||||
HANDLE aHandleCb,
|
||||
HANDLE aHandleCr,
|
||||
@ -682,6 +682,13 @@ DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aTextureY->SetPrivateData(sD3D11TextureUsage,
|
||||
new TextureMemoryMeasurer(aSizeY.width * aSizeY.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN);
|
||||
aTextureCb->SetPrivateData(sD3D11TextureUsage,
|
||||
new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN);
|
||||
aTextureCr->SetPrivateData(sD3D11TextureUsage,
|
||||
new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN);
|
||||
|
||||
RefPtr<DXGIYCbCrTextureClient> texture =
|
||||
new DXGIYCbCrTextureClient(aAllocator, aFlags);
|
||||
texture->mHandles[0] = aHandleY;
|
||||
@ -696,6 +703,59 @@ DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
|
||||
return texture.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DXGIYCbCrTextureClient>
|
||||
DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
|
||||
TextureFlags aFlags,
|
||||
ID3D11Texture2D* aTextureY,
|
||||
ID3D11Texture2D* aTextureCb,
|
||||
ID3D11Texture2D* aTextureCr,
|
||||
const gfx::IntSize& aSize,
|
||||
const gfx::IntSize& aSizeY,
|
||||
const gfx::IntSize& aSizeCbCr)
|
||||
{
|
||||
if (!aTextureY || !aTextureCb || !aTextureCr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aTextureY->SetPrivateDataInterface(sD3D11TextureUsage,
|
||||
new TextureMemoryMeasurer(aSize.width * aSize.height));
|
||||
aTextureCb->SetPrivateDataInterface(sD3D11TextureUsage,
|
||||
new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height));
|
||||
aTextureCr->SetPrivateDataInterface(sD3D11TextureUsage,
|
||||
new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height));
|
||||
|
||||
RefPtr<DXGIYCbCrTextureClient> texture =
|
||||
new DXGIYCbCrTextureClient(aAllocator, aFlags);
|
||||
|
||||
RefPtr<IDXGIResource> resource;
|
||||
|
||||
aTextureY->QueryInterface((IDXGIResource**)byRef(resource));
|
||||
HRESULT hr = resource->GetSharedHandle(&texture->mHandles[0]);
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aTextureCb->QueryInterface((IDXGIResource**)byRef(resource));
|
||||
hr = resource->GetSharedHandle(&texture->mHandles[1]);
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aTextureCr->QueryInterface((IDXGIResource**)byRef(resource));
|
||||
hr = resource->GetSharedHandle(&texture->mHandles[2]);
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
texture->mHoldRefs[0] = aTextureY;
|
||||
texture->mHoldRefs[1] = aTextureCb;
|
||||
texture->mHoldRefs[2] = aTextureCr;
|
||||
texture->mSize = aSize;
|
||||
texture->mSizeY = aSizeY;
|
||||
texture->mSizeCbCr = aSizeCbCr;
|
||||
return texture.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
DXGIYCbCrTextureClient::Lock(OpenMode)
|
||||
{
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include <d3d11.h>
|
||||
#include "d3d9.h"
|
||||
#include <vector>
|
||||
|
||||
namespace mozilla {
|
||||
@ -109,9 +110,9 @@ public:
|
||||
static already_AddRefed<DXGIYCbCrTextureClient>
|
||||
Create(ISurfaceAllocator* aAllocator,
|
||||
TextureFlags aFlags,
|
||||
IUnknown* aTextureY,
|
||||
IUnknown* aTextureCb,
|
||||
IUnknown* aTextureCr,
|
||||
IDirect3DTexture9* aTextureY,
|
||||
IDirect3DTexture9* aTextureCb,
|
||||
IDirect3DTexture9* aTextureCr,
|
||||
HANDLE aHandleY,
|
||||
HANDLE aHandleCb,
|
||||
HANDLE aHandleCr,
|
||||
@ -119,6 +120,17 @@ public:
|
||||
const gfx::IntSize& aSizeY,
|
||||
const gfx::IntSize& aSizeCbCr);
|
||||
|
||||
// Creates a TextureClient and init width.
|
||||
static already_AddRefed<DXGIYCbCrTextureClient>
|
||||
Create(ISurfaceAllocator* aAllocator,
|
||||
TextureFlags aFlags,
|
||||
ID3D11Texture2D* aTextureY,
|
||||
ID3D11Texture2D* aTextureCb,
|
||||
ID3D11Texture2D* aTextureCr,
|
||||
const gfx::IntSize& aSize,
|
||||
const gfx::IntSize& aSizeY,
|
||||
const gfx::IntSize& aSizeCbCr);
|
||||
|
||||
// TextureClient
|
||||
|
||||
virtual bool IsAllocated() const override{ return !!mHoldRefs[0]; }
|
||||
|
Loading…
Reference in New Issue
Block a user