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 
28 #define Window CARD32
29 #define Pixmap CARD32
30 #define Region CARD32
31 #define XSyncFence CARD32
32 #define EventID CARD32
33 
34 typedef struct {
35     Window  window;
36     CARD32  serial;
37 } xPresentNotify;
38 #define sz_xPresentNotify               8
39 
40 typedef struct {
41     CARD8   reqType;
42     CARD8   presentReqType;
43     CARD16  length;
44     CARD32  majorVersion;
45     CARD32  minorVersion;
46 } xPresentQueryVersionReq;
47 #define sz_xPresentQueryVersionReq   12
48 
49 typedef struct {
50     BYTE    type;   /* X_Reply */
51     BYTE    pad1;
52     CARD16  sequenceNumber;
53     CARD32  length;
54     CARD32  majorVersion;
55     CARD32  minorVersion;
56     CARD32  pad2;
57     CARD32  pad3;
58     CARD32  pad4;
59     CARD32  pad5;
60 } xPresentQueryVersionReply;
61 #define sz_xPresentQueryVersionReply	32
62 
63 typedef struct {
64     CARD8   reqType;
65     CARD8   presentReqType;
66     CARD16  length;
67     Window  window;
68 
69     Pixmap  pixmap;
70     CARD32  serial;
71 
72     Region  valid;
73     Region  update;
74 
75     INT16   x_off;
76     INT16   y_off;
77     CARD32  target_crtc;
78 
79     XSyncFence wait_fence;
80     XSyncFence idle_fence;
81 
82     CARD32  options;
83     CARD32  pad1;
84 
85     CARD64  target_msc;
86     CARD64  divisor;
87     CARD64  remainder;
88     /* followed by a LISTofPRESENTNOTIFY */
89 } xPresentPixmapReq;
90 #define sz_xPresentPixmapReq	72
91 
92 typedef struct {
93     CARD8   reqType;
94     CARD8   presentReqType;
95     CARD16  length;
96     Window  window;
97 
98     CARD32  serial;
99     CARD32  pad0;
100 
101     CARD64  target_msc;
102     CARD64  divisor;
103     CARD64  remainder;
104 } xPresentNotifyMSCReq;
105 #define sz_xPresentNotifyMSCReq	40
106 
107 typedef struct {
108     CARD8   reqType;
109     CARD8   presentReqType;
110     CARD16  length;
111     CARD32  eid;
112     CARD32  window;
113     CARD32  eventMask;
114 } xPresentSelectInputReq;
115 #define sz_xPresentSelectInputReq   16
116 
117 typedef struct {
118     CARD8   reqType;
119     CARD8   presentReqType;
120     CARD16  length;
121     CARD32  target;
122 } xPresentQueryCapabilitiesReq;
123 #define sz_xPresentQueryCapabilitiesReq   8
124 
125 typedef struct {
126     BYTE    type;   /* X_Reply */
127     BYTE    pad1;
128     CARD16  sequenceNumber;
129     CARD32  length;
130     CARD32  capabilities;
131     CARD32  pad3;
132     CARD32  pad4;
133     CARD32  pad5;
134     CARD32  pad6;
135     CARD32  pad7;
136 } xPresentQueryCapabilitiesReply;
137 #define sz_xPresentQueryCapabilitiesReply       32
138 
139 /*
140  * Events
141  *
142  * All Present events are X Generic Events
143  */
144 
145 typedef struct {
146     CARD8 type;
147     CARD8 extension;
148     CARD16 sequenceNumber;
149     CARD32 length;
150     CARD16 evtype;
151     CARD16 pad2;
152     CARD32 eid;
153     CARD32 window;
154     INT16  x;
155     INT16  y;
156     CARD16 width;
157     CARD16 height;
158     INT16  off_x;
159     INT16  off_y;
160 
161     CARD16 pixmap_width;
162     CARD16 pixmap_height;
163     CARD32 pixmap_flags;
164 } xPresentConfigureNotify;
165 #define sz_xPresentConfigureNotify 40
166 
167 typedef struct {
168     CARD8 type;
169     CARD8 extension;
170     CARD16 sequenceNumber;
171     CARD32 length;
172     CARD16 evtype;
173     CARD8  kind;
174     CARD8  mode;
175     CARD32 eid;
176     Window window;
177     CARD32 serial;
178     CARD64 ust;
179 
180     CARD64 msc;
181 } xPresentCompleteNotify;
182 #define sz_xPresentCompleteNotify 40
183 
184 typedef struct {
185     CARD8 type;
186     CARD8 extension;
187     CARD16 sequenceNumber;
188     CARD32 length;
189     CARD16 evtype;
190     CARD16 pad2;
191     CARD32 eid;
192     Window window;
193     CARD32 serial;
194     Pixmap pixmap;
195     CARD32 idle_fence;
196 } xPresentIdleNotify;
197 #define sz_xPresentIdleNotify   32
198 
199 #if PRESENT_FUTURE_VERSION
200 typedef struct {
201     CARD8 type;
202     CARD8 extension;
203     CARD16 sequenceNumber;
204     CARD32 length;
205     CARD16 evtype;
206     CARD8 update_window;
207     CARD8 pad1;
208     CARD32 eid;
209     Window event_window;
210     Window window;
211     Pixmap pixmap;
212     CARD32 serial;
213 
214     /* 32-byte boundary */
215 
216     Region valid_region;
217     Region update_region;
218 
219     xRectangle valid_rect;
220 
221     xRectangle update_rect;
222 
223     INT16 x_off;
224     INT16 y_off;
225     CARD32 target_crtc;
226 
227     XSyncFence wait_fence;
228     XSyncFence idle_fence;
229 
230     CARD32 options;
231     CARD32 pad2;
232 
233     CARD64 target_msc;
234     CARD64 divisor;
235     CARD64 remainder;
236 
237 } xPresentRedirectNotify;
238 
239 #define sz_xPresentRedirectNotify 104
240 #endif
241 
242 #undef Window
243 #undef Pixmap
244 #undef Region
245 #undef XSyncFence
246 #undef EventID
247 
248 #endif
249