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

Commit 85b2bdfe authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

SF: Rename functions related to mode switching

This change renames several function in SF in order to increase
readibility.

 * performSetActiveMode --> setActiveModeInHwcIfNeeded
 * setActiveModeInternal --> updateInternalStateWithChangedMode
 * setActiveMode --> setActiveModeFromBackdoor

This CL doesn't change behaviour.

Bug: 190982486
Test: m
Change-Id: I2723f66302016ffc196530f2000fce4a44524fb4
parent d1673fa2
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -1102,7 +1102,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) {
@@ -1143,7 +1143,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();
@@ -1198,9 +1198,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;
@@ -1235,8 +1234,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;
        }
@@ -1935,7 +1933,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) {
@@ -2002,7 +2000,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();
@@ -5611,7 +5609,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);