summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-10-21 15:18:28 -0700
committer The Android Automerger <android-build@android.com> 2011-10-21 17:04:05 -0700
commit0ef47a6a150ea0bf41cdebd2b34bb1d72696ef8c (patch)
tree87a39b5cdbf821691c07080240b08e1ff7e1d3a7 /services/surfaceflinger/SurfaceFlinger.cpp
parent69bd1e50f8defdfcd41979cffd7a7733368cff33 (diff)
mDirtyRegion is single threaded, but could be accessed from a hwc thread
We now have mInvalidateRegion which holds the region to invalidate, it can be set from any thread as long as mInvalidateLock is held. We use fine-grained locking here because mInvalidateRegion can be set from anywhere, in particular frmo HWC callbacks. Bug: 5466774 Change-Id: Iafca20aa3f5b25a87755e65bde7b769aa8f997bc
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4b2866cb67..ba8f6308b1 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -788,6 +788,8 @@ void SurfaceFlinger::handlePageFlip()
}
unlockPageFlip(currentLayers);
+
+ mDirtyRegion.orSelf(getAndClearInvalidateRegion());
mDirtyRegion.andSelf(screenRegion);
}
@@ -1798,12 +1800,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,