VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/dri2.h@ 58634

Last change on this file since 58634 was 32163, checked in by vboxsync, 14 years ago

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette