summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2019-12-09 17:10:24 -0800
committer Alec Mouri <alecmouri@google.com> 2020-01-23 18:49:03 -0800
commit74aef6d55db3e2a34369142b738b8270d242739e (patch)
treea016f3f9cfe9062d0c01a40b2c86e748a8504a82
parent09d122a798c8436a7e32ab4ca49a0e73398cf106 (diff)
[ANativeWindow] Add ANativeWindow_allocateBuffers stable abi.
Bug: 137012798 Test: builds Change-Id: Ibe2afe83d48adb583bfbda088376fcf402050814
-rw-r--r--libs/gui/Surface.cpp4
-rw-r--r--libs/nativewindow/ANativeWindow.cpp4
-rw-r--r--libs/nativewindow/include/apex/window.h10
-rw-r--r--libs/nativewindow/include/system/window.h1
-rw-r--r--libs/nativewindow/libnativewindow.map.txt1
5 files changed, 19 insertions, 1 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index e7880ebc39..23532e7e38 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -1176,6 +1176,10 @@ int Surface::perform(int operation, va_list args)
case NATIVE_WINDOW_SET_QUEUE_INTERCEPTOR:
res = dispatchAddQueueInterceptor(args);
break;
+ case NATIVE_WINDOW_ALLOCATE_BUFFERS:
+ allocateBuffers();
+ res = NO_ERROR;
+ break;
default:
res = NAME_NOT_FOUND;
break;
diff --git a/libs/nativewindow/ANativeWindow.cpp b/libs/nativewindow/ANativeWindow.cpp
index 7fdbeb5a06..06b793660d 100644
--- a/libs/nativewindow/ANativeWindow.cpp
+++ b/libs/nativewindow/ANativeWindow.cpp
@@ -320,3 +320,7 @@ int ANativeWindow_setQueueBufferInterceptor(ANativeWindow* window,
void* data) {
return window->perform(window, NATIVE_WINDOW_SET_QUEUE_INTERCEPTOR, interceptor, data);
}
+
+void ANativeWindow_allocateBuffers(ANativeWindow* window) {
+ window->perform(window, NATIVE_WINDOW_ALLOCATE_BUFFERS);
+}
diff --git a/libs/nativewindow/include/apex/window.h b/libs/nativewindow/include/apex/window.h
index 2060d037e2..3dec011a93 100644
--- a/libs/nativewindow/include/apex/window.h
+++ b/libs/nativewindow/include/apex/window.h
@@ -200,8 +200,16 @@ int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window);
* made by the window will return -ETIMEDOUT after the timeout if the dequeue
* takes too long.
*
- * \return NO_ERROR on succes, -errno on error.
+ * \return NO_ERROR on success, -errno on error.
*/
int ANativeWindow_setDequeueTimeout(ANativeWindow* window, int64_t timeout);
+/**
+ * Provides a hint to the window that buffers should be preallocated ahead of
+ * time. Note that the window implementation is not guaranteed to preallocate
+ * any buffers, for instance if a private API disallows allocation of new
+ * buffers. As such no success/error status is returned.
+ */
+void ANativeWindow_allocateBuffers(ANativeWindow* window);
+
__END_DECLS
diff --git a/libs/nativewindow/include/system/window.h b/libs/nativewindow/include/system/window.h
index a4e5afd38d..121374b1d5 100644
--- a/libs/nativewindow/include/system/window.h
+++ b/libs/nativewindow/include/system/window.h
@@ -252,6 +252,7 @@ enum {
NATIVE_WINDOW_SET_DEQUEUE_INTERCEPTOR = 42, /* private */
NATIVE_WINDOW_SET_PERFORM_INTERCEPTOR = 43, /* private */
NATIVE_WINDOW_SET_QUEUE_INTERCEPTOR = 44, /* private */
+ NATIVE_WINDOW_ALLOCATE_BUFFERS = 45, /* private */
// clang-format on
};
diff --git a/libs/nativewindow/libnativewindow.map.txt b/libs/nativewindow/libnativewindow.map.txt
index 127e633247..148bf07d0d 100644
--- a/libs/nativewindow/libnativewindow.map.txt
+++ b/libs/nativewindow/libnativewindow.map.txt
@@ -17,6 +17,7 @@ LIBNATIVEWINDOW {
ANativeWindow_OemStorageGet; # llndk
ANativeWindow_OemStorageSet; # llndk
ANativeWindow_acquire;
+ ANativeWindow_allocateBuffers; # apex # introduced=30
ANativeWindow_cancelBuffer; # llndk
ANativeWindow_dequeueBuffer; # llndk
ANativeWindow_getBuffersDataSpace; # introduced=28