Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33a45704 authored by Manoj Kumar AVM's avatar Manoj Kumar AVM Committed by Steve Kondik
Browse files

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
parent 92e6ffa4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -632,6 +632,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) {
@@ -1139,6 +1140,7 @@ static String8 getFormatStr(PixelFormat format) {
}

void HWComposer::dump(String8& result) const {
    Mutex::Autolock _l(mDrawLock);
    if (mHwc) {
        result.appendFormat("Hardware Composer state (version %08x):\n", hwcApiVersion(mHwc));
        result.appendFormat("  mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
+2 −0
Original line number Diff line number Diff line
@@ -365,6 +365,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