summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2020-02-14 15:18:11 -0800
committer Alec Mouri <alecmouri@google.com> 2020-02-14 15:28:58 -0800
commitd41a1be2d7a0a46be45c7f6338b739c49bef824e (patch)
tree05d70920d1baba0d3b11d9ee75775c34fa85c49f
parent133083e57a0ea88e6eee4b1e68801bfb59dfaefa (diff)
[ANativeWindow] Apply remaining API feedback
* move ANativeWindow_getFrameId to a platform api, as native_window_get_frame_timestamps is not stable and therefore the associated api surface is not complete enough to be stable. * Adjust documentation for returned errors. In most cases errors aren't returned in practice. In the case of ANativeWindow_setDequeueTimeout the errors are enumerated explicitly. Bug: 148962594 Test: builds Change-Id: I1ff5113d91fdcfc4679b2862af72fbf811171253
-rw-r--r--libs/nativewindow/ANativeWindow.cpp4
-rw-r--r--libs/nativewindow/include/apex/window.h34
-rw-r--r--libs/nativewindow/include/system/window.h11
-rw-r--r--libs/nativewindow/libnativewindow.map.txt1
4 files changed, 22 insertions, 28 deletions
diff --git a/libs/nativewindow/ANativeWindow.cpp b/libs/nativewindow/ANativeWindow.cpp
index 98b76fd667..d0d1114d30 100644
--- a/libs/nativewindow/ANativeWindow.cpp
+++ b/libs/nativewindow/ANativeWindow.cpp
@@ -335,7 +335,3 @@ int ANativeWindow_setQueueBufferInterceptor(ANativeWindow* window,
void* data) {
return window->perform(window, NATIVE_WINDOW_SET_QUEUE_INTERCEPTOR, interceptor, data);
}
-
-int64_t ANativeWindow_getNextFrameId(ANativeWindow* window) {
- return query64(window, NATIVE_WINDOW_GET_NEXT_FRAME_ID);
-}
diff --git a/libs/nativewindow/include/apex/window.h b/libs/nativewindow/include/apex/window.h
index 02b886c4f0..2d1354cdf1 100644
--- a/libs/nativewindow/include/apex/window.h
+++ b/libs/nativewindow/include/apex/window.h
@@ -173,25 +173,22 @@ int ANativeWindow_setQueueBufferInterceptor(ANativeWindow* window,
/**
* Retrieves how long it took for the last time a buffer was dequeued.
*
- * \return a negative value on error, otherwise returns the duration in
- * nanoseconds
+ * \return the dequeue duration in nanoseconds
*/
int64_t ANativeWindow_getLastDequeueDuration(ANativeWindow* window);
/**
* Retrieves how long it took for the last time a buffer was queued.
*
- * \return a negative value on error, otherwise returns the duration in
- * nanoseconds.
+ * \return the queue duration in nanoseconds
*/
int64_t ANativeWindow_getLastQueueDuration(ANativeWindow* window);
/**
* Retrieves the system time in nanoseconds when the last time a buffer
- * was dequeued.
+ * started to be dequeued.
*
- * \return a negative value on error, otherwise returns the duration in
- * nanoseconds.
+ * \return the start time in nanoseconds
*/
int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window);
@@ -200,23 +197,14 @@ 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 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);
-
-/**
- * Retrieves an identifier for the next frame to be queued by this window.
+ * If the provided timeout is negative, hen this removes the previously configured
+ * timeout. The window then behaves as if ANativeWindow_setDequeueTimeout was
+ * never called.
*
- * \return -errno on error, otherwise returns the next frame id.
+ * \return NO_ERROR on success
+ * \return BAD_VALUE if the dequeue timeout was unabled to be updated, as
+ * updating the dequeue timeout may change internals of the underlying window.
*/
-int64_t ANativeWindow_getNextFrameId(ANativeWindow* window);
+int ANativeWindow_setDequeueTimeout(ANativeWindow* window, int64_t timeout);
__END_DECLS
diff --git a/libs/nativewindow/include/system/window.h b/libs/nativewindow/include/system/window.h
index f686147a5f..c791b61753 100644
--- a/libs/nativewindow/include/system/window.h
+++ b/libs/nativewindow/include/system/window.h
@@ -1049,4 +1049,15 @@ static inline int ANativeWindow_getLastQueuedBuffer(ANativeWindow* window,
outTransformMatrix);
}
+/**
+ * Retrieves an identifier for the next frame to be queued by this window.
+ *
+ * \return the next frame id.
+ */
+static inline int64_t ANativeWindow_getNextFrameId(ANativeWindow* window) {
+ int64_t value;
+ window->perform(window, NATIVE_WINDOW_GET_NEXT_FRAME_ID, &value);
+ return value;
+}
+
__END_DECLS
diff --git a/libs/nativewindow/libnativewindow.map.txt b/libs/nativewindow/libnativewindow.map.txt
index 154eb8eb52..35f0627e90 100644
--- a/libs/nativewindow/libnativewindow.map.txt
+++ b/libs/nativewindow/libnativewindow.map.txt
@@ -25,7 +25,6 @@ LIBNATIVEWINDOW {
ANativeWindow_getLastDequeueDuration; # apex # introduced=30
ANativeWindow_getLastDequeueStartTime; # apex # introduced=30
ANativeWindow_getLastQueueDuration; # apex # introduced=30
- ANativeWindow_getNextFrameId; # apex # introduced=30
ANativeWindow_getWidth;
ANativeWindow_lock;
ANativeWindow_query; # llndk