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

Commit 36d90979 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 e3f51f51
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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