VirtualBox

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

最後變更 在這個檔案從62425是 28062,由 vboxsync 提交於 15 年 前

Additions/x11/x11include: header files for building X.Org server 1.8 drivers

  • 屬性 svn:eol-style 設為 native
檔案大小: 10.1 KB
 
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
49typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
50typedef void (*DRI2SwapEventPtr)(ClientPtr client, void *data, int type,
51 CARD64 ust, CARD64 msc, CARD64 sbc);
52
53
54typedef DRI2BufferPtr (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw,
55 unsigned int *attachments,
56 int count);
57typedef void (*DRI2DestroyBuffersProcPtr)(DrawablePtr pDraw,
58 DRI2BufferPtr buffers,
59 int count);
60typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
61 RegionPtr pRegion,
62 DRI2BufferPtr pDestBuffer,
63 DRI2BufferPtr pSrcBuffer);
64typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
65 unsigned int sequence);
66/**
67 * Schedule a buffer swap
68 *
69 * This callback is used to support glXSwapBuffers and the OML_sync_control
70 * extension (see it for a description of the params).
71 *
72 * Drivers should queue an event for the frame count that satisfies the
73 * parameters passed in. If the event is in the future (i.e. the conditions
74 * aren't currently satisfied), the server may block the client at the next
75 * GLX request using DRI2WaitSwap. When the event arrives, drivers should call
76 * \c DRI2SwapComplete, which will handle waking the client and returning
77 * the appropriate data.
78 *
79 * The DDX is responsible for doing a flip, exchange, or blit of the swap
80 * when the corresponding event arrives. The \c DRI2CanFlip and
81 * \c DRI2CanExchange functions can be used as helpers for this purpose.
82 *
83 * \param client client pointer (used for block/unblock)
84 * \param pDraw drawable whose count we want
85 * \param pDestBuffer current front buffer
86 * \param pSrcBuffer current back buffer
87 * \param target_msc frame count to wait for
88 * \param divisor divisor for condition equation
89 * \param remainder remainder for division equation
90 * \param func function to call when the swap completes
91 * \param data data for the callback \p func.
92 */
93typedef int (*DRI2ScheduleSwapProcPtr)(ClientPtr client,
94 DrawablePtr pDraw,
95 DRI2BufferPtr pDestBuffer,
96 DRI2BufferPtr pSrcBuffer,
97 CARD64 *target_msc,
98 CARD64 divisor,
99 CARD64 remainder,
100 DRI2SwapEventPtr func,
101 void *data);
102typedef DRI2BufferPtr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw,
103 unsigned int attachment,
104 unsigned int format);
105typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw,
106 DRI2BufferPtr buffer);
107/**
108 * Get current media stamp counter values
109 *
110 * This callback is used to support the SGI_video_sync and OML_sync_control
111 * extensions.
112 *
113 * Drivers should return the current frame counter and the timestamp from
114 * when the returned frame count was last incremented.
115 *
116 * The count should correspond to the screen where the drawable is currently
117 * visible. If the drawable isn't visible (e.g. redirected), the server
118 * should return BadDrawable to the client, pending GLX spec updates to
119 * define this behavior.
120 *
121 * \param pDraw drawable whose count we want
122 * \param ust timestamp from when the count was last incremented.
123 * \param mst current frame count
124 */
125typedef int (*DRI2GetMSCProcPtr)(DrawablePtr pDraw, CARD64 *ust,
126 CARD64 *msc);
127/**
128 * Schedule a frame count related wait
129 *
130 * This callback is used to support the SGI_video_sync and OML_sync_control
131 * extensions. See those specifications for details on how to handle
132 * the divisor and remainder parameters.
133 *
134 * Drivers should queue an event for the frame count that satisfies the
135 * parameters passed in. If the event is in the future (i.e. the conditions
136 * aren't currently satisfied), the driver should block the client using
137 * \c DRI2BlockClient. When the event arrives, drivers should call
138 * \c DRI2WaitMSCComplete, which will handle waking the client and returning
139 * the appropriate data.
140 *
141 * \param client client pointer (used for block/unblock)
142 * \param pDraw drawable whose count we want
143 * \param target_msc frame count to wait for
144 * \param divisor divisor for condition equation
145 * \param remainder remainder for division equation
146 */
147typedef int (*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client,
148 DrawablePtr pDraw,
149 CARD64 target_msc,
150 CARD64 divisor,
151 CARD64 remainder);
152/**
153 * Version of the DRI2InfoRec structure defined in this header
154 */
155#define DRI2INFOREC_VERSION 4
156
157typedef struct {
158 unsigned int version; /**< Version of this struct */
159 int fd;
160 const char *driverName;
161 const char *deviceName;
162
163 DRI2CreateBufferProcPtr CreateBuffer;
164 DRI2DestroyBufferProcPtr DestroyBuffer;
165 DRI2CopyRegionProcPtr CopyRegion;
166 DRI2WaitProcPtr Wait;
167
168 /* added in version 4 */
169
170 DRI2ScheduleSwapProcPtr ScheduleSwap;
171 DRI2GetMSCProcPtr GetMSC;
172 DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
173
174 /* number of drivers in the driverNames array */
175 unsigned int numDrivers;
176 /* array of driver names, indexed by DRI2Driver* driver types */
177 /* a name of NULL means that driver is not supported */
178 const char * const *driverNames;
179} DRI2InfoRec, *DRI2InfoPtr;
180
181extern _X_EXPORT int DRI2EventBase;
182
183extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen,
184 DRI2InfoPtr info);
185
186extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen);
187
188extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen,
189 unsigned int driverType,
190 int *fd,
191 const char **driverName,
192 const char **deviceName);
193
194extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic);
195
196extern _X_EXPORT int DRI2CreateDrawable(DrawablePtr pDraw);
197
198extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
199
200extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
201 int *width,
202 int *height,
203 unsigned int *attachments,
204 int count,
205 int *out_count);
206
207extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw,
208 RegionPtr pRegion,
209 unsigned int dest,
210 unsigned int src);
211
212/**
213 * Determine the major and minor version of the DRI2 extension.
214 *
215 * Provides a mechanism to other modules (e.g., 2D drivers) to determine the
216 * version of the DRI2 extension. While it is possible to peek directly at
217 * the \c XF86ModuleData from a layered module, such a module will fail to
218 * load (due to an unresolved symbol) if the DRI2 extension is not loaded.
219 *
220 * \param major Location to store the major verion of the DRI2 extension
221 * \param minor Location to store the minor verion of the DRI2 extension
222 *
223 * \note
224 * This interface was added some time after the initial release of the DRI2
225 * module. Layered modules that wish to use this interface must first test
226 * its existance by calling \c xf86LoaderCheckSymbol.
227 */
228extern _X_EXPORT void DRI2Version(int *major, int *minor);
229
230extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
231 int *width, int *height, unsigned int *attachments, int count,
232 int *out_count);
233
234extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval);
235extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable,
236 CARD64 target_msc, CARD64 divisor,
237 CARD64 remainder, CARD64 *swap_target,
238 DRI2SwapEventPtr func, void *data);
239extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable);
240
241extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 *ust,
242 CARD64 *msc, CARD64 *sbc);
243extern _X_EXPORT int DRI2WaitMSC(ClientPtr client, DrawablePtr pDrawable,
244 CARD64 target_msc, CARD64 divisor,
245 CARD64 remainder);
246extern _X_EXPORT int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust,
247 CARD64 msc, CARD64 sbc);
248extern _X_EXPORT int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw,
249 CARD64 target_sbc, CARD64 *ust, CARD64 *msc,
250 CARD64 *sbc);
251extern _X_EXPORT Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw);
252
253extern _X_EXPORT Bool DRI2CanFlip(DrawablePtr pDraw);
254
255extern _X_EXPORT Bool DRI2CanExchange(DrawablePtr pDraw);
256
257extern _X_EXPORT void DRI2BlockClient(ClientPtr client, DrawablePtr pDraw);
258
259extern _X_EXPORT void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw,
260 int frame, unsigned int tv_sec,
261 unsigned int tv_usec, int type,
262 DRI2SwapEventPtr swap_complete,
263 void *swap_data);
264extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw,
265 int frame, unsigned int tv_sec,
266 unsigned int tv_usec);
267
268#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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