Merge "Include stack traces for certain native processes in bugreport." into jb-dev
diff --git a/build/tablet-7in-hdpi-1024-dalvik-heap.mk b/build/tablet-7in-hdpi-1024-dalvik-heap.mk
index 115f177..63aede6 100644
--- a/build/tablet-7in-hdpi-1024-dalvik-heap.mk
+++ b/build/tablet-7in-hdpi-1024-dalvik-heap.mk
@@ -19,5 +19,5 @@
 PRODUCT_PROPERTY_OVERRIDES += \
     dalvik.vm.heapstartsize=8m \
     dalvik.vm.heapgrowthlimit=64m \
-    dalvik.vm.heapsize=512m
+    dalvik.vm.heapsize=384m
     
\ No newline at end of file
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 593f178..4062340 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -469,18 +469,31 @@
                 front.requested.crop.getWidth(),
                 front.requested.crop.getHeight());
 
-        if (!isFixedSize()) {
-            // this will make sure LayerBase::doTransaction doesn't update
-            // the drawing state's geometry
-            flags |= eDontUpdateGeometryState;
-        }
-
         // record the new size, form this point on, when the client request
         // a buffer, it'll get the new size.
         mSurfaceTexture->setDefaultBufferSize(
                 temp.requested.w, temp.requested.h);
     }
 
+    if (!isFixedSize()) {
+
+        const bool resizePending = (temp.requested.w != temp.active.w) ||
+                                   (temp.requested.h != temp.active.h);
+
+        if (resizePending) {
+            // don't let LayerBase::doTransaction update the drawing state
+            // if we have a pending resize, unless we are in fixed-size mode.
+            // the drawing state will be updated only once we receive a buffer
+            // with the correct size.
+            //
+            // in particular, we want to make sure the clip (which is part
+            // of the geometry state) is latched together with the size but is
+            // latched immediately when no resizing is involved.
+
+            flags |= eDontUpdateGeometryState;
+        }
+    }
+
     return LayerBase::doTransaction(flags);
 }
 
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f4779e7..25e80d7 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -960,7 +960,6 @@
     glDisable(GL_TEXTURE_EXTERNAL_OES);
     glDisable(GL_TEXTURE_2D);
     glDisable(GL_BLEND);
-    glDisable(GL_SCISSOR_TEST);
 
     static int toggle = 0;
     toggle = 1 - toggle;
@@ -1819,7 +1818,6 @@
     // redraw the screen entirely...
     glDisable(GL_TEXTURE_EXTERNAL_OES);
     glDisable(GL_TEXTURE_2D);
-    glDisable(GL_SCISSOR_TEST);
     glClearColor(0,0,0,1);
     glClear(GL_COLOR_BUFFER_BIT);
     glMatrixMode(GL_MODELVIEW);
@@ -1835,7 +1833,6 @@
 
     // back to main framebuffer
     glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
-    glDisable(GL_SCISSOR_TEST);
     glDeleteFramebuffersOES(1, &name);
 
     *textureName = tname;
@@ -2048,7 +2045,6 @@
     glDeleteTextures(1, &tname);
     glDisable(GL_TEXTURE_2D);
     glDisable(GL_BLEND);
-    glDisable(GL_SCISSOR_TEST);
     return NO_ERROR;
 }
 
@@ -2200,7 +2196,6 @@
     glDeleteTextures(1, &tname);
     glDisable(GL_TEXTURE_2D);
     glDisable(GL_BLEND);
-    glDisable(GL_SCISSOR_TEST);
 
     return NO_ERROR;
 }
@@ -2228,7 +2223,6 @@
 
     // always clear the whole screen at the end of the animation
     glClearColor(0,0,0,1);
-    glDisable(GL_SCISSOR_TEST);
     glClear(GL_COLOR_BUFFER_BIT);
     hw.flip( Region(hw.bounds()) );
 
@@ -2366,7 +2360,6 @@
 
         // invert everything, b/c glReadPixel() below will invert the FB
         glViewport(0, 0, sw, sh);
-        glScissor(0, 0, sw, sh);
         glMatrixMode(GL_PROJECTION);
         glPushMatrix();
         glLoadIdentity();
@@ -2390,10 +2383,6 @@
             }
         }
 
-        // XXX: this is needed on tegra
-        glEnable(GL_SCISSOR_TEST);
-        glScissor(0, 0, sw, sh);
-
         // check for errors and return screen capture
         if (glGetError() != GL_NO_ERROR) {
             // error while rendering
@@ -2419,7 +2408,6 @@
                 result = NO_MEMORY;
             }
         }
-        glDisable(GL_SCISSOR_TEST);
         glViewport(0, 0, hw_w, hw_h);
         glMatrixMode(GL_PROJECTION);
         glPopMatrix();