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

Commit ddf9b5c4 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Check for buffer changes explicitly instead of relying on acquire fence changes

Bug: 183997574
Test: atest ASurfaceControlTest
Change-Id: I4eabec13faa09b3d1f61d62e637b83baa720797d
parent 345c3c1b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -563,6 +563,10 @@ void layer_state_t::merge(const layer_state_t& other) {
    }
}

bool layer_state_t::hasBufferChanges() const {
    return (what & layer_state_t::eBufferChanged) || (what & layer_state_t::eCachedBufferChanged);
}

status_t layer_state_t::matrix22_t::write(Parcel& output) const {
    SAFE_PARCEL(output.writeFloat, dsdx);
    SAFE_PARCEL(output.writeFloat, dtdx);
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ struct layer_state_t {
    void merge(const layer_state_t& other);
    status_t write(Parcel& output) const;
    status_t read(const Parcel& input);
    bool hasBufferChanges() const;

    struct matrix22_t {
        float dsdx{0};
+3 −3
Original line number Diff line number Diff line
@@ -3457,7 +3457,7 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied(
        sp<Layer> layer = nullptr;
        if (s.surface) {
            layer = fromHandleLocked(s.surface).promote();
        } else if (acquireFenceChanged) {
        } else if (s.hasBufferChanges()) {
            ALOGW("Transaction with buffer, but no Layer?");
            continue;
        }
@@ -3467,7 +3467,7 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied(

        ATRACE_NAME(layer->getName().c_str());

        if (acquireFenceChanged) {
        if (s.hasBufferChanges()) {
            // If backpressure is enabled and we already have a buffer to commit, keep the
            // transaction in the queue.
            const bool hasPendingBuffer = pendingBuffers.find(s.surface) != pendingBuffers.end();
@@ -3550,7 +3550,7 @@ status_t SurfaceFlinger::setTransactionState(

    // Check for incoming buffer updates and increment the pending buffer count.
    for (const auto& state : states) {
        if ((state.state.what & layer_state_t::eAcquireFenceChanged) && (state.state.surface)) {
        if (state.state.hasBufferChanges() && (state.state.surface)) {
            mBufferCountTracker.increment(state.state.surface->localBinder());
        }
    }