summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorManoj Kumar AVM <manojavm@codeaurora.org>2015-06-11 14:18:14 -0700
committerNaseer Ahmed <naseer@codeaurora.org>2015-06-11 18:21:18 -0400
commite54506b81a3b81683056ad48294e37d6b4b4e36b (patch)
treee8245742744aca2c92c58fde7ba7529425991c23 /services/surfaceflinger
parent85e271d051770fdd5bb1bb017255f735cbd45459 (diff)
downloadframeworks_native-e54506b81a3b81683056ad48294e37d6b4b4e36b.zip
frameworks_native-e54506b81a3b81683056ad48294e37d6b4b4e36b.tar.gz
frameworks_native-e54506b81a3b81683056ad48294e37d6b4b4e36b.tar.bz2
sf: Fix incorrect state reporting in dumpsys
Dumpsys utility accesses 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 displayLock mutex in HWComposer will be used in both dumpsys and draw calls to ensure correct state is accessed. Change-Id: I8a57de59525adc0e089b3bed95c067c01e42b666
Diffstat (limited to 'services/surfaceflinger')
-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 02c31ff..2dad005 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -635,6 +635,7 @@ status_t HWComposer::setFramebufferTarget(int32_t id,
}
status_t HWComposer::prepare() {
+ Mutex::Autolock _l(mDisplayLock);
for (size_t i=0 ; i<mNumDisplays ; i++) {
DisplayData& disp(mDisplayData[i]);
if (disp.framebufferTarget) {
@@ -1145,6 +1146,7 @@ static String8 getFormatStr(PixelFormat format) {
}
void HWComposer::dump(String8& result) const {
+ Mutex::Autolock _l(mDisplayLock);
if (mHwc) {
result.appendFormat("Hardware Composer state (version %08x):\n", hwcApiVersion(mHwc));
result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 28d8c65..cc98b4c 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -354,6 +354,8 @@ private:
// mLists[i>0] can be NULL. that display is to be ignored
struct hwc_display_contents_1* mLists[MAX_HWC_DISPLAYS];
DisplayData mDisplayData[MAX_HWC_DISPLAYS];
+ // protect mDisplayData from races between prepare and dump
+ mutable Mutex mDisplayLock;
size_t mNumDisplays;
cb_context* mCBContext;