author | Nicolas Silva <nsilva@mozilla.com> |
Mon, 28 Jul 2014 14:58:38 +0200 | |
changeset 196388 | 0d8a1a23f5867f7993739881ab0e81422f726888 |
parent 196387 | 4e3ea1113de325557745be4fa85b68b106d54218 |
child 196389 | 862b06b06af01426287eedaa43492810adfe4863 |
push id | 27214 |
push user | cbook@mozilla.com |
push date | Tue, 29 Jul 2014 07:16:00 +0000 |
treeherder | mozilla-central@b17cad2d1e5e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Bas |
bugs | 1043929 |
milestone | 34.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -392,33 +392,36 @@ BufferTextureHost::DeallocateDeviceData( it->DeallocateDeviceData(); it = it->GetNextSibling(); } } bool BufferTextureHost::Lock() { - mLocked = true; - return true; + MOZ_ASSERT(!mLocked); + if (!MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr)) { + return false; + } + mLocked = !!mFirstSource; + return mLocked; } void BufferTextureHost::Unlock() { + MOZ_ASSERT(mLocked); mLocked = false; } NewTextureSource* BufferTextureHost::GetTextureSources() { - MOZ_ASSERT(mLocked, "should never be called while not locked"); - if (!MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr)) { - return nullptr; - } + MOZ_ASSERT(mLocked); + MOZ_ASSERT(mFirstSource); return mFirstSource; } gfx::SurfaceFormat BufferTextureHost::GetFormat() const { // mFormat is the format of the data that we share with the content process. // GetFormat, on the other hand, expects the format that we present to the @@ -437,16 +440,17 @@ bool BufferTextureHost::MaybeUpload(nsIntRegion *aRegion) { if (mFirstSource && mFirstSource->GetUpdateSerial() == mUpdateSerial) { return true; } if (!Upload(aRegion)) { return false; } + // If upload returns true we know mFirstSource is not null mFirstSource->SetUpdateSerial(mUpdateSerial); return true; } bool BufferTextureHost::Upload(nsIntRegion *aRegion) { if (!GetBuffer()) { @@ -541,16 +545,17 @@ BufferTextureHost::Upload(nsIntRegion *a return false; } if (!mFirstSource->Update(surf.get(), aRegion)) { NS_WARNING("failed to update the DataTextureSource"); return false; } } + MOZ_ASSERT(mFirstSource); return true; } TemporaryRef<gfx::DataSourceSurface> BufferTextureHost::GetAsSurface() { RefPtr<gfx::DataSourceSurface> result; if (mFormat == gfx::SurfaceFormat::UNKNOWN) {
--- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -389,16 +389,19 @@ DXGITextureHostD3D11::Unlock() MOZ_ASSERT(mIsLocked); UnlockD3DTexture(mTextureSource->GetD3D11Texture()); mIsLocked = false; } NewTextureSource* DXGITextureHostD3D11::GetTextureSources() { + MOZ_ASSERT(mIsLocked); + // If Lock was successful we must have a valid TextureSource. + MOZ_ASSERT(mTextureSource); return mTextureSource.get(); } bool DataTextureSourceD3D11::Update(DataSourceSurface* aSurface, nsIntRegion* aDestRegion, IntPoint* aSrcOffset) {
--- a/gfx/layers/d3d9/TextureD3D9.cpp +++ b/gfx/layers/d3d9/TextureD3D9.cpp @@ -758,16 +758,17 @@ SharedTextureClientD3D9::ToSurfaceDescri TextureHostD3D9::TextureHostD3D9(TextureFlags aFlags, const SurfaceDescriptorD3D9& aDescriptor) : TextureHost(aFlags) , mFormat(SurfaceFormat::UNKNOWN) , mIsLocked(false) { mTexture = reinterpret_cast<IDirect3DTexture9*>(aDescriptor.texture()); + MOZ_ASSERT(mTexture); mTexture->Release(); // see AddRef in CairoTextureClientD3D9::ToSurfaceDescriptor MOZ_ASSERT(mTexture); D3DSURFACE_DESC desc; HRESULT hr = mTexture->GetLevelDesc(0, &desc); if (!FAILED(hr)) { mFormat = D3D9FormatToSurfaceFormat(desc.Format); mSize.width = desc.Width; mSize.height = desc.Height; @@ -843,16 +844,17 @@ DataTextureSourceD3D9::UpdateFromTexture } mIsTiled = false; return true; } void TextureHostD3D9::Updated(const nsIntRegion* aRegion) { + MOZ_ASSERT(mTexture); if (!mTexture) { return; } if (!mTextureSource) { mTextureSource = new DataTextureSourceD3D9(mFormat, mSize, mCompositor, nullptr, mFlags); } @@ -874,25 +876,29 @@ TextureHostD3D9::SetCompositor(Composito mTextureSource->SetCompositor(aCompositor); } } NewTextureSource* TextureHostD3D9::GetTextureSources() { MOZ_ASSERT(mIsLocked); + MOZ_ASSERT(mTextureSource); return mTextureSource; } bool TextureHostD3D9::Lock() { MOZ_ASSERT(!mIsLocked); - mIsLocked = true; - return true; + // XXX - Currently if a TextureHostD3D9 is created but Update is never called, + // it will not have a TextureSource although it could since it has a valid + // D3D9 texture. + mIsLocked = !!mTextureSource; + return mIsLocked; } void TextureHostD3D9::Unlock() { MOZ_ASSERT(mIsLocked); mIsLocked = false; } @@ -912,22 +918,25 @@ DXGITextureHostD3D9::DXGITextureHostD3D9 , mIsLocked(false) { MOZ_ASSERT(mHandle); } NewTextureSource* DXGITextureHostD3D9::GetTextureSources() { + MOZ_ASSERT(mIsLocked); + MOZ_ASSERT(mTextureSource); return mTextureSource; } bool DXGITextureHostD3D9::Lock() { + MOZ_ASSERT(!mIsLocked); DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager(); if (!deviceManager) { NS_WARNING("trying to lock a TextureHost without a D3D device"); return false; } if (!mTextureSource) { nsRefPtr<IDirect3DTexture9> tex; @@ -942,17 +951,16 @@ DXGITextureHostD3D9::Lock() if (FAILED(hr)) { NS_WARNING("Failed to open shared texture"); return false; } mTextureSource = new DataTextureSourceD3D9(mFormat, mSize, mCompositor, tex); } - MOZ_ASSERT(!mIsLocked); mIsLocked = true; return true; } void DXGITextureHostD3D9::Unlock() { MOZ_ASSERT(mIsLocked);