Bug 737686. Avoid glTexSubImage2D on PowerVR hardware. r=gwright
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 20 Mar 2012 19:13:50 -0400
changeset 89951 80a7d26b02ecd89233ec2cb54a8e5d4a386a67df
parent 89950 a5ac2a7b72c6f8ed253af8491da1e8503a5745df
child 89952 2e3738aa6670ca66333b6b94b9fd2b16da717e30
push id7401
push userjmuizelaar@mozilla.com
push dateWed, 21 Mar 2012 22:09:10 +0000
treeherdermozilla-inbound@80a7d26b02ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwright
bugs737686
milestone14.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
Bug 737686. Avoid glTexSubImage2D on PowerVR hardware. r=gwright glTexSubImage causes a readback on PowerVR hardware if the texture has already been uploaded. Disabling CanUploadSubTextures() brings the median upload speed from 26ms to 10ms.
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -322,17 +322,19 @@ GLContext::InitWithPrefix(const char *pr
         }
 
         // The order of these strings must match up with the order of the enum
         // defined in GLContext.h for renderer IDs
         glRendererString = (const char *)fGetString(LOCAL_GL_RENDERER);
         const char *rendererMatchStrings[RendererOther] = {
                 "Adreno 200",
                 "Adreno 205",
-                "PowerVR SGX 540"
+                "PowerVR SGX 530",
+                "PowerVR SGX 540",
+
         };
         mRenderer = RendererOther;
         for (int i = 0; i < RendererOther; ++i) {
             if (DoesStringMatch(glRendererString, rendererMatchStrings[i])) {
                 mRenderer = i;
                 break;
             }
         }
@@ -565,18 +567,25 @@ GLContext::IsExtensionSupported(const ch
 // string in the form "Adreno (TM) 200" and the drivers we've seen so
 // far work fine with NPOT textures, so don't blacklist those until we
 // have evidence of any problems with them.
 bool
 GLContext::CanUploadSubTextures()
 {
     // There are certain GPUs that we don't want to use glTexSubImage2D on
     // because that function can be very slow and/or buggy
-    return (Renderer() != RendererAdreno200 &&
-            Renderer() != RendererAdreno205);
+    if (Renderer() == RendererAdreno200 || Renderer() == RendererAdreno205)
+        return false;
+
+    // On PowerVR glTexSubImage does a readback, so it will be slower
+    // than just doing a glTexImage2D() directly. i.e. 26ms vs 10ms
+    if (Renderer() == RendererSGX540 || Renderer() == RendererSGX530)
+        return false;
+
+    return true;
 }
 
 bool
 GLContext::CanUploadNonPowerOfTwo()
 {
     static bool sPowerOfTwoForced;
     static bool sPowerOfTwoPrefCached = false;
 
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -687,16 +687,17 @@ public:
         VendorQualcomm,
         VendorImagination,
         VendorOther
     };
 
     enum {
         RendererAdreno200,
         RendererAdreno205,
+        RendererSGX530,
         RendererSGX540,
         RendererOther
     };
 
     int Vendor() const {
         return mVendor;
     }