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
This commit is contained in:
Ady Abraham
2021-05-18 14:00:07 -07:00
parent 216d32af4d
commit f558ab782c
3 changed files with 0 additions and 11 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;