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

Commit 8bbcf7b0 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5892339 from fcf2c201 to qt-qpr1-release

Change-Id: I7b1a6b5a1b7fd1709d3f581b68269f63b342d41d
parents 25b08902 fcf2c201
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ class LayerInfo {
        bool isLowActivityLayer() const {
            // We want to make sure that we received more than two frames from the layer
            // in order to check low activity.
            if (mElements.size() < 2) {
            if (mElements.size() < scheduler::LOW_ACTIVITY_BUFFERS + 1) {
                return false;
            }

@@ -118,7 +118,8 @@ class LayerInfo {
            // Check the frame before last to determine whether there is low activity.
            // If that frame is older than LOW_ACTIVITY_EPSILON_NS, the layer is sending
            // infrequent updates.
            if (mElements.at(mElements.size() - 2) < obsoleteEpsilon) {
            if (mElements.at(mElements.size() - (scheduler::LOW_ACTIVITY_BUFFERS + 1)) <
                obsoleteEpsilon) {
                return true;
            }

+4 −2
Original line number Diff line number Diff line
@@ -42,9 +42,11 @@ static constexpr uint32_t HWC2_SCREEN_OFF_CONFIG_ID = 0xffffffff;
// or waiting idle in messaging app, when cursor is blinking.
static constexpr std::chrono::nanoseconds OBSOLETE_TIME_EPSILON_NS = 1200ms;

// Layer is considered low activity if the buffers come more than LOW_ACTIVITY_EPSILON_NS
// apart. This is helping SF to vote for lower refresh rates when there is not activity
// Layer is considered low activity if the LOW_ACTIVITY_BUFFERS buffers come more than
// LOW_ACTIVITY_EPSILON_NS  apart.
// This is helping SF to vote for lower refresh rates when there is not activity
// in screen.
static constexpr int LOW_ACTIVITY_BUFFERS = 2;
static constexpr std::chrono::nanoseconds LOW_ACTIVITY_EPSILON_NS = 250ms;

// Calculates the statistical mean (average) in the data structure (array, vector). The
+28 −6
Original line number Diff line number Diff line
@@ -358,6 +358,11 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI
    mPropagateBackpressure = !atoi(value);
    ALOGI_IF(!mPropagateBackpressure, "Disabling backpressure propagation");

    property_get("debug.sf.enable_gl_backpressure", value, "0");
    mPropagateBackpressureClientComposition = atoi(value);
    ALOGI_IF(mPropagateBackpressureClientComposition,
             "Enabling backpressure propagation for Client Composition");

    property_get("debug.sf.enable_hwc_vds", value, "0");
    mUseHwcVirtualDisplays = atoi(value);
    ALOGI_IF(mUseHwcVirtualDisplays, "Enabling HWC virtual displays");
@@ -1676,7 +1681,8 @@ void SurfaceFlinger::updateVrFlinger() {
    setTransactionFlags(eDisplayTransactionNeeded);
}

bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS {
bool SurfaceFlinger::previousFrameMissed(int graceTimeMs) NO_THREAD_SAFETY_ANALYSIS {
    ATRACE_CALL();
    // We are storing the last 2 present fences. If sf's phase offset is to be
    // woken up before the actual vsync but targeting the next vsync, we need to check
    // fence N-2
@@ -1685,7 +1691,15 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS {
            ? mPreviousPresentFences[0]
            : mPreviousPresentFences[1];

    return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled);
    if (fence == Fence::NO_FENCE) {
        return false;
    }

    if (graceTimeMs > 0 && fence->getStatus() == Fence::Status::Unsignaled) {
        fence->wait(graceTimeMs);
    }

    return (fence->getStatus() == Fence::Status::Unsignaled);
}

void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS {
@@ -1708,7 +1722,15 @@ void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS {
            // seeing this same value.
            populateExpectedPresentTime();

            bool frameMissed = previousFrameMissed();
            // When Backpressure propagation is enabled we want to give a small grace period
            // for the present fence to fire instead of just giving up on this frame to handle cases
            // where present fence is just about to get signaled.
            const int graceTimeForPresentFenceMs =
                    (mPropagateBackpressure &&
                     (mPropagateBackpressureClientComposition || !mHadClientComposition))
                    ? 1
                    : 0;
            bool frameMissed = previousFrameMissed(graceTimeForPresentFenceMs);
            bool hwcFrameMissed = mHadDeviceComposition && frameMissed;
            bool gpuFrameMissed = mHadClientComposition && frameMissed;
            ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
@@ -1737,9 +1759,9 @@ void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS {
                break;
            }

            // For now, only propagate backpressure when missing a hwc frame.
            if (hwcFrameMissed && !gpuFrameMissed) {
                if (mPropagateBackpressure) {
            if (frameMissed && mPropagateBackpressure) {
                if ((hwcFrameMissed && !gpuFrameMissed) ||
                    mPropagateBackpressureClientComposition) {
                    signalLayerUpdate();
                    break;
                }
+2 −1
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ private:
        return hwcDisplayId ? getHwComposer().toPhysicalDisplayId(*hwcDisplayId) : std::nullopt;
    }

    bool previousFrameMissed();
    bool previousFrameMissed(int graceTimeMs = 0);
    void setVsyncEnabledInHWC(DisplayId displayId, HWC2::Vsync enabled);

    /*
@@ -1023,6 +1023,7 @@ private:
    volatile nsecs_t mDebugInTransaction = 0;
    bool mForceFullDamage = false;
    bool mPropagateBackpressure = true;
    bool mPropagateBackpressureClientComposition = false;
    std::unique_ptr<SurfaceInterceptor> mInterceptor;
    SurfaceTracing mTracing{*this};
    bool mTracingEnabled = false;