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

Commit 6f39b79a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Read PRESENT_FENCE_IS_NOT_RELIABLE once" into main

parents 9e77d9a5 e62606d5
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -854,6 +854,9 @@ void SurfaceFlinger::init() FTL_FAKE_GUARD(kMainThreadContext) {
    mCompositionEngine->getHwComposer().setCallback(*this);
    ClientCache::getInstance().setRenderEngine(&getRenderEngine());

    mHasReliablePresentFences =
            !getHwComposer().hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE);

    enableLatchUnsignaledConfig = getLatchUnsignaledConfig();

    if (base::GetBoolProperty("debug.sf.enable_hwc_vds"s, false)) {
@@ -927,9 +930,7 @@ void SurfaceFlinger::init() FTL_FAKE_GUARD(kMainThreadContext) {

    // Inform native graphics APIs whether the present timestamp is supported:

    const bool presentFenceReliable =
            !getHwComposer().hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE);
    mStartPropertySetThread = getFactory().createStartPropertySetThread(presentFenceReliable);
    mStartPropertySetThread = getFactory().createStartPropertySetThread(mHasReliablePresentFences);

    if (mStartPropertySetThread->Start() != NO_ERROR) {
        ALOGE("Run StartPropertySetThread failed!");
@@ -1003,9 +1004,7 @@ status_t SurfaceFlinger::getSupportedFrameTimestamps(
        FrameEvent::RELEASE,
    };

    ConditionalLock lock(mStateLock, std::this_thread::get_id() != mMainThreadId);

    if (!getHwComposer().hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE)) {
    if (mHasReliablePresentFences) {
        outSupported->push_back(FrameEvent::DISPLAY_PRESENT);
    }
    return NO_ERROR;
@@ -3031,10 +3030,9 @@ void SurfaceFlinger::onCompositionPresented(PhysicalDisplayId pacesetterId,
    // but that should be okay since CompositorTiming has snapping logic.
    const TimePoint compositeTime =
            TimePoint::fromNs(mCompositionEngine->getLastFrameRefreshTimestamp());
    const Duration presentLatency =
            getHwComposer().hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE)
            ? Duration::zero()
            : mPresentLatencyTracker.trackPendingFrame(compositeTime, pacesetterPresentFenceTime);
    const Duration presentLatency = mHasReliablePresentFences
            ? mPresentLatencyTracker.trackPendingFrame(compositeTime, pacesetterPresentFenceTime)
            : Duration::zero();

    const auto schedule = mScheduler->getVsyncSchedule();
    const TimePoint vsyncDeadline = schedule->vsyncDeadlineAfter(presentTime);
@@ -4357,7 +4355,7 @@ void SurfaceFlinger::initScheduler(const sp<const DisplayDevice>& display) {
        features |= Feature::kTracePredictedVsync;
    }
    if (!base::GetBoolProperty("debug.sf.vsync_reactor_ignore_present_fences"s, false) &&
        !getHwComposer().hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE)) {
        mHasReliablePresentFences) {
        features |= Feature::kPresentFences;
    }
    if (display->refreshRateSelector().kernelIdleTimerController()) {
+1 −0
Original line number Diff line number Diff line
@@ -1220,6 +1220,7 @@ private:
    // constant members (no synchronization needed for access)
    const nsecs_t mBootTime = systemTime();
    bool mIsUserBuild = true;
    bool mHasReliablePresentFences = false;

    // Can only accessed from the main thread, these members
    // don't need synchronization