Bug 1265824 - Don't use client storage for overly large textures r?mstange draft
authorDoug Thayer <dothayer@mozilla.com>
Fri, 22 Jun 2018 11:11:22 -0700
changeset 809727 948fca89aa094d8cf451f46921fe503188b6ff84
parent 809726 bfc4777603b13b162232de667188a4cfbab8009c
push id113782
push userbmo:dothayer@mozilla.com
push dateFri, 22 Jun 2018 20:10:25 +0000
reviewersmstange
bugs1265824
milestone62.0a1
Bug 1265824 - Don't use client storage for overly large textures r?mstange See comment for details. MozReview-Commit-ID: 7N2i2Za8nY7
gfx/layers/client/TextureClient.cpp
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1231,20 +1231,25 @@ TextureClient::CreateFromSurface(KnowsCo
 already_AddRefed<TextureClient>
 TextureClient::CreateForRawBufferAccess(KnowsCompositor* aAllocator,
                                         gfx::SurfaceFormat aFormat,
                                         gfx::IntSize aSize,
                                         gfx::BackendType aMoz2DBackend,
                                         TextureFlags aTextureFlags,
                                         TextureAllocationFlags aAllocFlags)
 {
+  // If we exceed the max texture size for the GPU, then just fall back to no
+  // texture direct mapping. If it becomes a problem we can implement tiling
+  // logic inside DirectMapTextureSource to allow this.
+  bool supportsTextureDirectMapping = aAllocator->SupportsTextureDirectMapping() &&
+    std::max(aSize.width, aSize.height) <= aAllocator->GetMaxTextureSize();
   return CreateForRawBufferAccess(aAllocator->GetTextureForwarder(),
                                   aFormat, aSize, aMoz2DBackend,
                                   aAllocator->GetCompositorBackendType(),
-                                  aAllocator->SupportsTextureDirectMapping(),
+                                  supportsTextureDirectMapping,
                                   aTextureFlags, aAllocFlags);
 }
 
 // static
 already_AddRefed<TextureClient>
 TextureClient::CreateForRawBufferAccess(LayersIPCChannel* aAllocator,
                                         gfx::SurfaceFormat aFormat,
                                         gfx::IntSize aSize,