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

Commit 56d89e9c authored by Surbhi Kadam's avatar Surbhi Kadam
Browse files

Enable tracing in VsyncModulator

Removes the use of "debug.sf.vsync_trace_detailed_info" prop to
enable tracing. Additionally, adds tracing to getNextVsyncConfigType to reason about why a given VsyncConfigType was selected.

Bug: 360338323

Test: manual, perfetto traces

Flag: EXEMPT log only update

Change-Id: Ifa21e301c9ee6874ebe7805d4ca30aeab24bf32d
parent 19c98feb
Loading
Loading
Loading
Loading
+13 −16
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@

#include "VsyncModulator.h"

#include <android-base/properties.h>
#include <common/trace.h>
#include <log/log.h>

@@ -37,8 +36,7 @@ const std::chrono::nanoseconds VsyncModulator::MIN_EARLY_TRANSACTION_TIME = 1ms;

VsyncModulator::VsyncModulator(const VsyncConfigSet& config, Now now)
      : mVsyncConfigSet(config),
        mNow(now),
        mTraceDetailedInfo(base::GetBoolProperty("debug.sf.vsync_trace_detailed_info", false)) {}
        mNow(now) {}

VsyncConfig VsyncModulator::setVsyncConfigSet(const VsyncConfigSet& config) {
    std::lock_guard<std::mutex> lock(mMutex);
@@ -71,10 +69,6 @@ VsyncModulator::VsyncConfigOpt VsyncModulator::setTransactionSchedule(Transactio
            break;
    }

    if (mTraceDetailedInfo) {
        SFTRACE_INT("mEarlyWakeup", static_cast<int>(mEarlyWakeupRequests.size()));
    }

    if (mEarlyWakeupRequests.empty() && schedule == Schedule::EarlyEnd) {
        mEarlyTransactionFrames = MIN_EARLY_TRANSACTION_FRAMES;
        mEarlyTransactionStartTime = mNow();
@@ -167,15 +161,19 @@ VsyncConfig VsyncModulator::updateVsyncConfigLocked() {
    const VsyncConfig& offsets = getNextVsyncConfig();
    mVsyncConfig = offsets;

    if (mTraceDetailedInfo) {
        const bool isEarly = &offsets == &mVsyncConfigSet.early;
        const bool isEarlyGpu = &offsets == &mVsyncConfigSet.earlyGpu;
        const bool isLate = &offsets == &mVsyncConfigSet.late;
    // Trace config type
    SFTRACE_INT("Vsync-Early",  &mVsyncConfig == &mVsyncConfigSet.early);
    SFTRACE_INT("Vsync-EarlyGpu", &mVsyncConfig == &mVsyncConfigSet.earlyGpu);
    SFTRACE_INT("Vsync-Late", &mVsyncConfig == &mVsyncConfigSet.late);

        SFTRACE_INT("Vsync-EarlyOffsetsOn", isEarly);
        SFTRACE_INT("Vsync-EarlyGpuOffsetsOn", isEarlyGpu);
        SFTRACE_INT("Vsync-LateOffsetsOn", isLate);
    }
    // Trace early vsync conditions
    SFTRACE_INT("EarlyWakeupRequests",
                                 static_cast<int>(mEarlyWakeupRequests.size()));
    SFTRACE_INT("EarlyTransactionFrames", mEarlyTransactionFrames);
    SFTRACE_INT("RefreshRateChangePending", mRefreshRateChangePending);

    // Trace early gpu conditions
    SFTRACE_INT("EarlyGpuFrames", mEarlyGpuFrames);

    return offsets;
}
@@ -183,7 +181,6 @@ VsyncConfig VsyncModulator::updateVsyncConfigLocked() {
void VsyncModulator::binderDied(const wp<IBinder>& who) {
    std::lock_guard<std::mutex> lock(mMutex);
    mEarlyWakeupRequests.erase(who);

    static_cast<void>(updateVsyncConfigLocked());
}

+0 −1
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ private:
    std::atomic<TimePoint> mLastTransactionCommitTime = TimePoint();

    const Now mNow;
    const bool mTraceDetailedInfo;
};

} // namespace android::scheduler