1*6c119a46SAndroid Build Coastguard Worker<?xml version="1.0" encoding="UTF-8"?> 2*6c119a46SAndroid Build Coastguard Worker<protocol name="presentation_time"> 3*6c119a46SAndroid Build Coastguard Worker<!-- wrap:70 --> 4*6c119a46SAndroid Build Coastguard Worker 5*6c119a46SAndroid Build Coastguard Worker <copyright> 6*6c119a46SAndroid Build Coastguard Worker Copyright © 2013-2014 Collabora, Ltd. 7*6c119a46SAndroid Build Coastguard Worker 8*6c119a46SAndroid Build Coastguard Worker Permission is hereby granted, free of charge, to any person obtaining a 9*6c119a46SAndroid Build Coastguard Worker copy of this software and associated documentation files (the "Software"), 10*6c119a46SAndroid Build Coastguard Worker to deal in the Software without restriction, including without limitation 11*6c119a46SAndroid Build Coastguard Worker the rights to use, copy, modify, merge, publish, distribute, sublicense, 12*6c119a46SAndroid Build Coastguard Worker and/or sell copies of the Software, and to permit persons to whom the 13*6c119a46SAndroid Build Coastguard Worker Software is furnished to do so, subject to the following conditions: 14*6c119a46SAndroid Build Coastguard Worker 15*6c119a46SAndroid Build Coastguard Worker The above copyright notice and this permission notice (including the next 16*6c119a46SAndroid Build Coastguard Worker paragraph) shall be included in all copies or substantial portions of the 17*6c119a46SAndroid Build Coastguard Worker Software. 18*6c119a46SAndroid Build Coastguard Worker 19*6c119a46SAndroid Build Coastguard Worker THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20*6c119a46SAndroid Build Coastguard Worker IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21*6c119a46SAndroid Build Coastguard Worker FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22*6c119a46SAndroid Build Coastguard Worker THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23*6c119a46SAndroid Build Coastguard Worker LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24*6c119a46SAndroid Build Coastguard Worker FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25*6c119a46SAndroid Build Coastguard Worker DEALINGS IN THE SOFTWARE. 26*6c119a46SAndroid Build Coastguard Worker </copyright> 27*6c119a46SAndroid Build Coastguard Worker 28*6c119a46SAndroid Build Coastguard Worker <interface name="wp_presentation" version="1"> 29*6c119a46SAndroid Build Coastguard Worker <description summary="timed presentation related wl_surface requests"> 30*6c119a46SAndroid Build Coastguard Worker 31*6c119a46SAndroid Build Coastguard Worker<!-- Introduction --> 32*6c119a46SAndroid Build Coastguard Worker 33*6c119a46SAndroid Build Coastguard Worker The main feature of this interface is accurate presentation 34*6c119a46SAndroid Build Coastguard Worker timing feedback to ensure smooth video playback while maintaining 35*6c119a46SAndroid Build Coastguard Worker audio/video synchronization. Some features use the concept of a 36*6c119a46SAndroid Build Coastguard Worker presentation clock, which is defined in the 37*6c119a46SAndroid Build Coastguard Worker presentation.clock_id event. 38*6c119a46SAndroid Build Coastguard Worker 39*6c119a46SAndroid Build Coastguard Worker A content update for a wl_surface is submitted by a 40*6c119a46SAndroid Build Coastguard Worker wl_surface.commit request. Request 'feedback' associates with 41*6c119a46SAndroid Build Coastguard Worker the wl_surface.commit and provides feedback on the content 42*6c119a46SAndroid Build Coastguard Worker update, particularly the final realized presentation time. 43*6c119a46SAndroid Build Coastguard Worker 44*6c119a46SAndroid Build Coastguard Worker<!-- Completing presentation --> 45*6c119a46SAndroid Build Coastguard Worker 46*6c119a46SAndroid Build Coastguard Worker When the final realized presentation time is available, e.g. 47*6c119a46SAndroid Build Coastguard Worker after a framebuffer flip completes, the requested 48*6c119a46SAndroid Build Coastguard Worker presentation_feedback.presented events are sent. The final 49*6c119a46SAndroid Build Coastguard Worker presentation time can differ from the compositor's predicted 50*6c119a46SAndroid Build Coastguard Worker display update time and the update's target time, especially 51*6c119a46SAndroid Build Coastguard Worker when the compositor misses its target vertical blanking period. 52*6c119a46SAndroid Build Coastguard Worker </description> 53*6c119a46SAndroid Build Coastguard Worker 54*6c119a46SAndroid Build Coastguard Worker <enum name="error"> 55*6c119a46SAndroid Build Coastguard Worker <description summary="fatal presentation errors"> 56*6c119a46SAndroid Build Coastguard Worker These fatal protocol errors may be emitted in response to 57*6c119a46SAndroid Build Coastguard Worker illegal presentation requests. 58*6c119a46SAndroid Build Coastguard Worker </description> 59*6c119a46SAndroid Build Coastguard Worker <entry name="invalid_timestamp" value="0" 60*6c119a46SAndroid Build Coastguard Worker summary="invalid value in tv_nsec"/> 61*6c119a46SAndroid Build Coastguard Worker <entry name="invalid_flag" value="1" 62*6c119a46SAndroid Build Coastguard Worker summary="invalid flag"/> 63*6c119a46SAndroid Build Coastguard Worker </enum> 64*6c119a46SAndroid Build Coastguard Worker 65*6c119a46SAndroid Build Coastguard Worker <request name="destroy" type="destructor"> 66*6c119a46SAndroid Build Coastguard Worker <description summary="unbind from the presentation interface"> 67*6c119a46SAndroid Build Coastguard Worker Informs the server that the client will no longer be using 68*6c119a46SAndroid Build Coastguard Worker this protocol object. Existing objects created by this object 69*6c119a46SAndroid Build Coastguard Worker are not affected. 70*6c119a46SAndroid Build Coastguard Worker </description> 71*6c119a46SAndroid Build Coastguard Worker </request> 72*6c119a46SAndroid Build Coastguard Worker 73*6c119a46SAndroid Build Coastguard Worker <request name="feedback"> 74*6c119a46SAndroid Build Coastguard Worker <description summary="request presentation feedback information"> 75*6c119a46SAndroid Build Coastguard Worker Request presentation feedback for the current content submission 76*6c119a46SAndroid Build Coastguard Worker on the given surface. This creates a new presentation_feedback 77*6c119a46SAndroid Build Coastguard Worker object, which will deliver the feedback information once. If 78*6c119a46SAndroid Build Coastguard Worker multiple presentation_feedback objects are created for the same 79*6c119a46SAndroid Build Coastguard Worker submission, they will all deliver the same information. 80*6c119a46SAndroid Build Coastguard Worker 81*6c119a46SAndroid Build Coastguard Worker For details on what information is returned, see the 82*6c119a46SAndroid Build Coastguard Worker presentation_feedback interface. 83*6c119a46SAndroid Build Coastguard Worker </description> 84*6c119a46SAndroid Build Coastguard Worker <arg name="surface" type="object" interface="wl_surface" 85*6c119a46SAndroid Build Coastguard Worker summary="target surface"/> 86*6c119a46SAndroid Build Coastguard Worker <arg name="callback" type="new_id" interface="wp_presentation_feedback" 87*6c119a46SAndroid Build Coastguard Worker summary="new feedback object"/> 88*6c119a46SAndroid Build Coastguard Worker </request> 89*6c119a46SAndroid Build Coastguard Worker 90*6c119a46SAndroid Build Coastguard Worker <event name="clock_id"> 91*6c119a46SAndroid Build Coastguard Worker <description summary="clock ID for timestamps"> 92*6c119a46SAndroid Build Coastguard Worker This event tells the client in which clock domain the 93*6c119a46SAndroid Build Coastguard Worker compositor interprets the timestamps used by the presentation 94*6c119a46SAndroid Build Coastguard Worker extension. This clock is called the presentation clock. 95*6c119a46SAndroid Build Coastguard Worker 96*6c119a46SAndroid Build Coastguard Worker The compositor sends this event when the client binds to the 97*6c119a46SAndroid Build Coastguard Worker presentation interface. The presentation clock does not change 98*6c119a46SAndroid Build Coastguard Worker during the lifetime of the client connection. 99*6c119a46SAndroid Build Coastguard Worker 100*6c119a46SAndroid Build Coastguard Worker The clock identifier is platform dependent. On Linux/glibc, 101*6c119a46SAndroid Build Coastguard Worker the identifier value is one of the clockid_t values accepted 102*6c119a46SAndroid Build Coastguard Worker by clock_gettime(). clock_gettime() is defined by 103*6c119a46SAndroid Build Coastguard Worker POSIX.1-2001. 104*6c119a46SAndroid Build Coastguard Worker 105*6c119a46SAndroid Build Coastguard Worker Timestamps in this clock domain are expressed as tv_sec_hi, 106*6c119a46SAndroid Build Coastguard Worker tv_sec_lo, tv_nsec triples, each component being an unsigned 107*6c119a46SAndroid Build Coastguard Worker 32-bit value. Whole seconds are in tv_sec which is a 64-bit 108*6c119a46SAndroid Build Coastguard Worker value combined from tv_sec_hi and tv_sec_lo, and the 109*6c119a46SAndroid Build Coastguard Worker additional fractional part in tv_nsec as nanoseconds. Hence, 110*6c119a46SAndroid Build Coastguard Worker for valid timestamps tv_nsec must be in [0, 999999999]. 111*6c119a46SAndroid Build Coastguard Worker 112*6c119a46SAndroid Build Coastguard Worker Note that clock_id applies only to the presentation clock, 113*6c119a46SAndroid Build Coastguard Worker and implies nothing about e.g. the timestamps used in the 114*6c119a46SAndroid Build Coastguard Worker Wayland core protocol input events. 115*6c119a46SAndroid Build Coastguard Worker 116*6c119a46SAndroid Build Coastguard Worker Compositors should prefer a clock which does not jump and is 117*6c119a46SAndroid Build Coastguard Worker not slewed e.g. by NTP. The absolute value of the clock is 118*6c119a46SAndroid Build Coastguard Worker irrelevant. Precision of one millisecond or better is 119*6c119a46SAndroid Build Coastguard Worker recommended. Clients must be able to query the current clock 120*6c119a46SAndroid Build Coastguard Worker value directly, not by asking the compositor. 121*6c119a46SAndroid Build Coastguard Worker </description> 122*6c119a46SAndroid Build Coastguard Worker <arg name="clk_id" type="uint" summary="platform clock identifier"/> 123*6c119a46SAndroid Build Coastguard Worker </event> 124*6c119a46SAndroid Build Coastguard Worker 125*6c119a46SAndroid Build Coastguard Worker </interface> 126*6c119a46SAndroid Build Coastguard Worker 127*6c119a46SAndroid Build Coastguard Worker <interface name="wp_presentation_feedback" version="1"> 128*6c119a46SAndroid Build Coastguard Worker <description summary="presentation time feedback event"> 129*6c119a46SAndroid Build Coastguard Worker A presentation_feedback object returns an indication that a 130*6c119a46SAndroid Build Coastguard Worker wl_surface content update has become visible to the user. 131*6c119a46SAndroid Build Coastguard Worker One object corresponds to one content update submission 132*6c119a46SAndroid Build Coastguard Worker (wl_surface.commit). There are two possible outcomes: the 133*6c119a46SAndroid Build Coastguard Worker content update is presented to the user, and a presentation 134*6c119a46SAndroid Build Coastguard Worker timestamp delivered; or, the user did not see the content 135*6c119a46SAndroid Build Coastguard Worker update because it was superseded or its surface destroyed, 136*6c119a46SAndroid Build Coastguard Worker and the content update is discarded. 137*6c119a46SAndroid Build Coastguard Worker 138*6c119a46SAndroid Build Coastguard Worker Once a presentation_feedback object has delivered a 'presented' 139*6c119a46SAndroid Build Coastguard Worker or 'discarded' event it is automatically destroyed. 140*6c119a46SAndroid Build Coastguard Worker </description> 141*6c119a46SAndroid Build Coastguard Worker 142*6c119a46SAndroid Build Coastguard Worker <event name="sync_output"> 143*6c119a46SAndroid Build Coastguard Worker <description summary="presentation synchronized to this output"> 144*6c119a46SAndroid Build Coastguard Worker As presentation can be synchronized to only one output at a 145*6c119a46SAndroid Build Coastguard Worker time, this event tells which output it was. This event is only 146*6c119a46SAndroid Build Coastguard Worker sent prior to the presented event. 147*6c119a46SAndroid Build Coastguard Worker 148*6c119a46SAndroid Build Coastguard Worker As clients may bind to the same global wl_output multiple 149*6c119a46SAndroid Build Coastguard Worker times, this event is sent for each bound instance that matches 150*6c119a46SAndroid Build Coastguard Worker the synchronized output. If a client has not bound to the 151*6c119a46SAndroid Build Coastguard Worker right wl_output global at all, this event is not sent. 152*6c119a46SAndroid Build Coastguard Worker </description> 153*6c119a46SAndroid Build Coastguard Worker <arg name="output" type="object" interface="wl_output" 154*6c119a46SAndroid Build Coastguard Worker summary="presentation output"/> 155*6c119a46SAndroid Build Coastguard Worker </event> 156*6c119a46SAndroid Build Coastguard Worker 157*6c119a46SAndroid Build Coastguard Worker <enum name="kind" bitfield="true"> 158*6c119a46SAndroid Build Coastguard Worker <description summary="bitmask of flags in presented event"> 159*6c119a46SAndroid Build Coastguard Worker These flags provide information about how the presentation of 160*6c119a46SAndroid Build Coastguard Worker the related content update was done. The intent is to help 161*6c119a46SAndroid Build Coastguard Worker clients assess the reliability of the feedback and the visual 162*6c119a46SAndroid Build Coastguard Worker quality with respect to possible tearing and timings. 163*6c119a46SAndroid Build Coastguard Worker </description> 164*6c119a46SAndroid Build Coastguard Worker <entry name="vsync" value="0x1"> 165*6c119a46SAndroid Build Coastguard Worker <description summary="presentation was vsync'd"> 166*6c119a46SAndroid Build Coastguard Worker The presentation was synchronized to the "vertical retrace" by 167*6c119a46SAndroid Build Coastguard Worker the display hardware such that tearing does not happen. 168*6c119a46SAndroid Build Coastguard Worker Relying on user space scheduling is not acceptable for this 169*6c119a46SAndroid Build Coastguard Worker flag. If presentation is done by a copy to the active 170*6c119a46SAndroid Build Coastguard Worker frontbuffer, then it must guarantee that tearing cannot 171*6c119a46SAndroid Build Coastguard Worker happen. 172*6c119a46SAndroid Build Coastguard Worker </description> 173*6c119a46SAndroid Build Coastguard Worker </entry> 174*6c119a46SAndroid Build Coastguard Worker <entry name="hw_clock" value="0x2"> 175*6c119a46SAndroid Build Coastguard Worker <description summary="hardware provided the presentation timestamp"> 176*6c119a46SAndroid Build Coastguard Worker The display hardware provided measurements that the hardware 177*6c119a46SAndroid Build Coastguard Worker driver converted into a presentation timestamp. Sampling a 178*6c119a46SAndroid Build Coastguard Worker clock in user space is not acceptable for this flag. 179*6c119a46SAndroid Build Coastguard Worker </description> 180*6c119a46SAndroid Build Coastguard Worker </entry> 181*6c119a46SAndroid Build Coastguard Worker <entry name="hw_completion" value="0x4"> 182*6c119a46SAndroid Build Coastguard Worker <description summary="hardware signalled the start of the presentation"> 183*6c119a46SAndroid Build Coastguard Worker The display hardware signalled that it started using the new 184*6c119a46SAndroid Build Coastguard Worker image content. The opposite of this is e.g. a timer being used 185*6c119a46SAndroid Build Coastguard Worker to guess when the display hardware has switched to the new 186*6c119a46SAndroid Build Coastguard Worker image content. 187*6c119a46SAndroid Build Coastguard Worker </description> 188*6c119a46SAndroid Build Coastguard Worker </entry> 189*6c119a46SAndroid Build Coastguard Worker <entry name="zero_copy" value="0x8"> 190*6c119a46SAndroid Build Coastguard Worker <description summary="presentation was done zero-copy"> 191*6c119a46SAndroid Build Coastguard Worker The presentation of this update was done zero-copy. This means 192*6c119a46SAndroid Build Coastguard Worker the buffer from the client was given to display hardware as 193*6c119a46SAndroid Build Coastguard Worker is, without copying it. Compositing with OpenGL counts as 194*6c119a46SAndroid Build Coastguard Worker copying, even if textured directly from the client buffer. 195*6c119a46SAndroid Build Coastguard Worker Possible zero-copy cases include direct scanout of a 196*6c119a46SAndroid Build Coastguard Worker fullscreen surface and a surface on a hardware overlay. 197*6c119a46SAndroid Build Coastguard Worker </description> 198*6c119a46SAndroid Build Coastguard Worker </entry> 199*6c119a46SAndroid Build Coastguard Worker </enum> 200*6c119a46SAndroid Build Coastguard Worker 201*6c119a46SAndroid Build Coastguard Worker <event name="presented"> 202*6c119a46SAndroid Build Coastguard Worker <description summary="the content update was displayed"> 203*6c119a46SAndroid Build Coastguard Worker The associated content update was displayed to the user at the 204*6c119a46SAndroid Build Coastguard Worker indicated time (tv_sec_hi/lo, tv_nsec). For the interpretation of 205*6c119a46SAndroid Build Coastguard Worker the timestamp, see presentation.clock_id event. 206*6c119a46SAndroid Build Coastguard Worker 207*6c119a46SAndroid Build Coastguard Worker The timestamp corresponds to the time when the content update 208*6c119a46SAndroid Build Coastguard Worker turned into light the first time on the surface's main output. 209*6c119a46SAndroid Build Coastguard Worker Compositors may approximate this from the framebuffer flip 210*6c119a46SAndroid Build Coastguard Worker completion events from the system, and the latency of the 211*6c119a46SAndroid Build Coastguard Worker physical display path if known. 212*6c119a46SAndroid Build Coastguard Worker 213*6c119a46SAndroid Build Coastguard Worker This event is preceded by all related sync_output events 214*6c119a46SAndroid Build Coastguard Worker telling which output's refresh cycle the feedback corresponds 215*6c119a46SAndroid Build Coastguard Worker to, i.e. the main output for the surface. Compositors are 216*6c119a46SAndroid Build Coastguard Worker recommended to choose the output containing the largest part 217*6c119a46SAndroid Build Coastguard Worker of the wl_surface, or keeping the output they previously 218*6c119a46SAndroid Build Coastguard Worker chose. Having a stable presentation output association helps 219*6c119a46SAndroid Build Coastguard Worker clients predict future output refreshes (vblank). 220*6c119a46SAndroid Build Coastguard Worker 221*6c119a46SAndroid Build Coastguard Worker The 'refresh' argument gives the compositor's prediction of how 222*6c119a46SAndroid Build Coastguard Worker many nanoseconds after tv_sec, tv_nsec the very next output 223*6c119a46SAndroid Build Coastguard Worker refresh may occur. This is to further aid clients in 224*6c119a46SAndroid Build Coastguard Worker predicting future refreshes, i.e., estimating the timestamps 225*6c119a46SAndroid Build Coastguard Worker targeting the next few vblanks. If such prediction cannot 226*6c119a46SAndroid Build Coastguard Worker usefully be done, the argument is zero. 227*6c119a46SAndroid Build Coastguard Worker 228*6c119a46SAndroid Build Coastguard Worker If the output does not have a constant refresh rate, explicit 229*6c119a46SAndroid Build Coastguard Worker video mode switches excluded, then the refresh argument must 230*6c119a46SAndroid Build Coastguard Worker be zero. 231*6c119a46SAndroid Build Coastguard Worker 232*6c119a46SAndroid Build Coastguard Worker The 64-bit value combined from seq_hi and seq_lo is the value 233*6c119a46SAndroid Build Coastguard Worker of the output's vertical retrace counter when the content 234*6c119a46SAndroid Build Coastguard Worker update was first scanned out to the display. This value must 235*6c119a46SAndroid Build Coastguard Worker be compatible with the definition of MSC in 236*6c119a46SAndroid Build Coastguard Worker GLX_OML_sync_control specification. Note, that if the display 237*6c119a46SAndroid Build Coastguard Worker path has a non-zero latency, the time instant specified by 238*6c119a46SAndroid Build Coastguard Worker this counter may differ from the timestamp's. 239*6c119a46SAndroid Build Coastguard Worker 240*6c119a46SAndroid Build Coastguard Worker If the output does not have a concept of vertical retrace or a 241*6c119a46SAndroid Build Coastguard Worker refresh cycle, or the output device is self-refreshing without 242*6c119a46SAndroid Build Coastguard Worker a way to query the refresh count, then the arguments seq_hi 243*6c119a46SAndroid Build Coastguard Worker and seq_lo must be zero. 244*6c119a46SAndroid Build Coastguard Worker </description> 245*6c119a46SAndroid Build Coastguard Worker <arg name="tv_sec_hi" type="uint" 246*6c119a46SAndroid Build Coastguard Worker summary="high 32 bits of the seconds part of the presentation timestamp"/> 247*6c119a46SAndroid Build Coastguard Worker <arg name="tv_sec_lo" type="uint" 248*6c119a46SAndroid Build Coastguard Worker summary="low 32 bits of the seconds part of the presentation timestamp"/> 249*6c119a46SAndroid Build Coastguard Worker <arg name="tv_nsec" type="uint" 250*6c119a46SAndroid Build Coastguard Worker summary="nanoseconds part of the presentation timestamp"/> 251*6c119a46SAndroid Build Coastguard Worker <arg name="refresh" type="uint" summary="nanoseconds till next refresh"/> 252*6c119a46SAndroid Build Coastguard Worker <arg name="seq_hi" type="uint" 253*6c119a46SAndroid Build Coastguard Worker summary="high 32 bits of refresh counter"/> 254*6c119a46SAndroid Build Coastguard Worker <arg name="seq_lo" type="uint" 255*6c119a46SAndroid Build Coastguard Worker summary="low 32 bits of refresh counter"/> 256*6c119a46SAndroid Build Coastguard Worker <arg name="flags" type="uint" enum="kind" summary="combination of 'kind' values"/> 257*6c119a46SAndroid Build Coastguard Worker </event> 258*6c119a46SAndroid Build Coastguard Worker 259*6c119a46SAndroid Build Coastguard Worker <event name="discarded"> 260*6c119a46SAndroid Build Coastguard Worker <description summary="the content update was not displayed"> 261*6c119a46SAndroid Build Coastguard Worker The content update was never displayed to the user. 262*6c119a46SAndroid Build Coastguard Worker </description> 263*6c119a46SAndroid Build Coastguard Worker </event> 264*6c119a46SAndroid Build Coastguard Worker </interface> 265*6c119a46SAndroid Build Coastguard Worker 266*6c119a46SAndroid Build Coastguard Worker</protocol> 267