Fix tiling on QCOM GPU

Rename Caches::startTiling parameter from opaque to discard to
make it clearer what its role is. Tweak calls to startTiling
to preserve the buffer when needed and discard it when possible.

Change-Id: If7f8ff19003f79f36885a0a7207cc61901f637d2
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 5c2b388..7e645d2 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -466,9 +466,9 @@
 // Tiling
 ///////////////////////////////////////////////////////////////////////////////
 
-void Caches::startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool opaque) {
+void Caches::startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool discard) {
     if (extensions.hasTiledRendering() && !debugOverdraw) {
-        glStartTilingQCOM(x, y, width, height, (opaque ? GL_NONE : GL_COLOR_BUFFER_BIT0_QCOM));
+        glStartTilingQCOM(x, y, width, height, (discard ? GL_NONE : GL_COLOR_BUFFER_BIT0_QCOM));
     }
 }
 
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index ae188be..69c81c8 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -215,7 +215,7 @@
     bool disableScissor();
     void setScissorEnabled(bool enabled);
 
-    void startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool opaque);
+    void startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool preserve);
     void endTiling();
 
     /**
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index c08cc56..9f0a38b 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -818,7 +818,7 @@
     glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
             layer->getTexture(), 0);
 
-    startTiling(mSnapshot, !layer->isBlend());
+    startTiling(mSnapshot, true);
 
     // Clear the FBO, expand the clear region by 1 to get nice bilinear filtering
     mCaches.enableScissor();
@@ -1267,7 +1267,7 @@
 
         glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, buffer);
 
-        startTiling(layer->clipRect, layer->layer.getHeight(), !layer->isBlend());
+        startTiling(layer->clipRect, layer->layer.getHeight());
     }
 }