Bug 962629 - Respect max texture size when creating Gralloc textures. r=nical

Add a size hint parameter to CreateTextureClientForDrawing, and use said
parameter to not create Gralloc surfaces that are bigger than the maximum
texture size.
This commit is contained in:
Chris Lord
2014-03-12 12:16:37 +00:00
parent fd7a91c539
commit 7afec73423
11 changed files with 34 additions and 16 deletions

View File

@@ -278,7 +278,8 @@ DisableGralloc(SurfaceFormat aFormat)
TemporaryRef<TextureClient>
TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
SurfaceFormat aFormat,
TextureFlags aTextureFlags)
TextureFlags aTextureFlags,
const gfx::IntSize& aSizeHint)
{
RefPtr<TextureClient> result;
@@ -327,7 +328,12 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
#ifdef MOZ_WIDGET_GONK
if (!DisableGralloc(aFormat)) {
result = new GrallocTextureClientOGL(aAllocator, aFormat, aTextureFlags);
// Don't allow Gralloc texture clients to exceed the maximum texture size.
// BufferTextureClients have code to handle tiling the surface client-side.
int32_t maxTextureSize = aAllocator->GetMaxTextureSize();
if (aSizeHint.width <= maxTextureSize && aSizeHint.height <= maxTextureSize) {
result = new GrallocTextureClientOGL(aAllocator, aFormat, aTextureFlags);
}
}
#endif