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

Commit 65b8e872 authored by Valerie Hau's avatar Valerie Hau
Browse files

Move maxAcquired back to 1 and set maxDequeued

BufferQueue internally already limits number of acquired buffers to be 1
more than the maxAcquired set.  We want to be able to acquire 2, so
setting back to 1.  Enable triple buffering through maxDequeuedCount.

Bug: 146345307
Test: build, boot, turn BLAST ON, run manually, libgui_test
Change-Id: I1deff382da3b37a2bde840802fdc4c10a8b868ed
parent edd6bc95
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@

#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include <cutils/properties.h>

#include <gui/BLASTBufferQueue.h>
#include <gui/BufferItemConsumer.h>
#include <gui/GLConsumer.h>
@@ -99,7 +101,11 @@ BLASTBufferQueue::BLASTBufferQueue(const sp<SurfaceControl>& surface, int width,
        mHeight(height),
        mNextTransaction(nullptr) {
    BufferQueue::createBufferQueue(&mProducer, &mConsumer);
    mConsumer->setMaxAcquiredBufferCount(MAX_ACQUIRED_BUFFERS);

    int8_t disableTripleBuffer = property_get_bool("ro.sf.disable_triple_buffer", 0);
    if (!disableTripleBuffer) {
        mProducer->setMaxDequeuedBufferCount(2);
    }
    mBufferItemConsumer =
            new BLASTBufferItemConsumer(mConsumer, AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER, 1, true);
    static int32_t id = 0;
@@ -181,7 +187,7 @@ void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp<Fence

void BLASTBufferQueue::processNextBufferLocked() {
    ATRACE_CALL();
    if (mNumFrameAvailable == 0 || mNumAcquired == MAX_ACQUIRED_BUFFERS) {
    if (mNumFrameAvailable == 0 || mNumAcquired == MAX_ACQUIRED_BUFFERS + 1) {
        return;
    }

+3 −1
Original line number Diff line number Diff line
@@ -98,7 +98,9 @@ private:
    std::mutex mMutex;
    std::condition_variable mCallbackCV;

    static const int MAX_ACQUIRED_BUFFERS = 2;
    // BufferQueue internally allows 1 more than
    // the max to be acquired
    static const int MAX_ACQUIRED_BUFFERS = 1;

    int32_t mNumFrameAvailable GUARDED_BY(mMutex);
    int32_t mNumAcquired GUARDED_BY(mMutex);