зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1128765 - Add more more reporters to break down D3D9 texture usage. r=jrmuizel
This commit is contained in:
Родитель
2684f1b54d
Коммит
523dd220d2
|
@ -19,7 +19,12 @@ D3D9SurfaceImage::D3D9SurfaceImage()
|
|||
, mSize(0, 0)
|
||||
{}
|
||||
|
||||
D3D9SurfaceImage::~D3D9SurfaceImage() {}
|
||||
D3D9SurfaceImage::~D3D9SurfaceImage()
|
||||
{
|
||||
if (mTexture) {
|
||||
gfxWindowsPlatform::sD3D9SurfaceImageUsed -= mSize.width * mSize.height * 4;
|
||||
}
|
||||
}
|
||||
|
||||
static const GUID sD3D9TextureUsage =
|
||||
{ 0x631e1338, 0xdc22, 0x497f, { 0xa1, 0xa8, 0xb4, 0xfe, 0x3a, 0xf4, 0x13, 0x4d } };
|
||||
|
@ -117,6 +122,8 @@ D3D9SurfaceImage::SetData(const Data& aData)
|
|||
// Track the lifetime of this memory
|
||||
texture->SetPrivateData(sD3D9TextureUsage, new TextureMemoryMeasurer9(region.width * region.height * 4), sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
||||
|
||||
gfxWindowsPlatform::sD3D9SurfaceImageUsed += region.width * region.height * 4;
|
||||
|
||||
// Copy the image onto the texture, preforming YUV -> RGB conversion if necessary.
|
||||
RefPtr<IDirect3DSurface9> textureSurface;
|
||||
hr = texture->GetSurfaceLevel(0, byRef(textureSurface));
|
||||
|
|
|
@ -741,6 +741,9 @@ SharedTextureClientD3D9::~SharedTextureClientD3D9()
|
|||
if (mTexture && mActor) {
|
||||
KeepUntilFullDeallocation(new TKeepAlive<IDirect3DTexture9>(mTexture));
|
||||
}
|
||||
if (mTexture) {
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed -= mDesc.Width * mDesc.Height * 4;
|
||||
}
|
||||
MOZ_COUNT_DTOR(SharedTextureClientD3D9);
|
||||
}
|
||||
|
||||
|
|
|
@ -266,6 +266,7 @@ public:
|
|||
mTexture = aTexture;
|
||||
mHandle = aSharedHandle;
|
||||
mDesc = aDesc;
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed += mDesc.Width * mDesc.Height * 4;
|
||||
}
|
||||
|
||||
virtual gfx::IntSize GetSize() const
|
||||
|
|
|
@ -364,6 +364,42 @@ public:
|
|||
|
||||
NS_IMPL_ISUPPORTS(D3D9TextureReporter, nsIMemoryReporter)
|
||||
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D9SurfaceImageUsed;
|
||||
|
||||
class D3D9SurfaceImageReporter MOZ_FINAL : public nsIMemoryReporter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
|
||||
nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
|
||||
{
|
||||
return MOZ_COLLECT_REPORT("d3d9-surface-image", KIND_OTHER, UNITS_BYTES,
|
||||
gfxWindowsPlatform::sD3D9SurfaceImageUsed,
|
||||
"Memory used for D3D9 surface images");
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(D3D9SurfaceImageReporter, nsIMemoryReporter)
|
||||
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D9SharedTextureUsed;
|
||||
|
||||
class D3D9SharedTextureReporter MOZ_FINAL : public nsIMemoryReporter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
|
||||
nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
|
||||
{
|
||||
return MOZ_COLLECT_REPORT("d3d9-shared-texture", KIND_OTHER, UNITS_BYTES,
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed,
|
||||
"Memory used for D3D9 shared textures");
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(D3D9SharedTextureReporter, nsIMemoryReporter)
|
||||
|
||||
gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
: mD3D11DeviceInitialized(false)
|
||||
, mIsWARP(false)
|
||||
|
@ -393,6 +429,8 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
|||
RegisterStrongMemoryReporter(new GPUAdapterReporter());
|
||||
RegisterStrongMemoryReporter(new D3D11TextureReporter());
|
||||
RegisterStrongMemoryReporter(new D3D9TextureReporter());
|
||||
RegisterStrongMemoryReporter(new D3D9SurfaceImageReporter());
|
||||
RegisterStrongMemoryReporter(new D3D9SharedTextureReporter());
|
||||
}
|
||||
|
||||
gfxWindowsPlatform::~gfxWindowsPlatform()
|
||||
|
|
|
@ -255,6 +255,8 @@ public:
|
|||
|
||||
static mozilla::Atomic<size_t> sD3D11MemoryUsed;
|
||||
static mozilla::Atomic<size_t> sD3D9MemoryUsed;
|
||||
static mozilla::Atomic<size_t> sD3D9SurfaceImageUsed;
|
||||
static mozilla::Atomic<size_t> sD3D9SharedTextureUsed;
|
||||
|
||||
protected:
|
||||
RenderMode mRenderMode;
|
||||
|
|
Загрузка…
Ссылка в новой задаче