Bug 917160 - AssureBlitted before switching EGLSurfaces with MakeCurrent. r=bjacob, a=akeybl
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 07 Oct 2013 15:56:08 -0700
changeset 160622 8320c2fdf24093115072baeec5804b358d550c46
parent 160621 c186283ffd5cd167e2253e14d2f088d3e2bfa87c
child 160623 de66802f05aa7d780686c06268ec924f38225c2b
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob, akeybl
bugs917160
milestone26.0a2
Bug 917160 - AssureBlitted before switching EGLSurfaces with MakeCurrent. r=bjacob, a=akeybl
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -470,16 +470,25 @@ public:
         EGLSurface eglSurface = (EGLSurface)surf;
         if (!eglSurface)
             eglSurface = mSurface;
 
         if (eglSurface == mCurSurface)
             return;
 
         // Else, surface changed...
+        if (Screen()) {
+            /* Blit `draw` to `read` if we need to, before we potentially juggle
+             * `read` around. If we don't, we might attach a different `read`,
+             * and *then* hit AssureBlitted, which will blit a dirty `draw` onto
+             * the wrong `read`!
+             */
+            Screen()->AssureBlitted();
+        }
+
         mCurSurface = eglSurface;
         MakeCurrent(true);
     }
 
     bool MakeCurrentImpl(bool aForce = false) {
         bool succeeded = true;
 
         // Assume that EGL has the same problem as WGL does,