зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1139252 - Fix D3D texture memory reporters. r=jrmuizel.
This patch makes the names and reporter paths more consistent. It also removes sD3D9MemoryUsed, which was unused. --HG-- extra : rebase_source : f209636a938630e464d529078cfa116eb06339ba
This commit is contained in:
Родитель
99a82c0ac7
Коммит
c4c868a370
|
@ -31,7 +31,7 @@ public:
|
|||
TextureMemoryMeasurer(size_t aMemoryUsed)
|
||||
{
|
||||
mMemoryUsed = aMemoryUsed;
|
||||
gfxWindowsPlatform::sD3D11MemoryUsed += mMemoryUsed;
|
||||
gfxWindowsPlatform::sD3D11SharedTextures += mMemoryUsed;
|
||||
mRefCnt = 0;
|
||||
}
|
||||
STDMETHODIMP_(ULONG) AddRef() {
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
STDMETHODIMP_(ULONG) Release() {
|
||||
int refCnt = --mRefCnt;
|
||||
if (refCnt == 0) {
|
||||
gfxWindowsPlatform::sD3D11MemoryUsed -= mMemoryUsed;
|
||||
gfxWindowsPlatform::sD3D11SharedTextures -= mMemoryUsed;
|
||||
delete this;
|
||||
}
|
||||
return refCnt;
|
||||
|
|
|
@ -750,7 +750,7 @@ DXGID3D9TextureData::DXGID3D9TextureData(gfx::SurfaceFormat aFormat,
|
|||
|
||||
DXGID3D9TextureData::~DXGID3D9TextureData()
|
||||
{
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed -= mDesc.Width * mDesc.Height * 4;
|
||||
gfxWindowsPlatform::sD3D9SharedTextures -= mDesc.Width * mDesc.Height * 4;
|
||||
MOZ_COUNT_DTOR(DXGID3D9TextureData);
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ DXGID3D9TextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
|||
DXGID3D9TextureData* data = new DXGID3D9TextureData(aFormat, texture, shareHandle, aDevice);
|
||||
data->mDesc = surfaceDesc;
|
||||
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed += aSize.width * aSize.height * 4;
|
||||
gfxWindowsPlatform::sD3D9SharedTextures += aSize.width * aSize.height * 4;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,12 +297,12 @@ public:
|
|||
|
||||
NS_IMPL_ISUPPORTS(GPUAdapterReporter, nsIMemoryReporter)
|
||||
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D11SharedTextures;
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D9SharedTextures;
|
||||
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D11MemoryUsed;
|
||||
|
||||
class D3D11TextureReporter final : public nsIMemoryReporter
|
||||
class D3DSharedTexturesReporter final : public nsIMemoryReporter
|
||||
{
|
||||
~D3D11TextureReporter() {}
|
||||
~D3DSharedTexturesReporter() {}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -310,53 +310,29 @@ public:
|
|||
NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
|
||||
nsISupports* aData, bool aAnonymize) override
|
||||
{
|
||||
return MOZ_COLLECT_REPORT("d3d11-shared-textures", KIND_OTHER, UNITS_BYTES,
|
||||
gfxWindowsPlatform::sD3D11MemoryUsed,
|
||||
"Memory used for D3D11 shared textures");
|
||||
nsresult rv;
|
||||
|
||||
if (gfxWindowsPlatform::sD3D11SharedTextures > 0) {
|
||||
rv = MOZ_COLLECT_REPORT(
|
||||
"d3d11-shared-textures", KIND_OTHER, UNITS_BYTES,
|
||||
gfxWindowsPlatform::sD3D11SharedTextures,
|
||||
"D3D11 shared textures.");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (gfxWindowsPlatform::sD3D9SharedTextures > 0) {
|
||||
rv = MOZ_COLLECT_REPORT(
|
||||
"d3d9-shared-textures", KIND_OTHER, UNITS_BYTES,
|
||||
gfxWindowsPlatform::sD3D9SharedTextures,
|
||||
"D3D9 shared textures.");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(D3D11TextureReporter, nsIMemoryReporter)
|
||||
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D9MemoryUsed;
|
||||
|
||||
class D3D9TextureReporter final : public nsIMemoryReporter
|
||||
{
|
||||
~D3D9TextureReporter() {}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
|
||||
nsISupports* aData, bool aAnonymize) override
|
||||
{
|
||||
return MOZ_COLLECT_REPORT("d3d9-shared-textures", KIND_OTHER, UNITS_BYTES,
|
||||
gfxWindowsPlatform::sD3D9MemoryUsed,
|
||||
"Memory used for D3D9 shared textures");
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(D3D9TextureReporter, nsIMemoryReporter)
|
||||
|
||||
Atomic<size_t> gfxWindowsPlatform::sD3D9SharedTextureUsed;
|
||||
|
||||
class D3D9SharedTextureReporter final : public nsIMemoryReporter
|
||||
{
|
||||
~D3D9SharedTextureReporter() {}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
|
||||
nsISupports* aData, bool aAnonymize) 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)
|
||||
NS_IMPL_ISUPPORTS(D3DSharedTexturesReporter, nsIMemoryReporter)
|
||||
|
||||
gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
: mRenderMode(RENDER_GDI)
|
||||
|
@ -376,11 +352,8 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
|||
CoInitialize(nullptr);
|
||||
|
||||
RegisterStrongMemoryReporter(new GfxD2DVramReporter());
|
||||
|
||||
RegisterStrongMemoryReporter(new GPUAdapterReporter());
|
||||
RegisterStrongMemoryReporter(new D3D11TextureReporter());
|
||||
RegisterStrongMemoryReporter(new D3D9TextureReporter());
|
||||
RegisterStrongMemoryReporter(new D3D9SharedTextureReporter());
|
||||
RegisterStrongMemoryReporter(new D3DSharedTexturesReporter());
|
||||
}
|
||||
|
||||
gfxWindowsPlatform::~gfxWindowsPlatform()
|
||||
|
|
|
@ -251,9 +251,8 @@ public:
|
|||
void TestDeviceReset(DeviceResetReason aReason);
|
||||
|
||||
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
|
||||
static mozilla::Atomic<size_t> sD3D11MemoryUsed;
|
||||
static mozilla::Atomic<size_t> sD3D9MemoryUsed;
|
||||
static mozilla::Atomic<size_t> sD3D9SharedTextureUsed;
|
||||
static mozilla::Atomic<size_t> sD3D11SharedTextures;
|
||||
static mozilla::Atomic<size_t> sD3D9SharedTextures;
|
||||
|
||||
void GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut) override;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче