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

Commit 82386cd4 authored by Stephen Kiazyk's avatar Stephen Kiazyk
Browse files

Prevent buggy display orientation when exiting vr

The underlying issue is that the viewport settings were being re-set to
(0,0,-1,-1) on every transition to VR. I've instead extracted the vsync
period updates, and only apply those, as that was really all we wanted
out of it.

Bug: 37093920
Test: Compile and run Vr application. The 2d scene is now no longer in
the weird landscape viewport with portrait orientation if the phone is
in landscape when exiting VR mode.

Change-Id: I2bab6e4d834e15f477d1b56991375d1a18a77b8c
parent 7d3dcb92
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1251,7 +1251,6 @@ void SurfaceFlinger::resetHwcLocked() {
    // transition.
    mDrawingState.displays.clear();
    mDisplays.clear();
    initializeDisplays();
}

void SurfaceFlinger::updateVrFlinger() {
@@ -1298,6 +1297,12 @@ void SurfaceFlinger::updateVrFlinger() {
    // parts of this class rely on the primary display always being available.
    createDefaultDisplayDevice();

    // Reset the timing values to account for the period of the swapped in HWC
    const auto& activeConfig = mHwc->getActiveConfig(HWC_DISPLAY_PRIMARY);
    const nsecs_t period = activeConfig->getVsyncPeriod();
    mAnimFrameTracker.setDisplayRefreshPeriod(period);
    setCompositorTimingSnapped(0, period, 0);

    android_atomic_or(1, &mRepaintEverything);
    setTransactionFlags(eDisplayTransactionNeeded);
}