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

Commit 3ad977cc authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "SF: Rename functions related to mode switching"

parents ae75171d 85b2bdfe
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -1123,7 +1123,7 @@ void SurfaceFlinger::setDesiredActiveMode(const ActiveModeInfo& info) {
    }
}

status_t SurfaceFlinger::setActiveMode(const sp<IBinder>& displayToken, int modeId) {
status_t SurfaceFlinger::setActiveModeFromBackdoor(const sp<IBinder>& displayToken, int modeId) {
    ATRACE_CALL();

    if (!displayToken) {
@@ -1164,7 +1164,7 @@ status_t SurfaceFlinger::setActiveMode(const sp<IBinder>& displayToken, int mode
    return future.get();
}

void SurfaceFlinger::setActiveModeInternal() {
void SurfaceFlinger::updateInternalStateWithChangedMode() {
    ATRACE_CALL();

    const auto display = getDefaultDisplayDeviceLocked();
@@ -1219,9 +1219,8 @@ void SurfaceFlinger::desiredActiveModeChangeDone(const sp<DisplayDevice>& displa
    updatePhaseConfiguration(refreshRate);
}

void SurfaceFlinger::performSetActiveMode() {
void SurfaceFlinger::setActiveModeInHwcIfNeeded() {
    ATRACE_CALL();
    ALOGV("%s", __FUNCTION__);

    for (const auto& iter : mDisplays) {
        const auto& display = iter.second;
@@ -1256,8 +1255,7 @@ void SurfaceFlinger::performSetActiveMode() {
              to_string(display->getId()).c_str());

        if (display->getActiveMode()->getId() == desiredActiveMode->mode->getId()) {
            // display is not valid or we are already in the requested mode
            // on both cases there is nothing left to do
            // we are already in the requested mode, there is nothing left to do
            desiredActiveModeChangeDone(display);
            continue;
        }
@@ -1956,7 +1954,7 @@ bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expected
        // We received the present fence from the HWC, so we assume it successfully updated
        // the mode, hence we update SF.
        mSetActiveModePending = false;
        ON_MAIN_THREAD(setActiveModeInternal());
        ON_MAIN_THREAD(updateInternalStateWithChangedMode());
    }

    if (framePending) {
@@ -2023,7 +2021,7 @@ bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expected
        mScheduler->chooseRefreshRateForContent();
    }

    ON_MAIN_THREAD(performSetActiveMode());
    ON_MAIN_THREAD(setActiveModeInHwcIfNeeded());

    updateCursorAsync();
    updateInputFlinger();
@@ -5632,7 +5630,7 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                }();

                mDebugDisplayModeSetByBackdoor = false;
                const status_t result = setActiveMode(display, modeId);
                const status_t result = setActiveModeFromBackdoor(display, modeId);
                mDebugDisplayModeSetByBackdoor = result == NO_ERROR;
                return result;
            }
+3 −3
Original line number Diff line number Diff line
@@ -659,13 +659,13 @@ private:
    void onInitializeDisplays() REQUIRES(mStateLock);
    // Sets the desired active mode bit. It obtains the lock, and sets mDesiredActiveMode.
    void setDesiredActiveMode(const ActiveModeInfo& info) REQUIRES(mStateLock);
    status_t setActiveMode(const sp<IBinder>& displayToken, int id);
    status_t setActiveModeFromBackdoor(const sp<IBinder>& displayToken, int id);
    // Once HWC has returned the present fence, this sets the active mode and a new refresh
    // rate in SF.
    void setActiveModeInternal() REQUIRES(mStateLock);
    void updateInternalStateWithChangedMode() REQUIRES(mStateLock);
    // Calls to setActiveMode on the main thread if there is a pending mode change
    // that needs to be applied.
    void performSetActiveMode() REQUIRES(mStateLock);
    void setActiveModeInHwcIfNeeded() REQUIRES(mStateLock);
    void clearDesiredActiveModeState(const sp<DisplayDevice>&) REQUIRES(mStateLock);
    // Called when active mode is no longer is progress
    void desiredActiveModeChangeDone(const sp<DisplayDevice>&) REQUIRES(mStateLock);