libgui: Add dequeue/attach timeout
Adds the ability to specify the timeout when dequeueBuffer or
attachBuffer block due to the lack of a free buffer/slot. By default,
these will block indefinitely (which is signified by a timeout of -1).
When a timeout (other than -1) is specified, non-blocking mode is
disabled and the given timeout will be used instead.
Bug: 25196773
Change-Id: I17fdbeebccb7c8d878703d758ac1209608258e61
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
index f8fe8e1..64c1dd9 100644
--- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
@@ -551,6 +551,11 @@
return mSource[SOURCE_SINK]->setSingleBufferMode(singleBufferMode);
}
+status_t VirtualDisplaySurface::setDequeueTimeout(nsecs_t /* timeout */) {
+ ALOGE("setDequeueTimeout not supported on VirtualDisplaySurface");
+ return INVALID_OPERATION;
+}
+
void VirtualDisplaySurface::updateQueueBufferOutput(
const QueueBufferOutput& qbo) {
uint32_t w, h, transformHint, numPendingBuffers;
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h
index bde7fcf..7f451a9 100644
--- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h
+++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h
@@ -120,7 +120,8 @@
virtual status_t setGenerationNumber(uint32_t generationNumber);
virtual String8 getConsumerName() const override;
virtual uint64_t getNextFrameNumber() const override;
- virtual status_t setSingleBufferMode(bool singleBufferMode);
+ virtual status_t setSingleBufferMode(bool singleBufferMode) override;
+ virtual status_t setDequeueTimeout(nsecs_t timeout) override;
//
// Utility methods