Add interface for controlling single buffer auto refresh
- Adds a boolean to BufferQueue that controls whether or not auto
refresh is enabled in SurfaceFlinger when in single buffer mode.
- Adds plumbing up to ANativeWindow.
- When enabled, it will cache the shared buffer slot in Surface in
order to prevent the Binder transaction with SurfaceFlinger.
Bug 24940410
Change-Id: I83142afdc00e203f198a32288f071d926f8fda95
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp
index 2478601..c66694d 100644
--- a/libs/gui/IGraphicBufferProducer.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -52,6 +52,7 @@
SET_ASYNC_MODE,
GET_NEXT_FRAME_NUMBER,
SET_SINGLE_BUFFER_MODE,
+ SET_AUTO_REFRESH,
SET_DEQUEUE_TIMEOUT,
};
@@ -355,6 +356,18 @@
return result;
}
+ virtual status_t setAutoRefresh(bool autoRefresh) {
+ Parcel data, reply;
+ data.writeInterfaceToken(
+ IGraphicBufferProducer::getInterfaceDescriptor());
+ data.writeInt32(autoRefresh);
+ status_t result = remote()->transact(SET_AUTO_REFRESH, data, &reply);
+ if (result == NO_ERROR) {
+ result = reply.readInt32();
+ }
+ return result;
+ }
+
virtual status_t setDequeueTimeout(nsecs_t timeout) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
@@ -562,6 +575,13 @@
reply->writeInt32(result);
return NO_ERROR;
}
+ case SET_AUTO_REFRESH: {
+ CHECK_INTERFACE(IGraphicBuffer, data, reply);
+ bool autoRefresh = data.readInt32();
+ status_t result = setAutoRefresh(autoRefresh);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ }
case SET_DEQUEUE_TIMEOUT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
nsecs_t timeout = data.readInt64();