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

Commit 5a4fce8f authored by Su Hong Koo's avatar Su Hong Koo
Browse files

SF: Invoke DisplayDevice::animate*Overlay() on all displays

Right now HDR:SDR ratio and refresh rate overlays are only animated on
active displays. This CL splits animateOverlay() into two, one for each
of the overlay, and invokes it for for all physical and virtual
displays in SurfaceFlinger. The animate function call should check for
presence of the overlay so no pre-check is required.

Flag: EXEMPT trivial refactor
Bug: 255635821
Test: Tested on a foldable with hdr/sdr ratio using made you look
Change-Id: I68f76bcbaecd2f0a1b429160fb6c119a6738ed8f
parent 8bdb01e9
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -475,11 +475,17 @@ void DisplayDevice::onVrrIdle(bool idle) {
    }
}

void DisplayDevice::animateOverlay() {
void DisplayDevice::animateRefreshRateOverlay() {
    if (mRefreshRateOverlay) {
        mRefreshRateOverlay->animate();
    }
    if (mHdrSdrRatioOverlay) {
}

void DisplayDevice::animateHdrSdrRatioOverlay() {
    if (!mHdrSdrRatioOverlay) {
        return;
    }

    // hdr sdr ratio is designed to be on the top right of the screen,
    // therefore, we need to re-calculate the display's width and height
    if (mIsOrientationChanged) {
@@ -492,7 +498,6 @@ void DisplayDevice::animateOverlay() {
    }
    mHdrSdrRatioOverlay->animate();
}
}

void DisplayDevice::adjustRefreshRate(Fps pacesetterDisplayRefreshRate) {
    using fps_approx_ops::operator<=;
+2 −1
Original line number Diff line number Diff line
@@ -220,7 +220,8 @@ public:
            REQUIRES(kMainThreadContext);
    void updateRefreshRateOverlayRate(Fps refreshRate, Fps renderFps, bool setByHwc = false);
    bool isRefreshRateOverlayEnabled() const { return mRefreshRateOverlay != nullptr; }
    void animateOverlay();
    void animateRefreshRateOverlay();
    void animateHdrSdrRatioOverlay();
    bool onKernelTimerChanged(std::optional<DisplayModeId>, bool timerExpired);
    void onVrrIdle(bool idle);

+9 −3
Original line number Diff line number Diff line
@@ -2778,10 +2778,16 @@ bool SurfaceFlinger::commit(PhysicalDisplayId pacesetterId,
        mPowerAdvisor->updateTargetWorkDuration(idealVsyncPeriod);
    }

    if (mRefreshRateOverlaySpinner || mHdrSdrRatioOverlay) {
    if (mRefreshRateOverlaySpinner) {
        Mutex::Autolock lock(mStateLock);
        if (const auto display = getDefaultDisplayDeviceLocked()) {
            display->animateOverlay();
        for (const auto& [_, display] : mDisplays) {
            display->animateRefreshRateOverlay();
        }
    }
    if (mHdrSdrRatioOverlay) {
        Mutex::Autolock lock(mStateLock);
        for (const auto& [_, display] : mDisplays) {
            display->animateHdrSdrRatioOverlay();
        }
    }