summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-01-20 12:25:33 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2011-01-20 12:25:33 -0800
commit35e4a497f4463adb78d35a57f22847bec0eaab1a (patch)
tree29e7cc807bdc1df38bbc9809533a75bbd37dfc5b
parenta423d868009b9961597365ce7f190aef23f4b1cc (diff)
parent45491690d8f21d2648cad9247115720fa90046b4 (diff)
Merge "fix [3369743] SurfaceFlinger reads hardware composer hints before calling hwc.prepare()" into honeycomb
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5a8888a26622..694af70cf8fd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -868,30 +868,36 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
for (size_t i=0 ; i<count ; i++) {
const sp<LayerBase>& layer(layers[i]);
layer->setPerFrameData(&cur[i]);
- if (cur[i].hints & HWC_HINT_CLEAR_FB) {
- if (!(layer->needsBlending())) {
- transparent.orSelf(layer->visibleRegionScreen);
- }
- }
}
err = hwc.prepare();
LOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
- }
- /*
- * clear the area of the FB that need to be transparent
- */
- transparent.andSelf(dirty);
- if (!transparent.isEmpty()) {
- glClearColor(0,0,0,0);
- Region::const_iterator it = transparent.begin();
- Region::const_iterator const end = transparent.end();
- const int32_t height = hw.getHeight();
- while (it != end) {
- const Rect& r(*it++);
- const GLint sy = height - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glClear(GL_COLOR_BUFFER_BIT);
+ if (err == NO_ERROR) {
+ for (size_t i=0 ; i<count ; i++) {
+ if (cur[i].hints & HWC_HINT_CLEAR_FB) {
+ const sp<LayerBase>& layer(layers[i]);
+ if (!(layer->needsBlending())) {
+ transparent.orSelf(layer->visibleRegionScreen);
+ }
+ }
+ }
+
+ /*
+ * clear the area of the FB that need to be transparent
+ */
+ transparent.andSelf(dirty);
+ if (!transparent.isEmpty()) {
+ glClearColor(0,0,0,0);
+ Region::const_iterator it = transparent.begin();
+ Region::const_iterator const end = transparent.end();
+ const int32_t height = hw.getHeight();
+ while (it != end) {
+ const Rect& r(*it++);
+ const GLint sy = height - (r.top + r.height());
+ glScissor(r.left, sy, r.width(), r.height());
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+ }
}
}