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

Commit 0123ac61 authored by Steven Thomas's avatar Steven Thomas
Browse files

Fix display power state reset in vr flinger path

Some code refactoring in ag/4355343 accidentally broke vr flinger. When
switching to vr flinger, we call setPowerModeInternal() to reset the
display state. With ag/4355343, we were incorrectly holding on to a
stale display, causing us to early exit from setPowerModeInternal() and
not apply the display power state change.

Bug: 111398862

Test: Manually ran vr flinger, confirmed it works again after applying
this CL.

Change-Id: Idbead0338f9219c80cb8a2d9f283daefff373a33
parent d544a9c2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1429,9 +1429,13 @@ void SurfaceFlinger::updateVrFlinger() {

    Mutex::Autolock _l(mStateLock);

    const auto display = getDefaultDisplayDeviceLocked();
    sp<DisplayDevice> display = getDefaultDisplayDeviceLocked();
    LOG_ALWAYS_FATAL_IF(!display);
    const int currentDisplayPowerMode = display->getPowerMode();
    // This DisplayDevice will no longer be relevant once resetDisplayState() is
    // called below. Clear the reference now so we don't accidentally use it
    // later.
    display.clear();

    if (!vrFlingerRequestsDisplay) {
        mVrFlinger->SeizeDisplayOwnership();
@@ -1456,6 +1460,8 @@ void SurfaceFlinger::updateVrFlinger() {
    invalidateHwcGeometry();

    // Re-enable default display.
    display = getDefaultDisplayDeviceLocked();
    LOG_ALWAYS_FATAL_IF(!display);
    setPowerModeInternal(display, currentDisplayPowerMode, /*stateLockHeld*/ true);

    // Reset the timing values to account for the period of the swapped in HWC