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

Commit 4565daa6 authored by Brian Anderson's avatar Brian Anderson
Browse files

Suppress unnecessary "frame not found" errors.

ConsumerFrameEventHistory only stores 8 frames of history,
but video can queue more than 8 frames, which triggers
some annoying ALOGE messages that aren't really errors.

This patch makes sure to print the error only if the
producer has enabled the frame events, which only happens
with EGL where we won't see more than 3 frames queued.

Test: This only affects error reporting.

Change-Id: I184202a71f5fe29159c148957b92fb2e856bf625
parent 3d4039d7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -199,6 +199,8 @@ private:
    size_t mCompositionOffset{0};
    size_t mRetireOffset{0};
    size_t mReleaseOffset{0};

    bool mProducerWantsEvents{false};
};


+7 −6
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ void ConsumerFrameEventHistory::addLatch(
        uint64_t frameNumber, nsecs_t latchTime) {
    FrameEvents* frame = getFrame(frameNumber, &mCompositionOffset);
    if (frame == nullptr) {
        ALOGE("ConsumerFrameEventHistory::addLatch: Did not find frame.");
        ALOGE_IF(mProducerWantsEvents, "addLatch: Did not find frame.");
        return;
    }
    frame->latchTime = latchTime;
@@ -360,8 +360,8 @@ void ConsumerFrameEventHistory::addPreComposition(
        uint64_t frameNumber, nsecs_t refreshStartTime) {
    FrameEvents* frame = getFrame(frameNumber, &mCompositionOffset);
    if (frame == nullptr) {
        ALOGE("ConsumerFrameEventHistory::addPreComposition: "
              "Did not find frame.");
        ALOGE_IF(mProducerWantsEvents,
                "addPreComposition: Did not find frame.");
        return;
    }
    frame->lastRefreshStartTime = refreshStartTime;
@@ -377,8 +377,8 @@ void ConsumerFrameEventHistory::addPostComposition(uint64_t frameNumber,
        const std::shared_ptr<FenceTime>& displayPresent) {
    FrameEvents* frame = getFrame(frameNumber, &mCompositionOffset);
    if (frame == nullptr) {
        ALOGE("ConsumerFrameEventHistory::addPostComposition: "
              "Did not find frame.");
        ALOGE_IF(mProducerWantsEvents,
                "addPostComposition: Did not find frame.");
        return;
    }
    // Only get GPU and present info for the first composite.
@@ -397,7 +397,7 @@ void ConsumerFrameEventHistory::addRetire(
        uint64_t frameNumber, const std::shared_ptr<FenceTime>& displayRetire) {
    FrameEvents* frame = getFrame(frameNumber, &mRetireOffset);
    if (frame == nullptr) {
        ALOGE("ConsumerFrameEventHistory::addRetire: Did not find frame.");
        ALOGE_IF(mProducerWantsEvents, "addRetire: Did not find frame.");
        return;
    }
    frame->addRetireCalled = true;
@@ -420,6 +420,7 @@ void ConsumerFrameEventHistory::addRelease(
void ConsumerFrameEventHistory::getFrameDelta(
        FrameEventHistoryDelta* delta,
        const std::array<FrameEvents, MAX_FRAME_HISTORY>::iterator& frame) {
    mProducerWantsEvents = true;
    size_t i = static_cast<size_t>(std::distance(mFrames.begin(), frame));
    if (mFramesDirty[i].anyDirty()) {
        delta->mDeltas.emplace_back(i, *frame, mFramesDirty[i]);