author | Nicolas Silva <nsilva@mozilla.com> |
Tue, 29 Jul 2014 13:16:57 +0200 | |
changeset 196500 | 591fdfc7734b4c7bc5ace89d4444c42a80dc1c4f |
parent 196499 | c8d0a8cf50a17b9947f035b06c9c8e93a957ff57 |
child 196501 | 67cfdcd03f58afa3204e7c4d7884ccfa217288c8 |
push id | 46895 |
push user | nsilva@mozilla.com |
push date | Tue, 29 Jul 2014 11:17:30 +0000 |
treeherder | mozilla-inbound@591fdfc7734b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sotaro |
bugs | 1043389 |
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/CompositorTypes.h +++ b/gfx/layers/CompositorTypes.h @@ -79,19 +79,16 @@ MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint3 // The contents of the texture must be uploaded or copied immediately // during the transaction, because the producer may want to write // to it again. IMMEDIATE_UPLOAD = 1 << 15, // The texture is going to be used as part of a double // buffered pair, and so we can guarantee that the producer/consumer // won't be racing to access its contents. DOUBLE_BUFFERED = 1 << 16, - // We've previously tried a texture and it didn't work for some reason. If there - // is a fallback available, try that. - ALLOC_FALLBACK = 1 << 17, // Data in this texture has not been alpha-premultiplied. NON_PREMULTIPLIED = 1 << 18, // OR union of all valid bits ALL_BITS = (1 << 19) - 1, // the default flags DEFAULT = FRONT MOZ_END_ENUM_CLASS(TextureFlags)
--- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -228,25 +228,16 @@ void ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect) { // gfx::BackendType::NONE means fallback to the content backend mTextureClient = CreateTextureClientForDrawing( mSurfaceFormat, mSize, gfx::BackendType::NONE, mTextureInfo.mTextureFlags, TextureAllocationFlags::ALLOC_CLEAR_BUFFER ); - if (!mTextureClient) { - // try with ALLOC_FALLBACK - mTextureClient = CreateTextureClientForDrawing( - mSurfaceFormat, mSize, gfx::BackendType::NONE, - mTextureInfo.mTextureFlags | TextureFlags::ALLOC_FALLBACK, - TextureAllocationFlags::ALLOC_CLEAR_BUFFER - ); - } - if (!mTextureClient || !AddTextureClient(mTextureClient)) { AbortTextureClientCreation(); return; } if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) { mTextureClientOnWhite = mTextureClient->CreateSimilar( mTextureInfo.mTextureFlags,
--- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -246,125 +246,112 @@ CreateBufferTextureClient(ISurfaceAlloca return result.forget(); } RefPtr<BufferTextureClient> result = new ShmemTextureClient(aAllocator, aFormat, aMoz2DBackend, aTextureFlags); return result.forget(); } -static +// static TemporaryRef<TextureClient> -CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator, - SurfaceFormat aFormat, - TextureFlags aTextureFlags, - gfx::BackendType aMoz2DBackend, - const gfx::IntSize& aSizeHint) +TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator, + gfx::SurfaceFormat aFormat, + gfx::IntSize aSize, + gfx::BackendType aMoz2DBackend, + TextureFlags aTextureFlags, + TextureAllocationFlags aAllocFlags) { if (aMoz2DBackend == gfx::BackendType::NONE) { aMoz2DBackend = gfxPlatform::GetPlatform()->GetContentBackend(); } - RefPtr<TextureClient> result; + RefPtr<TextureClient> texture; #if defined(MOZ_WIDGET_GONK) || defined(XP_WIN) int32_t maxTextureSize = aAllocator->GetMaxTextureSize(); #endif #ifdef XP_WIN LayersBackend parentBackend = aAllocator->GetCompositorBackendType(); if (parentBackend == LayersBackend::LAYERS_D3D11 && (aMoz2DBackend == gfx::BackendType::DIRECT2D || aMoz2DBackend == gfx::BackendType::DIRECT2D1_1) && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() && - aSizeHint.width <= maxTextureSize && - aSizeHint.height <= maxTextureSize && - !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) { - result = new TextureClientD3D11(aFormat, aTextureFlags); + aSize.width <= maxTextureSize && + aSize.height <= maxTextureSize) { + texture = new TextureClientD3D11(aFormat, aTextureFlags); } if (parentBackend == LayersBackend::LAYERS_D3D9 && aMoz2DBackend == gfx::BackendType::CAIRO && aAllocator->IsSameProcess() && - aSizeHint.width <= maxTextureSize && - aSizeHint.height <= maxTextureSize && - !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) { + aSize.width <= maxTextureSize && + aSize.height <= maxTextureSize) { if (gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) { - result = new CairoTextureClientD3D9(aFormat, aTextureFlags); + texture = new CairoTextureClientD3D9(aFormat, aTextureFlags); } } - if (!result && aFormat == SurfaceFormat::B8G8R8X8 && + if (!texture && aFormat == SurfaceFormat::B8G8R8X8 && aAllocator->IsSameProcess()) { - result = new DIBTextureClient(aFormat, aTextureFlags); + texture = new DIBTextureClient(aFormat, aTextureFlags); } #endif #ifdef MOZ_X11 LayersBackend parentBackend = aAllocator->GetCompositorBackendType(); gfxSurfaceType type = gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType(); if (parentBackend == LayersBackend::LAYERS_BASIC && aMoz2DBackend == gfx::BackendType::CAIRO && - type == gfxSurfaceType::Xlib && - !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) + type == gfxSurfaceType::Xlib) { - result = new TextureClientX11(aAllocator, aFormat, aTextureFlags); + texture = new TextureClientX11(aAllocator, aFormat, aTextureFlags); } #ifdef GL_PROVIDER_GLX if (parentBackend == LayersBackend::LAYERS_OPENGL && type == gfxSurfaceType::Xlib && - !(aTextureFlags & TextureFlags::ALLOC_FALLBACK) && aFormat != SurfaceFormat::A8 && gl::sGLXLibrary.UseTextureFromPixmap()) { - result = new TextureClientX11(aAllocator, aFormat, aTextureFlags); + texture = new TextureClientX11(aAllocator, aFormat, aTextureFlags); } #endif #endif #ifdef MOZ_WIDGET_GONK - if (!DisableGralloc(aFormat, aSizeHint)) { + if (!DisableGralloc(aFormat, aSize)) { // Don't allow Gralloc texture clients to exceed the maximum texture size. // BufferTextureClients have code to handle tiling the surface client-side. - if (aSizeHint.width <= maxTextureSize && aSizeHint.height <= maxTextureSize) { - result = new GrallocTextureClientOGL(aAllocator, aFormat, aMoz2DBackend, + if (aSize.width <= maxTextureSize && aSize.height <= maxTextureSize) { + texture = new GrallocTextureClientOGL(aAllocator, aFormat, aMoz2DBackend, aTextureFlags); } } #endif - // Can't do any better than a buffer texture client. - if (!result) { - result = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend); + MOZ_ASSERT(!texture || texture->CanExposeDrawTarget(), "texture cannot expose a DrawTarget?"); + + if (texture && texture->AllocateForSurface(aSize, aAllocFlags)) { + return texture; } - MOZ_ASSERT(!result || result->CanExposeDrawTarget(), "texture cannot expose a DrawTarget?"); - return result; -} + if (texture) { + NS_WARNING("Failed to allocate a TextureClient, falling back to BufferTextureClient."); + } -// static -TemporaryRef<TextureClient> -TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator, - gfx::SurfaceFormat aFormat, - gfx::IntSize aSize, - gfx::BackendType aMoz2DBackend, - TextureFlags aTextureFlags, - TextureAllocationFlags aAllocFlags) -{ - RefPtr<TextureClient> texture = - CreateTextureClientForDrawing(aAllocator, aFormat, - aTextureFlags, aMoz2DBackend, - aSize); - if (texture) { - if (!texture->AllocateForSurface(aSize, aAllocFlags)) { - return nullptr; - } + // Can't do any better than a buffer texture client. + texture = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend); + + if (!texture->AllocateForSurface(aSize, aAllocFlags)) { + return nullptr; } + return texture; } // static TemporaryRef<BufferTextureClient> TextureClient::CreateForRawBufferAccess(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat, gfx::IntSize aSize,