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

Commit f558ab78 authored by Ady Abraham's avatar Ady Abraham
Browse files

Remove the extra buffer allocation from hwui

SurfaceFlinger will set the maxAcquiredBufferCount on the buffer queue
to account for the extra buffers needed, depends on the refresh rate
and app/sf durations, and there is no needed for any addional buffer
allocation is hwui.

Test: TBD
Bug: 188553729
Change-Id: Ic441a6feb15f6b084d45c9e538b11b7b24e36a0e
parent 216d32af
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -174,16 +174,12 @@ void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) {
    ATRACE_CALL();

    if (window) {
        int extraBuffers = 0;
        native_window_get_extra_buffer_count(window, &extraBuffers);

        mNativeSurface = std::make_unique<ReliableSurface>(window);
        mNativeSurface->init();
        if (enableTimeout) {
            // TODO: Fix error handling & re-shorten timeout
            ANativeWindow_setDequeueTimeout(window, 4000_ms);
        }
        mNativeSurface->setExtraBufferCount(extraBuffers);
    } else {
        mNativeSurface = nullptr;
    }
+0 −1
Original line number Diff line number Diff line
@@ -278,7 +278,6 @@ int ReliableSurface::hook_query(const ANativeWindow *window, ANativeWindow_query
    int result = query(window, what, value);
    if (what == ANATIVEWINDOW_QUERY_MIN_UNDEQUEUED_BUFFERS && result == OK) {
        std::lock_guard _lock{rs->mMutex};
        *value += rs->mExtraBuffers;
        rs->mExpectedBufferCount = *value + 2;
    }
    return result;
+0 −6
Original line number Diff line number Diff line
@@ -51,11 +51,6 @@ public:
        return ret;
    }

    void setExtraBufferCount(size_t extraBuffers) {
        std::lock_guard _lock{mMutex};
        mExtraBuffers = extraBuffers;
    }

    bool didSetExtraBuffers() const {
        std::lock_guard _lock{mMutex};
        return mDidSetExtraBuffers;
@@ -73,7 +68,6 @@ private:
    base::unique_fd mReservedFenceFd;
    bool mHasDequeuedBuffer = false;
    int mBufferQueueState = OK;
    size_t mExtraBuffers = 0;
    size_t mExpectedBufferCount = 0;
    bool mDidSetExtraBuffers = false;