1*8975f5c5SAndroid Build Coastguard WorkerName 2*8975f5c5SAndroid Build Coastguard Worker 3*8975f5c5SAndroid Build Coastguard Worker CHROMIUM_sync_control 4*8975f5c5SAndroid Build Coastguard Worker 5*8975f5c5SAndroid Build Coastguard WorkerName Strings 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Worker EGL_CHROMIUM_sync_control 8*8975f5c5SAndroid Build Coastguard Worker 9*8975f5c5SAndroid Build Coastguard WorkerContact 10*8975f5c5SAndroid Build Coastguard Worker 11*8975f5c5SAndroid Build Coastguard Worker Stéphane Marchesin, Google (marcheu 'at' google.com) 12*8975f5c5SAndroid Build Coastguard Worker 13*8975f5c5SAndroid Build Coastguard WorkerStatus 14*8975f5c5SAndroid Build Coastguard Worker 15*8975f5c5SAndroid Build Coastguard Worker Draft. 16*8975f5c5SAndroid Build Coastguard Worker 17*8975f5c5SAndroid Build Coastguard WorkerVersion 18*8975f5c5SAndroid Build Coastguard Worker 19*8975f5c5SAndroid Build Coastguard Worker Version 2, 2015-05-05 20*8975f5c5SAndroid Build Coastguard Worker 21*8975f5c5SAndroid Build Coastguard Worker Based on GLX_OML_sync_control Revision 6.0 22*8975f5c5SAndroid Build Coastguard Worker 23*8975f5c5SAndroid Build Coastguard WorkerNumber 24*8975f5c5SAndroid Build Coastguard Worker 25*8975f5c5SAndroid Build Coastguard Worker ??? 26*8975f5c5SAndroid Build Coastguard Worker 27*8975f5c5SAndroid Build Coastguard WorkerDependencies 28*8975f5c5SAndroid Build Coastguard Worker 29*8975f5c5SAndroid Build Coastguard Worker The extension is written against the EGL 1.2 Specification, although it 30*8975f5c5SAndroid Build Coastguard Worker should work on other versions of these specifications. This extension 31*8975f5c5SAndroid Build Coastguard Worker also requires an operating system which supports CLOCK_MONOTONIC. 32*8975f5c5SAndroid Build Coastguard Worker 33*8975f5c5SAndroid Build Coastguard WorkerOverview 34*8975f5c5SAndroid Build Coastguard Worker 35*8975f5c5SAndroid Build Coastguard Worker This extension provides counters which let applications know about the 36*8975f5c5SAndroid Build Coastguard Worker timing of the last vertical retrace. By looking at the system clock, as 37*8975f5c5SAndroid Build Coastguard Worker well as the refresh rate of the monitor, this should enable applications 38*8975f5c5SAndroid Build Coastguard Worker to predict the position of future retraces so as to schedule an optimal 39*8975f5c5SAndroid Build Coastguard Worker workload. 40*8975f5c5SAndroid Build Coastguard Worker 41*8975f5c5SAndroid Build Coastguard Worker This extension incorporates the use of three counters that provide 42*8975f5c5SAndroid Build Coastguard Worker the necessary synchronization. The Unadjusted System Time (or UST) 43*8975f5c5SAndroid Build Coastguard Worker is the 64-bit CLOCK_MONOTONIC clock; in particular this lets the 44*8975f5c5SAndroid Build Coastguard Worker application schedule future vertical retraces by querying this clock. 45*8975f5c5SAndroid Build Coastguard Worker The graphics Media Stream Counter (or graphics MSC) is a counter 46*8975f5c5SAndroid Build Coastguard Worker that is unique to the graphics subsystem and increments for each 47*8975f5c5SAndroid Build Coastguard Worker vertical retrace that occurs. The Swap Buffer Counter (SBC) is an 48*8975f5c5SAndroid Build Coastguard Worker attribute of an EGLSurface and is incremented each time a swap 49*8975f5c5SAndroid Build Coastguard Worker buffer action is performed on the associated surface. 50*8975f5c5SAndroid Build Coastguard Worker 51*8975f5c5SAndroid Build Coastguard Worker The use of these three counters allows the application to 52*8975f5c5SAndroid Build Coastguard Worker synchronize graphics rendering to vertical retraces and/or swap 53*8975f5c5SAndroid Build Coastguard Worker buffer actions. For example, by querying the synchronization values for 54*8975f5c5SAndroid Build Coastguard Worker a given surface, the application can accurately predict the timing for 55*8975f5c5SAndroid Build Coastguard Worker the next vertical retraces and schedule rendering accordingly. 56*8975f5c5SAndroid Build Coastguard Worker 57*8975f5c5SAndroid Build Coastguard WorkerIssues 58*8975f5c5SAndroid Build Coastguard Worker 59*8975f5c5SAndroid Build Coastguard Worker None. 60*8975f5c5SAndroid Build Coastguard Worker 61*8975f5c5SAndroid Build Coastguard WorkerIP Status 62*8975f5c5SAndroid Build Coastguard Worker 63*8975f5c5SAndroid Build Coastguard Worker No known issues. 64*8975f5c5SAndroid Build Coastguard Worker 65*8975f5c5SAndroid Build Coastguard WorkerNew Procedures and Functions 66*8975f5c5SAndroid Build Coastguard Worker 67*8975f5c5SAndroid Build Coastguard Worker Bool eglGetSyncValuesCHROMIUM(EGLDisplay dpy, 68*8975f5c5SAndroid Build Coastguard Worker EGLSurface surface, 69*8975f5c5SAndroid Build Coastguard Worker int64_t* ust, 70*8975f5c5SAndroid Build Coastguard Worker int64_t* msc, 71*8975f5c5SAndroid Build Coastguard Worker int64_t* sbc) 72*8975f5c5SAndroid Build Coastguard Worker 73*8975f5c5SAndroid Build Coastguard WorkerNew Tokens 74*8975f5c5SAndroid Build Coastguard Worker 75*8975f5c5SAndroid Build Coastguard Worker None 76*8975f5c5SAndroid Build Coastguard Worker 77*8975f5c5SAndroid Build Coastguard WorkerAdditions to the EGL 1.3 Specification 78*8975f5c5SAndroid Build Coastguard Worker 79*8975f5c5SAndroid Build Coastguard Worker eglGetSyncValuesCHROMIUM returns the current UST/MSC/SBC triple. A UST 80*8975f5c5SAndroid Build Coastguard Worker timestamp is obtained each time the graphics MSC is incremented. 81*8975f5c5SAndroid Build Coastguard Worker If this value does not reflect the value of the UST at the time the 82*8975f5c5SAndroid Build Coastguard Worker first scan line of the display begins passing through the video 83*8975f5c5SAndroid Build Coastguard Worker output port, it will be adjusted by the graphics driver to do so 84*8975f5c5SAndroid Build Coastguard Worker prior to being returned by any of the functions defined by this 85*8975f5c5SAndroid Build Coastguard Worker extension. 86*8975f5c5SAndroid Build Coastguard Worker 87*8975f5c5SAndroid Build Coastguard Worker This UST timestamp, together with the current graphics MSC and the 88*8975f5c5SAndroid Build Coastguard Worker current SBC, comprise the current UST/MSC/SBC triple. The UST, 89*8975f5c5SAndroid Build Coastguard Worker graphics MSC, and SBC values are not part of the render context 90*8975f5c5SAndroid Build Coastguard Worker state. These values cannot be pushed or popped. The graphics MSC 91*8975f5c5SAndroid Build Coastguard Worker value is initialized to 0 when the graphics device is initialized. 92*8975f5c5SAndroid Build Coastguard Worker The SBC is per-surface state and is initialized to 0 when the 93*8975f5c5SAndroid Build Coastguard Worker EGLSurface data structure is initialized. 94*8975f5c5SAndroid Build Coastguard Worker 95*8975f5c5SAndroid Build Coastguard Worker The SBC value is incremented by the graphics driver at the completion 96*8975f5c5SAndroid Build Coastguard Worker of each buffer swap (e.g., the pixel copy has been completed or the 97*8975f5c5SAndroid Build Coastguard Worker hardware register that swaps memory banks has been written). For pixel 98*8975f5c5SAndroid Build Coastguard Worker formats that do not contain a back buffer, the SBC will always be 99*8975f5c5SAndroid Build Coastguard Worker returned as 0. 100*8975f5c5SAndroid Build Coastguard Worker 101*8975f5c5SAndroid Build Coastguard Worker The graphics MSC value is incremented once for each screen refresh. 102*8975f5c5SAndroid Build Coastguard Worker For a non-interlaced display, this means that the graphics MSC value 103*8975f5c5SAndroid Build Coastguard Worker is incremented for each frame. For an interlaced display, it means 104*8975f5c5SAndroid Build Coastguard Worker that it will be incremented for each field. For a multi-monitor 105*8975f5c5SAndroid Build Coastguard Worker system, the monitor used to determine MSC is the one where the surface 106*8975f5c5SAndroid Build Coastguard Worker is located. If the surface spans multiple monitors, the monitor used 107*8975f5c5SAndroid Build Coastguard Worker to determine MSC is the one with the biggest coverage in pixels. 108*8975f5c5SAndroid Build Coastguard Worker 109*8975f5c5SAndroid Build Coastguard Worker The function eglGetSyncValuesCHROMIUM will return TRUE if the function 110*8975f5c5SAndroid Build Coastguard Worker completed successfully, FALSE otherwise. 111*8975f5c5SAndroid Build Coastguard Worker 112*8975f5c5SAndroid Build Coastguard Worker Each time eglSwapBuffer succeeds, the SBC will be increased within a 113*8975f5c5SAndroid Build Coastguard Worker finite time period. 114*8975f5c5SAndroid Build Coastguard Worker 115*8975f5c5SAndroid Build Coastguard WorkerErrors 116*8975f5c5SAndroid Build Coastguard Worker 117*8975f5c5SAndroid Build Coastguard Worker The function eglGetSyncValuesCHROMIUM will return FALSE if there is no 118*8975f5c5SAndroid Build Coastguard Worker current EGLContext. 119*8975f5c5SAndroid Build Coastguard Worker 120*8975f5c5SAndroid Build Coastguard Worker 121*8975f5c5SAndroid Build Coastguard WorkerNew State 122*8975f5c5SAndroid Build Coastguard Worker 123*8975f5c5SAndroid Build Coastguard Worker Get Value Get Command Type Initial Value 124*8975f5c5SAndroid Build Coastguard Worker --------- ----------- ---- ------------- 125*8975f5c5SAndroid Build Coastguard Worker [UST] eglGetSyncValuesCHROMIUM Z unspecified 126*8975f5c5SAndroid Build Coastguard Worker [MSC] eglGetSyncValuesCHROMIUM Z 0 127*8975f5c5SAndroid Build Coastguard Worker [SBC] eglGetSyncValuesCHROMIUM Z 0 128*8975f5c5SAndroid Build Coastguard Worker 129*8975f5c5SAndroid Build Coastguard WorkerNew Implementation Dependent State 130*8975f5c5SAndroid Build Coastguard Worker 131*8975f5c5SAndroid Build Coastguard Worker None 132*8975f5c5SAndroid Build Coastguard Worker 133*8975f5c5SAndroid Build Coastguard WorkerRevision History 134*8975f5c5SAndroid Build Coastguard Worker 135*8975f5c5SAndroid Build Coastguard Worker Version 2, 2015-05-05 (Chad Versace) 136*8975f5c5SAndroid Build Coastguard Worker - Rename to EGL_CHROMIUM_sync_control from EGL_CHROMIUM_get_sync_values. 137*8975f5c5SAndroid Build Coastguard Worker EGL_CHROMIUM_sync_control is the de facto extension name because all 138*8975f5c5SAndroid Build Coastguard Worker users query that extension string. 139*8975f5c5SAndroid Build Coastguard Worker 140*8975f5c5SAndroid Build Coastguard Worker Version 1, 2014-08-15 (Stéphane Marchesin) 141*8975f5c5SAndroid Build Coastguard Worker - Initial draft, based on GLX_OML_sync_control revision 6.0. 142