xref: /OK3568_Linux_fs/external/xserver/hw/xfree86/dri2/dri2.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright © 2007 Red Hat, Inc.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
5*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Soft-
6*4882a593Smuzhiyun  * ware"), to deal in the Software without restriction, including without
7*4882a593Smuzhiyun  * limitation the rights to use, copy, modify, merge, publish, distribute,
8*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
9*4882a593Smuzhiyun  * Software is furnished to do so, provided that the above copyright
10*4882a593Smuzhiyun  * notice(s) and this permission notice appear in all copies of the Soft-
11*4882a593Smuzhiyun  * ware and that both the above copyright notice(s) and this permission
12*4882a593Smuzhiyun  * notice appear in supporting documentation.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15*4882a593Smuzhiyun  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16*4882a593Smuzhiyun  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
17*4882a593Smuzhiyun  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
18*4882a593Smuzhiyun  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
19*4882a593Smuzhiyun  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20*4882a593Smuzhiyun  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21*4882a593Smuzhiyun  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
22*4882a593Smuzhiyun  * MANCE OF THIS SOFTWARE.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * Except as contained in this notice, the name of a copyright holder shall
25*4882a593Smuzhiyun  * not be used in advertising or otherwise to promote the sale, use or
26*4882a593Smuzhiyun  * other dealings in this Software without prior written authorization of
27*4882a593Smuzhiyun  * the copyright holder.
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * Authors:
30*4882a593Smuzhiyun  *   Kristian Høgsberg (krh@redhat.com)
31*4882a593Smuzhiyun  */
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun #ifndef _DRI2_H_
34*4882a593Smuzhiyun #define _DRI2_H_
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun #include <X11/extensions/dri2tokens.h>
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /* Version 2 structure (with format at the end) */
39*4882a593Smuzhiyun typedef struct {
40*4882a593Smuzhiyun     unsigned int attachment;
41*4882a593Smuzhiyun     unsigned int name;
42*4882a593Smuzhiyun     unsigned int pitch;
43*4882a593Smuzhiyun     unsigned int cpp;
44*4882a593Smuzhiyun     unsigned int flags;
45*4882a593Smuzhiyun     unsigned int format;
46*4882a593Smuzhiyun     void *driverPrivate;
47*4882a593Smuzhiyun } DRI2BufferRec, *DRI2BufferPtr;
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun extern CARD8 dri2_major;        /* version of DRI2 supported by DDX */
50*4882a593Smuzhiyun extern CARD8 dri2_minor;
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
53*4882a593Smuzhiyun typedef void (*DRI2SwapEventPtr) (ClientPtr client, void *data, int type,
54*4882a593Smuzhiyun                                   CARD64 ust, CARD64 msc, CARD32 sbc);
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun typedef DRI2BufferPtr(*DRI2CreateBuffersProcPtr) (DrawablePtr pDraw,
57*4882a593Smuzhiyun                                                   unsigned int *attachments,
58*4882a593Smuzhiyun                                                   int count);
59*4882a593Smuzhiyun typedef void (*DRI2DestroyBuffersProcPtr) (DrawablePtr pDraw,
60*4882a593Smuzhiyun                                            DRI2BufferPtr buffers, int count);
61*4882a593Smuzhiyun typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw,
62*4882a593Smuzhiyun                                        RegionPtr pRegion,
63*4882a593Smuzhiyun                                        DRI2BufferPtr pDestBuffer,
64*4882a593Smuzhiyun                                        DRI2BufferPtr pSrcBuffer);
65*4882a593Smuzhiyun typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence);
66*4882a593Smuzhiyun typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic);
67*4882a593Smuzhiyun typedef int (*DRI2AuthMagic2ProcPtr) (ScreenPtr pScreen, uint32_t magic);
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /**
70*4882a593Smuzhiyun  * Schedule a buffer swap
71*4882a593Smuzhiyun  *
72*4882a593Smuzhiyun  * This callback is used to support glXSwapBuffers and the OML_sync_control
73*4882a593Smuzhiyun  * extension (see it for a description of the params).
74*4882a593Smuzhiyun  *
75*4882a593Smuzhiyun  * Drivers should queue an event for the frame count that satisfies the
76*4882a593Smuzhiyun  * parameters passed in.  If the event is in the future (i.e. the conditions
77*4882a593Smuzhiyun  * aren't currently satisfied), the server may block the client at the next
78*4882a593Smuzhiyun  * GLX request using DRI2WaitSwap. When the event arrives, drivers should call
79*4882a593Smuzhiyun  * \c DRI2SwapComplete, which will handle waking the client and returning
80*4882a593Smuzhiyun  * the appropriate data.
81*4882a593Smuzhiyun  *
82*4882a593Smuzhiyun  * The DDX is responsible for doing a flip, exchange, or blit of the swap
83*4882a593Smuzhiyun  * when the corresponding event arrives.  The \c DRI2CanFlip and
84*4882a593Smuzhiyun  * \c DRI2CanExchange functions can be used as helpers for this purpose.
85*4882a593Smuzhiyun  *
86*4882a593Smuzhiyun  * \param client client pointer (used for block/unblock)
87*4882a593Smuzhiyun  * \param pDraw drawable whose count we want
88*4882a593Smuzhiyun  * \param pDestBuffer current front buffer
89*4882a593Smuzhiyun  * \param pSrcBuffer current back buffer
90*4882a593Smuzhiyun  * \param target_msc frame count to wait for
91*4882a593Smuzhiyun  * \param divisor divisor for condition equation
92*4882a593Smuzhiyun  * \param remainder remainder for division equation
93*4882a593Smuzhiyun  * \param func function to call when the swap completes
94*4882a593Smuzhiyun  * \param data data for the callback \p func.
95*4882a593Smuzhiyun  */
96*4882a593Smuzhiyun typedef int (*DRI2ScheduleSwapProcPtr) (ClientPtr client,
97*4882a593Smuzhiyun                                         DrawablePtr pDraw,
98*4882a593Smuzhiyun                                         DRI2BufferPtr pDestBuffer,
99*4882a593Smuzhiyun                                         DRI2BufferPtr pSrcBuffer,
100*4882a593Smuzhiyun                                         CARD64 * target_msc,
101*4882a593Smuzhiyun                                         CARD64 divisor,
102*4882a593Smuzhiyun                                         CARD64 remainder,
103*4882a593Smuzhiyun                                         DRI2SwapEventPtr func, void *data);
104*4882a593Smuzhiyun typedef DRI2BufferPtr(*DRI2CreateBufferProcPtr) (DrawablePtr pDraw,
105*4882a593Smuzhiyun                                                  unsigned int attachment,
106*4882a593Smuzhiyun                                                  unsigned int format);
107*4882a593Smuzhiyun typedef void (*DRI2DestroyBufferProcPtr) (DrawablePtr pDraw,
108*4882a593Smuzhiyun                                           DRI2BufferPtr buffer);
109*4882a593Smuzhiyun /**
110*4882a593Smuzhiyun  * Notifies driver when DRI2GetBuffers reuses a dri2 buffer.
111*4882a593Smuzhiyun  *
112*4882a593Smuzhiyun  * Driver may rename the dri2 buffer in this notify if it is required.
113*4882a593Smuzhiyun  *
114*4882a593Smuzhiyun  * \param pDraw drawable whose count we want
115*4882a593Smuzhiyun  * \param buffer buffer that will be returned to client
116*4882a593Smuzhiyun  */
117*4882a593Smuzhiyun typedef void (*DRI2ReuseBufferNotifyProcPtr) (DrawablePtr pDraw,
118*4882a593Smuzhiyun                                               DRI2BufferPtr buffer);
119*4882a593Smuzhiyun /**
120*4882a593Smuzhiyun  * Get current media stamp counter values
121*4882a593Smuzhiyun  *
122*4882a593Smuzhiyun  * This callback is used to support the SGI_video_sync and OML_sync_control
123*4882a593Smuzhiyun  * extensions.
124*4882a593Smuzhiyun  *
125*4882a593Smuzhiyun  * Drivers should return the current frame counter and the timestamp from
126*4882a593Smuzhiyun  * when the returned frame count was last incremented.
127*4882a593Smuzhiyun  *
128*4882a593Smuzhiyun  * The count should correspond to the screen where the drawable is currently
129*4882a593Smuzhiyun  * visible.  If the drawable isn't visible (e.g. redirected), the server
130*4882a593Smuzhiyun  * should return BadDrawable to the client, pending GLX spec updates to
131*4882a593Smuzhiyun  * define this behavior.
132*4882a593Smuzhiyun  *
133*4882a593Smuzhiyun  * \param pDraw drawable whose count we want
134*4882a593Smuzhiyun  * \param ust timestamp from when the count was last incremented.
135*4882a593Smuzhiyun  * \param mst current frame count
136*4882a593Smuzhiyun  */
137*4882a593Smuzhiyun typedef int (*DRI2GetMSCProcPtr) (DrawablePtr pDraw, CARD64 * ust,
138*4882a593Smuzhiyun                                   CARD64 * msc);
139*4882a593Smuzhiyun /**
140*4882a593Smuzhiyun  * Schedule a frame count related wait
141*4882a593Smuzhiyun  *
142*4882a593Smuzhiyun  * This callback is used to support the SGI_video_sync and OML_sync_control
143*4882a593Smuzhiyun  * extensions.  See those specifications for details on how to handle
144*4882a593Smuzhiyun  * the divisor and remainder parameters.
145*4882a593Smuzhiyun  *
146*4882a593Smuzhiyun  * Drivers should queue an event for the frame count that satisfies the
147*4882a593Smuzhiyun  * parameters passed in.  If the event is in the future (i.e. the conditions
148*4882a593Smuzhiyun  * aren't currently satisfied), the driver should block the client using
149*4882a593Smuzhiyun  * \c DRI2BlockClient.  When the event arrives, drivers should call
150*4882a593Smuzhiyun  * \c DRI2WaitMSCComplete, which will handle waking the client and returning
151*4882a593Smuzhiyun  * the appropriate data.
152*4882a593Smuzhiyun  *
153*4882a593Smuzhiyun  * \param client client pointer (used for block/unblock)
154*4882a593Smuzhiyun  * \param pDraw drawable whose count we want
155*4882a593Smuzhiyun  * \param target_msc frame count to wait for
156*4882a593Smuzhiyun  * \param divisor divisor for condition equation
157*4882a593Smuzhiyun  * \param remainder remainder for division equation
158*4882a593Smuzhiyun  */
159*4882a593Smuzhiyun typedef int (*DRI2ScheduleWaitMSCProcPtr) (ClientPtr client,
160*4882a593Smuzhiyun                                            DrawablePtr pDraw,
161*4882a593Smuzhiyun                                            CARD64 target_msc,
162*4882a593Smuzhiyun                                            CARD64 divisor, CARD64 remainder);
163*4882a593Smuzhiyun 
164*4882a593Smuzhiyun typedef void (*DRI2InvalidateProcPtr) (DrawablePtr pDraw, void *data, XID id);
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun /**
167*4882a593Smuzhiyun  * DRI2 calls this hook when ever swap_limit is going to be changed. Default
168*4882a593Smuzhiyun  * implementation for the hook only accepts one as swap_limit. If driver can
169*4882a593Smuzhiyun  * support other swap_limits it has to implement supported limits with this
170*4882a593Smuzhiyun  * callback.
171*4882a593Smuzhiyun  *
172*4882a593Smuzhiyun  * \param pDraw drawable whos swap_limit is going to be changed
173*4882a593Smuzhiyun  * \param swap_limit new swap_limit that going to be set
174*4882a593Smuzhiyun  * \return TRUE if limit is support, FALSE if not.
175*4882a593Smuzhiyun  */
176*4882a593Smuzhiyun typedef Bool (*DRI2SwapLimitValidateProcPtr) (DrawablePtr pDraw,
177*4882a593Smuzhiyun                                               int swap_limit);
178*4882a593Smuzhiyun 
179*4882a593Smuzhiyun typedef DRI2BufferPtr(*DRI2CreateBuffer2ProcPtr) (ScreenPtr pScreen,
180*4882a593Smuzhiyun                                                   DrawablePtr pDraw,
181*4882a593Smuzhiyun                                                   unsigned int attachment,
182*4882a593Smuzhiyun                                                   unsigned int format);
183*4882a593Smuzhiyun typedef void (*DRI2DestroyBuffer2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw,
184*4882a593Smuzhiyun                                           DRI2BufferPtr buffer);
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun typedef void (*DRI2CopyRegion2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw,
187*4882a593Smuzhiyun                                         RegionPtr pRegion,
188*4882a593Smuzhiyun                                         DRI2BufferPtr pDestBuffer,
189*4882a593Smuzhiyun                                         DRI2BufferPtr pSrcBuffer);
190*4882a593Smuzhiyun 
191*4882a593Smuzhiyun /**
192*4882a593Smuzhiyun  * \brief Get the value of a parameter.
193*4882a593Smuzhiyun  *
194*4882a593Smuzhiyun  * The parameter's \a value is looked up on the screen associated with
195*4882a593Smuzhiyun  * \a pDrawable.
196*4882a593Smuzhiyun  *
197*4882a593Smuzhiyun  * \return \c Success or error code.
198*4882a593Smuzhiyun  */
199*4882a593Smuzhiyun typedef int (*DRI2GetParamProcPtr) (ClientPtr client,
200*4882a593Smuzhiyun                                     DrawablePtr pDrawable,
201*4882a593Smuzhiyun                                     CARD64 param,
202*4882a593Smuzhiyun                                     BOOL *is_param_recognized,
203*4882a593Smuzhiyun                                     CARD64 *value);
204*4882a593Smuzhiyun 
205*4882a593Smuzhiyun /**
206*4882a593Smuzhiyun  * Version of the DRI2InfoRec structure defined in this header
207*4882a593Smuzhiyun  */
208*4882a593Smuzhiyun #define DRI2INFOREC_VERSION 9
209*4882a593Smuzhiyun 
210*4882a593Smuzhiyun typedef struct {
211*4882a593Smuzhiyun     unsigned int version;       /**< Version of this struct */
212*4882a593Smuzhiyun     int fd;
213*4882a593Smuzhiyun     const char *driverName;
214*4882a593Smuzhiyun     const char *deviceName;
215*4882a593Smuzhiyun 
216*4882a593Smuzhiyun     DRI2CreateBufferProcPtr CreateBuffer;
217*4882a593Smuzhiyun     DRI2DestroyBufferProcPtr DestroyBuffer;
218*4882a593Smuzhiyun     DRI2CopyRegionProcPtr CopyRegion;
219*4882a593Smuzhiyun     DRI2WaitProcPtr Wait;
220*4882a593Smuzhiyun 
221*4882a593Smuzhiyun     /* added in version 4 */
222*4882a593Smuzhiyun 
223*4882a593Smuzhiyun     DRI2ScheduleSwapProcPtr ScheduleSwap;
224*4882a593Smuzhiyun     DRI2GetMSCProcPtr GetMSC;
225*4882a593Smuzhiyun     DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun     /* number of drivers in the driverNames array */
228*4882a593Smuzhiyun     unsigned int numDrivers;
229*4882a593Smuzhiyun     /* array of driver names, indexed by DRI2Driver* driver types */
230*4882a593Smuzhiyun     /* a name of NULL means that driver is not supported */
231*4882a593Smuzhiyun     const char *const *driverNames;
232*4882a593Smuzhiyun 
233*4882a593Smuzhiyun     /* added in version 5 */
234*4882a593Smuzhiyun 
235*4882a593Smuzhiyun     DRI2AuthMagicProcPtr AuthMagic;
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun     /* added in version 6 */
238*4882a593Smuzhiyun 
239*4882a593Smuzhiyun     DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
240*4882a593Smuzhiyun     DRI2SwapLimitValidateProcPtr SwapLimitValidate;
241*4882a593Smuzhiyun 
242*4882a593Smuzhiyun     /* added in version 7 */
243*4882a593Smuzhiyun     DRI2GetParamProcPtr GetParam;
244*4882a593Smuzhiyun 
245*4882a593Smuzhiyun     /* added in version 8 */
246*4882a593Smuzhiyun     /* AuthMagic callback which passes extra context */
247*4882a593Smuzhiyun     /* If this is NULL the AuthMagic callback is used */
248*4882a593Smuzhiyun     /* If this is non-NULL the AuthMagic callback is ignored */
249*4882a593Smuzhiyun     DRI2AuthMagic2ProcPtr AuthMagic2;
250*4882a593Smuzhiyun 
251*4882a593Smuzhiyun     /* added in version 9 */
252*4882a593Smuzhiyun     DRI2CreateBuffer2ProcPtr CreateBuffer2;
253*4882a593Smuzhiyun     DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
254*4882a593Smuzhiyun     DRI2CopyRegion2ProcPtr CopyRegion2;
255*4882a593Smuzhiyun } DRI2InfoRec, *DRI2InfoPtr;
256*4882a593Smuzhiyun 
257*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
258*4882a593Smuzhiyun 
259*4882a593Smuzhiyun extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen);
260*4882a593Smuzhiyun 
261*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2HasSwapControl(ScreenPtr pScreen);
262*4882a593Smuzhiyun 
263*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen,
264*4882a593Smuzhiyun                                   unsigned int driverType,
265*4882a593Smuzhiyun                                   int *fd,
266*4882a593Smuzhiyun                                   const char **driverName,
267*4882a593Smuzhiyun                                   const char **deviceName);
268*4882a593Smuzhiyun 
269*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic);
270*4882a593Smuzhiyun 
271*4882a593Smuzhiyun extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
272*4882a593Smuzhiyun                                         DrawablePtr pDraw,
273*4882a593Smuzhiyun                                         XID id,
274*4882a593Smuzhiyun                                         DRI2InvalidateProcPtr invalidate,
275*4882a593Smuzhiyun                                         void *priv);
276*4882a593Smuzhiyun 
277*4882a593Smuzhiyun extern _X_EXPORT int DRI2CreateDrawable2(ClientPtr client,
278*4882a593Smuzhiyun                                          DrawablePtr pDraw,
279*4882a593Smuzhiyun                                          XID id,
280*4882a593Smuzhiyun                                          DRI2InvalidateProcPtr invalidate,
281*4882a593Smuzhiyun                                          void *priv,
282*4882a593Smuzhiyun                                          XID *dri2_id_out);
283*4882a593Smuzhiyun 
284*4882a593Smuzhiyun extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
285*4882a593Smuzhiyun                                                int *width,
286*4882a593Smuzhiyun                                                int *height,
287*4882a593Smuzhiyun                                                unsigned int *attachments,
288*4882a593Smuzhiyun                                                int count, int *out_count);
289*4882a593Smuzhiyun 
290*4882a593Smuzhiyun extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw,
291*4882a593Smuzhiyun                                     RegionPtr pRegion,
292*4882a593Smuzhiyun                                     unsigned int dest, unsigned int src);
293*4882a593Smuzhiyun 
294*4882a593Smuzhiyun /**
295*4882a593Smuzhiyun  * Determine the major and minor version of the DRI2 extension.
296*4882a593Smuzhiyun  *
297*4882a593Smuzhiyun  * Provides a mechanism to other modules (e.g., 2D drivers) to determine the
298*4882a593Smuzhiyun  * version of the DRI2 extension.  While it is possible to peek directly at
299*4882a593Smuzhiyun  * the \c XF86ModuleData from a layered module, such a module will fail to
300*4882a593Smuzhiyun  * load (due to an unresolved symbol) if the DRI2 extension is not loaded.
301*4882a593Smuzhiyun  *
302*4882a593Smuzhiyun  * \param major  Location to store the major verion of the DRI2 extension
303*4882a593Smuzhiyun  * \param minor  Location to store the minor verion of the DRI2 extension
304*4882a593Smuzhiyun  *
305*4882a593Smuzhiyun  * \note
306*4882a593Smuzhiyun  * This interface was added some time after the initial release of the DRI2
307*4882a593Smuzhiyun  * module.  Layered modules that wish to use this interface must first test
308*4882a593Smuzhiyun  * its existance by calling \c xf86LoaderCheckSymbol.
309*4882a593Smuzhiyun  */
310*4882a593Smuzhiyun extern _X_EXPORT void DRI2Version(int *major, int *minor);
311*4882a593Smuzhiyun 
312*4882a593Smuzhiyun extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
313*4882a593Smuzhiyun                                                          int *width,
314*4882a593Smuzhiyun                                                          int *height,
315*4882a593Smuzhiyun                                                          unsigned int
316*4882a593Smuzhiyun                                                          *attachments,
317*4882a593Smuzhiyun                                                          int count,
318*4882a593Smuzhiyun                                                          int *out_count);
319*4882a593Smuzhiyun 
320*4882a593Smuzhiyun extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval);
321*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit);
322*4882a593Smuzhiyun extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable,
323*4882a593Smuzhiyun                                      CARD64 target_msc, CARD64 divisor,
324*4882a593Smuzhiyun                                      CARD64 remainder, CARD64 * swap_target,
325*4882a593Smuzhiyun                                      DRI2SwapEventPtr func, void *data);
326*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable);
327*4882a593Smuzhiyun 
328*4882a593Smuzhiyun extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 * ust,
329*4882a593Smuzhiyun                                 CARD64 * msc, CARD64 * sbc);
330*4882a593Smuzhiyun extern _X_EXPORT int DRI2WaitMSC(ClientPtr client, DrawablePtr pDrawable,
331*4882a593Smuzhiyun                                  CARD64 target_msc, CARD64 divisor,
332*4882a593Smuzhiyun                                  CARD64 remainder);
333*4882a593Smuzhiyun extern _X_EXPORT int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust,
334*4882a593Smuzhiyun                                           CARD64 msc, CARD64 sbc);
335*4882a593Smuzhiyun extern _X_EXPORT int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw,
336*4882a593Smuzhiyun                                  CARD64 target_sbc);
337*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw);
338*4882a593Smuzhiyun 
339*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2CanFlip(DrawablePtr pDraw);
340*4882a593Smuzhiyun 
341*4882a593Smuzhiyun extern _X_EXPORT Bool DRI2CanExchange(DrawablePtr pDraw);
342*4882a593Smuzhiyun 
343*4882a593Smuzhiyun /* Note: use *only* for MSC related waits */
344*4882a593Smuzhiyun extern _X_EXPORT void DRI2BlockClient(ClientPtr client, DrawablePtr pDraw);
345*4882a593Smuzhiyun 
346*4882a593Smuzhiyun extern _X_EXPORT void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw,
347*4882a593Smuzhiyun                                        int frame, unsigned int tv_sec,
348*4882a593Smuzhiyun                                        unsigned int tv_usec, int type,
349*4882a593Smuzhiyun                                        DRI2SwapEventPtr swap_complete,
350*4882a593Smuzhiyun                                        void *swap_data);
351*4882a593Smuzhiyun extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw,
352*4882a593Smuzhiyun                                           int frame, unsigned int tv_sec,
353*4882a593Smuzhiyun                                           unsigned int tv_usec);
354*4882a593Smuzhiyun 
355*4882a593Smuzhiyun extern _X_EXPORT int DRI2GetParam(ClientPtr client,
356*4882a593Smuzhiyun                                   DrawablePtr pDrawable,
357*4882a593Smuzhiyun                                   CARD64 param,
358*4882a593Smuzhiyun                                   BOOL *is_param_recognized,
359*4882a593Smuzhiyun                                   CARD64 *value);
360*4882a593Smuzhiyun 
361*4882a593Smuzhiyun extern _X_EXPORT DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest);
362*4882a593Smuzhiyun #endif
363