Cache NATIVE_WINDOW_MAX_BUFFER_COUNT in Surface
To avoid the sync binder call to BufferQueue everytime
vkGetPhysicalDeviceSurfaceCapabilitiesKHR and
GetPhysicalDeviceSurfacePresentModesKHR are called, we cache the
NATIVE_WINDOW_MAX_BUFFER_COUNT at the Surface each time the client
connects.
Bug: 133187007
Test: dEQP-VK.wsi.android.surface#query_present_modes,
libgui_test:BufferQueueTest#GetMaxBufferCountInQueueBufferOutput_Succeeds
Change-Id: I7c1a0e99d73151cd451a2f3cb173f843efd57ce1
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 9c311a3..b9a4749 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -1132,9 +1132,6 @@
case NATIVE_WINDOW_CONSUMER_IS_PROTECTED:
value = static_cast<int32_t>(mCore->mConsumerIsProtected);
break;
- case NATIVE_WINDOW_MAX_BUFFER_COUNT:
- value = static_cast<int32_t>(mCore->mMaxBufferCount);
- break;
default:
return BAD_VALUE;
}
@@ -1199,6 +1196,7 @@
static_cast<uint32_t>(mCore->mQueue.size());
output->nextFrameNumber = mCore->mFrameCounter + 1;
output->bufferReplaced = false;
+ output->maxBufferCount = mCore->mMaxBufferCount;
if (listener != nullptr) {
// Set up a death notification so that we can disconnect