Merge "fix [3369743] SurfaceFlinger reads hardware composer hints before calling hwc.prepare()" into honeycomb

This commit is contained in:
Mathias Agopian
2011-01-20 12:25:33 -08:00
committed by Android (Google) Code Review

View File

@@ -868,30 +868,36 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
for (size_t i=0 ; i<count ; i++) { for (size_t i=0 ; i<count ; i++) {
const sp<LayerBase>& layer(layers[i]); const sp<LayerBase>& layer(layers[i]);
layer->setPerFrameData(&cur[i]); layer->setPerFrameData(&cur[i]);
if (cur[i].hints & HWC_HINT_CLEAR_FB) {
if (!(layer->needsBlending())) {
transparent.orSelf(layer->visibleRegionScreen);
}
}
} }
err = hwc.prepare(); err = hwc.prepare();
LOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); LOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
}
/* if (err == NO_ERROR) {
* clear the area of the FB that need to be transparent for (size_t i=0 ; i<count ; i++) {
*/ if (cur[i].hints & HWC_HINT_CLEAR_FB) {
transparent.andSelf(dirty); const sp<LayerBase>& layer(layers[i]);
if (!transparent.isEmpty()) { if (!(layer->needsBlending())) {
glClearColor(0,0,0,0); transparent.orSelf(layer->visibleRegionScreen);
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()); * clear the area of the FB that need to be transparent
glScissor(r.left, sy, r.width(), r.height()); */
glClear(GL_COLOR_BUFFER_BIT); 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);
}
}
} }
} }