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

Commit 86653e9e authored by Vishnu Nair's avatar Vishnu Nair
Browse files

SF: Add autorefresh to drawingstate

Autorefresh does not need to be an atomic variable. It is
only accessed from the main thread. Move it to drawing
state so it can be accessed from the base Layer class when
creating the starting state.

Test: presubmit
Bug: 200284593
Change-Id: I52a00c4185a3a883e4d5cf850257bb3a098b4d22
parent ca25186d
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -171,7 +171,7 @@ protected:
    // the mStateLock.
    // the mStateLock.
    ui::Transform::RotationFlags mTransformHint = ui::Transform::ROT_0;
    ui::Transform::RotationFlags mTransformHint = ui::Transform::ROT_0;


    bool getAutoRefresh() const { return mAutoRefresh; }
    bool getAutoRefresh() const { return mDrawingState.autoRefresh; }
    bool getSidebandStreamChanged() const { return mSidebandStreamChanged; }
    bool getSidebandStreamChanged() const { return mSidebandStreamChanged; }


    // Returns true if the next buffer should be presented at the expected present time
    // Returns true if the next buffer should be presented at the expected present time
@@ -182,7 +182,6 @@ protected:
    // specific logic
    // specific logic
    virtual bool isBufferDue(nsecs_t /*expectedPresentTime*/) const = 0;
    virtual bool isBufferDue(nsecs_t /*expectedPresentTime*/) const = 0;


    std::atomic<bool> mAutoRefresh{false};
    std::atomic<bool> mSidebandStreamChanged{false};
    std::atomic<bool> mSidebandStreamChanged{false};


private:
private:
+2 −2
Original line number Original line Diff line number Diff line
@@ -216,7 +216,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t
    bool autoRefresh;
    bool autoRefresh;
    status_t updateResult = mConsumer->updateTexImage(&r, expectedPresentTime, &autoRefresh,
    status_t updateResult = mConsumer->updateTexImage(&r, expectedPresentTime, &autoRefresh,
                                                      &queuedBuffer, maxFrameNumberToAcquire);
                                                      &queuedBuffer, maxFrameNumberToAcquire);
    mAutoRefresh = autoRefresh;
    mDrawingState.autoRefresh = autoRefresh;
    if (updateResult == BufferQueue::PRESENT_LATER) {
    if (updateResult == BufferQueue::PRESENT_LATER) {
        // Producer doesn't want buffer to be displayed yet.  Signal a
        // Producer doesn't want buffer to be displayed yet.  Signal a
        // layer update so we check again at the next opportunity.
        // layer update so we check again at the next opportunity.
@@ -300,7 +300,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t


    // Decrement the queued-frames count.  Signal another event if we
    // Decrement the queued-frames count.  Signal another event if we
    // have more frames pending.
    // have more frames pending.
    if ((queuedBuffer && more_frames_pending) || mAutoRefresh) {
    if ((queuedBuffer && more_frames_pending) || mDrawingState.autoRefresh) {
        mFlinger->onLayerUpdate();
        mFlinger->onLayerUpdate();
    }
    }


+1 −3
Original line number Original line Diff line number Diff line
@@ -660,9 +660,7 @@ bool BufferStateLayer::onPreComposition(nsecs_t refreshStartTime) {
}
}


void BufferStateLayer::setAutoRefresh(bool autoRefresh) {
void BufferStateLayer::setAutoRefresh(bool autoRefresh) {
    if (!mAutoRefresh.exchange(autoRefresh)) {
    mDrawingState.autoRefresh = autoRefresh;
        mFlinger->onLayerUpdate();
    }
}
}


bool BufferStateLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
bool BufferStateLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
+2 −0
Original line number Original line Diff line number Diff line
@@ -280,6 +280,8 @@ public:
        sp<IBinder> releaseBufferEndpoint;
        sp<IBinder> releaseBufferEndpoint;


        gui::DropInputMode dropInputMode;
        gui::DropInputMode dropInputMode;

        bool autoRefresh = false;
    };
    };


    /*
    /*