1ea1d6981Smrg<?xml version="1.0" encoding="UTF-8" ?> 2ea1d6981Smrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3ea1d6981Smrg "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4ea1d6981Smrg[ 5ea1d6981Smrg<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6ea1d6981Smrg]> 7ea1d6981Smrg 8ea1d6981Smrg<!--translated from sync.tex, on 2010-06-29 10:52:00, 9ea1d6981Smrgby TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/) xhtml,docbook,html,refcaption --> 10ea1d6981Smrg 11ea1d6981Smrg 12ea1d6981Smrg<book id="sync"> 13ea1d6981Smrg 14ea1d6981Smrg<bookinfo> 15ea1d6981Smrg <title>X Synchronization Extension Protocol</title> 16ea1d6981Smrg <subtitle>X Consortium Standard</subtitle> 17ea1d6981Smrg <authorgroup> 18ea1d6981Smrg <author> 19ea1d6981Smrg <firstname>Tim</firstname><surname>Glauert</surname> 20ea1d6981Smrg <affiliation> 21ea1d6981Smrg <orgname>Olivetti Research</orgname> 22ea1d6981Smrg <orgdiv>MultiWorks</orgdiv> 23ea1d6981Smrg </affiliation> 24ea1d6981Smrg </author> 25ea1d6981Smrg <othercredit> 26ea1d6981Smrg <firstname>Dave</firstname> 27ea1d6981Smrg <surname>Carver</surname> 28ea1d6981Smrg <affiliation> 29ea1d6981Smrg <orgname>Digital Equipment Corporation</orgname> 30ea1d6981Smrg <orgdiv>MIT/Project Athena</orgdiv> 31ea1d6981Smrg </affiliation> 32ea1d6981Smrg </othercredit> 33ea1d6981Smrg <othercredit> 34ea1d6981Smrg <firstname>Jim</firstname> 35ea1d6981Smrg <surname>Gettys</surname> 36ea1d6981Smrg <affiliation> 37ea1d6981Smrg <orgname>Digital Equipment Corporation</orgname> 38ea1d6981Smrg <orgdiv>Cambridge Research Laboratory</orgdiv> 39ea1d6981Smrg </affiliation> 40ea1d6981Smrg </othercredit> 41ea1d6981Smrg <othercredit> 42ea1d6981Smrg <firstname>David</firstname> 43ea1d6981Smrg <othername>P.</othername> 44ea1d6981Smrg <surname>Wiggins</surname> 45ea1d6981Smrg <affiliation><orgname>X Consortium, Inc.</orgname></affiliation> 46ea1d6981Smrg </othercredit> 47ea1d6981Smrg <othercredit> 48ea1d6981Smrg <firstname>James</firstname> 49ea1d6981Smrg <surname>Jones</surname> 50ea1d6981Smrg <affiliation><orgname>NVIDIA Corporation</orgname></affiliation> 51ea1d6981Smrg </othercredit> 52ea1d6981Smrg </authorgroup> 53ea1d6981Smrg <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 54ea1d6981Smrg <releaseinfo>Version 3.1</releaseinfo> 55ea1d6981Smrg <copyright><year>1991</year> 56ea1d6981Smrg <holder>Olivetti Research Limited, Cambridge England</holder> 57ea1d6981Smrg <holder>Digital Equipment Corporation, Maynard, Massachusetts</holder> 58ea1d6981Smrg <holder>X Consortium</holder> 59ea1d6981Smrg </copyright> 60ea1d6981Smrg <copyright><year>2010</year><holder>NVIDIA Corporation</holder></copyright> 61ea1d6981Smrg 62ea1d6981Smrg<legalnotice> 63ea1d6981Smrg<para> 64ea1d6981SmrgPermission to use, copy, modify, and distribute this documentation for any 65ea1d6981Smrgpurpose and without fee is hereby granted, provided that the above 66ea1d6981Smrgcopyright notice appear in all copies. Olivetti, Digital, MIT, the 67ea1d6981SmrgX Consortium, and NVIDIA make no representations about the suitability for 68ea1d6981Smrgany purpose of the information in this document. This documentation is 69ea1d6981Smrgprovided as is without express or implied warranty. 70ea1d6981Smrg</para> 71ea1d6981Smrg 72ea1d6981Smrg<para> 73ea1d6981SmrgPermission is hereby granted, free of charge, to any person obtaining 74ea1d6981Smrga copy of this software and associated documentation files 75ea1d6981Smrg(the "Software"), to deal in the Software without 76ea1d6981Smrgrestriction, including without limitation the rights to use, copy, 77ea1d6981Smrgmodify, merge, publish, distribute, sublicense, and/or sell copies of 78ea1d6981Smrgthe Software, and to permit persons to whom the Software is furnished 79ea1d6981Smrgto do so, subject to the following conditions: 80ea1d6981Smrg</para> 81ea1d6981Smrg 82ea1d6981Smrg<para>The above copyright notice and this permission notice shall be included 83ea1d6981Smrgin all copies or substantial portions of the Software.</para> 84ea1d6981Smrg 85ea1d6981Smrg<para>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY 86ea1d6981SmrgKIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 87ea1d6981SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 88ea1d6981SmrgEVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 89ea1d6981SmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 90ea1d6981SmrgOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 91ea1d6981SmrgSOFTWARE.</para> 92ea1d6981Smrg 93ea1d6981Smrg<para>Except as contained in this notice, the name of the X Consortium shall 94ea1d6981Smrgnot be used in advertising or otherwise to promote the sale, use or other 95ea1d6981Smrgdealings in this Software without prior written authorization from the X 96ea1d6981SmrgConsortium.</para> 97ea1d6981Smrg</legalnotice> 98ea1d6981Smrg 99ea1d6981Smrg</bookinfo> 100ea1d6981Smrg 101ea1d6981Smrg<chapter id='Synchronization_Protocol'> 102ea1d6981Smrg<title>Synchronization Protocol</title> 103ea1d6981Smrg<para> 104ea1d6981SmrgThe core X protocol makes no guarantees about the relative order of execution 105ea1d6981Smrgof requests for different clients. This means that any synchronization between 106ea1d6981Smrgclients must be done at the client level in an operating system-dependent and 107ea1d6981Smrgnetwork-dependent manner. Even if there was an accepted standard for such 108ea1d6981Smrgsynchronization, the use of a network introduces unpredictable delays between 109ea1d6981Smrgthe synchronization of the clients and the delivery of the resulting requests 110ea1d6981Smrgto the X server. 111ea1d6981Smrg</para> 112ea1d6981Smrg 113ea1d6981Smrg<para> 114ea1d6981SmrgThe core X protocol also makes no guarantees about the time at which requests 115ea1d6981Smrgare executed, which means that all clients with real-time constraints must 116ea1d6981Smrgimplement their timing on the host computer. Any such timings are subject to 117ea1d6981Smrgerror introduced by delays within the operating system and network and are 118ea1d6981Smrginefficient because of the need for round-trip requests that keep the client 119ea1d6981Smrgand server synchronized. 120ea1d6981Smrg</para> 121ea1d6981Smrg 122ea1d6981Smrg<para> 123ea1d6981SmrgThe synchronization extension provides primitives that allow synchronization 124ea1d6981Smrgbetween clients to take place entirely within the X server. This removes any 125ea1d6981Smrgerror introduced by the network and makes it possible to synchronize clients 126ea1d6981Smrgon different hosts running different operating systems. This is important for 127ea1d6981Smrgmultimedia applications, where audio, video, and graphics data streams are 128ea1d6981Smrgbeing synchronized. The extension also provides internal timers within the 129ea1d6981SmrgX server to which client requests can be synchronized. This allows simple 130ea1d6981Smrganimation applications to be implemented without any round-trip requests and 131ea1d6981Smrgmakes best use of buffering within the client, network, and server. 132ea1d6981Smrg</para> 133ea1d6981Smrg 134ea1d6981Smrg<sect1 id='Description'> 135ea1d6981Smrg<title>Description</title> 136ea1d6981Smrg<para> 137ea1d6981SmrgThe mechanism used by this extension for synchronization within the X 138ea1d6981Smrgserver is to block the processing of requests from a client until a 139ea1d6981Smrgspecific synchronization condition occurs. When the condition occurs, the 140ea1d6981Smrgclient is released and processing of requests continues. Multiple clients 141ea1d6981Smrgmay block on the same condition to give inter-client synchronization. 142ea1d6981SmrgAlternatively, a single client may block on a condition such as an animation 143ea1d6981Smrgframe marker. 144ea1d6981Smrg</para> 145ea1d6981Smrg 146ea1d6981Smrg<para> 147ea1d6981SmrgThe extension adds <function>Counter</function>, <function>Alarm</function>, 148ea1d6981Smrgand <function>Fence</function> to the set of resources managed by the 149ea1d6981Smrgserver. A counter has a 64-bit integer value that may be increased or 150ea1d6981Smrgdecreased by client requests or by the server internally. A client can block 151ea1d6981Smrgby sending an Await request that waits until one of a set of synchronization 152ea1d6981Smrgconditions, called TRIGGERs, becomes TRUE. Alarms generate events when 153ea1d6981Smrgcounter values go through a specified transition. A fence has two possible 154ea1d6981Smrgstates: triggered and not triggered. Client requests can put the fence in 155ea1d6981Smrgeither of these states. A client can block until one of a set of fences 156ea1d6981Smrgbecomes triggered by sending an AwaitFence request. Fences are bound to a 157ea1d6981Smrgparticular screen at creation time. 158ea1d6981Smrg</para> 159ea1d6981Smrg 160ea1d6981Smrg<para> 161ea1d6981SmrgThe <function>CreateCounter</function> request allows a client to create a 162ea1d6981Smrg<function>Counter</function> that can be changed by explicit 163ea1d6981Smrg<function>SetCounter</function> and <function>ChangeCounter</function> 164ea1d6981Smrgrequests. These can be used to implement synchronization between different 165ea1d6981Smrgclients. 166ea1d6981Smrg</para> 167ea1d6981Smrg 168ea1d6981Smrg<para> 169ea1d6981SmrgThere are some counters, called <function>System Counters</function>, that 170ea1d6981Smrgare changed by the server internally rather than by client requests. The 171ea1d6981Smrgeffect of any change to a system counter is not visible until the server 172ea1d6981Smrghas finished processing the current request. In other words, system 173ea1d6981Smrgcounters are apparently updated in the gaps between the execution of 174ea1d6981Smrgrequests rather than during the actual execution of a request. The extension 175ea1d6981Smrgprovides a system counter that advances with the server time as defined by 176ea1d6981Smrgthe core protocol, and it may also provide counters that advance with the 177ea1d6981Smrgreal-world time or that change each time the CRT screen is refreshed. 178ea1d6981SmrgOther extensions may provide their own extension-specific system counters. 179ea1d6981Smrg</para> 180ea1d6981Smrg 181ea1d6981Smrg<para> 182ea1d6981SmrgThe extension provides an <function>Alarm</function> mechanism that allows 183ea1d6981Smrgclients to receive an event on a regular basis when a particular counter 184ea1d6981Smrgis changed. 185ea1d6981Smrg</para> 186ea1d6981Smrg 187ea1d6981Smrg<para> 188ea1d6981SmrgThe <function>CreateFence</function> request allows a client to create a 189ea1d6981Smrg<function>Fence</function> that can be triggered and reset using 190ea1d6981Smrg<function>TriggerFence</function> and <function>ResetFence</function> 191ea1d6981Smrgrequests, respectively. <function>CreateFence</function> takes a drawable 192ea1d6981Smrgargument that implies which screen the fence should be created on. The 193ea1d6981Smrg<function>TriggerFence</function> request changes the fence's state only 194ea1d6981Smrgafter all previous rendering commands affecting objects owned by the given 195ea1d6981Smrgfence's screen have completed. Note that while fence objects are bound 196ea1d6981Smrgto a screen and the simple trigger operation provided by this extension 197ea1d6981Smrgoperates at screen granularity, other extensions may add more fine-grained 198ea1d6981Smrgtrigger operations based on any number of events. The screen binding 199ea1d6981Smrgmerely establishes an upper bound for the scope of fence operations. 200ea1d6981Smrg</para> 201ea1d6981Smrg 202ea1d6981Smrg</sect1> 203ea1d6981Smrg<sect1 id='Types'> 204ea1d6981Smrg<title>Types</title> 205ea1d6981Smrg<para> 206ea1d6981SmrgPlease refer to the X11 Protocol specification as this document uses 207ea1d6981Smrgsyntactic conventions established there and references types defined there. 208ea1d6981Smrg</para> 209ea1d6981Smrg 210ea1d6981Smrg<para>The following new types are used by the extension.</para> 211ea1d6981Smrg 212ea1d6981Smrg<literallayout class="monospaced"> 213ea1d6981SmrgINT64: 64-bit signed integer 214ea1d6981SmrgCOUNTER: XID 215ea1d6981SmrgVALUETYPE: {Absolute,Relative}; 216ea1d6981SmrgTESTTYPE: {PositiveTransition,NegativeTransition, 217ea1d6981Smrg PositiveComparison,NegativeComparison} 218ea1d6981SmrgTRIGGER: [ 219ea1d6981Smrg counter:COUNTER, 220ea1d6981Smrg value-type:VALUETYPE, 221ea1d6981Smrg wait-value:INT64, 222ea1d6981Smrg test-type:TESTTYPE 223ea1d6981Smrg ] 224ea1d6981SmrgWAITCONDITION: [ 225ea1d6981Smrg trigger:TRIGGER, 226ea1d6981Smrg event-threshold:INT64 227ea1d6981Smrg ] 228ea1d6981SmrgSYSTEMCOUNTER: [ 229ea1d6981Smrg name:STRING8, 230ea1d6981Smrg counter:COUNTER, 231ea1d6981Smrg resolution:INT64 232ea1d6981Smrg ] 233ea1d6981SmrgALARM: XID 234ea1d6981SmrgALARMSTATE: {Active,Inactive,Destroyed} 235ea1d6981SmrgFENCE: XID 236ea1d6981Smrg</literallayout> 237ea1d6981Smrg 238ea1d6981Smrg<para> 239ea1d6981SmrgThe COUNTER type defines the client-side handle on a server 240ea1d6981Smrg<function>Counter</function>. The value of a counter is an INT64. 241ea1d6981Smrg</para> 242ea1d6981Smrg 243ea1d6981Smrg<para> 244ea1d6981SmrgThe TRIGGER type defines a test on a counter that is either TRUE or FALSE. The 245ea1d6981Smrgvalue of the test is determined by the combination of a test value, the value 246ea1d6981Smrgof the counter, and the specified test-type. 247ea1d6981Smrg</para> 248ea1d6981Smrg 249ea1d6981Smrg<para> 250ea1d6981SmrgThe test value for a trigger is calculated using the value-type and 251ea1d6981Smrgwait-value fields when the trigger is initialized. If the value-type field 252ea1d6981Smrgis not one of the named VALUETYPE constants, the request that initialized the 253ea1d6981Smrgtrigger will return a <function>Value</function> error. If the value-type 254ea1d6981Smrgfield is <function>Absolute</function>, the test value is given by the 255ea1d6981Smrgwait-value field. If the value-type field is <function>Relative</function>, 256ea1d6981Smrgthe test value is obtained by adding the wait-value field to the value of the 257ea1d6981Smrgcounter. If the resulting test value would lie outside the range for an 258ea1d6981SmrgINT64, the request that initialized the trigger will return a 259ea1d6981Smrg<function>Value</function> error. If counter is <function>None</function> 260ea1d6981Smrgand the value-type is <function>Relative</function>, the request that 261ea1d6981Smrginitialized the trigger will return a <function>Match</function> error. If 262ea1d6981Smrgcounter is not None and does not name a valid counter, a Counter error is 263ea1d6981Smrggenerated. 264ea1d6981Smrg</para> 265ea1d6981Smrg 266ea1d6981Smrg<para> 267ea1d6981SmrgIf the test-type is <function>PositiveTransition</function>, the trigger is 268ea1d6981Smrginitialized to FALSE, and it will become TRUE when the counter changes from 269ea1d6981Smrga value less than the test value to a value greater than or equal to the 270ea1d6981Smrgtest value. If the test-type is <function>NegativeTransition</function>, 271ea1d6981Smrgthe trigger is initialize to FALSE, and it will become TRUE when the counter 272ea1d6981Smrgchanges from a value greater than the test value to a value less than or 273ea1d6981Smrgequal to the test value. If the test-type is 274ea1d6981Smrg<function>PositiveComparison</function>, the trigger is TRUE if the 275ea1d6981Smrgcounter is greater than or equal to the test value and FALSE otherwise. If the 276ea1d6981Smrgtest-type is <function>NegativeComparison</function>, the trigger is TRUE 277ea1d6981Smrgif the counter is less than or equal to the test value and FALSE otherwise. 278ea1d6981SmrgIf the test-type is not one of the named TESTTYPE constants, the request that 279ea1d6981Smrginitialized the trigger will return a Value error. A trigger with a counter 280ea1d6981Smrgvalue of <function>None</function> and a valid test-type is always TRUE. 281ea1d6981Smrg</para> 282ea1d6981Smrg 283ea1d6981Smrg<para> 284ea1d6981SmrgThe WAITCONDITION type is simply a trigger with an associated event-threshold. 285ea1d6981SmrgThe event threshold is used by the <function>Await</function> request to 286ea1d6981Smrgdecide whether or not to generate an event to the client after the trigger has 287ea1d6981Smrgbecome TRUE. By setting the event-threshold to an appropriate value, it is 288ea1d6981Smrgpossible to detect the situation where an <function>Await</function> request 289ea1d6981Smrgwas processed after the TRIGGER became TRUE, which usually indicates that 290ea1d6981Smrgthe server is not processing requests as fast as the client expects. 291ea1d6981Smrg</para> 292ea1d6981Smrg 293ea1d6981Smrg<para> 294ea1d6981SmrgThe SYSTEMCOUNTER type provides the client with information about a 295ea1d6981Smrg<function>System</function>Counter. The name field is the textual name of 296ea1d6981Smrgthe counter that identifies the counter to the client. The counter field 297ea1d6981Smrgis the client-side handle that should be used in requests that require a 298ea1d6981Smrgcounter. The resolution field gives the approximate step size of the system 299ea1d6981Smrgcounter. This is a hint to the client 300ea1d6981Smrgthat the extension may not be able to resolve two wait conditions with test 301ea1d6981Smrgvalues that differ by less than this step size. A microsecond clock, for 302ea1d6981Smrgexample, may advance in steps of 64 microseconds, so a counter based on this 303ea1d6981Smrgclock would have a resolution of 64. 304ea1d6981Smrg</para> 305ea1d6981Smrg 306ea1d6981Smrg<para> 307ea1d6981SmrgThe only system counter that is guaranteed to be present is called SERVERTIME, 308ea1d6981Smrgwhich counts milliseconds from some arbitrary starting point. The least 309ea1d6981Smrgsignificant 32 bits of this counter track the value of Time used by the 310ea1d6981Smrgserver in Events and Requests. Other system counters may be provided by 311ea1d6981Smrgdifferent implementations of the extension. The X Consortium will maintain a 312ea1d6981Smrgregistry of system counter names to avoid collisions in the name space. 313ea1d6981Smrg</para> 314ea1d6981Smrg 315ea1d6981Smrg<para> 316ea1d6981SmrgAn ALARM is the client-side handle on an <function>Alarm</function> resource. 317ea1d6981Smrg</para> 318ea1d6981Smrg 319ea1d6981Smrg<para> 320ea1d6981SmrgThe FENCE type defines the client-side handle on a server 321ea1d6981Smrg<function>Fence</function>. A fence can only be in one of two states, 322ea1d6981Smrgrepresented by a BOOL. If the value is TRUE, the fence is in the triggered 323ea1d6981Smrgstate. Otherwise, the fence is in the not triggered state. 324ea1d6981Smrg</para> 325ea1d6981Smrg 326ea1d6981Smrg</sect1> 327ea1d6981Smrg 328ea1d6981Smrg<sect1 id='Errors'> 329ea1d6981Smrg<title>Errors</title> 330ea1d6981Smrg 331ea1d6981Smrg<variablelist> 332ea1d6981Smrg <varlistentry> 333ea1d6981Smrg <term>Counter</term> 334ea1d6981Smrg <listitem> 335ea1d6981Smrg <para> 336ea1d6981SmrgThis error is generated if the value for a COUNTER argument in a request 337ea1d6981Smrgdoes not name a defined COUNTER. 338ea1d6981Smrg </para> 339ea1d6981Smrg </listitem> 340ea1d6981Smrg </varlistentry> 341ea1d6981Smrg <varlistentry> 342ea1d6981Smrg <term>Alarm</term> 343ea1d6981Smrg <listitem> 344ea1d6981Smrg <para> 345ea1d6981SmrgThis error is generated if the value for an ALARM argument in a request 346ea1d6981Smrgdoes not name a defined ALARM. 347ea1d6981Smrg </para> 348ea1d6981Smrg </listitem> 349ea1d6981Smrg </varlistentry> 350ea1d6981Smrg <varlistentry> 351ea1d6981Smrg <term>Fence</term> 352ea1d6981Smrg <listitem> 353ea1d6981Smrg <para> 354ea1d6981SmrgThis error is generated if the value for a FENCE argument in a request 355ea1d6981Smrgdoes not name a defined FENCE. 356ea1d6981Smrg </para> 357ea1d6981Smrg </listitem> 358ea1d6981Smrg </varlistentry> 359ea1d6981Smrg</variablelist> 360ea1d6981Smrg 361ea1d6981Smrg</sect1> 362ea1d6981Smrg<sect1 id='Requests'> 363ea1d6981Smrg<title>Requests</title> 364ea1d6981Smrg 365ea1d6981Smrg<variablelist> 366ea1d6981Smrg <varlistentry> 367ea1d6981Smrg <term>Initialize</term> 368ea1d6981Smrg <listitem> 369ea1d6981Smrg<literallayout class="monospaced"> 370ea1d6981Smrgversion-major,version-minor: CARD8 371ea1d6981Smrg=> 372ea1d6981Smrgversion-major,version-minor: CARD8 373ea1d6981Smrg</literallayout> 374ea1d6981Smrg 375ea1d6981Smrg <para> 376ea1d6981SmrgThis request must be executed before any other requests for this extension. If a 377ea1d6981Smrgclient violates this rule, the results of all SYNC requests that it issues are 378ea1d6981Smrgundefined. The request takes the version number of the extension that the 379ea1d6981Smrgclient wishes to use and returns the actual version number being implemented 380ea1d6981Smrgby the extension for this client. The extension may return different 381ea1d6981Smrgversion numbers to a client depending of the version number supplied by 382ea1d6981Smrgthat client. This request should be executed only once for each client 383ea1d6981Smrgconnection. 384ea1d6981Smrg </para> 385ea1d6981Smrg <para> 386ea1d6981SmrgGiven two different versions of the SYNC protocol, v1 and v2, v1 is 387ea1d6981Smrgcompatible with v2 if and only if v1.version_major = v2.version_major 388ea1d6981Smrgand v1.version_minor <= v2.version_minor. Compatible means that the 389ea1d6981Smrgfunctionality is fully supported in an identical fashion in the two versions. 390ea1d6981Smrg </para> 391ea1d6981Smrg <para> 392ea1d6981SmrgThis document describes major version 3, minor version 1 of the SYNC protocol. 393ea1d6981Smrg </para> 394ea1d6981Smrg </listitem> 395ea1d6981Smrg </varlistentry> 396ea1d6981Smrg <varlistentry> 397ea1d6981Smrg <term>ListSystemCounters</term> 398ea1d6981Smrg <listitem> 399ea1d6981Smrg<literallayout class="monospaced"> 400ea1d6981Smrg=> 401ea1d6981Smrgsystem-counters: LISTofSYSTEMCOUNTER 402ea1d6981SmrgErrors: Alloc 403ea1d6981Smrg</literallayout> 404ea1d6981Smrg <para> 405ea1d6981SmrgThis request returns a list of all the system counters that are available at 406ea1d6981Smrgthe time the request is executed, which includes the system counters 407ea1d6981Smrgthat are maintained by other extensions. The list returned by this 408ea1d6981Smrgrequest may change as counters are created and destroyed by other extensions. 409ea1d6981Smrg </para> 410ea1d6981Smrg </listitem> 411ea1d6981Smrg </varlistentry> 412ea1d6981Smrg <varlistentry> 413ea1d6981Smrg <term>CreateCounter</term> 414ea1d6981Smrg <listitem> 415ea1d6981Smrg<literallayout class="monospaced"> 416ea1d6981Smrgid: COUNTER 417ea1d6981Smrginitial-value: INT64 418ea1d6981SmrgErrors: IDChoice,Alloc 419ea1d6981Smrg</literallayout> 420ea1d6981Smrg <para> 421ea1d6981SmrgThis request creates a counter and assigns the specified id to it. The counter 422ea1d6981Smrgvalue is initialized to the specified initial-value and there are no clients 423ea1d6981Smrgwaiting on the counter. 424ea1d6981Smrg </para> 425ea1d6981Smrg </listitem> 426ea1d6981Smrg </varlistentry> 427ea1d6981Smrg <varlistentry> 428ea1d6981Smrg <term>DestroyCounter</term> 429ea1d6981Smrg <listitem> 430ea1d6981Smrg<literallayout class="monospaced"> 431ea1d6981Smrgcounter: COUNTER 432ea1d6981SmrgErrors: Counter,Access 433ea1d6981Smrg</literallayout> 434ea1d6981Smrg <para> 435ea1d6981SmrgThis request destroys the given counter and sets the counter fields for all 436ea1d6981Smrgtriggers that specify this counter to <function>None</function>. All clients 437ea1d6981Smrgwaiting on the counter are released and a <function>CounterNotify</function> 438ea1d6981Smrgevent with the destroyed field set to TRUE is sent to each waiting client, 439ea1d6981Smrgregardless of the event-threshold. All alarms specifying the counter become 440ea1d6981Smrg<function>Inactive</function> and an <function>AlarmNotify</function> 441ea1d6981Smrgevent with a state field of <function>Inactive</function> is generated. A 442ea1d6981Smrgcounter is destroyed automatically when the connection to the creating client 443ea1d6981Smrgis closed down if the close-down mode is Destroy. An 444ea1d6981Smrg<function>Access</function> error is generated if counter is a system 445ea1d6981Smrgcounter. A <function>Counter</function> error is generated if counter does 446ea1d6981Smrgnot name a valid counter. 447ea1d6981Smrg </para> 448ea1d6981Smrg </listitem> 449ea1d6981Smrg </varlistentry> 450ea1d6981Smrg <varlistentry> 451ea1d6981Smrg <term>QueryCounter</term> 452ea1d6981Smrg <listitem> 453ea1d6981Smrg<literallayout class="monospaced"> 454ea1d6981Smrgcounter: COUNTER 455ea1d6981Smrg=> 456ea1d6981Smrgvalue: INT64 457ea1d6981SmrgErrors: <function>Counter</function> 458ea1d6981Smrg</literallayout> 459ea1d6981Smrg <para> 460ea1d6981SmrgThis request returns the current value of the given counter or a generates 461ea1d6981SmrgCounter error if counter does not name a valid counter. 462ea1d6981Smrg </para> 463ea1d6981Smrg </listitem> 464ea1d6981Smrg </varlistentry> 465ea1d6981Smrg <varlistentry> 466ea1d6981Smrg <term>Await</term> 467ea1d6981Smrg <listitem> 468ea1d6981Smrg<literallayout class="monospaced"> 469ea1d6981Smrgwait-list: LISTofWAITCONDITION 470ea1d6981SmrgErrors: Counter,Alloc,Value 471ea1d6981Smrg</literallayout> 472ea1d6981Smrg <para> 473ea1d6981SmrgWhen this request is executed, the triggers in the wait-list are initialized 474ea1d6981Smrgusing the wait-value and value-type fields, as described in the definition of 475ea1d6981SmrgTRIGGER above. The processing of further requests for the client is blocked 476ea1d6981Smrguntil one or more of the triggers becomes TRUE. This may happen immediately, 477ea1d6981Smrgas a result of the initialization, or at some later time, as a result of 478ea1d6981Smrga subsequent <function>SetCounter</function>, 479ea1d6981Smrg<function>ChangeCounter</function> or 480ea1d6981Smrg<function>DestroyCounter</function> request. 481ea1d6981Smrg </para> 482ea1d6981Smrg <para> 483ea1d6981SmrgA Value error is generated if wait-list is empty. 484ea1d6981Smrg </para> 485ea1d6981Smrg <para> 486ea1d6981SmrgWhen the client becomes unblocked, each trigger is checked to determine 487ea1d6981Smrgwhether a <function>CounterNotify</function> event should be generated. 488ea1d6981SmrgThe difference between the counter and the test value is calculated by 489ea1d6981Smrgsubtracting the test value from the value of the counter. If the test-type 490ea1d6981Smrgis <function>PositiveTransition</function> or 491ea1d6981Smrg<function>PositiveComparison</function>, a 492ea1d6981Smrg<function>CounterNotify</function> event is generated if the difference is 493ea1d6981Smrgat least event-threshold. If the test-type is 494ea1d6981Smrg<function>NegativeTransition</function> or 495ea1d6981Smrg<function>NegativeComparison</function>, a 496ea1d6981Smrg<function>CounterNotify</function> event is generated if the difference 497ea1d6981Smrgis at most event-threshold. If the difference lies outside the range for an 498ea1d6981SmrgINT64, an event is not generated. 499ea1d6981Smrg </para> 500ea1d6981Smrg <para> 501ea1d6981SmrgThis threshold check is made for each trigger in the list and a 502ea1d6981Smrg<function>CounterNotify</function> event is generated for every trigger for 503ea1d6981Smrgwhich the check succeeds. The check for 504ea1d6981Smrg<function>CounterNotify</function> events is performed even if one of the 505ea1d6981Smrgtriggers is TRUE when the request is first executed. Note that a 506ea1d6981Smrg<function>CounterNotify</function> event may be generated for a trigger 507ea1d6981Smrgthat is FALSE if there are multiple triggers in the request. A 508ea1d6981Smrg<function>CounterNotify</function> event with the destroyed flag set to 509ea1d6981SmrgTRUE is always generated if the counter for one of the triggers is 510ea1d6981Smrgdestroyed. 511ea1d6981Smrg </para> 512ea1d6981Smrg </listitem> 513ea1d6981Smrg </varlistentry> 514ea1d6981Smrg <varlistentry> 515ea1d6981Smrg <term>ChangeCounter</term> 516ea1d6981Smrg <listitem> 517ea1d6981Smrg<literallayout class="monospaced"> 518ea1d6981Smrgcounter: COUNTER 519ea1d6981Smrgamount: INT64 520ea1d6981SmrgErrors: <function>Counter,Access,Value</function> 521ea1d6981Smrg</literallayout> 522ea1d6981Smrg <para> 523ea1d6981SmrgThis request changes the given counter by adding amount to the current 524ea1d6981Smrgcounter value. If the change to this counter satisfies a trigger for which a client 525ea1d6981Smrgis waiting, that client is unblocked and one or more 526ea1d6981Smrg<function>CounterNotify</function> events may be generated. If the change to 527ea1d6981Smrgthe counter satisfies the trigger for an alarm, an 528ea1d6981Smrg<function>AlarmNotify</function> event is generated and the 529ea1d6981Smrgalarm is updated. An <function>Access</function> error is generated if 530ea1d6981Smrgcounter is a system counter. A <function>Counter</function> error is 531ea1d6981Smrggenerated if counter does not name a valid counter. If the resulting value 532ea1d6981Smrgfor the counter would be outside the range for an INT64, a 533ea1d6981Smrg<function>Value</function> error is generated and the counter is not changed. 534ea1d6981Smrg </para> 535ea1d6981Smrg <para> 536ea1d6981SmrgIt should be noted that all the clients whose triggers are satisfied by this 537ea1d6981Smrgchange are unblocked, so this request cannot be used to implement mutual 538ea1d6981Smrgexclusion. 539ea1d6981Smrg </para> 540ea1d6981Smrg </listitem> 541ea1d6981Smrg </varlistentry> 542ea1d6981Smrg <varlistentry> 543ea1d6981Smrg <term>SetCounter</term> 544ea1d6981Smrg <listitem> 545ea1d6981Smrg<literallayout class="monospaced"> 546ea1d6981Smrgcounter: COUNTER 547ea1d6981Smrgvalue: INT64 548ea1d6981SmrgErrors: <function>Counter,Access</function> 549ea1d6981Smrg</literallayout> 550ea1d6981Smrg <para> 551ea1d6981SmrgThis request sets the value of the given counter to value. The effect is 552ea1d6981Smrgequivalent to executing the appropriate ChangeCounter request to change 553ea1d6981Smrgthe counter value to value. An Access error is generated if counter names a 554ea1d6981Smrgsystem counter. A Counter error is generated if counter does not name a valid 555ea1d6981Smrgcounter. 556ea1d6981Smrg </para> 557ea1d6981Smrg </listitem> 558ea1d6981Smrg </varlistentry> 559ea1d6981Smrg <varlistentry> 560ea1d6981Smrg <term>CreateAlarm</term> 561ea1d6981Smrg <listitem> 562ea1d6981Smrg<literallayout class="monospaced"> 563ea1d6981Smrgid: ALARM 564ea1d6981Smrgvalues-mask: CARD32 565ea1d6981Smrgvalues-list: LISTofVALUE 566ea1d6981Smrgleft">Errors: IDChoice,Counter,Match,Value,Alloc 567ea1d6981Smrg</literallayout> 568ea1d6981Smrg <para> 569ea1d6981SmrgThis request creates an alarm and assigns the identifier id to it. The 570ea1d6981Smrgvalues-mask and values-list specify the attributes that are to be explicitly 571ea1d6981Smrginitialized. The attributes for an Alarm and their defaults are: 572ea1d6981Smrg </para> 573ea1d6981Smrg <informaltable frame="none"> 574ea1d6981Smrg <?dbfo keep-together="always" ?> 575ea1d6981Smrg <tgroup cols='4' align='left' colsep='0' rowsep='0'> 576ea1d6981Smrg <colspec colname='c1' colwidth="1.0*" colsep='1'/> 577ea1d6981Smrg <colspec colname='c2' colwidth="1.0*" colsep='1'/> 578ea1d6981Smrg <colspec colname='c3' colwidth="1.0*"/> 579ea1d6981Smrg <colspec colname='c4' colwidth="1.3*"/> 580ea1d6981Smrg <thead> 581ea1d6981Smrg <row rowsep='1'> 582ea1d6981Smrg <entry>Attribute</entry> 583ea1d6981Smrg <entry>Type</entry> 584ea1d6981Smrg <entry namest='c3' nameend='c4'>Default</entry> 585ea1d6981Smrg </row> 586ea1d6981Smrg </thead> 587ea1d6981Smrg <tbody> 588ea1d6981Smrg <row> 589ea1d6981Smrg <entry>trigger</entry> 590ea1d6981Smrg <entry>TRIGGER</entry> 591ea1d6981Smrg <entry>counter</entry> 592ea1d6981Smrg <entry>None</entry> 593ea1d6981Smrg </row> 594ea1d6981Smrg <row> 595ea1d6981Smrg <entry></entry> 596ea1d6981Smrg <entry></entry> 597ea1d6981Smrg <entry>value-type</entry> 598ea1d6981Smrg <entry>Absolute</entry> 599ea1d6981Smrg </row> 600ea1d6981Smrg <row> 601ea1d6981Smrg <entry></entry> 602ea1d6981Smrg <entry></entry> 603ea1d6981Smrg <entry>value</entry> 604ea1d6981Smrg <entry>0</entry> 605ea1d6981Smrg </row> 606ea1d6981Smrg <row> 607ea1d6981Smrg <entry></entry> 608ea1d6981Smrg <entry></entry> 609ea1d6981Smrg <entry>test-type</entry> 610ea1d6981Smrg <entry>PositiveComparison</entry> 611ea1d6981Smrg </row> 612ea1d6981Smrg <row> 613ea1d6981Smrg <entry>delta</entry> 614ea1d6981Smrg <entry>INT64</entry> 615ea1d6981Smrg <entry>1</entry> 616ea1d6981Smrg </row> 617ea1d6981Smrg <row> 618ea1d6981Smrg <entry>events</entry> 619ea1d6981Smrg <entry>BOOL</entry> 620ea1d6981Smrg <entry>TRUE</entry> 621ea1d6981Smrg </row> 622ea1d6981Smrg </tbody> 623ea1d6981Smrg </tgroup> 624ea1d6981Smrg </informaltable> 625ea1d6981Smrg <para> 626ea1d6981SmrgThe trigger is initialized as described in the definition of TRIGGER, with an 627ea1d6981Smrgerror being generated if necessary. 628ea1d6981Smrg </para> 629ea1d6981Smrg <para> 630ea1d6981SmrgIf the counter is <function>None</function>, the state of the alarm is set 631ea1d6981Smrgto <function>Inactive</function>, else it is set to Active. 632ea1d6981Smrg </para> 633ea1d6981Smrg <para> 634ea1d6981SmrgWhenever the trigger becomes TRUE, either as a result of this request or as the 635ea1d6981Smrgresult of a <function>SetCounter</function>, 636ea1d6981Smrg<function>ChangeCounter</function>, <function>DestroyCounter</function>, or 637ea1d6981Smrg<function>ChangeAlarm</function> request, an 638ea1d6981Smrg<function>AlarmNotify</function> event is generated and the alarm is 639ea1d6981Smrgupdated. The alarm is updated by repeatedly adding delta to the value of the 640ea1d6981Smrgtrigger and reinitializing it until it becomes FALSE. If this update would 641ea1d6981Smrgcause value to fall outside the range for an INT64, or if the counter 642ea1d6981Smrgvalue is <function>None</function>, or if the delta is 0 and test-type 643ea1d6981Smrgis <function>PositiveComparison</function> or 644ea1d6981Smrg<function>NegativeComparison</function>, no change is made to value and 645ea1d6981Smrgthe alarm state is changed to <function>Inactive</function> before the 646ea1d6981Smrgevent is generated. No further events are generated by an 647ea1d6981Smrg<function>Inactive</function> alarm until a <function>ChangeAlarm</function> 648ea1d6981Smrgor <function>DestroyAlarm </function> request is executed. 649ea1d6981Smrg </para> 650ea1d6981Smrg <para> 651ea1d6981SmrgIf the test-type is <function>PositiveComparison</function> or 652ea1d6981Smrg<function>PositiveTransition and</function> delta is less than zero, or 653ea1d6981Smrgif the test-type is <function>NegativeComparison</function> or 654ea1d6981Smrg<function>NegativeTransition</function> and delta is greater than zero, 655ea1d6981Smrga <function>Match</function> error is generated. 656ea1d6981Smrg </para> 657ea1d6981Smrg <para> 658ea1d6981SmrgThe events value enables or disables delivery of 659ea1d6981Smrg<function>AlarmNotify</function> events 660ea1d6981Smrgto the requesting client. The alarm keeps a separate event flag for 661ea1d6981Smrgeach client so that other clients may select to receive events from this 662ea1d6981Smrgalarm. 663ea1d6981Smrg </para> 664ea1d6981Smrg <para> 665ea1d6981SmrgAn <function>AlarmNotify</function> event is always generated at some time 666ea1d6981Smrgafter the execution of a <function>CreateAlarm</function> request. This 667ea1d6981Smrgwill happen immediately if the trigger is TRUE, or it will happen later 668ea1d6981Smrgwhen the trigger becomes TRUE or the Alarm is destroyed. 669ea1d6981Smrg </para> 670ea1d6981Smrg </listitem> 671ea1d6981Smrg </varlistentry> 672ea1d6981Smrg <varlistentry> 673ea1d6981Smrg <term>ChangeAlarm</term> 674ea1d6981Smrg <listitem> 675ea1d6981Smrg<literallayout class="monospaced"> 676ea1d6981Smrgid: ALARM 677ea1d6981Smrgvalues-mask: CARD32 678ea1d6981Smrgvalues-list: LISTofVALUE 679ea1d6981SmrgErrors: Alarm,Counter,Value,Match 680ea1d6981Smrg</literallayout> 681ea1d6981Smrg <para> 682ea1d6981SmrgThis request changes the parameters of an Alarm. All of the parameters 683ea1d6981Smrgspecified for the <function>CreateAlarm</function> request may be changed 684ea1d6981Smrgusing this request. The trigger is reinitialized and an 685ea1d6981Smrg<function>AlarmNotify</function> event is generated if appropriate, as 686ea1d6981Smrgexplained in the description of the <function>CreateAlarm</function> request. 687ea1d6981Smrg </para> 688ea1d6981Smrg <para> 689ea1d6981SmrgChanges to the events flag affect the event delivery to the requesting 690ea1d6981Smrgclient only and may be used by a client to select or deselect event delivery 691ea1d6981Smrgfrom an alarm created by another client. 692ea1d6981Smrg </para> 693ea1d6981Smrg <para> 694ea1d6981SmrgThe order in which attributes are verified and altered is server-dependent. 695ea1d6981SmrgIf an error is generated, a subset of the attributes may have been altered. 696ea1d6981Smrg </para> 697ea1d6981Smrg </listitem> 698ea1d6981Smrg </varlistentry> 699ea1d6981Smrg <varlistentry> 700ea1d6981Smrg <term>DestroyAlarm</term> 701ea1d6981Smrg <listitem> 702ea1d6981Smrg<literallayout class="monospaced"> 703ea1d6981Smrgalarm: ALARM 704ea1d6981SmrgErrors: Alarm 705ea1d6981Smrg</literallayout> 706ea1d6981Smrg <para> 707ea1d6981SmrgThis request destroys an alarm. An alarm is automatically destroyed when the 708ea1d6981Smrgcreating client is closed down if the close-down mode is 709ea1d6981Smrg<function>Destroy</function>. When an alarm is destroyed, an 710ea1d6981Smrg<function>AlarmNotify</function> event is generated with a state value of 711ea1d6981Smrg<function>Destroyed</function>. 712ea1d6981Smrg </para> 713ea1d6981Smrg </listitem> 714ea1d6981Smrg </varlistentry> 715ea1d6981Smrg <varlistentry> 716ea1d6981Smrg <term>QueryAlarm</term> 717ea1d6981Smrg <listitem> 718ea1d6981Smrg<literallayout class="monospaced"> 719ea1d6981Smrgalarm: ALARM 720ea1d6981Smrg=> 721ea1d6981Smrgtrigger: TRIGGER 722ea1d6981Smrgdelta: INT64 723ea1d6981Smrgevents: ALARMEVENTMASK 724ea1d6981Smrgstate: ALARMSTATE 725ea1d6981SmrgErrors: <function>Alarm</function> 726ea1d6981Smrg</literallayout> 727ea1d6981Smrg <para>This request retrieves the current parameters for an Alarm.</para> 728ea1d6981Smrg </listitem> 729ea1d6981Smrg </varlistentry> 730ea1d6981Smrg <varlistentry> 731ea1d6981Smrg <term>SetPriority</term> 732ea1d6981Smrg <listitem> 733ea1d6981Smrg<literallayout class="monospaced"> 734ea1d6981Smrgclient-resource: XID 735ea1d6981Smrgpriority: INT32 736ea1d6981SmrgErrors: <function>Match</function> 737ea1d6981Smrg</literallayout> 738ea1d6981Smrg <para> 739ea1d6981SmrgThis request changes the scheduling priority of the client that created 740ea1d6981Smrgclient-resource. If client-resource is <function>None</function>, then 741ea1d6981Smrgthe priority for the client making the request is changed. A 742ea1d6981Smrg<function>Match</function> error is generated if client-resource is not 743ea1d6981Smrg<function>None</function> and does not name an existing resource in the 744ea1d6981Smrgserver. For any two priority values, A and B, A is higher priority if 745ea1d6981Smrgand only if A is greater than B. 746ea1d6981Smrg </para> 747ea1d6981Smrg <para> 748ea1d6981SmrgThe priority of a client is set to 0 when the initial client connection is 749ea1d6981Smrg made. 750ea1d6981Smrg </para> 751ea1d6981Smrg <para> 752ea1d6981SmrgThe effect of different client priorities depends on the particular 753ea1d6981Smrgimplementation of the extension, and in some cases it may have no effect at 754ea1d6981Smrgall. However, the intention is that higher priority clients will have 755ea1d6981Smrgtheir requests executed before those of lower priority clients. 756ea1d6981Smrg </para> 757ea1d6981Smrg <para> 758ea1d6981SmrgFor most animation applications, it is desirable that animation clients be 759ea1d6981Smrggiven priority over nonrealtime clients. This improves the smoothness of the 760ea1d6981Smrganimation on a loaded server. Because a server is free to implement very strict 761ea1d6981Smrgpriorities, processing requests for the highest priority client to the 762ea1d6981Smrgexclusion of all others, it is important that a client that may potentially 763ea1d6981Smrgmonopolize the whole server, such as an animation that produces continuous 764ea1d6981Smrgoutput as fast as it can with no rate control, is run at low rather than high 765ea1d6981Smrgpriority. 766ea1d6981Smrg </para> 767ea1d6981Smrg </listitem> 768ea1d6981Smrg </varlistentry> 769ea1d6981Smrg <varlistentry> 770ea1d6981Smrg <term>GetPriority</term> 771ea1d6981Smrg <listitem> 772ea1d6981Smrg<literallayout class="monospaced"> 773ea1d6981Smrgclient-resource: XID 774ea1d6981Smrg=> 775ea1d6981Smrgpriority: INT32 776ea1d6981SmrgErrors: <function>Match</function> 777ea1d6981Smrg</literallayout> 778ea1d6981Smrg <para> 779ea1d6981SmrgThis request returns the scheduling priority of the client that created 780ea1d6981Smrgclient-resource. If client-resource is <function>None</function>, then the 781ea1d6981Smrgpriority for the client making the request is returned. A 782ea1d6981Smrg<function>Match</function> error is generated if client-resource is 783ea1d6981Smrgnot <function>None</function> and does not name an existing resource in the 784ea1d6981Smrgserver. 785ea1d6981Smrg </para> 786ea1d6981Smrg </listitem> 787ea1d6981Smrg </varlistentry> 788ea1d6981Smrg <varlistentry> 789ea1d6981Smrg <term>CreateFence</term> 790ea1d6981Smrg <listitem> 791ea1d6981Smrg<literallayout class="monospaced"> 792ea1d6981Smrgdrawable: DRAWABLE 793ea1d6981Smrgid: FENCE 794ea1d6981Smrginitially-triggered: BOOL 795ea1d6981SmrgErrors: <function>IDChoice</function>,<function>Alloc</function> 796ea1d6981Smrg</literallayout> 797ea1d6981Smrg <para> 798ea1d6981SmrgThis request creates a fence on the screen associated with drawable and 799ea1d6981Smrgassigns the specified id to it. The fence is in the triggered state iff 800ea1d6981Smrginitially-triggered is TRUE. There are no clients waiting on the fence. 801ea1d6981Smrg </para> 802ea1d6981Smrg </listitem> 803ea1d6981Smrg </varlistentry> 804ea1d6981Smrg <varlistentry> 805ea1d6981Smrg <term>TriggerFence</term> 806ea1d6981Smrg <listitem> 807ea1d6981Smrg<literallayout class="monospaced"> 808ea1d6981Smrgfence: FENCE 809ea1d6981SmrgErrors: <function>Fence</function> 810ea1d6981Smrg</literallayout> 811ea1d6981Smrg <para> 812ea1d6981SmrgThis request puts the given fence in the triggered state after all rendering 813ea1d6981Smrgfrom previous requests that affects resources owned by the fence's screen has 814ea1d6981Smrgcompleted. This includes requests from other clients if those requests have 815ea1d6981Smrgbeen dispatched. This request has no visible effects if the fence was already 816ea1d6981Smrgin the triggered state. A <function>Fence</function> error is generated if 817ea1d6981Smrgfence does not name a valid fence. 818ea1d6981Smrg </para> 819ea1d6981Smrg <para> 820ea1d6981SmrgNote that the given fence's state is not necessarily directly modified by this 821ea1d6981Smrgrequest. The state change need only be queued to occur after the required 822ea1d6981Smrgrendering has completed. Clients should take care to not assume the fence will 823ea1d6981Smrgbe in the triggered state in subsequent requests, such as those that operate 824ea1d6981Smrgon the given fence immediately. <function>AwaitFence</function> should first 825ea1d6981Smrgbe issued if subsequent requests require the fence to be in the triggered 826ea1d6981Smrgstate. 827ea1d6981Smrg </para> 828ea1d6981Smrg </listitem> 829ea1d6981Smrg </varlistentry> 830ea1d6981Smrg <varlistentry> 831ea1d6981Smrg <term>ResetFence</term> 832ea1d6981Smrg <listitem> 833ea1d6981Smrg<literallayout class="monospaced"> 834ea1d6981Smrgfence: FENCE 835ea1d6981SmrgErrors: <function>Fence</function>,<function>Match</function> 836ea1d6981Smrg</literallayout> 837ea1d6981Smrg <para> 838ea1d6981SmrgThis request immediately puts the given fence in the not triggered state. 839ea1d6981SmrgA <function>Match</function> error is generated if the fence is not in the 840ea1d6981Smrgtriggered state. A <function>Fence</function> error is generated if fence 841ea1d6981Smrgdoes not name a valid fence. 842ea1d6981Smrg </para> 843ea1d6981Smrg <para> 844ea1d6981SmrgSee the warnings above regarding <function>TriggerFence</function>'s delayed 845ea1d6981Smrgeffect. In particular, a <function>TriggerFence</function> request 846ea1d6981Smrgimmediately followed by a <function>ResetFence</function> request is likely 847ea1d6981Smrgto result in a <function>Match</function> error. An 848ea1d6981Smrg<function>AwaitFence</function> request should be issued between the two. 849ea1d6981Smrg </para> 850ea1d6981Smrg </listitem> 851ea1d6981Smrg </varlistentry> 852ea1d6981Smrg <varlistentry> 853ea1d6981Smrg <term>DestroyFence</term> 854ea1d6981Smrg <listitem> 855ea1d6981Smrg<literallayout class="monospaced"> 856ea1d6981Smrgfence: FENCE 857ea1d6981SmrgErrors: <function>Fence</function> 858ea1d6981Smrg</literallayout> 859ea1d6981Smrg <para> 860ea1d6981SmrgThis request destroys the given fence. All clients waiting on this fence are 861ea1d6981Smrgreleased. A fence is destroyed automatically when the connection to the client 862ea1d6981Smrgthat created the fence is closed if the close-down mode is 863ea1d6981Smrg<function>DestroyAll</function>. A <function>Fence</function> error is 864ea1d6981Smrggenerated if fence does not name a valid fence. 865ea1d6981Smrg </para> 866ea1d6981Smrg </listitem> 867ea1d6981Smrg </varlistentry> 868ea1d6981Smrg <varlistentry> 869ea1d6981Smrg <term>QueryFence</term> 870ea1d6981Smrg <listitem> 871ea1d6981Smrg<literallayout class="monospaced"> 872ea1d6981Smrgfence: FENCE 873ea1d6981Smrg=> 874ea1d6981Smrgtriggered: BOOL 875ea1d6981SmrgErrors: <function>Fence</function> 876ea1d6981Smrg</literallayout> 877ea1d6981Smrg <para> 878ea1d6981SmrgThis request returns TRUE if the given fence is triggered, or FALSE if it 879ea1d6981Smrgis not triggered. A <function>Fence</function> error is generated if 880ea1d6981Smrgfence does not name a valid fence. 881ea1d6981Smrg </para> 882ea1d6981Smrg </listitem> 883ea1d6981Smrg </varlistentry> 884ea1d6981Smrg <varlistentry> 885ea1d6981Smrg <term>AwaitFence</term> 886ea1d6981Smrg <listitem> 887ea1d6981Smrg<literallayout class="monospaced"> 888ea1d6981Smrgfence-list: LISTofFENCE 889ea1d6981SmrgErrors: <function>Fence</function>,<function>Alloc</function> 890ea1d6981Smrg</literallayout> 891ea1d6981Smrg <para> 892ea1d6981SmrgWhen this request is executed, the processing of further requests for the 893ea1d6981Smrgclient is blocked until one or more of the fences in fence-list reaches the 894ea1d6981Smrgtriggered state. If any of the fences are already in the triggered state, 895ea1d6981Smrgrequest processing resumes immediately. A <function>Fence</function> error 896ea1d6981Smrgis generated if any member of fence-list does not name a valid fence. 897ea1d6981Smrg </para> 898ea1d6981Smrg </listitem> 899ea1d6981Smrg </varlistentry> 900ea1d6981Smrg</variablelist> 901ea1d6981Smrg</sect1> 902ea1d6981Smrg 903ea1d6981Smrg<sect1 id='Events'> 904ea1d6981Smrg<title>Events</title> 905ea1d6981Smrg 906ea1d6981Smrg<variablelist> 907ea1d6981Smrg <varlistentry> 908ea1d6981Smrg <term>CounterNotify</term> 909ea1d6981Smrg <listitem> 910ea1d6981Smrg<literallayout class="monospaced"> 911ea1d6981Smrgcounter: COUNTER 912ea1d6981Smrgwait-value: INT64 913ea1d6981Smrgcounter-value: INT64 914ea1d6981Smrgtime: TIME 915ea1d6981Smrgcount: CARD16 916ea1d6981Smrgdestroyed: BOOL 917ea1d6981Smrg</literallayout> 918ea1d6981Smrg <para> 919ea1d6981Smrg<function>CounterNotify</function> events may be generated when a client 920ea1d6981Smrgbecomes unblocked after an <function>Await</function> request has been 921ea1d6981Smrgprocessed. The wait-value is the value being waited for, and counter-value 922ea1d6981Smrgis the actual value of the counter at the time the event was generated. 923ea1d6981SmrgThe destroyed flag is TRUE if this request was generated as the result of 924ea1d6981Smrgthe destruction of the counter and FALSE otherwise. The time is the server 925ea1d6981Smrgtime at which the event was generated. 926ea1d6981Smrg </para> 927ea1d6981Smrg <para> 928ea1d6981SmrgWhen a client is unblocked, all the <function>CounterNotify</function> 929ea1d6981Smrgevents for the Await request are generated contiguously. If count is 0, 930ea1d6981Smrgthere are no more events to follow for this request. If count is n, 931ea1d6981Smrgthere are at least n more events to follow. 932ea1d6981Smrg </para> 933ea1d6981Smrg </listitem> 934ea1d6981Smrg </varlistentry> 935ea1d6981Smrg <varlistentry> 936ea1d6981Smrg <term>AlarmNotify</term> 937ea1d6981Smrg <listitem> 938ea1d6981Smrg<literallayout class="monospaced"> 939ea1d6981Smrgalarm: ALARM 940ea1d6981Smrgcounter-value: INT64 941ea1d6981Smrgalarm-value: INT64 942ea1d6981Smrgstate: ALARMSTATE 943ea1d6981Smrgtime: TIME 944ea1d6981Smrg</literallayout> 945ea1d6981Smrg <para> 946ea1d6981SmrgAn <function>AlarmNotify</function> event is generated when an alarm is 947ea1d6981Smrgtriggered. alarm-value is the test value of the trigger in the alarm when 948ea1d6981Smrgit was triggered, counter-value is the value of the counter that triggered 949ea1d6981Smrgthe alarm, and time is the server time at which the event was generated. 950ea1d6981SmrgThe state is the new state of the alarm. If state is 951ea1d6981Smrg<function>Inactive</function>, no more events will be generated by this 952ea1d6981Smrgalarm until a <function>ChangeAlarm</function> request is executed, the alarm 953ea1d6981Smrgis destroyed, or the counter for the alarm is destroyed. 954ea1d6981Smrg </para> 955ea1d6981Smrg </listitem> 956ea1d6981Smrg </varlistentry> 957ea1d6981Smrg</variablelist> 958ea1d6981Smrg</sect1> 959ea1d6981Smrg</chapter> 960ea1d6981Smrg 961ea1d6981Smrg<chapter id='Encoding'> 962ea1d6981Smrg<title>Encoding</title> 963ea1d6981Smrg<para> 964ea1d6981SmrgPlease refer to the X11 Protocol Encoding document as this section uses 965ea1d6981Smrgsyntactic conventions established there and references types defined there. 966ea1d6981Smrg</para> 967ea1d6981Smrg<para>The name of this extension is "SYNC".</para> 968ea1d6981Smrg 969ea1d6981Smrg<sect1 id='Encoding_New_Types'> 970ea1d6981Smrg<title>Encoding New Types</title> 971ea1d6981Smrg<para> 972ea1d6981SmrgThe following new types are used by the extension. 973ea1d6981Smrg</para> 974ea1d6981Smrg 975ea1d6981Smrg<literallayout class="monospaced"> 976ea1d6981SmrgALARM: CARD32 977ea1d6981SmrgALARMSTATE: 978ea1d6981Smrg 0 Active 979ea1d6981Smrg 1 Inactive 980ea1d6981Smrg 2 Destroyed 981ea1d6981SmrgCOUNTER: CARD32 982ea1d6981SmrgINT64: 64-bit signed integer 983ea1d6981SmrgSYSTEMCOUNTER: 984ea1d6981Smrg 4 COUNTER counter 985ea1d6981Smrg 8 INT64 resolution 986ea1d6981Smrg 2 n length of name in bytes 987ea1d6981Smrg n STRING8 name 988ea1d6981Smrg p pad,p=pad(n+2) 989ea1d6981SmrgTESTTYPE: 990ea1d6981Smrg 0 PositiveTransition 991ea1d6981Smrg 1 NegativeTransition 992ea1d6981Smrg 2 PositiveComparison 993ea1d6981Smrg 3 NegativeComparison 994ea1d6981SmrgTRIGGER: 995ea1d6981Smrg 4 COUNTER counter 996ea1d6981Smrg 4 VALUETYPE wait-type 997ea1d6981Smrg 8 INT64 wait-value 998ea1d6981Smrg 4 TESTTYPE test-type VALUETYPE: 999ea1d6981Smrg 0 Absolute 1000ea1d6981Smrg 1 Relative 1001ea1d6981SmrgWAITCONDITION: 1002ea1d6981Smrg 20 TRIGGER trigger 1003ea1d6981Smrg 8 INT64 event threshold 1004ea1d6981SmrgFENCE: CARD32 1005ea1d6981Smrg</literallayout> 1006ea1d6981Smrg 1007ea1d6981Smrg<para> 1008ea1d6981SmrgAn INT64 is encoded in 8 bytes with the most significant 4 bytes 1009ea1d6981Smrgfirst followed by the least significant 4 bytes. Within these 4-byte 1010ea1d6981Smrggroups, the byte ordering determined during connection setup is used. 1011ea1d6981Smrg</para> 1012ea1d6981Smrg</sect1> 1013ea1d6981Smrg 1014ea1d6981Smrg<sect1 id='Encoding_Errors'> 1015ea1d6981Smrg<title>Encoding Errors</title> 1016ea1d6981Smrg<literallayout class="monospaced"> 1017ea1d6981Smrg<function>Counter</function> 1018ea1d6981Smrg 1 0 Error 1019ea1d6981Smrg 1 Base + 0 code 1020ea1d6981Smrg 2 CARD16 sequence number 1021ea1d6981Smrg 4 CARD32 bad counter 1022ea1d6981Smrg 2 CARD16 minor opcode 1023ea1d6981Smrg 1 CARD8 major opcode 1024ea1d6981Smrg 21 unused 1025ea1d6981Smrg<function>Alarm</function> 1026ea1d6981Smrg 1 0 Error 1027ea1d6981Smrg 1 Base + 1 code 1028ea1d6981Smrg 2 CARD16 sequence number 1029ea1d6981Smrg 4 CARD32 bad alarm 1030ea1d6981Smrg 2 CARD16 minor opcode 1031ea1d6981Smrg 1 CARD8 major opcode 1032ea1d6981Smrg 21 unused 1033ea1d6981Smrg<function>Fence</function> 1034ea1d6981Smrg 1 0 Error 1035ea1d6981Smrg 1 Base + 2 code 1036ea1d6981Smrg 2 CARD16 sequence number 1037ea1d6981Smrg 4 CARD32 bad fence 1038ea1d6981Smrg 2 CARD16 minor opcode 1039ea1d6981Smrg 1 CARD8 major opcode 1040ea1d6981Smrg 21 unused 1041ea1d6981Smrg</literallayout> 1042ea1d6981Smrg 1043ea1d6981Smrg</sect1> 1044ea1d6981Smrg 1045ea1d6981Smrg<sect1 id='Encoding_Requests'> 1046ea1d6981Smrg<title>Encoding Requests</title> 1047ea1d6981Smrg 1048ea1d6981Smrg<literallayout class="monospaced"> 1049ea1d6981Smrg<function>Initialize</function> 1050ea1d6981Smrg 1 CARD8 major opcode 1051ea1d6981Smrg 1 0 minor opcode 1052ea1d6981Smrg 2 2 request length 1053ea1d6981Smrg 1 CARD8 major version 1054ea1d6981Smrg 1 CARD8 minor version 1055ea1d6981Smrg 2 unused 1056ea1d6981Smrg=> 1057ea1d6981Smrg 1 1 Reply 1058ea1d6981Smrg 1 unused 1059ea1d6981Smrg 2 CARD16 sequence number 1060ea1d6981Smrg 4 0 reply length 1061ea1d6981Smrg 1 CARD8 major version 1062ea1d6981Smrg 1 CARD8 minor version 1063ea1d6981Smrg 2 unused 1064ea1d6981Smrg 20 unused 1065ea1d6981Smrg 1066ea1d6981Smrg<function>ListSystemCounters</function> 1067ea1d6981Smrg 1 CARD8 major opcode 1068ea1d6981Smrg 1 1 minor opcode 1069ea1d6981Smrg 2 1 request length 1070ea1d6981Smrg=> 1071ea1d6981Smrg 1 1 Reply 1072ea1d6981Smrg 1 unused 1073ea1d6981Smrg 2 CARD16 sequence number 1074ea1d6981Smrg 4 0 reply length 1075ea1d6981Smrg 4 INT32 list length 1076ea1d6981Smrg 20 unused 1077ea1d6981Smrg 4n list of SYSTEMCOUNTER system counters 1078ea1d6981Smrg 1079ea1d6981Smrg<function>CreateCounter</function> 1080ea1d6981Smrg 1 CARD8 major opcode 1081ea1d6981Smrg 1 2 minor opcode 1082ea1d6981Smrg 2 4 request length 1083ea1d6981Smrg 4 COUNTER id 1084ea1d6981Smrg 8 INT64 initial value 1085ea1d6981Smrg 1086ea1d6981Smrg<function>DestroyCounter</function> 1087ea1d6981Smrg 1 CARD8 major opcode 1088ea1d6981Smrg 1 6 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode</para></footnote> 1089ea1d6981Smrg 2 2 request length 1090ea1d6981Smrg 4 COUNTER counter 1091ea1d6981Smrg=> 1092ea1d6981Smrg 1 1 Reply 1093ea1d6981Smrg 1 unused 1094ea1d6981Smrg 2 CARD16 sequence number 1095ea1d6981Smrg 4 0 reply length 1096ea1d6981Smrg 8 INT64 counter value 1097ea1d6981Smrg 16 unused 1098ea1d6981Smrg 1099ea1d6981SmrgAwait 1100ea1d6981Smrg 1 CARD8 major opcode 1101ea1d6981Smrg 1 7 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote> 1102ea1d6981Smrg 2 1 + 7*n request length 1103ea1d6981Smrg 28n LISTofWAITCONDITION wait conditions 1104ea1d6981Smrg 1105ea1d6981SmrgChangeCounter 1106ea1d6981Smrg 1 CARD8 major opcode 1107ea1d6981Smrg 1 4 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote> 1108ea1d6981Smrg 2 4 request length 1109ea1d6981Smrg 4 COUNTER counter 1110ea1d6981Smrg 8 INT64 amount 1111ea1d6981Smrg 1112ea1d6981SmrgSetCounter 1113ea1d6981Smrg 1 CARD8 major opcode 1114ea1d6981Smrg 1 3 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote> 1115ea1d6981Smrg 2 4 request length 1116ea1d6981Smrg 4 COUNTER counter 1117ea1d6981Smrg 8 INT64 value 1118ea1d6981Smrg 1119ea1d6981SmrgCreateAlarm 1120ea1d6981Smrg 1 CARD8 major opcode 1121ea1d6981Smrg 1 8 minor opcode 1122ea1d6981Smrg 2 3+n request length 1123ea1d6981Smrg 4 ALARM id 1124ea1d6981Smrg 4 BITMASK values mask 1125ea1d6981Smrg 1126ea1d6981Smrg #x00000001 counter 1127ea1d6981Smrg #x00000002 value-type 1128ea1d6981Smrg #x00000004 value 1129ea1d6981Smrg #x00000008 test-type 1130ea1d6981Smrg #x00000010 delta 1131ea1d6981Smrg #x00000020 events 1132ea1d6981Smrg 1133ea1d6981Smrg 4n LISTofVALUE values 1134ea1d6981Smrg 1135ea1d6981SmrgVALUES 1136ea1d6981Smrg 4 COUNTER counter 1137ea1d6981Smrg 4 VALUETYPE value-type 1138ea1d6981Smrg 8 INT64 value 1139ea1d6981Smrg 4 TESTTYPE test-type 1140ea1d6981Smrg 8 INT64 delta 1141ea1d6981Smrg 4 BOOL events 1142ea1d6981Smrg 1143ea1d6981SmrgChangeAlarm 1144ea1d6981Smrg 1 CARD8 major opcode 1145ea1d6981Smrg 1 9 minor opcode 1146ea1d6981Smrg 2 3+n request length 1147ea1d6981Smrg 4 ALARM id 1148ea1d6981Smrg 4 BITMASK values mask 1149ea1d6981Smrg encodings as for <function>CreateAlarm</function> 1150ea1d6981Smrg 4n LISTofVALUE values 1151ea1d6981Smrg encodings as for <function>CreateAlarm</function> 1152ea1d6981Smrg 1153ea1d6981SmrgDestroyAlarm 1154ea1d6981Smrg 1 CARD8 major opcode 1155ea1d6981Smrg 1 11 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote> 1156ea1d6981Smrg 2 2 request length 1157ea1d6981Smrg 4 ALARM alarm 1158ea1d6981Smrg 1159ea1d6981SmrgQueryAlarm 1160ea1d6981Smrg 1 CARD8 major opcode 1161ea1d6981Smrg 1 10 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote> 1162ea1d6981Smrg 2 2 request length 1163ea1d6981Smrg 4 ALARM alarm 1164ea1d6981Smrg=> 1165ea1d6981Smrg 1 1 Reply 1166ea1d6981Smrg 1 unused 1167ea1d6981Smrg 2 CARD16 sequence number 1168ea1d6981Smrg 4 2 reply length 1169ea1d6981Smrg 20 TRIGGER trigger 1170ea1d6981Smrg 8 INT64 delta 1171ea1d6981Smrg 1 BOOL events 1172ea1d6981Smrg 1 ALARMSTATE state 1173ea1d6981Smrg 2 unused 1174ea1d6981Smrg 1175ea1d6981SmrgSetPriority 1176ea1d6981Smrg 1 CARD8 major opcode 1177ea1d6981Smrg 1 12 minor opcode 1178ea1d6981Smrg 2 3 request length 1179ea1d6981Smrg 4 CARD32 id 1180ea1d6981Smrg 4 INT32 priority 1181ea1d6981Smrg 1182ea1d6981SmrgGetPriority 1183ea1d6981Smrg 1 CARD8 major opcode 1184ea1d6981Smrg 1 13 minor opcode 1185ea1d6981Smrg 2 1 request length 1186ea1d6981Smrg 4 CARD32 id 1187ea1d6981Smrg=> 1188ea1d6981Smrg 1 1 Reply 1189ea1d6981Smrg 1 unused 1190ea1d6981Smrg 2 CARD16 sequence number 1191ea1d6981Smrg 4 0 reply length 1192ea1d6981Smrg 4 INT32 priority 1193ea1d6981Smrg 20 unused 1194ea1d6981Smrg 1195ea1d6981SmrgCreateFence 1196ea1d6981Smrg 1 CARD8 major opcode 1197ea1d6981Smrg 1 14 minor opcode 1198ea1d6981Smrg 2 4 request length 1199ea1d6981Smrg 4 DRAWABLE drawable 1200ea1d6981Smrg 4 FENCE id 1201ea1d6981Smrg 1 BOOL initially triggered 1202ea1d6981Smrg 3 unused 1203ea1d6981Smrg 1204ea1d6981SmrgTriggerFence 1205ea1d6981Smrg 1 CARD8 major opcode 1206ea1d6981Smrg 1 15 minor opcode 1207ea1d6981Smrg 2 2 request length 1208ea1d6981Smrg 4 FENCE id 1209ea1d6981Smrg 1210ea1d6981SmrgResetFence 1211ea1d6981Smrg 1 CARD8 major opcode 1212ea1d6981Smrg 1 16 minor opcode 1213ea1d6981Smrg 2 2 request length 1214ea1d6981Smrg 4 FENCE id 1215ea1d6981Smrg 1216ea1d6981SmrgDestroyFence 1217ea1d6981Smrg 1 CARD8 major opcode 1218ea1d6981Smrg 1 17 minor opcode 1219ea1d6981Smrg 2 2 request length 1220ea1d6981Smrg 4 FENCE id 1221ea1d6981Smrg 1222ea1d6981SmrgQueryFence 1223ea1d6981Smrg 1 CARD8 major opcode 1224ea1d6981Smrg 1 18 minor opcode 1225ea1d6981Smrg 2 2 request length 1226ea1d6981Smrg 4 FENCE id 1227ea1d6981Smrg=> 1228ea1d6981Smrg 1 1 Reply 1229ea1d6981Smrg 1 unused 1230ea1d6981Smrg 2 CARD16 sequence number 1231ea1d6981Smrg 4 0 reply length 1232ea1d6981Smrg 1 BOOL triggered 1233ea1d6981Smrg 23 unused 1234ea1d6981Smrg 1235ea1d6981SmrgAwaitFence 1236ea1d6981Smrg 1 CARD8 major opcode 1237ea1d6981Smrg 1 19 minor opcode 1238ea1d6981Smrg 2 1 + n request length 1239ea1d6981Smrg 4*n LISTofFENCE wait conditions 1240ea1d6981Smrg 1241ea1d6981Smrg</literallayout> 1242ea1d6981Smrg 1243ea1d6981Smrg</sect1> 1244ea1d6981Smrg 1245ea1d6981Smrg<sect1 id='Encoding_Events'> 1246ea1d6981Smrg<title>Encoding Events</title> 1247ea1d6981Smrg 1248ea1d6981Smrg<literallayout class="monospaced"> 1249ea1d6981Smrg<function>CounterNotify</function> 1250ea1d6981Smrg 1 Base + 0 code 1251ea1d6981Smrg 1 0 kind 1252ea1d6981Smrg 2 CARD16 sequence number 1253ea1d6981Smrg 4 COUNTER counter 1254ea1d6981Smrg 8 INT64 wait value 1255ea1d6981Smrg 8 INT64 counter value 1256ea1d6981Smrg 4 TIME timestamp 1257ea1d6981Smrg 2 CARD16 count 1258ea1d6981Smrg 1 BOOL destroyed 1259ea1d6981Smrg 1 unused 1260ea1d6981Smrg 1261ea1d6981Smrg<function>AlarmNotify</function> 1262ea1d6981Smrg 1 Base + 1 code 1263ea1d6981Smrg 1 1 kind 1264ea1d6981Smrg 2 CARD16 sequence number 1265ea1d6981Smrg 4 ALARM alarm 1266ea1d6981Smrg 8 INT64 counter value 1267ea1d6981Smrg 8 INT64 alarm value 1268ea1d6981Smrg 4 TIME timestamp 1269ea1d6981Smrg 1 ALARMSTATE state 1270ea1d6981Smrg 3 unused 1271ea1d6981Smrg</literallayout> 1272ea1d6981Smrg</sect1> 1273ea1d6981Smrg</chapter> 1274ea1d6981Smrg</book> 1275