EGL_ANDROID_presentation_time.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. Name
  2. ANDROID_presentation_time
  3. Name Strings
  4. EGL_ANDROID_presentation_time
  5. Contributors
  6. Jamie Gennis
  7. Andy McFadden
  8. Jesse Hall
  9. Contact
  10. Jamie Gennis, Google Inc. (jgennis 'at' google.com)
  11. Status
  12. Draft
  13. Version
  14. Version 3, June 26, 2013
  15. Number
  16. EGL Extension #XXX
  17. Dependencies
  18. Requires EGL 1.1
  19. This extension is written against the wording of the EGL 1.4 Specification
  20. Overview
  21. Often when rendering a sequence of images, there is some time at which each
  22. image is intended to be presented to the viewer. This extension allows
  23. this desired presentation time to be specified for each frame rendered to
  24. an EGLSurface, allowing the native window system to use it.
  25. New Types
  26. /*
  27. * EGLnsecsANDROID is a signed integer type for representing a time in
  28. * nanoseconds.
  29. */
  30. #include <khrplatform.h>
  31. typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
  32. New Procedures and Functions
  33. EGLboolean eglPresentationTimeANDROID(
  34. EGLDisplay dpy,
  35. EGLSurface sur,
  36. EGLnsecsANDROID time);
  37. New Tokens
  38. None.
  39. Changes to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors)
  40. Add a new subsection before Section 3.9.4, page 53 (Posting Errors)
  41. "3.9.4 Presentation Time
  42. The function
  43. EGLboolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface
  44. surface, EGLnsecsANDROID time);
  45. specifies the time at which the current color buffer of surface should be
  46. presented to the viewer. The time parameter should be a time in
  47. nanoseconds, but the exact meaning of the time depends on the native
  48. window system's use of the presentation time. In situations where
  49. an absolute time is needed such as displaying the color buffer on a
  50. display device, the time should correspond to the system monotonic up-time
  51. clock. For situations in which an absolute time is not needed such as
  52. using the color buffer for video encoding, the presentation time of the
  53. first frame may be arbitrarily chosen and those of subsequent frames
  54. chosen relative to that of the first frame.
  55. The presentation time may be set multiple times, with each call to
  56. eglPresentationTimeANDROID overriding prior calls. Setting the
  57. presentation time alone does not cause the color buffer to be made
  58. visible, but if the color buffer is subsequently posted to a native window
  59. or copied to a native pixmap then the presentation time of the surface at
  60. that time may be passed along for the native window system to use.
  61. If the surface presentation time is successfully set, EGL_TRUE is
  62. returned. Otherwise EGL_FALSE is returned and an appropriate error is
  63. set. If <dpy> is not the name of a valid, initialized EGLDisplay, an
  64. EGL_BAD_DISPLAY error is generated. If <surface> is not a valid EGLSurface
  65. then an EGL_BAD_SURFACE error is generated.
  66. Issues
  67. 1. How is the presentation time used?
  68. RESOLVED: The uses of the presentation time are intentionally not specified
  69. in this extension. Some possible uses include Audio/Video synchronization,
  70. video frame timestamps for video encoding, display latency metrics, and
  71. display latency control.
  72. 2. How can the current value of the clock that should be used for the
  73. presentation time when an absolute time is needed be queried on Android?
  74. RESOLVED: The current clock value can be queried from the Java
  75. System.nanoTime() method, or from the native clock_gettime function by
  76. passing CLOCK_MONOTONIC as the clock identifier.
  77. 3. Should the presentation time be state which is used by eglSwapBuffers,
  78. or should it be a new parameter to an extended variant of eglSwapBuffers?
  79. RESOLVED: The presentation time should be new state which is used by
  80. the existing eglSwapBuffers call. Adding new state composes better with
  81. other (hypothetical) extensions that also modify the behavior of
  82. eglSwapBuffers.
  83. Revision History
  84. #3 (Jesse Hall, June 26, 2013)
  85. - Enumerated errors generated by eglPresentationTimeANDROID.
  86. - Added Issue #3 with resolution.
  87. #2 (Jamie Gennis, April 1, 2013)
  88. - Clarified how uses that either do or do not need an absolute time should
  89. be handled.
  90. - Specified the eglPresentationTimeANDROID return value.
  91. #1 (Jamie Gennis, January 8, 2013)
  92. - Initial draft.