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

Commit 6d88ba44 authored by Alec Mouri's avatar Alec Mouri Committed by Automerger Merge Worker
Browse files

Merge "VirtualDisplaySurface propagate reallocation to VDS producer" am:...

Merge "VirtualDisplaySurface propagate reallocation to VDS producer" am: c1e78b2b am: 39917be3 am: 361be6e2

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1473598

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icb6ebc574e8f299dfb31466507c91c9d53d0a1eb
parents 7d75d16e 361be6e2
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, VirtualDisplayId d
        mOutputUsage(GRALLOC_USAGE_HW_COMPOSER),
        mProducerSlotSource(0),
        mProducerBuffers(),
        mProducerSlotNeedReallocation(0),
        mQueueBufferOutput(),
        mSinkBufferWidth(0),
        mSinkBufferHeight(0),
@@ -337,10 +338,14 @@ status_t VirtualDisplaySurface::dequeueBuffer(Source source,
            dbgSourceStr(source), *sslot, pslot, result);
    uint64_t sourceBit = static_cast<uint64_t>(source) << pslot;

    // reset producer slot reallocation flag
    mProducerSlotNeedReallocation &= ~(1ULL << pslot);

    if ((mProducerSlotSource & (1ULL << pslot)) != sourceBit) {
        // This slot was previously dequeued from the other source; must
        // re-request the buffer.
        result |= BUFFER_NEEDS_REALLOCATION;
        mProducerSlotNeedReallocation |= 1ULL << pslot;

        mProducerSlotSource &= ~(1ULL << pslot);
        mProducerSlotSource |= sourceBit;
    }
@@ -362,6 +367,9 @@ status_t VirtualDisplaySurface::dequeueBuffer(Source source,
                dbgSourceStr(source), pslot, mProducerBuffers[pslot].get(),
                mProducerBuffers[pslot]->getPixelFormat(),
                mProducerBuffers[pslot]->getUsage());

        // propagate reallocation to VDS consumer
        mProducerSlotNeedReallocation |= 1ULL << pslot;
    }

    return result;
@@ -436,6 +444,11 @@ status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp<Fence>* fence, uint
    if (outBufferAge) {
        *outBufferAge = 0;
    }

    if ((mProducerSlotNeedReallocation & (1ULL << *pslot)) != 0) {
        result |= BUFFER_NEEDS_REALLOCATION;
    }

    return result;
}

+4 −0
Original line number Diff line number Diff line
@@ -176,6 +176,10 @@ private:
    uint64_t mProducerSlotSource;
    sp<GraphicBuffer> mProducerBuffers[BufferQueueDefs::NUM_BUFFER_SLOTS];

    // Need to propagate reallocation to VDS consumer.
    // Each bit corresponds to a producer slot.
    uint64_t mProducerSlotNeedReallocation;

    // The QueueBufferOutput with the latest info from the sink, and with the
    // transform hint cleared. Since we defer queueBuffer from the GPU driver
    // to the sink, we have to return the previous version.