1/*
2 * Copyright © 2013 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission.  The copyright holders make no representations
11 * about the suitability of this software for any purpose.  It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef _PRESENT_PROTO_H_
24#define _PRESENT_PROTO_H_
25
26#include <X11/extensions/presenttokens.h>
27#include <X11/extensions/dri3proto.h>
28
29#define Window CARD32
30#define Pixmap CARD32
31#define Region CARD32
32#define XSyncFence CARD32
33#define EventID CARD32
34
35typedef struct {
36    Window  window;
37    CARD32  serial;
38} xPresentNotify;
39#define sz_xPresentNotify               8
40
41typedef struct {
42    CARD8   reqType;
43    CARD8   presentReqType;
44    CARD16  length;
45    CARD32  majorVersion;
46    CARD32  minorVersion;
47} xPresentQueryVersionReq;
48#define sz_xPresentQueryVersionReq   12
49
50typedef struct {
51    BYTE    type;   /* X_Reply */
52    BYTE    pad1;
53    CARD16  sequenceNumber;
54    CARD32  length;
55    CARD32  majorVersion;
56    CARD32  minorVersion;
57    CARD32  pad2;
58    CARD32  pad3;
59    CARD32  pad4;
60    CARD32  pad5;
61} xPresentQueryVersionReply;
62#define sz_xPresentQueryVersionReply	32
63
64typedef struct {
65    CARD8   reqType;
66    CARD8   presentReqType;
67    CARD16  length;
68    Window  window;
69
70    Pixmap  pixmap;
71    CARD32  serial;
72
73    Region  valid;
74    Region  update;
75
76    INT16   x_off;
77    INT16   y_off;
78    CARD32  target_crtc;
79
80    XSyncFence wait_fence;
81    XSyncFence idle_fence;
82
83    CARD32  options;
84    CARD32  pad1;
85
86    CARD64  target_msc;
87    CARD64  divisor;
88    CARD64  remainder;
89    /* followed by a LISTofPRESENTNOTIFY */
90} xPresentPixmapReq;
91#define sz_xPresentPixmapReq	72
92
93typedef struct {
94    CARD8   reqType;
95    CARD8   presentReqType;
96    CARD16  length;
97    Window  window;
98
99    CARD32  serial;
100    CARD32  pad0;
101
102    CARD64  target_msc;
103    CARD64  divisor;
104    CARD64  remainder;
105} xPresentNotifyMSCReq;
106#define sz_xPresentNotifyMSCReq	40
107
108typedef struct {
109    CARD8   reqType;
110    CARD8   presentReqType;
111    CARD16  length;
112    CARD32  eid;
113    CARD32  window;
114    CARD32  eventMask;
115} xPresentSelectInputReq;
116#define sz_xPresentSelectInputReq   16
117
118typedef struct {
119    CARD8   reqType;
120    CARD8   presentReqType;
121    CARD16  length;
122    CARD32  target;
123} xPresentQueryCapabilitiesReq;
124#define sz_xPresentQueryCapabilitiesReq   8
125
126typedef struct {
127    BYTE    type;   /* X_Reply */
128    BYTE    pad1;
129    CARD16  sequenceNumber;
130    CARD32  length;
131    CARD32  capabilities;
132    CARD32  pad3;
133    CARD32  pad4;
134    CARD32  pad5;
135    CARD32  pad6;
136    CARD32  pad7;
137} xPresentQueryCapabilitiesReply;
138#define sz_xPresentQueryCapabilitiesReply       32
139
140typedef struct {
141    CARD8   reqType;
142    CARD8   presentReqType;
143    CARD16  length;
144    Window  window;
145
146    Pixmap  pixmap;
147    CARD32  serial;
148
149    Region  valid;
150    Region  update;
151
152    INT16   x_off;
153    INT16   y_off;
154    CARD32  target_crtc;
155
156    DRI3Syncobj acquire_syncobj;
157    DRI3Syncobj release_syncobj;
158    CARD64 acquire_point;
159    CARD64 release_point;
160
161    CARD32  options;
162    CARD32  pad1;
163
164    CARD64  target_msc;
165    CARD64  divisor;
166    CARD64  remainder;
167    /* followed by a LISTofPRESENTNOTIFY */
168} xPresentPixmapSyncedReq;
169#define sz_xPresentPixmapSyncedReq	88
170
171/*
172 * Events
173 *
174 * All Present events are X Generic Events
175 */
176
177typedef struct {
178    CARD8 type;
179    CARD8 extension;
180    CARD16 sequenceNumber;
181    CARD32 length;
182    CARD16 evtype;
183    CARD16 pad2;
184    CARD32 eid;
185    CARD32 window;
186    INT16  x;
187    INT16  y;
188    CARD16 width;
189    CARD16 height;
190    INT16  off_x;
191    INT16  off_y;
192
193    CARD16 pixmap_width;
194    CARD16 pixmap_height;
195    CARD32 pixmap_flags;
196} xPresentConfigureNotify;
197#define sz_xPresentConfigureNotify 40
198
199typedef struct {
200    CARD8 type;
201    CARD8 extension;
202    CARD16 sequenceNumber;
203    CARD32 length;
204    CARD16 evtype;
205    CARD8  kind;
206    CARD8  mode;
207    CARD32 eid;
208    Window window;
209    CARD32 serial;
210    CARD64 ust;
211
212    CARD64 msc;
213} xPresentCompleteNotify;
214#define sz_xPresentCompleteNotify 40
215
216typedef struct {
217    CARD8 type;
218    CARD8 extension;
219    CARD16 sequenceNumber;
220    CARD32 length;
221    CARD16 evtype;
222    CARD16 pad2;
223    CARD32 eid;
224    Window window;
225    CARD32 serial;
226    Pixmap pixmap;
227    CARD32 idle_fence;
228} xPresentIdleNotify;
229#define sz_xPresentIdleNotify   32
230
231#if PRESENT_FUTURE_VERSION
232typedef struct {
233    CARD8 type;
234    CARD8 extension;
235    CARD16 sequenceNumber;
236    CARD32 length;
237    CARD16 evtype;
238    CARD8 update_window;
239    CARD8 pad1;
240    CARD32 eid;
241    Window event_window;
242    Window window;
243    Pixmap pixmap;
244    CARD32 serial;
245
246    /* 32-byte boundary */
247
248    Region valid_region;
249    Region update_region;
250
251    xRectangle valid_rect;
252
253    xRectangle update_rect;
254
255    INT16 x_off;
256    INT16 y_off;
257    CARD32 target_crtc;
258
259    XSyncFence wait_fence;
260    XSyncFence idle_fence;
261
262    CARD32 options;
263    CARD32 pad2;
264
265    CARD64 target_msc;
266    CARD64 divisor;
267    CARD64 remainder;
268
269} xPresentRedirectNotify;
270
271#define sz_xPresentRedirectNotify 104
272#endif
273
274#undef Window
275#undef Pixmap
276#undef Region
277#undef XSyncFence
278#undef EventID
279
280#endif
281