summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRachel Lee <rnlee@google.com>2022-01-12 14:33:07 -0800
committerRachel Lee <rnlee@google.com>2022-01-14 16:01:05 -0800
commit1fb2ddcb4cfb3c848b69ae2fe27b6c1b66ae792c (patch)
tree69600e8ff05e4f83e08c2666d9daaa6565e4f5cd /include
parent14e7dc8bc7503d2ca0d525a0e5909c29056f8320 (diff)
downloadnative-1fb2ddcb4cfb3c848b69ae2fe27b6c1b66ae792c.tar.gz
Improve ASurfaceTransaction_setFrameTimeline docs.
Also use a new typedef AVsyncId shared in AChoreographer and ASurfaceControl. Test: atest ASurfaceControlTest; atest ChoreographerNativeTest Bug: 214063411 Change-Id: If24f144404038064de2ba72cca44572aca507e44
Diffstat (limited to 'include')
-rw-r--r--include/android/choreographer.h8
-rw-r--r--include/android/surface_control.h17
2 files changed, 21 insertions, 4 deletions
diff --git a/include/android/choreographer.h b/include/android/choreographer.h
index 0389e573a2..889ecffd56 100644
--- a/include/android/choreographer.h
+++ b/include/android/choreographer.h
@@ -39,6 +39,12 @@ struct AChoreographer;
*/
typedef struct AChoreographer AChoreographer;
+
+/**
+ * The identifier of a frame timeline.
+ */
+typedef int64_t AVsyncId;
+
struct AChoreographerFrameCallbackData;
/**
* Opaque type that provides access to an AChoreographerFrameCallbackData object.
@@ -203,7 +209,7 @@ size_t AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(
/**
* The vsync ID token used to map Choreographer data.
*/
-int64_t AChoreographerFrameCallbackData_getFrameTimelineVsyncId(
+AVsyncId AChoreographerFrameCallbackData_getFrameTimelineVsyncId(
const AChoreographerFrameCallbackData* data, size_t index) __INTRODUCED_IN(33);
/**
diff --git a/include/android/surface_control.h b/include/android/surface_control.h
index 3a131045e8..9a36ecb537 100644
--- a/include/android/surface_control.h
+++ b/include/android/surface_control.h
@@ -28,6 +28,7 @@
#include <sys/cdefs.h>
+#include <android/choreographer.h>
#include <android/data_space.h>
#include <android/hardware_buffer.h>
#include <android/hdr_metadata.h>
@@ -596,13 +597,23 @@ void ASurfaceTransaction_setEnableBackPressure(ASurfaceTransaction* transaction,
__INTRODUCED_IN(31);
/**
- * Sets the frame timeline to use.
+ * Sets the frame timeline to use in Surface Flinger.
+ *
+ * A frame timeline should be chosen based on what frame deadline the application
+ * can meet when rendering the frame and the application's desired present time.
+ * By setting a frame timeline, Surface Flinger tries to present the frame at the corresponding
+ * expected present time.
+ *
+ * To receive frame timelines, a callback must be posted to Choreographer using
+ * AChoreographer_postExtendedFrameCallback(). The \a vsnycId can then be extracted from the
+ * callback payload using AChoreographerFrameCallbackData_getFrameTimelineVsyncId().
*
* \param vsyncId The vsync ID received from AChoreographer, setting the frame's present target to
- * the corresponding expected present time and deadline from the frame to be rendered.
+ * the corresponding expected present time and deadline from the frame to be rendered. A stale or
+ * invalid value will be ignored.
*/
void ASurfaceTransaction_setFrameTimeline(ASurfaceTransaction* transaction,
- int64_t vsyncId) __INTRODUCED_IN(33);
+ AVsyncId vsyncId) __INTRODUCED_IN(33);
__END_DECLS