Bug 743314 - Force CanUploadSubtextures on Maemo6 harmattan. r=chrislord.net
authorOleg Romashin <romaxa@gmail.com>
Sat, 28 Apr 2012 09:05:41 -0400
changeset 92673 339e0c1de0e19ad04277992c99ae0d790364cdc7
parent 92672 299758765c724224a71d6e1a479e997bd000d54c
child 92674 8352ac30ddcd06f31b9d3609fa06f059d42016b9
push id8809
push userromaxa@gmail.com
push dateSat, 28 Apr 2012 18:13:51 +0000
treeherdermozilla-inbound@339e0c1de0e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschrislord
bugs743314
milestone15.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 743314 - Force CanUploadSubtextures on Maemo6 harmattan. r=chrislord.net
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -636,16 +636,21 @@ CopyAndPadTextureData(const GLvoid* srcB
 // far work fine with NPOT textures, so don't blacklist those until we
 // have evidence of any problems with them.
 bool
 GLContext::CanUploadSubTextures()
 {
     if (!mWorkAroundDriverBugs)
         return true;
 
+    // Lock surface feature allows to mmap texture memory and modify it directly
+    // this feature allow us modify texture partially without full upload
+    if (HasLockSurface())
+        return true;
+
     // There are certain GPUs that we don't want to use glTexSubImage2D on
     // because that function can be very slow and/or buggy
     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)
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -726,16 +726,17 @@ public:
 
     int Renderer() const {
         return mRenderer;
     }
 
     bool CanUploadSubTextures();
     bool CanUploadNonPowerOfTwo();
     bool WantsSmallTiles();
+    virtual bool HasLockSurface() { return false; }
 
     /**
      * If this context wraps a double-buffered target, swap the back
      * and front buffers.  It should be assumed that after a swap, the
      * contents of the new back buffer are undefined.
      */
     virtual bool SwapBuffers() { return false; }
 
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -592,16 +592,20 @@ public:
                                                    EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, (void**) &h))
         {
             return nsnull;
         }
 
         return h;
     }
 
+    virtual bool HasLockSurface() {
+        return sEGLLibrary.HasKHRLockSurface();
+    }
+
 protected:
     friend class GLContextProviderEGL;
 
     EGLConfig  mConfig;
     EGLSurface mSurface;
     EGLContext mContext;
     void *mPlatformContext;
     nsRefPtr<gfxASurface> mThebesSurface;