we were mistakenly optimizing out SF's main transactions in some cases

due to a typo, SF's main transaction was conditional to having a
display transaction.

more correct fix for 6970310

Bug: 6970310
Change-Id: Iafd8c4e02afa5db829cc1c65950cfcc74754c6af
This commit is contained in:
Mathias Agopian 2012-08-15 13:46:03 -07:00
parent ac1f70bb71
commit 3559b07a88
1 changed files with 30 additions and 27 deletions

View File

@ -891,8 +891,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
* (perform the transaction for each of them if needed) * (perform the transaction for each of them if needed)
*/ */
const bool layersNeedTransaction = transactionFlags & eTraversalNeeded; if (transactionFlags & eTraversalNeeded) {
if (layersNeedTransaction) {
for (size_t i=0 ; i<count ; i++) { for (size_t i=0 ; i<count ; i++) {
const sp<LayerBase>& layer = currentLayers[i]; const sp<LayerBase>& layer = currentLayers[i];
uint32_t trFlags = layer->getTransactionFlags(eTransactionNeeded); uint32_t trFlags = layer->getTransactionFlags(eTransactionNeeded);
@ -905,7 +904,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
} }
/* /*
* Perform our own transaction if needed * Perform display own transactions if needed
*/ */
if (transactionFlags & eDisplayTransactionNeeded) { if (transactionFlags & eDisplayTransactionNeeded) {
@ -978,31 +977,35 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
} }
} }
} }
}
if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) { /*
// layers have been added * Perform our own transaction if needed
mVisibleRegionsDirty = true; */
}
// some layers might have been removed, so if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) {
// we need to update the regions they're exposing. // layers have been added
if (mLayersRemoved) { mVisibleRegionsDirty = true;
mLayersRemoved = false; }
mVisibleRegionsDirty = true;
const LayerVector& previousLayers(mDrawingState.layersSortedByZ); // some layers might have been removed, so
const size_t count = previousLayers.size(); // we need to update the regions they're exposing.
for (size_t i=0 ; i<count ; i++) { if (mLayersRemoved) {
const sp<LayerBase>& layer(previousLayers[i]); mLayersRemoved = false;
if (currentLayers.indexOf(layer) < 0) { mVisibleRegionsDirty = true;
// this layer is not visible anymore const LayerVector& previousLayers(mDrawingState.layersSortedByZ);
// TODO: we could traverse the tree from front to back and const size_t count = previousLayers.size();
// compute the actual visible region for (size_t i=0 ; i<count ; i++) {
// TODO: we could cache the transformed region const sp<LayerBase>& layer(previousLayers[i]);
Layer::State front(layer->drawingState()); if (currentLayers.indexOf(layer) < 0) {
Region visibleReg = front.transform.transform( // this layer is not visible anymore
Region(Rect(front.active.w, front.active.h))); // TODO: we could traverse the tree from front to back and
invalidateLayerStack(front.layerStack, visibleReg); // compute the actual visible region
} // TODO: we could cache the transformed region
Layer::State front(layer->drawingState());
Region visibleReg = front.transform.transform(
Region(Rect(front.active.w, front.active.h)));
invalidateLayerStack(front.layerStack, visibleReg);
} }
} }
} }
@ -1406,7 +1409,7 @@ status_t SurfaceFlinger::removeLayer(const sp<LayerBase>& layer)
Mutex::Autolock _l(mStateLock); Mutex::Autolock _l(mStateLock);
status_t err = purgatorizeLayer_l(layer); status_t err = purgatorizeLayer_l(layer);
if (err == NO_ERROR) if (err == NO_ERROR)
setTransactionFlags(eDisplayTransactionNeeded); setTransactionFlags(eTransactionNeeded);
return err; return err;
} }