summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-10-21 16:00:00 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-10-21 16:00:00 -0700
commit51726c381e23d148867c760d06306dfa940b4d15 (patch)
tree48c2145567ecf52499447942baa81394456d6dcd
parent3d62b42d64b24fd24d48af4a9b3381ec2636efee (diff)
parent239c0491086c09007a18505c4743ff95abfcb8f7 (diff)
downloadframeworks_native-51726c381e23d148867c760d06306dfa940b4d15.zip
frameworks_native-51726c381e23d148867c760d06306dfa940b4d15.tar.gz
frameworks_native-51726c381e23d148867c760d06306dfa940b4d15.tar.bz2
am aa938c8d: Merge "mDirtyRegion is single threaded, but could be accessed from a hwc thread" into ics-mr0
* commit 'aa938c8d9c0e71c9b556657cb33794210ce6ebf8': mDirtyRegion is single threaded, but could be accessed from a hwc thread
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp18
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h7
2 files changed, 23 insertions, 2 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dc47a03..e869ba2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -742,6 +742,8 @@ void SurfaceFlinger::handlePageFlip()
}
unlockPageFlip(currentLayers);
+
+ mDirtyRegion.orSelf(getAndClearInvalidateRegion());
mDirtyRegion.andSelf(screenRegion);
}
@@ -1716,12 +1718,24 @@ status_t SurfaceFlinger::onTransact(
}
void SurfaceFlinger::repaintEverything() {
- Mutex::Autolock _l(mStateLock);
const DisplayHardware& hw(graphicPlane(0).displayHardware());
- mDirtyRegion.set(hw.bounds());
+ const Rect bounds(hw.getBounds());
+ setInvalidateRegion(Region(bounds));
signalEvent();
}
+void SurfaceFlinger::setInvalidateRegion(const Region& reg) {
+ Mutex::Autolock _l(mInvalidateLock);
+ mInvalidateRegion = reg;
+}
+
+Region SurfaceFlinger::getAndClearInvalidateRegion() {
+ Mutex::Autolock _l(mInvalidateLock);
+ Region reg(mInvalidateRegion);
+ mInvalidateRegion.clear();
+ return reg;
+}
+
// ---------------------------------------------------------------------------
status_t SurfaceFlinger::renderScreenToTexture(DisplayID dpy,
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 1490dec..ea5bfa7 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -303,6 +303,9 @@ private:
void composeSurfaces(const Region& dirty);
+ void setInvalidateRegion(const Region& reg);
+ Region getAndClearInvalidateRegion();
+
ssize_t addClientLayer(const sp<Client>& client,
const sp<LayerBaseClient>& lbc);
status_t addLayer_l(const sp<LayerBase>& layer);
@@ -348,6 +351,10 @@ private:
bool mLayersRemoved;
DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayerMap;
+ // access must be protected by mInvalidateLock
+ mutable Mutex mInvalidateLock;
+ Region mInvalidateRegion;
+
// constant members (no synchronization needed for access)
sp<IMemoryHeap> mServerHeap;
surface_flinger_cblk_t* mServerCblk;