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

Commit 49cea519 authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Fully disable content detection if opted out

Layer history was created but not recorded/traversed on devices without
refresh rate switching. ag/9549429 destroys stale history on traversal,
so the LayerInfo records were leaked.

Bug: 144363590
Test: Layer history is not created on crosshatch
Change-Id: I45ebc7c4f8447b2bc2bfb1af01325d562b4afed1
parent e00dd195
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -400,11 +400,9 @@ void BufferQueueLayer::onFrameAvailable(const BufferItem& item) {
    ATRACE_CALL();
    // Add this buffer from our internal queue tracker
    { // Autolock scope
        if (mFlinger->mUseSmart90ForVideo) {
        const nsecs_t presentTime = item.mIsAutoTimestamp ? 0 : item.mTimestamp;
            mFlinger->mScheduler->recordLayerHistory(this, presentTime,
                                                     item.mHdrMetadata.validTypes != 0);
        }
        const bool isHDR = item.mHdrMetadata.validTypes != 0;
        mFlinger->mScheduler->recordLayerHistory(this, presentTime, isHDR);

        Mutex::Autolock lock(mQueueItemLock);
        // Reset the frame number tracker when we receive the first buffer after
+2 −5
Original line number Diff line number Diff line
@@ -247,11 +247,8 @@ bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer, nsecs_t postTi
                                           FrameTracer::FrameEvent::POST);
    mCurrentState.desiredPresentTime = desiredPresentTime;

    if (mFlinger->mUseSmart90ForVideo) {
        const nsecs_t presentTime = (desiredPresentTime == -1) ? 0 : desiredPresentTime;
        mFlinger->mScheduler->recordLayerHistory(this, presentTime,
                                                 mCurrentState.hdrMetadata.validTypes != 0);
    }
    const bool isHDR = mCurrentState.hdrMetadata.validTypes != 0;
    mFlinger->mScheduler->recordLayerHistory(this, desiredPresentTime, isHDR);

    return true;
}
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
namespace android {

class Layer;
class TestableScheduler;

namespace scheduler {

@@ -59,6 +60,7 @@ public:

private:
    friend class LayerHistoryTest;
    friend TestableScheduler;

    using LayerPair = std::pair<wp<Layer>, std::unique_ptr<LayerInfo>>;
    using LayerInfos = std::vector<LayerPair>;
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ LayerInfo::LayerInfo(float lowRefreshRate, float highRefreshRate)
      : mLowRefreshRate(lowRefreshRate), mHighRefreshRate(highRefreshRate) {}

void LayerInfo::setLastPresentTime(nsecs_t lastPresentTime, nsecs_t now) {
    lastPresentTime = std::max(lastPresentTime, static_cast<nsecs_t>(0));

    // Buffers can come with a present time far in the future. That keeps them relevant.
    mLastUpdatedTime = std::max(lastPresentTime, now);
    mPresentTimeHistory.insertPresentTime(mLastUpdatedTime);
+8 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "OneShotTimer.h"

#include <chrono>
#include <sstream>
#include <thread>

namespace android {
@@ -98,7 +99,7 @@ void OneShotTimer::loop() {
            mTimeoutCallback();
        }
    }
} // namespace scheduler
}

void OneShotTimer::reset() {
    {
@@ -108,5 +109,11 @@ void OneShotTimer::reset() {
    mCondition.notify_all();
}

std::string OneShotTimer::dump() const {
    std::ostringstream stream;
    stream << mInterval.count() << " ms";
    return stream.str();
}

} // namespace scheduler
} // namespace android
Loading