summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-08-11 16:27:39 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-11 16:27:39 -0700
commit47a740b50f0107f61dfc3140c674b860eb0cf97b (patch)
tree73aeddad6573794057d99dadd55d0137563c6fc5
parentb219a83ff6278eeef981e6908abf871876a68699 (diff)
parent801d0b33e845648866472263263a7001b528c3f4 (diff)
downloadframeworks_base-47a740b50f0107f61dfc3140c674b860eb0cf97b.zip
frameworks_base-47a740b50f0107f61dfc3140c674b860eb0cf97b.tar.gz
frameworks_base-47a740b50f0107f61dfc3140c674b860eb0cf97b.tar.bz2
am 801d0b33: am 025822a0: Merge "keep a list of visible sorted surfaces" into gingerbread
Merge commit '801d0b33e845648866472263263a7001b528c3f4' * commit '801d0b33e845648866472263263a7001b528c3f4': keep a list of visible sorted surfaces
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp40
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h5
2 files changed, 30 insertions, 15 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 3167c4c..c630a0d 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -521,6 +521,10 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)
{
Vector< sp<LayerBase> > ditchedLayers;
+ /*
+ * Perform and commit the transaction
+ */
+
{ // scope for the lock
Mutex::Autolock _l(mStateLock);
const nsecs_t now = systemTime();
@@ -528,9 +532,13 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)
handleTransactionLocked(transactionFlags, ditchedLayers);
mLastTransactionTime = systemTime() - now;
mDebugInTransaction = 0;
+ // here the transaction has been committed
}
- // do this without lock held
+ /*
+ * Clean-up all layers that went away
+ * (do this without the lock held)
+ */
const size_t count = ditchedLayers.size();
for (size_t i=0 ; i<count ; i++) {
if (ditchedLayers[i] != 0) {
@@ -773,6 +781,19 @@ void SurfaceFlinger::handlePageFlip()
if (visibleRegions) {
Region opaqueRegion;
computeVisibleRegions(currentLayers, mDirtyRegion, opaqueRegion);
+
+ /*
+ * rebuild the visible layer list
+ */
+ mVisibleLayersSortedByZ.clear();
+ const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
+ size_t count = currentLayers.size();
+ mVisibleLayersSortedByZ.setCapacity(count);
+ for (size_t i=0 ; i<count ; i++) {
+ if (!currentLayers[i]->visibleRegionScreen.isEmpty())
+ mVisibleLayersSortedByZ.add(currentLayers[i]);
+ }
+
mWormholeRegion = screenRegion.subtract(opaqueRegion);
mVisibleRegionsDirty = false;
}
@@ -869,18 +890,13 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
// draw something...
drawWormhole();
}
- const SurfaceFlinger& flinger(*this);
- const LayerVector& drawingLayers(mDrawingState.layersSortedByZ);
- const size_t count = drawingLayers.size();
- sp<LayerBase> const* const layers = drawingLayers.array();
+ const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
+ const size_t count = layers.size();
for (size_t i=0 ; i<count ; ++i) {
- const sp<LayerBase>& layer = layers[i];
- const Region& visibleRegion(layer->visibleRegionScreen);
- if (!visibleRegion.isEmpty()) {
- const Region clip(dirty.intersect(visibleRegion));
- if (!clip.isEmpty()) {
- layer->draw(clip);
- }
+ const sp<LayerBase>& layer(layers[i]);
+ const Region clip(dirty.intersect(layer->visibleRegionScreen));
+ if (!clip.isEmpty()) {
+ layer->draw(clip);
}
}
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 8821e5c..c8b9512 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -40,9 +40,6 @@
#include "MessageQueue.h"
-struct copybit_device_t;
-struct overlay_device_t;
-
namespace android {
// ---------------------------------------------------------------------------
@@ -379,6 +376,8 @@ private:
bool mFreezeDisplay;
int32_t mFreezeCount;
nsecs_t mFreezeDisplayTime;
+ Vector< sp<LayerBase> > mVisibleLayersSortedByZ;
+
// don't use a lock for these, we don't care
int mDebugRegion;