Add the MIN_UNDEQUEUED_BUFFERS query to ANW.
This change adds a new query to ANativeWindow for getting the minimum
number of buffers that must be left un-dequeued during the steady-state
operation of the ANativeWindow.
Change-Id: Ie8c461fc26b02ecde02ddb4f95bf763662cf1551
Related-Bug: 3356050
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index ee14ac9..43b330c 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -143,8 +143,21 @@
int SurfaceTextureClient::query(int what, int* value) {
LOGV("SurfaceTextureClient::query");
Mutex::Autolock lock(mMutex);
- // XXX: Implement this!
- return INVALID_OPERATION;
+ switch (what) {
+ case NATIVE_WINDOW_WIDTH:
+ case NATIVE_WINDOW_HEIGHT:
+ // XXX: How should SurfaceTexture behave if setBuffersGeometry didn't
+ // override the size?
+ *value = 0;
+ return NO_ERROR;
+ case NATIVE_WINDOW_FORMAT:
+ *value = DEFAULT_FORMAT;
+ return NO_ERROR;
+ case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
+ *value = MIN_UNDEQUEUED_BUFFERS;
+ return NO_ERROR;
+ }
+ return BAD_VALUE;
}
int SurfaceTextureClient::perform(int operation, va_list args)