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

Commit 406acb8c authored by Chia-I Wu's avatar Chia-I Wu
Browse files

surfaceflinger: skip buffer cache when BYPASS_IHWC

When SF talks to hwcomposer2 directly, we should skip HWC buffer
cache.  The cache works somehow similar to
IGraphicBufferConsumer::acquireBuffer, where buffer is set to
nullptr when it is already seen previously.  That confuses
hwcomposer2.

Bug: 35325794
Test: manual
Change-Id: I5306ecc9e7290bc6734091a9884024bf38667628
parent 33bc71ff
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -914,6 +914,10 @@ void HWComposerBufferCache::getHwcBuffer(int slot,
        const sp<GraphicBuffer>& buffer,
        const sp<GraphicBuffer>& buffer,
        uint32_t* outSlot, sp<GraphicBuffer>* outBuffer)
        uint32_t* outSlot, sp<GraphicBuffer>* outBuffer)
{
{
#ifdef BYPASS_IHWC
    *outSlot = slot;
    *outBuffer = buffer;
#else
    if (slot == BufferQueue::INVALID_BUFFER_SLOT || slot < 0) {
    if (slot == BufferQueue::INVALID_BUFFER_SLOT || slot < 0) {
        // default to slot 0
        // default to slot 0
        slot = 0;
        slot = 0;
@@ -934,6 +938,7 @@ void HWComposerBufferCache::getHwcBuffer(int slot,
        // update cache
        // update cache
        mBuffers[slot] = buffer;
        mBuffers[slot] = buffer;
    }
    }
#endif
}
}


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------