From 12536a8fdae818ec39ae274d7da561480f4e1d61 Mon Sep 17 00:00:00 2001 From: silence_dogood Date: Fri, 7 Jun 2019 15:00:32 -0700 Subject: Cache NATIVE_WINDOW_MAX_BUFFER_COUNT in Surface To avoid the sync binder call to BufferQueue everytime vkGetPhysicalDeviceSurfaceCapabilitiesKHR is called, we cache the NATIVE_WINDOW_MAX_BUFFER_COUNT at the Surface each time the client connects. Bug: 133187007 Test: Vulkan cts tests Change-Id: I1942ff75ceb539c4904dc98c2e488c4d4cade31d --- libs/gui/Surface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs/gui/Surface.cpp') diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index e6eb327c6f..2e8a5d005b 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -96,6 +96,7 @@ Surface::Surface(const sp& bufferProducer, bool controll mConnectedToCpu = false; mProducerControlledByApp = controlledByApp; mSwapIntervalZero = false; + mMaxBufferCount = 0; } Surface::~Surface() { @@ -961,6 +962,10 @@ int Surface::query(int what, int* value) const { *value = static_cast(mDataSpace); return NO_ERROR; } + case NATIVE_WINDOW_MAX_BUFFER_COUNT: { + *value = mMaxBufferCount; + return NO_ERROR; + } } } return mGraphicBufferProducer->query(what, value); @@ -1298,6 +1303,7 @@ int Surface::connect( mDefaultWidth = output.width; mDefaultHeight = output.height; mNextFrameNumber = output.nextFrameNumber; + mMaxBufferCount = output.maxBufferCount; // Ignore transform hint if sticky transform is set or transform to display inverse flag is // set. Transform hint should be ignored if the client is expected to always submit buffers -- cgit v1.2.3-59-g8ed1b