Bug 1068613 - Part 3: Log failures in D2D, D2D 1.1 and the D3D11 TextureClient. r=bas

This commit is contained in:
Nicolas Silva 2014-09-17 23:23:09 +02:00
parent 6c1d4fc37f
commit 1d405a8655
3 changed files with 27 additions and 9 deletions

View File

@ -76,7 +76,7 @@ public:
HRESULT hr = mDT->mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpTexture));
if (FAILED(hr)) {
gfxWarning() << "Failure to create temporary texture. Size: " << size << " Code: " << hr;
gfxCriticalError() << "[D2D] CreateTexture2D failure " << size << " Code: " << hr;
// Crash debug builds but try to recover in release builds.
MOZ_ASSERT(false);
return;
@ -93,7 +93,7 @@ public:
&props, byRef(mOldSurfBitmap));
if (FAILED(hr)) {
gfxWarning() << "Failed to create shared bitmap for old surface. Code: " << hr;
gfxCriticalError() << "[D2D] CreateSharedBitmap failure " << size << " Code: " << hr;
// Crash debug builds but try to recover in release builds.
MOZ_ASSERT(false);
return;
@ -532,8 +532,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mipTexture));
if (FAILED(hr)) {
gfxWarning() << "Failure to create temporary texture. Size: " <<
aSurface->GetSize() << " Code: " << hr;
gfxCriticalError() << "[D2D] CreateTexture2D failure " << aSurface->GetSize() << " Code: " << hr;
return;
}
@ -560,7 +559,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpDSTexture));
if (FAILED(hr)) {
gfxWarning() << "Failure to create temporary texture. Size: " << dsSize << " Code: " << hr;
gfxCriticalError() << "[D2D] CreateTexture2D failure " << dsSize << " Code: " << hr;
return;
}

View File

@ -619,6 +619,10 @@ DrawTargetD2D1::CreateSourceSurfaceFromData(unsigned char *aData,
D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, D2DPixelFormat(aFormat)),
byRef(bitmap));
if (FAILED(hr)) {
gfxCriticalError() << "[D2D1.1] CreateBitmap failure " << aSize << " Code: " << hr;
}
if (!bitmap) {
return nullptr;
}
@ -704,7 +708,7 @@ bool
DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat)
{
HRESULT hr;
`
hr = Factory::GetD2D1Device()->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, byRef(mDC));
if (FAILED(hr)) {
@ -728,7 +732,7 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat)
hr = mDC->CreateBitmapFromDxgiSurface(dxgiSurface, props, (ID2D1Bitmap1**)byRef(mBitmap));
if (FAILED(hr)) {
gfxWarning() << *this << ": Error " << hr << " failed to create new bitmap.";
gfxCriticalError() << "[D2D1.1] CreateBitmapFromDxgiSurface failure Code: " << hr;
return false;
}
@ -741,7 +745,12 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat)
props.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
props.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap));
hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap));
if (FAILED(hr)) {
gfxCriticalError() << "[D2D1.1] CreateBitmap failure " << mSize << " Code: " << hr;
return false;
}
mDC->SetTarget(mBitmap);
@ -1273,6 +1282,10 @@ DrawTargetD2D1::OptimizeSourceSurface(SourceSurface* aSurface) const
D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, D2DPixelFormat(data->GetFormat())),
byRef(bitmap));
if (FAILED(hr)) {
gfxCriticalError() << "[D2D1.1] CreateBitmap failure " << data->GetSize() << " Code: " << hr;
}
data->Unmap();
if (!bitmap) {

View File

@ -13,6 +13,7 @@
#include "gfx2DGlue.h"
#include "gfxPrefs.h"
#include "ReadbackManagerD3D11.h"
#include "mozilla/gfx/Logging.h"
namespace mozilla {
@ -286,6 +287,11 @@ TextureClientD3D11::Unlock()
RefPtr<ID3D10Texture2D> tex;
HRESULT hr = device->CreateTexture2D(&desc, nullptr, byRef(tex));
if (FAILED(hr)) {
gfx::gfxCriticalError() << "[D3D11] CreateTexture2D failure " << mSize << " Code: " << hr;
return false;
}
if (SUCCEEDED(hr)) {
device->CopyResource(tex, mTexture10);
@ -369,7 +375,7 @@ TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlag
}
if (FAILED(hr)) {
LOGD3D11("Error creating texture for client!");
gfx::gfxCriticalError() << "[D3D11] CreateTexture2D failure " << aSize << " Code: " << hr;
return false;
}