EGL: Enable eglGetFrameTimestamps.
Also clean up the specification description:
1) Reverse order of revision history notes.
2) Specifically mention polling from another thread.
3) Make it explicit that eglQueryTimestampSupportedANDROID
works for the timestamps of both eglGetCompositorTimingANDROID
and eglGetFrameTimestampsANDROID.
Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*
Change-Id: I26ff1ea97654d8953a18afaad1455813191abe7d
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 42d01b2..8f2abed 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -56,8 +56,6 @@
using namespace android;
-#define ENABLE_EGL_ANDROID_GET_FRAME_TIMESTAMPS 0
-
// ----------------------------------------------------------------------------
namespace android {
@@ -88,9 +86,7 @@
"EGL_KHR_swap_buffers_with_damage "
"EGL_ANDROID_create_native_client_buffer "
"EGL_ANDROID_front_buffer_auto_refresh "
-#if ENABLE_EGL_ANDROID_GET_FRAME_TIMESTAMPS
"EGL_ANDROID_get_frame_timestamps "
-#endif
;
extern char const * const gExtensionString =
"EGL_KHR_image " // mandatory
@@ -1246,7 +1242,6 @@
setError(EGL_BAD_SURFACE, EGL_FALSE);
}
-#if ENABLE_EGL_ANDROID_GET_FRAME_TIMESTAMPS
if (attribute == EGL_TIMESTAMPS_ANDROID) {
if (!s->win.get()) {
return setError(EGL_BAD_SURFACE, EGL_FALSE);
@@ -1256,7 +1251,6 @@
return (err == NO_ERROR) ? EGL_TRUE :
setError(EGL_BAD_SURFACE, EGL_FALSE);
}
-#endif
if (s->cnx->egl.eglSurfaceAttrib) {
return s->cnx->egl.eglSurfaceAttrib(
@@ -2162,12 +2156,10 @@
}
switch (name) {
-#if ENABLE_EGL_ANDROID_GET_FRAME_TIMESTAMPS
case EGL_COMPOSITE_DEADLINE_ANDROID:
case EGL_COMPOSITE_INTERVAL_ANDROID:
case EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID:
return EGL_TRUE;
-#endif
default:
return EGL_FALSE;
}
@@ -2288,7 +2280,6 @@
}
switch (timestamp) {
-#if ENABLE_EGL_ANDROID_GET_FRAME_TIMESTAMPS
case EGL_COMPOSITE_DEADLINE_ANDROID:
case EGL_COMPOSITE_INTERVAL_ANDROID:
case EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID:
@@ -2313,7 +2304,6 @@
NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE, &value);
return value == 0 ? EGL_FALSE : EGL_TRUE;
}
-#endif
default:
return EGL_FALSE;
}
diff --git a/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt b/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt
index f946418..d0ed8e1 100644
--- a/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt
+++ b/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt
@@ -8,11 +8,19 @@
Contributors
+ Brian Anderson
+ Dan Stoza
Pablo Ceballos
+ Jesse Hall
+ Fabien Sanglard
Contact
+ Brian Anderson, Google Inc. (brianderson 'at' google.com)
+ Dan Stoza, Google Inc. (stoza 'at' google.com)
Pablo Ceballos, Google Inc. (pceballos 'at' google.com)
+ Jesse Hall, Google Inc. (jessehall 'at' google.com)
+ Fabien Sanglard, Google Inc. (sanglardf 'at' google.com)
Status
@@ -20,7 +28,7 @@
Version
- Version 1, May 31, 2016
+ Version 1, January 13, 2017
Number
@@ -96,7 +104,6 @@
enables timestamp collection, while a value of EGL_FALSE disables it. The
initial value is false. If surface is not a window surface this has no
effect.
-
Changes to Chapter 3 of the EGL 1.5 Specification (EGL Functions and Errors)
Add a new subsection under Section 3,
@@ -154,6 +161,12 @@
supported will generate an EGL_BAD_PARAMETER error. If any error is
generated the function will return EGL_FALSE.
+ The application can poll for the timestamp of particular events by calling
+ eglGetFrameTimestamps over and over without needing to call any other EGL
+ function between calls. This is true even for the most recently swapped
+ frame. eglGetFrameTimestamps is thread safe and can be called from a
+ different thread than the swapping thread.
+
The eglGetFrameTimestampsANDROID function takes an array of timestamps to
query and returns timestamps in the corresponding indices of the values
array. The possible timestamps that can be queried are:
@@ -212,20 +225,21 @@
Revision History
-#1 (Pablo Ceballos, May 31, 2016)
- - Initial draft.
+#5 (Brian Anderson, January 13, 2017)
+ - Add eglGetCompositorTimingANDROID.
-#2 (Brian Anderson, July 22, 2016)
- - Replace EGL_QUEUE_TIME_ANDROID with EGL_REQUESTED_PRESENT_TIME_ANDROID.
- - Add DISPLAY_PRESENT_TIME_ANDROID.
+#4 (Brian Anderson, January 10, 2017)
+ - Use an absolute frameId rather than a relative framesAgo.
#3 (Brian Anderson, November 30, 2016)
- Add EGL_COMPOSITION_LATCH_TIME_ANDROID,
EGL_LAST_COMPOSITION_START_TIME_ANDROID, and
EGL_DEQUEUE_READY_TIME_ANDROID.
-#4 (Brian Anderson, January 10, 2017)
- - Use an absolute frameId rather than a relative framesAgo.
+#2 (Brian Anderson, July 22, 2016)
+ - Replace EGL_QUEUE_TIME_ANDROID with EGL_REQUESTED_PRESENT_TIME_ANDROID.
+ - Add DISPLAY_PRESENT_TIME_ANDROID.
-#5 (Brian Anderson, January 13, 2017)
- - Add eglGetCompositorTimingANDROID.
+#1 (Pablo Ceballos, May 31, 2016)
+ - Initial draft.
+