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

Commit 1b700199 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

SF: Remove layer mRefreshPending tracking

This flag was used to ensure we do not latch a
second buffer without going through the
composition stage. This flag is not needed because
if we latch a buffer, then we are guaranteed to go
into the composition stage.

Incentive for this change: to rebuild the layer state,
via layertracegenerator, we invoke the commit stage
over and over again. This flag prevents us from
latching another buffer because the tool does not
call composite.

Test: presubmit, also presubmit with fatal log if we ever try
to latch when mRefreshPending is true (ag/16790650)

Bug: 200284593
Change-Id: I332349865b19ae7a205002167f26f5a2f76688af
parent c945c1b8
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ status_t LayerDebugInfo::writeToParcel(Parcel* parcel) const {
    RETURN_ON_ERROR(parcel->writeInt32(mActiveBufferStride));
    RETURN_ON_ERROR(parcel->writeInt32(mActiveBufferFormat));
    RETURN_ON_ERROR(parcel->writeInt32(mNumQueuedFrames));
    RETURN_ON_ERROR(parcel->writeBool(mRefreshPending));
    RETURN_ON_ERROR(parcel->writeBool(mIsOpaque));
    RETURN_ON_ERROR(parcel->writeBool(mContentDirty));
    RETURN_ON_ERROR(parcel->write(mStretchEffect));
@@ -103,7 +102,6 @@ status_t LayerDebugInfo::readFromParcel(const Parcel* parcel) {
    RETURN_ON_ERROR(parcel->readInt32(&mActiveBufferStride));
    RETURN_ON_ERROR(parcel->readInt32(&mActiveBufferFormat));
    RETURN_ON_ERROR(parcel->readInt32(&mNumQueuedFrames));
    RETURN_ON_ERROR(parcel->readBool(&mRefreshPending));
    RETURN_ON_ERROR(parcel->readBool(&mIsOpaque));
    RETURN_ON_ERROR(parcel->readBool(&mContentDirty));
    RETURN_ON_ERROR(parcel->read(mStretchEffect));
@@ -146,8 +144,7 @@ std::string to_string(const LayerDebugInfo& info) {
    StringAppendF(&result, "      activeBuffer=[%4ux%4u:%4u,%s],", info.mActiveBufferWidth,
                  info.mActiveBufferHeight, info.mActiveBufferStride,
                  decodePixelFormat(info.mActiveBufferFormat).c_str());
    StringAppendF(&result, " queued-frames=%d, mRefreshPending=%d", info.mNumQueuedFrames,
                  info.mRefreshPending);
    StringAppendF(&result, " queued-frames=%d", info.mNumQueuedFrames);
    result.append("\n");
    return result;
}
+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ public:
    int32_t mActiveBufferStride = 0;
    PixelFormat mActiveBufferFormat = PIXEL_FORMAT_NONE;
    int32_t mNumQueuedFrames = -1;
    bool mRefreshPending = false;
    bool mIsOpaque = false;
    bool mContentDirty = false;
    StretchEffect mStretchEffect = {};
+0 −16
Original line number Diff line number Diff line
@@ -319,7 +319,6 @@ bool BufferLayer::onPreComposition(nsecs_t refreshStartTime) {
        Mutex::Autolock lock(mFrameEventHistoryMutex);
        mFrameEventHistory.addPreComposition(mCurrentFrameNumber, refreshStartTime);
    }
    mRefreshPending = false;
    return hasReadyFrame();
}
namespace {
@@ -474,19 +473,6 @@ bool BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime,
        return refreshRequired;
    }

    if (!hasReadyFrame()) {
        return false;
    }

    // if we've already called updateTexImage() without going through
    // a composition step, we have to skip this layer at this point
    // because we cannot call updateTeximage() without a corresponding
    // compositionComplete() call.
    // we'll trigger an update in onPreComposition().
    if (mRefreshPending) {
        return false;
    }

    // If the head buffer's acquire fence hasn't signaled yet, return and
    // try again later
    if (!fenceHasSignaled()) {
@@ -518,7 +504,6 @@ bool BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime,

    gatherBufferInfo();

    mRefreshPending = true;
    if (oldBufferInfo.mBuffer == nullptr) {
        // the first time we receive a buffer, we need to trigger a
        // geometry invalidation.
@@ -689,7 +674,6 @@ FloatRect BufferLayer::computeSourceBounds(const FloatRect& parentBounds) const
}

void BufferLayer::latchAndReleaseBuffer() {
    mRefreshPending = false;
    if (hasReadyFrame()) {
        bool ignored = false;
        latchBuffer(ignored, systemTime(), 0 /* expectedPresentTime */);
+0 −6
Original line number Diff line number Diff line
@@ -88,9 +88,6 @@ public:
    // to figure out if the content or size of a surface has changed.
    bool latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime,
                     nsecs_t expectedPresentTime) override;

    bool isBufferLatched() const override { return mRefreshPending; }

    bool hasReadyFrame() const override;

    // Returns the current scaling mode
@@ -158,9 +155,6 @@ protected:

    // from graphics API
    const uint32_t mTextureName;

    bool mRefreshPending{false};

    ui::Dataspace translateDataspace(ui::Dataspace dataspace);
    void setInitialValuesForClone(const sp<Layer>& clonedFrom);
    void updateCloneBufferInfo() override;
+0 −2
Original line number Diff line number Diff line
@@ -1398,7 +1398,6 @@ LayerDebugInfo Layer::getLayerDebugInfo(const DisplayDevice* display) const {
        }
    }
    info.mNumQueuedFrames = getQueuedFrameCount();
    info.mRefreshPending = isBufferLatched();
    info.mIsOpaque = isOpaque(ds);
    info.mContentDirty = contentDirty;
    info.mStretchEffect = getStretchEffect();
@@ -2029,7 +2028,6 @@ void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags,
    layerInfo->set_is_protected(isProtected());
    layerInfo->set_dataspace(dataspaceDetails(static_cast<android_dataspace>(getDataSpace())));
    layerInfo->set_queued_frames(getQueuedFrameCount());
    layerInfo->set_refresh_pending(isBufferLatched());
    layerInfo->set_curr_frame(mCurrentFrameNumber);
    layerInfo->set_effective_scaling_mode(getEffectiveScalingMode());

Loading