summaryrefslogtreecommitdiff
path: root/libs/gui/ISurfaceComposer.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2021-06-15 16:56:21 -0700
committer Ady Abraham <adyabr@google.com> 2021-06-17 16:43:54 -0700
commit899dcdb63ad9cb81d1987e89be08dc9603aad89b (patch)
treece6ea8bb20845f18d901fab94e2ba9027d2757db /libs/gui/ISurfaceComposer.cpp
parent0bde6b5a9837ab96484c988bb3f148d0b9b3ab4e (diff)
SF: change acquired buffers based on the current refresh rate
BLASTBufferQueue set the max acquired buffers based on SF vsync configuration (sf.duration and app.duration). This is calculated based on the max supported refresh rate on the device, and it turn is propogated to apps via min_undequeued_buffers to the app could allocate enough buffers for maintaining the pipeline SF expects. This leads to a higher latency when the device is running in a lower refresh rate as there are more buffers on the buffer queue then required. In this change we are holding on the these "extra buffers" and not releasing them back to the buffer queue so the app would use the number of buffers it needs based on the current refresh rate, and to avoid having unnecessary long latency. Bug: 188553729 Test: Run backpressure based game on 60Hz and 120Hz and collect systraces Change-Id: I9d4e6278f0ddd28008ac437ab0576aa79d05166a
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r--libs/gui/ISurfaceComposer.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 71e18a97c9..0d7795e1ba 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -1215,16 +1215,17 @@ public:
return reply.readInt32();
}
- status_t getExtraBufferCount(int* extraBuffers) const override {
+ status_t getMaxAcquiredBufferCount(int* buffers) const override {
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- status_t err = remote()->transact(BnSurfaceComposer::GET_EXTRA_BUFFER_COUNT, data, &reply);
+ status_t err =
+ remote()->transact(BnSurfaceComposer::GET_MAX_ACQUIRED_BUFFER_COUNT, data, &reply);
if (err != NO_ERROR) {
- ALOGE("getExtraBufferCount failed to read data: %s (%d)", strerror(-err), err);
+ ALOGE("getMaxAcquiredBufferCount failed to read data: %s (%d)", strerror(-err), err);
return err;
}
- return reply.readInt32(extraBuffers);
+ return reply.readInt32(buffers);
}
};
@@ -2069,14 +2070,14 @@ status_t BnSurfaceComposer::onTransact(
SAFE_PARCEL(reply->writeInt32, priority);
return NO_ERROR;
}
- case GET_EXTRA_BUFFER_COUNT: {
+ case GET_MAX_ACQUIRED_BUFFER_COUNT: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- int extraBuffers = 0;
- int err = getExtraBufferCount(&extraBuffers);
+ int buffers = 0;
+ int err = getMaxAcquiredBufferCount(&buffers);
if (err != NO_ERROR) {
return err;
}
- SAFE_PARCEL(reply->writeInt32, extraBuffers);
+ SAFE_PARCEL(reply->writeInt32, buffers);
return NO_ERROR;
}
case OVERRIDE_HDR_TYPES: {