summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoj Kumar AVM <manojavm@codeaurora.org>2014-03-04 18:15:03 -0800
committerSteve Kondik <shade@chemlab.org>2014-08-30 15:34:59 -0700
commit36d90979bf9bb532ee4b097b816140de59bafd69 (patch)
treed33752a5ba7d123f5509018ef9293a73f25aa991
parente3f51f51d157e9400d531e7d415dbafdcd964a3c (diff)
downloadandroid_frameworks_native-36d90979bf9bb532ee4b097b816140de59bafd69.tar.gz
android_frameworks_native-36d90979bf9bb532ee4b097b816140de59bafd69.tar.bz2
android_frameworks_native-36d90979bf9bb532ee4b097b816140de59bafd69.zip
sf: Fix incorrect state reporting in dumpsys
Dumpsys utility access layer compositionType variable with out proper protection. These variables are modified during hwc_prepare call. Existing HAL lock protection is not sufficient to address this issue. Failure to do this will result in incorrect state reporting in dumpsys. A new drawLock mutex in HWComposer that will be used in both dumpsys and draw calls to ensure correct state is accessed. Change-Id: I6289e0a3d1f5bbf35a18ddcd0538c9cda3e96c27
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp2
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index f123e6dd0..bc67dfda7 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -733,6 +733,7 @@ status_t HWComposer::setFramebufferTarget(int32_t id,
}
status_t HWComposer::prepare() {
+ Mutex::Autolock _l(mDrawLock);
for (size_t i=0 ; i<mNumDisplays ; i++) {
DisplayData& disp(mDisplayData[i]);
if (disp.framebufferTarget) {
@@ -1375,6 +1376,7 @@ HWComposer::LayerListIterator HWComposer::end(int32_t id) {
}
void HWComposer::dump(String8& result) const {
+ Mutex::Autolock _l(mDrawLock);
if (mHwc) {
result.appendFormat("Hardware Composer state (version %8x):\n", hwcApiVersion(mHwc));
result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 1969349d8..c8d2b57e6 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -369,6 +369,8 @@ private:
// protected by mLock
mutable Mutex mLock;
+ // synchronization between Draw call and Dumpsys call
+ mutable Mutex mDrawLock;
mutable nsecs_t mLastHwVSync[HWC_NUM_PHYSICAL_DISPLAY_TYPES];
// thread-safe