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

Commit 1592f2b1 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Check for buffer changes explicitly instead of relying on acquire fence changes" into sc-dev

parents 53dc121e ddf9b5c4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -564,6 +564,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());
        }
    }