From 739aae6070d8af2c9acf6b197d368d8d077edc6b Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 28 Jan 2013 23:49:38 -0800 Subject: [PATCH] Bug 792966: Don't try to gralloc small buffers. r=kanru --- gfx/gl/GLContextProviderEGL.cpp | 2 +- gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index f7d21a8dde1..b082277e00b 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -1822,7 +1822,7 @@ public: #endif #ifdef MOZ_WIDGET_GONK - if (gUseBackingSurface) { + if (gUseBackingSurface && aSize.width >= 64) { mGLContext->MakeCurrent(true); PixelFormat format = PixelFormatForImage(mUpdateFormat); uint32_t usage = GraphicBuffer::USAGE_HW_TEXTURE | diff --git a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp index 631b645574f..c35d3e7dc1b 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp @@ -294,6 +294,13 @@ ShadowLayerForwarder::PlatformAllocBuffer(const gfxIntSize& aSize, uint32_t aCaps, SurfaceDescriptor* aBuffer) { + // Some GL implementations fail to render gralloc textures with + // width < 64. There's not much point in gralloc'ing buffers that + // small anyway, so fall back on shared memory plus a texture + // upload. + if (aSize.width < 64) { + return false; + } SAMPLE_LABEL("ShadowLayerForwarder", "PlatformAllocBuffer"); // Gralloc buffers are efficiently mappable as gfxImageSurface, so // no need to check |aCaps & MAP_AS_IMAGE_SURFACE|.