1 /*
2 
3 Copyright 1991, 1993, 1994, 1998  The Open Group
4 
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
24 
25 */
26 
27 /***********************************************************
28 Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
29 and Olivetti Research Limited, Cambridge, England.
30 
31                         All Rights Reserved
32 
33 Permission to use, copy, modify, and distribute this software and its
34 documentation for any purpose and without fee is hereby granted,
35 provided that the above copyright notice appear in all copies and that
36 both that copyright notice and this permission notice appear in
37 supporting documentation, and that the names of Digital or Olivetti
38 not be used in advertising or publicity pertaining to distribution of the
39 software without specific, written prior permission.
40 
41 DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
42 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
43 FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
44 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
45 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
46 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
47 PERFORMANCE OF THIS SOFTWARE.
48 
49 ******************************************************************/
50 
51 #ifndef _SYNCPROTO_H_
52 #define _SYNCPROTO_H_
53 
54 #include <X11/extensions/syncconst.h>
55 
56 #define X_SyncInitialize		0
57 #define X_SyncListSystemCounters	1
58 #define X_SyncCreateCounter		2
59 #define X_SyncSetCounter		3
60 #define X_SyncChangeCounter		4
61 #define X_SyncQueryCounter              5
62 #define X_SyncDestroyCounter		6
63 #define X_SyncAwait			7
64 #define X_SyncCreateAlarm               8
65 #define X_SyncChangeAlarm	        9
66 #define X_SyncQueryAlarm	       10
67 #define X_SyncDestroyAlarm	       11
68 #define X_SyncSetPriority   	       12
69 #define X_SyncGetPriority   	       13
70 #define X_SyncCreateFence	       14
71 #define X_SyncTriggerFence	       15
72 #define X_SyncResetFence	       16
73 #define X_SyncDestroyFence	       17
74 #define X_SyncQueryFence	       18
75 #define X_SyncAwaitFence	       19
76 
77 /* cover up types from sync.h to make sure they're the right size for
78  * protocol packaging.  These will be undef'ed after all the protocol
79  * structures are defined.
80  */
81 #define XSyncCounter CARD32
82 #define XSyncAlarm   CARD32
83 #define XSyncFence   CARD32
84 #define Drawable     CARD32
85 
86 /*
87  * Initialize
88  */
89 typedef struct _xSyncInitialize {
90     CARD8	reqType;
91     CARD8	syncReqType;
92     CARD16	length;
93     CARD8	majorVersion;
94     CARD8	minorVersion;
95     CARD16	pad;
96 } xSyncInitializeReq;
97 #define sz_xSyncInitializeReq		8
98 
99 typedef struct {
100     BYTE	type;
101     CARD8	unused;
102     CARD16	sequenceNumber;
103     CARD32	length;
104     CARD8	majorVersion;
105     CARD8	minorVersion;
106     CARD16	pad;
107     CARD32	pad0;
108     CARD32	pad1;
109     CARD32	pad2;
110     CARD32	pad3;
111     CARD32	pad4;
112 } xSyncInitializeReply;
113 #define sz_xSyncInitializeReply	32
114 
115 /*
116  * ListSystemCounters
117  */
118 typedef struct _xSyncListSystemCounters
119 {
120     CARD8	reqType;
121     CARD8	syncReqType;
122     CARD16	length;
123 } xSyncListSystemCountersReq;
124 #define sz_xSyncListSystemCountersReq	4
125 
126 typedef struct {
127     BYTE	type;
128     CARD8	unused;
129     CARD16	sequenceNumber;
130     CARD32	length;
131     INT32	nCounters;
132     CARD32	pad0;
133     CARD32	pad1;
134     CARD32	pad2;
135     CARD32	pad3;
136     CARD32	pad4;
137 } xSyncListSystemCountersReply;
138 #define sz_xSyncListSystemCountersReply	32
139 
140 typedef struct {
141     XSyncCounter counter;
142     INT32	resolution_hi;
143     CARD32	resolution_lo;
144     CARD16	name_length;
145 } xSyncSystemCounter;
146 #define sz_xSyncSystemCounter 14
147 
148 /*
149  * Create Counter
150  */
151 typedef struct _xSyncCreateCounterReq {
152     CARD8	reqType;
153     CARD8	syncReqType;
154     CARD16	length;
155     XSyncCounter cid;
156     INT32	initial_value_hi;
157     CARD32	initial_value_lo;
158 } xSyncCreateCounterReq;
159 #define sz_xSyncCreateCounterReq	16
160 
161 /*
162  * Change Counter
163  */
164 typedef struct _xSyncChangeCounterReq {
165     CARD8	reqType;
166     CARD8	syncReqType;
167     CARD16	length;
168     XSyncCounter cid;
169     INT32	value_hi;
170     CARD32	value_lo;
171 } xSyncChangeCounterReq;
172 #define sz_xSyncChangeCounterReq	16
173 
174 /*
175  * Set Counter
176  */
177 typedef struct _xSyncSetCounterReq {
178     CARD8	reqType;
179     CARD8	syncReqType;
180     CARD16	length;
181     XSyncCounter cid;
182     INT32	value_hi;
183     CARD32	value_lo;
184 } xSyncSetCounterReq;
185 #define sz_xSyncSetCounterReq	16
186 
187 /*
188  * Destroy Counter
189  */
190 typedef struct _xSyncDestroyCounterReq {
191     CARD8	reqType;
192     CARD8	syncReqType;
193     CARD16	length;
194     XSyncCounter counter;
195 } xSyncDestroyCounterReq;
196 #define sz_xSyncDestroyCounterReq	8
197 
198 /*
199  * Query Counter
200  */
201 typedef struct _xSyncQueryCounterReq {
202     CARD8	reqType;
203     CARD8	syncReqType;
204     CARD16	length;
205     XSyncCounter counter;
206 } xSyncQueryCounterReq;
207 #define sz_xSyncQueryCounterReq		8
208 
209 
210 typedef struct {
211     BYTE	type;
212     CARD8	unused;
213     CARD16	sequenceNumber;
214     CARD32	length;
215     INT32	value_hi;
216     CARD32	value_lo;
217     CARD32	pad0;
218     CARD32	pad1;
219     CARD32	pad2;
220     CARD32	pad3;
221 } xSyncQueryCounterReply;
222 #define sz_xSyncQueryCounterReply	32
223 
224 /*
225  * Await
226  */
227 typedef struct _xSyncAwaitReq {
228     CARD8	reqType;
229     CARD8	syncReqType;
230     CARD16	length;
231 } xSyncAwaitReq;
232 #define sz_xSyncAwaitReq		4
233 
234 typedef struct _xSyncWaitCondition {
235     XSyncCounter counter;
236     CARD32	value_type;
237     INT32	wait_value_hi;
238     CARD32	wait_value_lo;
239     CARD32	test_type;
240     INT32	event_threshold_hi;
241     CARD32	event_threshold_lo;
242 } xSyncWaitCondition;
243 #define sz_xSyncWaitCondition		28
244 
245 /*
246  * Create Alarm
247  */
248 typedef struct _xSyncCreateAlarmReq {
249     CARD8	reqType;
250     CARD8	syncReqType;
251     CARD16	length;
252     XSyncAlarm	id;
253     CARD32	valueMask;
254 } xSyncCreateAlarmReq;
255 #define sz_xSyncCreateAlarmReq		12
256 
257 /*
258  * Destroy Alarm
259  */
260 typedef struct _xSyncDestroyAlarmReq {
261     CARD8	reqType;
262     CARD8	syncReqType;
263     CARD16	length;
264     XSyncAlarm	alarm;
265 } xSyncDestroyAlarmReq;
266 #define sz_xSyncDestroyAlarmReq		8
267 
268 /*
269  * Query Alarm
270  */
271 typedef struct _xSyncQueryAlarmReq {
272     CARD8	reqType;
273     CARD8	syncReqType;
274     CARD16	length;
275     XSyncAlarm	alarm;
276 } xSyncQueryAlarmReq;
277 #define sz_xSyncQueryAlarmReq		8
278 
279 typedef struct {
280     BYTE	type;
281     CARD8	unused;
282     CARD16	sequenceNumber;
283     CARD32	length;
284     XSyncCounter counter;
285     CARD32	value_type;
286     INT32	wait_value_hi;
287     CARD32	wait_value_lo;
288     CARD32	test_type;
289     INT32	delta_hi;
290     CARD32	delta_lo;
291     BOOL        events;
292     BYTE        state;
293     BYTE	pad0;
294     BYTE	pad1;
295 } xSyncQueryAlarmReply;
296 #define sz_xSyncQueryAlarmReply		40
297 
298 /*
299  * Change Alarm
300  */
301 typedef struct _xSyncChangeAlarmReq {
302     CARD8	reqType;
303     CARD8	syncReqType;
304     CARD16	length;
305     XSyncAlarm	alarm;
306     CARD32	valueMask;
307 } xSyncChangeAlarmReq;
308 #define sz_xSyncChangeAlarmReq		12
309 
310 /*
311  * SetPriority
312  */
313 typedef struct _xSyncSetPriority{
314     CARD8   	reqType;
315     CARD8   	syncReqType;
316     CARD16  	length;
317     CARD32  	id;
318     INT32  	priority;
319 } xSyncSetPriorityReq;
320 #define sz_xSyncSetPriorityReq	    	12
321 
322 /*
323  * Get Priority
324  */
325 typedef struct _xSyncGetPriority{
326     CARD8   	reqType;
327     CARD8   	syncReqType;
328     CARD16  	length;
329     CARD32  	id; /*XXX XID? */
330 } xSyncGetPriorityReq;
331 #define sz_xSyncGetPriorityReq	    	 8
332 
333 typedef struct {
334     BYTE	type;
335     CARD8	unused;
336     CARD16	sequenceNumber;
337     CARD32	length;
338     INT32  	priority;
339     CARD32  	pad0;
340     CARD32  	pad1;
341     CARD32  	pad2;
342     CARD32  	pad3;
343     CARD32  	pad4;
344 } xSyncGetPriorityReply;
345 #define sz_xSyncGetPriorityReply	32
346 
347 /*
348  * Create Fence
349  */
350 typedef struct _xSyncCreateFenceReq {
351     CARD8	reqType;
352     CARD8	syncReqType;
353     CARD16	length;
354     Drawable	d;
355     XSyncFence	fid;
356     BOOL	initially_triggered;
357     CARD8	pad0;
358     CARD16	pad1;
359 } xSyncCreateFenceReq;
360 #define sz_xSyncCreateFenceReq		16
361 
362 /*
363  * Put a fence object in the "triggered" state.
364  */
365 typedef struct _xSyncTriggerFenceReq {
366     CARD8	reqType;
367     CARD8	syncReqType;
368     CARD16	length;
369     XSyncFence	fid;
370 } xSyncTriggerFenceReq;
371 #define sz_xSyncTriggerFenceReq		8
372 
373 /*
374  * Put a fence in the "untriggered" state.
375  */
376 typedef struct _xSyncResetFenceReq {
377     CARD8	reqType;
378     CARD8	syncReqType;
379     CARD16	length;
380     XSyncFence	fid;
381 } xSyncResetFenceReq;
382 #define sz_xSyncResetFenceReq		8
383 
384 /*
385  * Destroy a fence object
386  */
387 typedef struct _xSyncDestroyFenceReq {
388     CARD8	reqType;
389     CARD8	syncReqType;
390     CARD16	length;
391     XSyncFence	fid;
392 } xSyncDestroyFenceReq;
393 #define sz_xSyncDestroyFenceReq		8
394 
395 /*
396  * Query a fence object
397  */
398 typedef struct _xSyncQueryFenceReq {
399     CARD8	reqType;
400     CARD8	syncReqType;
401     CARD16	length;
402     XSyncFence	fid;
403 } xSyncQueryFenceReq;
404 #define sz_xSyncQueryFenceReq		8
405 
406 /*
407  * Wait for any of a list of fence sync objects
408  * to reach the "triggered" state.
409  */
410 typedef struct _xSyncAwaitFenceReq {
411     CARD8	reqType;
412     CARD8	syncReqType;
413     CARD16	length;
414 } xSyncAwaitFenceReq;
415 #define sz_xSyncAwaitFenceReq		4
416 
417 typedef struct {
418     BYTE	type;
419     CARD8	unused;
420     CARD16	sequenceNumber;
421     CARD32	length;
422     BOOL	triggered;
423     BYTE	pad0;
424     CARD16	pad1;
425     CARD32	pad2;
426     CARD32	pad3;
427     CARD32	pad4;
428     CARD32	pad5;
429     CARD32	pad6;
430 } xSyncQueryFenceReply;
431 #define sz_xSyncQueryFenceReply		32
432 
433 /*
434  * Events
435  */
436 
437 typedef struct _xSyncCounterNotifyEvent {
438     BYTE	type;
439     BYTE	kind;
440     CARD16	sequenceNumber;
441     XSyncCounter counter;
442     INT32	wait_value_hi;
443     CARD32	wait_value_lo;
444     INT32	counter_value_hi;
445     CARD32	counter_value_lo;
446     CARD32	time;
447     CARD16	count;
448     BOOL	destroyed;
449     BYTE        pad0;
450 } xSyncCounterNotifyEvent;
451 
452 typedef struct _xSyncAlarmNotifyEvent {
453     BYTE	type;
454     BYTE	kind;
455     CARD16	sequenceNumber;
456     XSyncAlarm	alarm;
457     INT32	counter_value_hi;
458     CARD32	counter_value_lo;
459     INT32	alarm_value_hi;
460     CARD32	alarm_value_lo;
461     CARD32	time;
462     CARD8       state;
463     BYTE        pad0;
464     BYTE        pad1;
465     BYTE        pad2;
466 } xSyncAlarmNotifyEvent;
467 
468 #undef XSyncCounter
469 #undef XSyncAlarm
470 #undef XSyncFence
471 #undef Drawable
472 
473 
474 #endif /* _SYNCPROTO_H_ */
475