15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    OML_sync_control
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GLX_OML_sync_control
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Randi Rost, 3Dlabs (rost 'at' 3dlabs.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciStatus
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Complete. Approved by the Khronos SIG on July 19, 2001.
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciVersion
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    Last Modified Date: 07/23/2001   Revision: 6.0
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Based on WGL_OML_sync_control Revision 16.0
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciNumber
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    238
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciDependencies
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    The extension is written against the OpenGL 1.2.1 Specification
305bd8deadSopenharmony_ci    and the GLX 1.3 Specification, although it should work on previous
315bd8deadSopenharmony_ci    versions of these specifications.
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ciOverview
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    This extension provides the control necessary to ensure
365bd8deadSopenharmony_ci    synchronization between events on the graphics card (such as
375bd8deadSopenharmony_ci    vertical retrace) and other parts of the system. It provides support
385bd8deadSopenharmony_ci    for applications with real-time rendering requirements by providing
395bd8deadSopenharmony_ci    precise synchronization between graphics and streaming video or
405bd8deadSopenharmony_ci    audio.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension incorporates the use of three counters that provide
435bd8deadSopenharmony_ci    the necessary synchronization. The Unadjusted System Time (or UST)
445bd8deadSopenharmony_ci    is a 64-bit monotonically increasing counter that is available
455bd8deadSopenharmony_ci    throughout the system. UST is not a resource that is controlled
465bd8deadSopenharmony_ci    by OpenGL, so it is not defined further as part of this extension.
475bd8deadSopenharmony_ci    The graphics Media Stream Counter (or graphics MSC) is a counter
485bd8deadSopenharmony_ci    that is unique to the graphics subsystem and increments for each
495bd8deadSopenharmony_ci    vertical retrace that occurs. The Swap Buffer Counter (SBC) is an
505bd8deadSopenharmony_ci    attribute of a GLXDrawable and is incremented each time a swap
515bd8deadSopenharmony_ci    buffer action is performed on the associated drawable.
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    The use of these three counters allows the application to
545bd8deadSopenharmony_ci    synchronize graphics rendering to vertical retraces and/or swap
555bd8deadSopenharmony_ci    buffer actions, and to synchronize other activities in the system
565bd8deadSopenharmony_ci    (such as streaming video or audio) to vertical retraces and/or
575bd8deadSopenharmony_ci    swap buffer actions.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    Functions are provided to allow an application to detect when an
605bd8deadSopenharmony_ci    MSC or SBC has reached a certain value. This function will block
615bd8deadSopenharmony_ci    until the specified value has been reached. Applications that want
625bd8deadSopenharmony_ci    to continue other processing while waiting are expected to call
635bd8deadSopenharmony_ci    these blocking functions from a thread that is separate from the
645bd8deadSopenharmony_ci    main processing thread(s) of the application.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    This extension carefully defines the observable order in which
675bd8deadSopenharmony_ci    things occur in order to allow implementations to perform
685bd8deadSopenharmony_ci    optimizations and avoid artifacts such as tearing, while at the
695bd8deadSopenharmony_ci    same time providing a framework for consistent behavior from the
705bd8deadSopenharmony_ci    point of view of an application.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ciIssues
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    None.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciIP Status
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    No known issues.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciNew Procedures and Functions
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    Bool glXGetSyncValuesOML(Display* dpy,
835bd8deadSopenharmony_ci			     GLXDrawable drawable,
845bd8deadSopenharmony_ci			     int64_t* ust,
855bd8deadSopenharmony_ci			     int64_t* msc,
865bd8deadSopenharmony_ci			     int64_t* sbc)
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    Bool glXGetMscRateOML(Display* dpy,
895bd8deadSopenharmony_ci			  GLXDrawable drawable,
905bd8deadSopenharmony_ci			  int32_t* numerator,
915bd8deadSopenharmony_ci			  int32_t* denominator)
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    int64_t glXSwapBuffersMscOML(Display* dpy,
945bd8deadSopenharmony_ci				 GLXDrawable drawable,
955bd8deadSopenharmony_ci				 int64_t target_msc,
965bd8deadSopenharmony_ci				 int64_t divisor,
975bd8deadSopenharmony_ci				 int64_t remainder)
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    Bool glXWaitForMscOML(Display* dpy,
1005bd8deadSopenharmony_ci			  GLXDrawable drawable,
1015bd8deadSopenharmony_ci			  int64_t target_msc,
1025bd8deadSopenharmony_ci			  int64_t divisor,
1035bd8deadSopenharmony_ci			  int64_t remainder,
1045bd8deadSopenharmony_ci			  int64_t* ust,
1055bd8deadSopenharmony_ci			  int64_t* msc,
1065bd8deadSopenharmony_ci			  int64_t* sbc)
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    Bool glXWaitForSbcOML(Display* dpy,
1095bd8deadSopenharmony_ci			  GLXDrawable drawable,
1105bd8deadSopenharmony_ci			  int64_t target_sbc,
1115bd8deadSopenharmony_ci			  int64_t* ust,
1125bd8deadSopenharmony_ci			  int64_t* msc,
1135bd8deadSopenharmony_ci			  int64_t* sbc)
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ciNew Tokens
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    None
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    None
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    None
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
1285bd8deadSopenharmony_ciOperations and the Framebuffer)
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci    None
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    None
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
1375bd8deadSopenharmony_ciState Requests)
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    None
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ciAdditions to the GLX 1.3 Specification
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    glXGetSyncValuesOML returns the current UST/MSC/SBC triple. A UST
1445bd8deadSopenharmony_ci    timestamp is obtained each time the graphics MSC is incremented.
1455bd8deadSopenharmony_ci    If this value does not reflect the value of the UST at the time the
1465bd8deadSopenharmony_ci    first scan line of the display begins passing through the video
1475bd8deadSopenharmony_ci    output port, it will be adjusted by the graphics driver to do so
1485bd8deadSopenharmony_ci    prior to being returned by any of the functions defined by this
1495bd8deadSopenharmony_ci    extension.
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    This UST timestamp, together with the current graphics MSC and the
1525bd8deadSopenharmony_ci    current SBC, comprise the current UST/MSC/SBC triple. The UST,
1535bd8deadSopenharmony_ci    graphics MSC, and SBC values are not part of the render context
1545bd8deadSopenharmony_ci    state. These values cannot be pushed or popped. The graphics MSC
1555bd8deadSopenharmony_ci    value is initialized to 0 when the graphics device is initialized.
1565bd8deadSopenharmony_ci    The SBC is per-window state and is initialized to 0 when the
1575bd8deadSopenharmony_ci    GLXDrawable data structure is initialized.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    The SBC value is incremented by the graphics driver at the completion
1605bd8deadSopenharmony_ci    of each buffer swap (e.g., the pixel copy has been completed or the
1615bd8deadSopenharmony_ci    hardware register that swaps memory banks has been written). For pixel
1625bd8deadSopenharmony_ci    formats that do not contain a back buffer, the SBC will always be
1635bd8deadSopenharmony_ci    returned as 0.
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci    The graphics MSC value is incremented once for each screen refresh.
1665bd8deadSopenharmony_ci    For a non-interlaced display, this means that the graphics MSC value
1675bd8deadSopenharmony_ci    is incremented for each frame. For an interlaced display, it means
1685bd8deadSopenharmony_ci    that it will be incremented for each field. For a multi-monitor
1695bd8deadSopenharmony_ci    system, the monitor used to determine MSC is screen 0 of <display>.
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    glXGetMscRateOML returns the rate at which the MSC will be incremented
1725bd8deadSopenharmony_ci    for the display associated with <hdc>. The rate is expressed in Hertz
1735bd8deadSopenharmony_ci    as <numerator> / <denominator>. If the MSC rate in Hertz is an
1745bd8deadSopenharmony_ci    integer, then <denominator> will be 1 and <numerator> will be
1755bd8deadSopenharmony_ci    the MSC rate.
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    glXSwapBuffersMscOML has the same functionality as glXSwapBuffers,
1785bd8deadSopenharmony_ci    except for the following. The swap indicated by a call to
1795bd8deadSopenharmony_ci    glXSwapBuffersMscOML does not perform an implicit glFlush. The
1805bd8deadSopenharmony_ci    indicated swap will not occur until all prior rendering commands
1815bd8deadSopenharmony_ci    affecting the buffer have been completed. Once prior rendering
1825bd8deadSopenharmony_ci    commands have been completed, if the current MSC is less than
1835bd8deadSopenharmony_ci    <target_msc>, the buffer swap will occur when the MSC value becomes
1845bd8deadSopenharmony_ci    equal to <target_msc>. Once prior rendering commands have completed,
1855bd8deadSopenharmony_ci    if the current MSC is greater than or equal to <target_msc>, the
1865bd8deadSopenharmony_ci    buffer swap will occur the next time the MSC value is incremented
1875bd8deadSopenharmony_ci    to a value such that MSC % <divisor> = <remainder>. If <divisor> = 0,
1885bd8deadSopenharmony_ci    the swap will occur when MSC becomes greater than or equal to
1895bd8deadSopenharmony_ci    <target_msc>.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    Once glXSwapBuffersMscOML has been called, subsequent OpenGL commands
1925bd8deadSopenharmony_ci    can be issued immediately.	If the thread's current context is made
1935bd8deadSopenharmony_ci    current to another drawable, or if the thread makes another context
1945bd8deadSopenharmony_ci    current on another drawable, rendering can proceed immediately.
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    If there are multiple outstanding swaps for the same window, at most
1975bd8deadSopenharmony_ci    one such swap can be satisfied per increment of MSC.  The order of
1985bd8deadSopenharmony_ci    satisfying outstanding swaps of a window must be the order they were
1995bd8deadSopenharmony_ci    issued. Each window that has an outstanding swap satisfied by the same
2005bd8deadSopenharmony_ci    current MSC should have one swap done.
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    If a thread issues a glXSwapBuffersMscOML call on a window, then
2035bd8deadSopenharmony_ci    issues OpenGL commands while still current to this window (which now
2045bd8deadSopenharmony_ci    has a pending glXSwapBuffersMscOML call), the commands will be executed
2055bd8deadSopenharmony_ci    in the order they were received, subject to implementation resource
2065bd8deadSopenharmony_ci    constraints.  Furthermore, subsequent commands that would affect
2075bd8deadSopenharmony_ci    the back buffer will only affect the new back buffer (that is, the
2085bd8deadSopenharmony_ci    back buffer after the swap completes). Such commands do not affect
2095bd8deadSopenharmony_ci    the current front buffer.
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    If the graphics driver utilizes an extra thread to perform the wait,
2125bd8deadSopenharmony_ci    it is expected that this thread will have a high priority so that
2135bd8deadSopenharmony_ci    the swap will occur at the earliest possible moment once all the
2145bd8deadSopenharmony_ci    conditions for swapping have been satisfied.
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    glXSwapBuffersMscOML will return the value that will correspond to
2175bd8deadSopenharmony_ci    the value of the SBC when the buffer swap actually occurs (in other
2185bd8deadSopenharmony_ci    words, the return value will be the current value of the SBC + the
2195bd8deadSopenharmony_ci    number of pending buffer swaps + 1).  It will return a value of -1
2205bd8deadSopenharmony_ci    if the function failed because of errors detected in the input
2215bd8deadSopenharmony_ci    parameters.  glXSwapBuffersMscOML is a no-op and will always return
2225bd8deadSopenharmony_ci    0 if the specified drawable was created with a non-double-buffered
2235bd8deadSopenharmony_ci    GLXFBConfig or if the specified drawable is a GLXPixmap.
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    glXWaitForMscOML can be used to cause the calling thread to wait
2265bd8deadSopenharmony_ci    until a specific graphics MSC value has been reached. If the current
2275bd8deadSopenharmony_ci    MSC is less than the <target_msc> parameter for glXWaitForMscOML,
2285bd8deadSopenharmony_ci    glXWaitForMscOML will block until the MSC value becomes equal to
2295bd8deadSopenharmony_ci    <target_msc> and then will return the current values for UST, MSC,
2305bd8deadSopenharmony_ci    and SBC. Otherwise, the function will block until the MSC value is
2315bd8deadSopenharmony_ci    incremented to a value such that MSC % <divisor> = <remainder> and
2325bd8deadSopenharmony_ci    then will return the current values for UST, MSC, and SBC. If
2335bd8deadSopenharmony_ci    <divisor> = 0, then the wait will return as soon as MSC >= <target_msc>.
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    glXWaitForSbcOML can be used to cause the calling thread to wait
2365bd8deadSopenharmony_ci    until a specific SBC value has been reached. This function will block
2375bd8deadSopenharmony_ci    until the SBC value for <hdc> becomes equal to <target_sbc> and then
2385bd8deadSopenharmony_ci    will return the current values for UST, MSC, and SBC. If the SBC
2395bd8deadSopenharmony_ci    value is already greater than or equal to <target_sbc>, the function
2405bd8deadSopenharmony_ci    will return immediately with the current values for UST, MSC, and
2415bd8deadSopenharmony_ci    SBC. If <target_sbc> = 0, the function will block until all previous
2425bd8deadSopenharmony_ci    swaps requested with glXSwapBuffersMscOML for that window have
2435bd8deadSopenharmony_ci    completed.	It will then return the current values for UST, MSC,
2445bd8deadSopenharmony_ci    and SBC.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci    When glXSwapBuffersMscOML has been called to cause a swap at a
2475bd8deadSopenharmony_ci    particular MSC, an application process would observe the following
2485bd8deadSopenharmony_ci    order of execution for that MSC:
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci	1. The window for which a glXSwapBuffersMscOML call has been
2515bd8deadSopenharmony_ci	   issued has been completely scanned out to the display for
2525bd8deadSopenharmony_ci	   the previous MSC
2535bd8deadSopenharmony_ci	2. The swap buffer action for that window begins
2545bd8deadSopenharmony_ci	3. All the swap buffer actions for all the windows for the
2555bd8deadSopenharmony_ci	   application process are completed
2565bd8deadSopenharmony_ci	4. SBC and MSC values are atomically incremented
2575bd8deadSopenharmony_ci	5. Any calls to glXWaitForMscOML or glXWaitForSbcOML that
2585bd8deadSopenharmony_ci	   are satisfied by the new values for SBC and graphics
2595bd8deadSopenharmony_ci	   MSC are released
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    The functions glXGetSyncValuesOML, glXGetMscRateOML, glXWaitForMscOML,
2625bd8deadSopenharmony_ci    and glXWaitForSbcOML will each return TRUE if the function completed
2635bd8deadSopenharmony_ci    successfully, FALSE otherwise.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ciErrors
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    Each of the functions defined by this extension will generate a
2685bd8deadSopenharmony_ci    GLX_BAD_CONTEXT error if there is no current GLXContext.
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci    glXWaitForMscOML and glXWaitForSbcOML will each generate a
2715bd8deadSopenharmony_ci    GLX_BAD_CONTEXT error if the current context is not direct.
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    glXSwapBuffersMscOML and glXWaitForMscOML will each generate
2745bd8deadSopenharmony_ci    a GLX_BAD_VALUE error if <divisor> is less than zero, or if
2755bd8deadSopenharmony_ci    <remainder> is less than zero, or if <remainder> is greater
2765bd8deadSopenharmony_ci    than or equal to a non-zero <divisor>, or if <target_msc> is
2775bd8deadSopenharmony_ci    less than zero.
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci    glXWaitForSbcOML will generate a GLX_BAD_VALUE error if
2805bd8deadSopenharmony_ci    <target_sbc> is less than zero.
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ciGLX Protocol
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ci    TBD
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ciNew State
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ci    Get Value		 Get Command	    Type    Initial Value
2895bd8deadSopenharmony_ci    ---------		 -----------	    ----    -------------
2905bd8deadSopenharmony_ci      [UST]	     glXGetSyncValuesOML      Z      unspecified
2915bd8deadSopenharmony_ci      [MSC]	     glXGetSyncValuesOML      Z		  0
2925bd8deadSopenharmony_ci      [SBC]	     glXGetSyncValuesOML      Z		  0
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ciNew Implementation Dependent State
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci    None
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci
305