Uncomment the Java compositor integration, except for the part that causes PowerVR crashes
authorPatrick Walton <pwalton@mozilla.com>
Fri, 10 Feb 2012 23:03:02 -0800
changeset 92436 000c3e42a0dbe7ef75955a55cefaa08ba957fd7d
parent 92435 44d0e5c43b20aacddd8adc5239f4952b142acfe4
child 92437 2a128563daedfa8bc1e2b1b9c312f958255292dc
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone13.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
Uncomment the Java compositor integration, except for the part that causes PowerVR crashes
mobile/android/base/gfx/GeckoGLLayerClient.java
mobile/android/base/gfx/LayerRenderer.java
widget/android/nsWindow.cpp
--- a/mobile/android/base/gfx/GeckoGLLayerClient.java
+++ b/mobile/android/base/gfx/GeckoGLLayerClient.java
@@ -219,16 +219,17 @@ public class GeckoGLLayerClient extends 
         renderRequested();
     }
 
     /** For Gecko to use. */
     public LayerRenderer.Frame createFrame(float offsetX, float offsetY, float zoomFactor) {
         // Create the shaders and textures if necessary.
         if (!mLayerRendererInitialized) {
             mLayerRenderer.onSurfaceCreated(null, null);
+            mLayerRendererInitialized = true;
         }
 
         // FIXME: This geometry is surely wrong.
         ViewportMetrics metrics = getLayerController().getViewportMetrics();
         FloatSize pageSize = metrics.getPageSize(), screenSize = metrics.getSize();
         RectF viewport = new RectF(offsetX, offsetY, offsetX + screenSize.width,
                                    offsetY + screenSize.height);
 
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -207,29 +207,38 @@ public class LayerRenderer implements GL
         mTextureHandle = GLES20.glGetAttribLocation(mProgram, "aTexCoord");
         mSampleHandle = GLES20.glGetUniformLocation(mProgram, "sTexture");
         mTMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uTMatrix");
 
         int maxTextureSizeResult[] = new int[1];
         GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, maxTextureSizeResult, 0);
         mMaxTextureSize = maxTextureSizeResult[0];
 
+        /*
+
         // Add the program to the OpenGL environment
         GLES20.glUseProgram(mProgram);
 
         // Set the transformation matrix
         GLES20.glUniformMatrix4fv(mTMatrixHandle, 1, false, TEXTURE_MATRIX, 0);
 
         // Enable the arrays from which we get the vertex and texture coordinates
+        Log.e(LOGTAG, "### Position handle is " + mPositionHandle + ", texture handle is " +
+              mTextureHandle + ", last error is " + GLES20.glGetError());
+
+        // FIXME: This crashes PowerVR drivers. Seems that we cannot actually use multiple GL
+        // programs reliably.
         GLES20.glEnableVertexAttribArray(mPositionHandle);
         GLES20.glEnableVertexAttribArray(mTextureHandle);
 
         GLES20.glUniform1i(mSampleHandle, 0);
 
         TextureGenerator.get().fill();
+
+        */
     }
 
     public int getMaxTextureSize() {
         return mMaxTextureSize;
     }
 
     public void addLayer(Layer layer) {
         LayerController controller = mView.getController();
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2383,35 +2383,42 @@ nsIMEUpdatePreference
 nsWindow::GetIMEUpdatePreference()
 {
     return nsIMEUpdatePreference(true, true);
 }
 
 #ifdef MOZ_JAVA_COMPOSITOR
 void
 nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {
-#if 0
-    TransformLayerUserData* userData =
-        static_cast<TransformLayerUserData*>(aManager->GetUserData(nsGkAtoms::transform));
+    AndroidBridge::AutoLocalJNIFrame jniFrame(GetJNIForThread());
+
+    mozilla::layers::LayerUserData* userData = aManager->GetUserData(nsGkAtoms::transform);
+    mozilla::layers::TransformLayerUserData* transformUserData =
+        static_cast<mozilla::layers::TransformLayerUserData*>(userData);
     NS_ABORT_IF_FALSE(userData, "No transform user data!");
 
     // Transform the unit square to figure out the offset and scale we need.
     gfxRect rect(0, 0, 1, 1);
-    userData->matrix.TransformBounds(rect);
+    transformUserData->matrix.TransformBounds(rect);
 
     AndroidGeckoLayerClient& client = AndroidBridge::Bridge()->GetLayerClient();
     AndroidGeckoGLLayerClient& glClient = static_cast<AndroidGeckoGLLayerClient&>(client);
     glClient.CreateFrame(mLayerRendererFrame, rect.x, rect.y, rect.width);
+
+#if 0
     mLayerRendererFrame.DrawBackground();
 #endif
 }
 
 void
 nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {
-#if 0
+    AndroidBridge::AutoLocalJNIFrame jniFrame(GetJNIForThread());
     NS_ABORT_IF_FALSE(!mLayerRendererFrame.isNull(),
                       "Frame should have been created in DrawWindowUnderlay()!");
+
+#if 0
     mLayerRendererFrame.DrawForeground();
+#endif
+
     mLayerRendererFrame.Dispose();
-#endif
 }
 #endif