Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MESA_swap_frame_usage.spec 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. Name
  2. MESA_swap_frame_usage
  3. Name Strings
  4. GLX_MESA_swap_frame_usage
  5. Contact
  6. Ian Romanick, IBM, idr at us.ibm.com
  7. Status
  8. Deployed in DRI drivers post-XFree86 4.3.
  9. Version
  10. Date: 5/1/2003 Revision: 1.1
  11. Number
  12. ???
  13. Dependencies
  14. GLX_SGI_swap_control affects the definition of this extension.
  15. GLX_MESA_swap_control affects the definition of this extension.
  16. GLX_OML_sync_control affects the definition of this extension.
  17. Based on WGL_I3D_swap_frame_usage version 1.3.
  18. Overview
  19. This extension allows an application to determine what portion of the
  20. swap period has elapsed since the last swap operation completed. The
  21. "usage" value is a floating point value on the range [0,max] which is
  22. calculated as follows:
  23. td
  24. percent = ----
  25. tf
  26. where td is the time measured from the last completed buffer swap (or
  27. call to enable the statistic) to when the next buffer swap completes, tf
  28. is the entire time for a frame which may be multiple screen refreshes
  29. depending on the swap interval as set by the GLX_SGI_swap_control or
  30. GLX_OML_sync_control extensions.
  31. The value, percent, indicates the amount of time spent between the
  32. completion of the two swaps. If the value is in the range [0,1], the
  33. buffer swap occurred within the time period required to maintain a
  34. constant frame rate. If the value is in the range (1,max], a constant
  35. frame rate was not achieved. The value indicates the number of frames
  36. required to draw.
  37. This definition of "percent" differs slightly from
  38. WGL_I3D_swap_frame_usage. In WGL_I3D_swap_frame_usage, the measurement
  39. is taken from the completion of one swap to the issuance of the next.
  40. This representation may not be as useful as measuring between
  41. completions, as a significant amount of time may pass between the
  42. issuance of a swap and the swap actually occurring.
  43. There is also a mechanism to determine whether a frame swap was
  44. missed.
  45. New Procedures and Functions
  46. int glXGetFrameUsageMESA(Display *dpy,
  47. GLXDrawable drawable,
  48. float *usage)
  49. int glXBeginFrameTrackingMESA(Display *dpy,
  50. GLXDrawable drawable)
  51. int glXEndFrameTrackingMESA(Display *dpy,
  52. GLXDrawable drawable)
  53. int glXQueryFrameTrackingMESA(Display *dpy,
  54. GLXDrawable drawable,
  55. int64_t *swapCount,
  56. int64_t *missedFrames,
  57. float *lastMissedUsage)
  58. New Tokens
  59. None
  60. Additions to Chapter 2 of the 1.4 GL Specification (OpenGL Operation)
  61. None
  62. Additions to Chapter 3 of the 1.4 GL Specification (Rasterization)
  63. None
  64. Additions to Chapter 4 of the 1.4 GL Specification (Per-Fragment Operations
  65. and the Framebuffer)
  66. None
  67. Additions to Chapter 5 of the 1.4 GL Specification (Special Functions)
  68. None
  69. Additions to Chapter 6 of the 1.4 GL Specification (State and State Requests)
  70. None
  71. Additions to the GLX 1.3 Specification
  72. The frame usage is measured as the percentage of the swap period elapsed
  73. between two buffer-swap operations being committed. In unextended GLX the
  74. swap period is the vertical refresh time. If SGI_swap_control or
  75. MESA_swap_control are supported, the swap period is the vertical refresh
  76. time multiplied by the swap interval (or one if the swap interval is set
  77. to zero).
  78. If OML_sync_control is supported, the swap period is the vertical
  79. refresh time multiplied by the divisor parameter to
  80. glXSwapBuffersMscOML. The frame usage in this case is less than 1.0 if
  81. the swap is committed before target_msc, and is greater than or equal to
  82. 1.0 otherwise. The actual usage value is based on the divisor and is
  83. never less than 0.0.
  84. int glXBeginFrameTrackingMESA(Display *dpy,
  85. GLXDrawable drawable,
  86. float *usage)
  87. glXGetFrameUsageMESA returns a floating-point value in <usage>
  88. that represents the current swap usage, as defined above.
  89. Missed frame swaps can be tracked by calling the following function:
  90. int glXBeginFrameTrackingMESA(Display *dpy,
  91. GLXDrawable drawable)
  92. glXBeginFrameTrackingMESA resets a "missed frame" count and
  93. synchronizes with the next frame vertical sync before it returns.
  94. If a swap is missed based in the rate control specified by the
  95. <interval> set by glXSwapIntervalSGI or the default swap of once
  96. per frame, the missed frame count is incremented.
  97. The current missed frame count and total number of swaps since
  98. the last call to glXBeginFrameTrackingMESA can be obtained by
  99. calling the following function:
  100. int glXQueryFrameTrackingMESA(Display *dpy,
  101. GLXDrawable drawable,
  102. int64_t *swapCount,
  103. int64_t *missedFrames,
  104. float *lastMissedUsage)
  105. The location pointed to by <swapCount> will be updated with the
  106. number of swaps that have been committed. This value may not match the
  107. number of swaps that have been requested since swaps may be
  108. queued by the implementation. This function can be called at any
  109. time and does not synchronize to vertical blank.
  110. The location pointed to by <missedFrames> will contain the number
  111. swaps that missed the specified frame. The frame usage for the
  112. last missed frame is returned in the location pointed to by
  113. <lastMissedUsage>.
  114. Frame tracking is disabled by calling the function
  115. int glXEndFrameTrackingMESA(Display *dpy,
  116. GLXDrawable drawable)
  117. This function will not return until all swaps have occurred. The
  118. application can call glXQueryFrameTrackingMESA for a final swap and
  119. missed frame count.
  120. If these functions are successful, zero is returned. If the context
  121. associated with dpy and drawable is not a direct context,
  122. GLX_BAD_CONTEXT is returned.
  123. Errors
  124. If the function succeeds, zero is returned. If the function
  125. fails, one of the following error codes is returned:
  126. GLX_BAD_CONTEXT The current rendering context is not a direct
  127. context.
  128. GLX Protocol
  129. None. This extension only extends to direct rendering contexts.
  130. New State
  131. None
  132. New Implementation Dependent State
  133. None
  134. Revision History
  135. 1.1, 5/1/03 Added contact information.
  136. 1.0, 3/17/03 Initial version based on WGL_I3D_swap_frame_usage.