hardware/intel/libva
修訂 | 51867e9d9417b2fd7f7f77fdad7fc3f3b9c99c90 (tree) |
---|---|
時間 | 2009-12-08 18:14:13 |
作者 | Austin Yuan <shengquan.yuan@inte...> |
Commiter | Austin Yuan |
remove the duplicated X11 subdir
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
@@ -1,29 +0,0 @@ | ||
1 | -# INTEL CONFIDENTIAL | |
2 | -# Copyright 2007 Intel Corporation. All Rights Reserved. | |
3 | -# | |
4 | -# The source code contained or described herein and all documents related to | |
5 | -# the source code ("Material") are owned by Intel Corporation or its suppliers | |
6 | -# or licensors. Title to the Material remains with Intel Corporation or its | |
7 | -# suppliers and licensors. The Material may contain trade secrets and | |
8 | -# proprietary and confidential information of Intel Corporation and its | |
9 | -# suppliers and licensors, and is protected by worldwide copyright and trade | |
10 | -# secret laws and treaty provisions. No part of the Material may be used, | |
11 | -# copied, reproduced, modified, published, uploaded, posted, transmitted, | |
12 | -# distributed, or disclosed in any way without Intel's prior express written | |
13 | -# permission. | |
14 | -# | |
15 | -# No license under any patent, copyright, trade secret or other intellectual | |
16 | -# property right is granted to or conferred upon you by disclosure or delivery | |
17 | -# of the Materials, either expressly, by implication, inducement, estoppel or | |
18 | -# otherwise. Any license under such intellectual property rights must be | |
19 | -# express and approved by Intel in writing. | |
20 | - | |
21 | -AM_CFLAGS = -DLINUX -DIN_LIBVA -I$(top_srcdir)/src $(DRM_CFLAGS) | |
22 | - | |
23 | -noinst_LTLIBRARIES = libva_X11.la | |
24 | - | |
25 | -libva_X11includedir = ${includedir}/va | |
26 | -libva_X11include_HEADERS = va_x11.h va_dri.h va_dri2.h | |
27 | - | |
28 | -libva_X11_la_SOURCES = va_x11.c va_dri.c va_dri2.c | |
29 | -CFLAGS = -ansi -O2 |
@@ -1,624 +0,0 @@ | ||
1 | -/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */ | |
2 | -/************************************************************************** | |
3 | - | |
4 | -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | |
5 | -Copyright 2000 VA Linux Systems, Inc. | |
6 | -Copyright 2007 Intel Corporation | |
7 | -All Rights Reserved. | |
8 | - | |
9 | -Permission is hereby granted, free of charge, to any person obtaining a | |
10 | -copy of this software and associated documentation files (the | |
11 | -"Software"), to deal in the Software without restriction, including | |
12 | -without limitation the rights to use, copy, modify, merge, publish, | |
13 | -distribute, sub license, and/or sell copies of the Software, and to | |
14 | -permit persons to whom the Software is furnished to do so, subject to | |
15 | -the following conditions: | |
16 | - | |
17 | -The above copyright notice and this permission notice (including the | |
18 | -next paragraph) shall be included in all copies or substantial portions | |
19 | -of the Software. | |
20 | - | |
21 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
22 | -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
23 | -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |
24 | -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | |
25 | -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
26 | -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
27 | -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
28 | - | |
29 | -**************************************************************************/ | |
30 | - | |
31 | -/* | |
32 | - * Authors: | |
33 | - * Kevin E. Martin <martin@valinux.com> | |
34 | - * Jens Owen <jens@tungstengraphics.com> | |
35 | - * Rickard E. (Rik) Faith <faith@valinux.com> | |
36 | - * | |
37 | - */ | |
38 | - | |
39 | -/* THIS IS NOT AN X CONSORTIUM STANDARD */ | |
40 | - | |
41 | -#define NEED_REPLIES | |
42 | -#include <X11/Xlibint.h> | |
43 | -#include <X11/extensions/Xext.h> | |
44 | -#include <X11/extensions/extutil.h> | |
45 | -#include "va_dristr.h" | |
46 | - | |
47 | -#define PUBLIC | |
48 | - | |
49 | -static XExtensionInfo _va_dri_info_data; | |
50 | -static XExtensionInfo *va_dri_info = &_va_dri_info_data; | |
51 | -static char va_dri_extension_name[] = VA_DRINAME; | |
52 | - | |
53 | -#define VA_DRICheckExtension(dpy,i,val) \ | |
54 | - XextCheckExtension (dpy, i, va_dri_extension_name, val) | |
55 | - | |
56 | -/***************************************************************************** | |
57 | - * * | |
58 | - * private utility routines * | |
59 | - * * | |
60 | - *****************************************************************************/ | |
61 | - | |
62 | -static int close_display(Display *dpy, XExtCodes *extCodes); | |
63 | -static /* const */ XExtensionHooks va_dri_extension_hooks = { | |
64 | - NULL, /* create_gc */ | |
65 | - NULL, /* copy_gc */ | |
66 | - NULL, /* flush_gc */ | |
67 | - NULL, /* free_gc */ | |
68 | - NULL, /* create_font */ | |
69 | - NULL, /* free_font */ | |
70 | - close_display, /* close_display */ | |
71 | - NULL, /* wire_to_event */ | |
72 | - NULL, /* event_to_wire */ | |
73 | - NULL, /* error */ | |
74 | - NULL, /* error_string */ | |
75 | -}; | |
76 | - | |
77 | -static XEXT_GENERATE_FIND_DISPLAY (find_display, va_dri_info, | |
78 | - va_dri_extension_name, | |
79 | - &va_dri_extension_hooks, | |
80 | - 0, NULL) | |
81 | - | |
82 | -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, va_dri_info) | |
83 | - | |
84 | - | |
85 | -/***************************************************************************** | |
86 | - * * | |
87 | - * public XFree86-DRI Extension routines * | |
88 | - * * | |
89 | - *****************************************************************************/ | |
90 | - | |
91 | -#if 0 | |
92 | -#include <stdio.h> | |
93 | -#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg); | |
94 | -#else | |
95 | -#define TRACE(msg) | |
96 | -#endif | |
97 | - | |
98 | - | |
99 | -PUBLIC Bool VA_DRIQueryExtension (dpy, event_basep, error_basep) | |
100 | - Display *dpy; | |
101 | - int *event_basep, *error_basep; | |
102 | -{ | |
103 | - XExtDisplayInfo *info = find_display (dpy); | |
104 | - | |
105 | - TRACE("QueryExtension..."); | |
106 | - if (XextHasExtension(info)) { | |
107 | - *event_basep = info->codes->first_event; | |
108 | - *error_basep = info->codes->first_error; | |
109 | - TRACE("QueryExtension... return True"); | |
110 | - return True; | |
111 | - } else { | |
112 | - TRACE("QueryExtension... return False"); | |
113 | - return False; | |
114 | - } | |
115 | -} | |
116 | - | |
117 | -PUBLIC Bool VA_DRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) | |
118 | - Display* dpy; | |
119 | - int* majorVersion; | |
120 | - int* minorVersion; | |
121 | - int* patchVersion; | |
122 | -{ | |
123 | - XExtDisplayInfo *info = find_display (dpy); | |
124 | - xVA_DRIQueryVersionReply rep; | |
125 | - xVA_DRIQueryVersionReq *req; | |
126 | - | |
127 | - TRACE("QueryVersion..."); | |
128 | - VA_DRICheckExtension (dpy, info, False); | |
129 | - | |
130 | - LockDisplay(dpy); | |
131 | - GetReq(VA_DRIQueryVersion, req); | |
132 | - req->reqType = info->codes->major_opcode; | |
133 | - req->driReqType = X_VA_DRIQueryVersion; | |
134 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
135 | - UnlockDisplay(dpy); | |
136 | - SyncHandle(); | |
137 | - TRACE("QueryVersion... return False"); | |
138 | - return False; | |
139 | - } | |
140 | - *majorVersion = rep.majorVersion; | |
141 | - *minorVersion = rep.minorVersion; | |
142 | - *patchVersion = rep.patchVersion; | |
143 | - UnlockDisplay(dpy); | |
144 | - SyncHandle(); | |
145 | - TRACE("QueryVersion... return True"); | |
146 | - return True; | |
147 | -} | |
148 | - | |
149 | -PUBLIC Bool VA_DRIQueryDirectRenderingCapable(dpy, screen, isCapable) | |
150 | - Display* dpy; | |
151 | - int screen; | |
152 | - Bool* isCapable; | |
153 | -{ | |
154 | - XExtDisplayInfo *info = find_display (dpy); | |
155 | - xVA_DRIQueryDirectRenderingCapableReply rep; | |
156 | - xVA_DRIQueryDirectRenderingCapableReq *req; | |
157 | - | |
158 | - TRACE("QueryDirectRenderingCapable..."); | |
159 | - VA_DRICheckExtension (dpy, info, False); | |
160 | - | |
161 | - LockDisplay(dpy); | |
162 | - GetReq(VA_DRIQueryDirectRenderingCapable, req); | |
163 | - req->reqType = info->codes->major_opcode; | |
164 | - req->driReqType = X_VA_DRIQueryDirectRenderingCapable; | |
165 | - req->screen = screen; | |
166 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
167 | - UnlockDisplay(dpy); | |
168 | - SyncHandle(); | |
169 | - TRACE("QueryDirectRenderingCapable... return False"); | |
170 | - return False; | |
171 | - } | |
172 | - *isCapable = rep.isCapable; | |
173 | - UnlockDisplay(dpy); | |
174 | - SyncHandle(); | |
175 | - TRACE("QueryDirectRenderingCapable... return True"); | |
176 | - return True; | |
177 | -} | |
178 | - | |
179 | -PUBLIC Bool VA_DRIOpenConnection(dpy, screen, hSAREA, busIdString) | |
180 | - Display* dpy; | |
181 | - int screen; | |
182 | - drm_handle_t * hSAREA; | |
183 | - char **busIdString; | |
184 | -{ | |
185 | - XExtDisplayInfo *info = find_display (dpy); | |
186 | - xVA_DRIOpenConnectionReply rep; | |
187 | - xVA_DRIOpenConnectionReq *req; | |
188 | - | |
189 | - TRACE("OpenConnection..."); | |
190 | - VA_DRICheckExtension (dpy, info, False); | |
191 | - | |
192 | - LockDisplay(dpy); | |
193 | - GetReq(VA_DRIOpenConnection, req); | |
194 | - req->reqType = info->codes->major_opcode; | |
195 | - req->driReqType = X_VA_DRIOpenConnection; | |
196 | - req->screen = screen; | |
197 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
198 | - UnlockDisplay(dpy); | |
199 | - SyncHandle(); | |
200 | - TRACE("OpenConnection... return False"); | |
201 | - return False; | |
202 | - } | |
203 | - | |
204 | - *hSAREA = rep.hSAREALow; | |
205 | - if (sizeof(drm_handle_t) == 8) { | |
206 | - int shift = 32; /* var to prevent warning on next line */ | |
207 | - *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift; | |
208 | - } | |
209 | - | |
210 | - if (rep.length) { | |
211 | - if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) { | |
212 | - _XEatData(dpy, ((rep.busIdStringLength+3) & ~3)); | |
213 | - UnlockDisplay(dpy); | |
214 | - SyncHandle(); | |
215 | - TRACE("OpenConnection... return False"); | |
216 | - return False; | |
217 | - } | |
218 | - _XReadPad(dpy, *busIdString, rep.busIdStringLength); | |
219 | - } else { | |
220 | - *busIdString = NULL; | |
221 | - } | |
222 | - UnlockDisplay(dpy); | |
223 | - SyncHandle(); | |
224 | - TRACE("OpenConnection... return True"); | |
225 | - return True; | |
226 | -} | |
227 | - | |
228 | -PUBLIC Bool VA_DRIAuthConnection(dpy, screen, magic) | |
229 | - Display* dpy; | |
230 | - int screen; | |
231 | - drm_magic_t magic; | |
232 | -{ | |
233 | - XExtDisplayInfo *info = find_display (dpy); | |
234 | - xVA_DRIAuthConnectionReq *req; | |
235 | - xVA_DRIAuthConnectionReply rep; | |
236 | - | |
237 | - TRACE("AuthConnection..."); | |
238 | - VA_DRICheckExtension (dpy, info, False); | |
239 | - | |
240 | - LockDisplay(dpy); | |
241 | - GetReq(VA_DRIAuthConnection, req); | |
242 | - req->reqType = info->codes->major_opcode; | |
243 | - req->driReqType = X_VA_DRIAuthConnection; | |
244 | - req->screen = screen; | |
245 | - req->magic = magic; | |
246 | - rep.authenticated = 0; | |
247 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) { | |
248 | - UnlockDisplay(dpy); | |
249 | - SyncHandle(); | |
250 | - TRACE("AuthConnection... return False"); | |
251 | - return False; | |
252 | - } | |
253 | - UnlockDisplay(dpy); | |
254 | - SyncHandle(); | |
255 | - TRACE("AuthConnection... return True"); | |
256 | - return True; | |
257 | -} | |
258 | - | |
259 | -PUBLIC Bool VA_DRICloseConnection(dpy, screen) | |
260 | - Display* dpy; | |
261 | - int screen; | |
262 | -{ | |
263 | - XExtDisplayInfo *info = find_display (dpy); | |
264 | - xVA_DRICloseConnectionReq *req; | |
265 | - | |
266 | - TRACE("CloseConnection..."); | |
267 | - | |
268 | - VA_DRICheckExtension (dpy, info, False); | |
269 | - | |
270 | - LockDisplay(dpy); | |
271 | - GetReq(VA_DRICloseConnection, req); | |
272 | - req->reqType = info->codes->major_opcode; | |
273 | - req->driReqType = X_VA_DRICloseConnection; | |
274 | - req->screen = screen; | |
275 | - UnlockDisplay(dpy); | |
276 | - SyncHandle(); | |
277 | - TRACE("CloseConnection... return True"); | |
278 | - return True; | |
279 | -} | |
280 | - | |
281 | -PUBLIC Bool VA_DRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion, | |
282 | - ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName) | |
283 | - Display* dpy; | |
284 | - int screen; | |
285 | - int* ddxDriverMajorVersion; | |
286 | - int* ddxDriverMinorVersion; | |
287 | - int* ddxDriverPatchVersion; | |
288 | - char** clientDriverName; | |
289 | -{ | |
290 | - XExtDisplayInfo *info = find_display (dpy); | |
291 | - xVA_DRIGetClientDriverNameReply rep; | |
292 | - xVA_DRIGetClientDriverNameReq *req; | |
293 | - | |
294 | - TRACE("GetClientDriverName..."); | |
295 | - VA_DRICheckExtension (dpy, info, False); | |
296 | - | |
297 | - LockDisplay(dpy); | |
298 | - GetReq(VA_DRIGetClientDriverName, req); | |
299 | - req->reqType = info->codes->major_opcode; | |
300 | - req->driReqType = X_VA_DRIGetClientDriverName; | |
301 | - req->screen = screen; | |
302 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
303 | - UnlockDisplay(dpy); | |
304 | - SyncHandle(); | |
305 | - TRACE("GetClientDriverName... return False"); | |
306 | - return False; | |
307 | - } | |
308 | - | |
309 | - *ddxDriverMajorVersion = rep.ddxDriverMajorVersion; | |
310 | - *ddxDriverMinorVersion = rep.ddxDriverMinorVersion; | |
311 | - *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; | |
312 | - | |
313 | - if (rep.length) { | |
314 | - if (!(*clientDriverName = (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) { | |
315 | - _XEatData(dpy, ((rep.clientDriverNameLength+3) & ~3)); | |
316 | - UnlockDisplay(dpy); | |
317 | - SyncHandle(); | |
318 | - TRACE("GetClientDriverName... return False"); | |
319 | - return False; | |
320 | - } | |
321 | - _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength); | |
322 | - } else { | |
323 | - *clientDriverName = NULL; | |
324 | - } | |
325 | - UnlockDisplay(dpy); | |
326 | - SyncHandle(); | |
327 | - TRACE("GetClientDriverName... return True"); | |
328 | - return True; | |
329 | -} | |
330 | - | |
331 | -PUBLIC Bool VA_DRICreateContextWithConfig(dpy, screen, configID, context, | |
332 | - hHWContext) | |
333 | - Display* dpy; | |
334 | - int screen; | |
335 | - int configID; | |
336 | - XID* context; | |
337 | - drm_context_t * hHWContext; | |
338 | -{ | |
339 | - XExtDisplayInfo *info = find_display (dpy); | |
340 | - xVA_DRICreateContextReply rep; | |
341 | - xVA_DRICreateContextReq *req; | |
342 | - | |
343 | - TRACE("CreateContext..."); | |
344 | - VA_DRICheckExtension (dpy, info, False); | |
345 | - | |
346 | - LockDisplay(dpy); | |
347 | - GetReq(VA_DRICreateContext, req); | |
348 | - req->reqType = info->codes->major_opcode; | |
349 | - req->driReqType = X_VA_DRICreateContext; | |
350 | - req->visual = configID; | |
351 | - req->screen = screen; | |
352 | - *context = XAllocID(dpy); | |
353 | - req->context = *context; | |
354 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
355 | - UnlockDisplay(dpy); | |
356 | - SyncHandle(); | |
357 | - TRACE("CreateContext... return False"); | |
358 | - return False; | |
359 | - } | |
360 | - *hHWContext = rep.hHWContext; | |
361 | - UnlockDisplay(dpy); | |
362 | - SyncHandle(); | |
363 | - TRACE("CreateContext... return True"); | |
364 | - return True; | |
365 | -} | |
366 | - | |
367 | -PUBLIC Bool VA_DRICreateContext(dpy, screen, visual, context, hHWContext) | |
368 | - Display* dpy; | |
369 | - int screen; | |
370 | - Visual* visual; | |
371 | - XID* context; | |
372 | - drm_context_t * hHWContext; | |
373 | -{ | |
374 | - return VA_DRICreateContextWithConfig( dpy, screen, visual->visualid, | |
375 | - context, hHWContext ); | |
376 | -} | |
377 | - | |
378 | -PUBLIC Bool VA_DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, | |
379 | - __DRIid context ) | |
380 | -{ | |
381 | - Display * const dpy = (Display *) ndpy; | |
382 | - XExtDisplayInfo *info = find_display (dpy); | |
383 | - xVA_DRIDestroyContextReq *req; | |
384 | - | |
385 | - TRACE("DestroyContext..."); | |
386 | - VA_DRICheckExtension (dpy, info, False); | |
387 | - | |
388 | - LockDisplay(dpy); | |
389 | - GetReq(VA_DRIDestroyContext, req); | |
390 | - req->reqType = info->codes->major_opcode; | |
391 | - req->driReqType = X_VA_DRIDestroyContext; | |
392 | - req->screen = screen; | |
393 | - req->context = context; | |
394 | - UnlockDisplay(dpy); | |
395 | - SyncHandle(); | |
396 | - TRACE("DestroyContext... return True"); | |
397 | - return True; | |
398 | -} | |
399 | - | |
400 | -PUBLIC Bool VA_DRICreateDrawable( __DRInativeDisplay * ndpy, int screen, | |
401 | - __DRIid drawable, drm_drawable_t * hHWDrawable ) | |
402 | -{ | |
403 | - Display * const dpy = (Display *) ndpy; | |
404 | - XExtDisplayInfo *info = find_display (dpy); | |
405 | - xVA_DRICreateDrawableReply rep; | |
406 | - xVA_DRICreateDrawableReq *req; | |
407 | - | |
408 | - TRACE("CreateDrawable..."); | |
409 | - VA_DRICheckExtension (dpy, info, False); | |
410 | - | |
411 | - LockDisplay(dpy); | |
412 | - GetReq(VA_DRICreateDrawable, req); | |
413 | - req->reqType = info->codes->major_opcode; | |
414 | - req->driReqType = X_VA_DRICreateDrawable; | |
415 | - req->screen = screen; | |
416 | - req->drawable = drawable; | |
417 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
418 | - UnlockDisplay(dpy); | |
419 | - SyncHandle(); | |
420 | - TRACE("CreateDrawable... return False"); | |
421 | - return False; | |
422 | - } | |
423 | - *hHWDrawable = rep.hHWDrawable; | |
424 | - UnlockDisplay(dpy); | |
425 | - SyncHandle(); | |
426 | - TRACE("CreateDrawable... return True"); | |
427 | - return True; | |
428 | -} | |
429 | - | |
430 | -PUBLIC Bool VA_DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, | |
431 | - __DRIid drawable ) | |
432 | -{ | |
433 | - Display * const dpy = (Display *) ndpy; | |
434 | - XExtDisplayInfo *info = find_display (dpy); | |
435 | - xVA_DRIDestroyDrawableReq *req; | |
436 | - | |
437 | - TRACE("DestroyDrawable..."); | |
438 | - VA_DRICheckExtension (dpy, info, False); | |
439 | - | |
440 | - LockDisplay(dpy); | |
441 | - GetReq(VA_DRIDestroyDrawable, req); | |
442 | - req->reqType = info->codes->major_opcode; | |
443 | - req->driReqType = X_VA_DRIDestroyDrawable; | |
444 | - req->screen = screen; | |
445 | - req->drawable = drawable; | |
446 | - UnlockDisplay(dpy); | |
447 | - SyncHandle(); | |
448 | - TRACE("DestroyDrawable... return True"); | |
449 | - return True; | |
450 | -} | |
451 | - | |
452 | -PUBLIC Bool VA_DRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable, | |
453 | - unsigned int* index, unsigned int* stamp, | |
454 | - int* X, int* Y, int* W, int* H, | |
455 | - int* numClipRects, drm_clip_rect_t ** pClipRects, | |
456 | - int* backX, int* backY, | |
457 | - int* numBackClipRects, drm_clip_rect_t ** pBackClipRects ) | |
458 | -{ | |
459 | - XExtDisplayInfo *info = find_display (dpy); | |
460 | - xVA_DRIGetDrawableInfoReply rep; | |
461 | - xVA_DRIGetDrawableInfoReq *req; | |
462 | - int total_rects; | |
463 | - | |
464 | - TRACE("GetDrawableInfo..."); | |
465 | - VA_DRICheckExtension (dpy, info, False); | |
466 | - | |
467 | - LockDisplay(dpy); | |
468 | - GetReq(VA_DRIGetDrawableInfo, req); | |
469 | - req->reqType = info->codes->major_opcode; | |
470 | - req->driReqType = X_VA_DRIGetDrawableInfo; | |
471 | - req->screen = screen; | |
472 | - req->drawable = drawable; | |
473 | - | |
474 | - if (!_XReply(dpy, (xReply *)&rep, 1, xFalse)) | |
475 | - { | |
476 | - UnlockDisplay(dpy); | |
477 | - SyncHandle(); | |
478 | - TRACE("GetDrawableInfo... return False"); | |
479 | - return False; | |
480 | - } | |
481 | - *index = rep.drawableTableIndex; | |
482 | - *stamp = rep.drawableTableStamp; | |
483 | - *X = (int)rep.drawableX; | |
484 | - *Y = (int)rep.drawableY; | |
485 | - *W = (int)rep.drawableWidth; | |
486 | - *H = (int)rep.drawableHeight; | |
487 | - *numClipRects = rep.numClipRects; | |
488 | - total_rects = *numClipRects; | |
489 | - | |
490 | - *backX = rep.backX; | |
491 | - *backY = rep.backY; | |
492 | - *numBackClipRects = rep.numBackClipRects; | |
493 | - total_rects += *numBackClipRects; | |
494 | - | |
495 | -#if 0 | |
496 | - /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks | |
497 | - * backwards compatibility (Because of the >> 2 shift) but the fix | |
498 | - * enables multi-threaded apps to work. | |
499 | - */ | |
500 | - if (rep.length != ((((SIZEOF(xVA_DRIGetDrawableInfoReply) - | |
501 | - SIZEOF(xGenericReply) + | |
502 | - total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) { | |
503 | - _XEatData(dpy, rep.length); | |
504 | - UnlockDisplay(dpy); | |
505 | - SyncHandle(); | |
506 | - TRACE("GetDrawableInfo... return False"); | |
507 | - return False; | |
508 | - } | |
509 | -#endif | |
510 | - | |
511 | - if (*numClipRects) { | |
512 | - int len = sizeof(drm_clip_rect_t) * (*numClipRects); | |
513 | - | |
514 | - *pClipRects = (drm_clip_rect_t *)Xcalloc(len, 1); | |
515 | - if (*pClipRects) | |
516 | - _XRead(dpy, (char*)*pClipRects, len); | |
517 | - } else { | |
518 | - *pClipRects = NULL; | |
519 | - } | |
520 | - | |
521 | - if (*numBackClipRects) { | |
522 | - int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); | |
523 | - | |
524 | - *pBackClipRects = (drm_clip_rect_t *)Xcalloc(len, 1); | |
525 | - if (*pBackClipRects) | |
526 | - _XRead(dpy, (char*)*pBackClipRects, len); | |
527 | - } else { | |
528 | - *pBackClipRects = NULL; | |
529 | - } | |
530 | - | |
531 | - UnlockDisplay(dpy); | |
532 | - SyncHandle(); | |
533 | - TRACE("GetDrawableInfo... return True"); | |
534 | - return True; | |
535 | -} | |
536 | - | |
537 | -PUBLIC Bool VA_DRIGetDeviceInfo(dpy, screen, hFrameBuffer, | |
538 | - fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate) | |
539 | - Display* dpy; | |
540 | - int screen; | |
541 | - drm_handle_t * hFrameBuffer; | |
542 | - int* fbOrigin; | |
543 | - int* fbSize; | |
544 | - int* fbStride; | |
545 | - int* devPrivateSize; | |
546 | - void** pDevPrivate; | |
547 | -{ | |
548 | - XExtDisplayInfo *info = find_display (dpy); | |
549 | - xVA_DRIGetDeviceInfoReply rep; | |
550 | - xVA_DRIGetDeviceInfoReq *req; | |
551 | - | |
552 | - TRACE("GetDeviceInfo..."); | |
553 | - VA_DRICheckExtension (dpy, info, False); | |
554 | - | |
555 | - LockDisplay(dpy); | |
556 | - GetReq(VA_DRIGetDeviceInfo, req); | |
557 | - req->reqType = info->codes->major_opcode; | |
558 | - req->driReqType = X_VA_DRIGetDeviceInfo; | |
559 | - req->screen = screen; | |
560 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
561 | - UnlockDisplay(dpy); | |
562 | - SyncHandle(); | |
563 | - TRACE("GetDeviceInfo... return False"); | |
564 | - return False; | |
565 | - } | |
566 | - | |
567 | - *hFrameBuffer = rep.hFrameBufferLow; | |
568 | - if (sizeof(drm_handle_t) == 8) { | |
569 | - int shift = 32; /* var to prevent warning on next line */ | |
570 | - *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift; | |
571 | - } | |
572 | - | |
573 | - *fbOrigin = rep.framebufferOrigin; | |
574 | - *fbSize = rep.framebufferSize; | |
575 | - *fbStride = rep.framebufferStride; | |
576 | - *devPrivateSize = rep.devPrivateSize; | |
577 | - | |
578 | - if (rep.length) { | |
579 | - if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) { | |
580 | - _XEatData(dpy, ((rep.devPrivateSize+3) & ~3)); | |
581 | - UnlockDisplay(dpy); | |
582 | - SyncHandle(); | |
583 | - TRACE("GetDeviceInfo... return False"); | |
584 | - return False; | |
585 | - } | |
586 | - _XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize); | |
587 | - } else { | |
588 | - *pDevPrivate = NULL; | |
589 | - } | |
590 | - | |
591 | - UnlockDisplay(dpy); | |
592 | - SyncHandle(); | |
593 | - TRACE("GetDeviceInfo... return True"); | |
594 | - return True; | |
595 | -} | |
596 | - | |
597 | -PUBLIC Bool VA_DRIOpenFullScreen(dpy, screen, drawable) | |
598 | - Display* dpy; | |
599 | - int screen; | |
600 | - Drawable drawable; | |
601 | -{ | |
602 | - /* This function and the underlying X protocol are deprecated. | |
603 | - */ | |
604 | - (void) dpy; | |
605 | - (void) screen; | |
606 | - (void) drawable; | |
607 | - return False; | |
608 | -} | |
609 | - | |
610 | -PUBLIC Bool VA_DRICloseFullScreen(dpy, screen, drawable) | |
611 | - Display* dpy; | |
612 | - int screen; | |
613 | - Drawable drawable; | |
614 | -{ | |
615 | - /* This function and the underlying X protocol are deprecated. | |
616 | - */ | |
617 | - (void) dpy; | |
618 | - (void) screen; | |
619 | - (void) drawable; | |
620 | - return True; | |
621 | -} | |
622 | - | |
623 | -#undef TRACE | |
624 | - |
@@ -1,120 +0,0 @@ | ||
1 | -/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */ | |
2 | -/************************************************************************** | |
3 | - | |
4 | -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | |
5 | -Copyright 2000 VA Linux Systems, Inc. | |
6 | -Copyright 2007 Intel Corporation | |
7 | -All Rights Reserved. | |
8 | - | |
9 | -Permission is hereby granted, free of charge, to any person obtaining a | |
10 | -copy of this software and associated documentation files (the | |
11 | -"Software"), to deal in the Software without restriction, including | |
12 | -without limitation the rights to use, copy, modify, merge, publish, | |
13 | -distribute, sub license, and/or sell copies of the Software, and to | |
14 | -permit persons to whom the Software is furnished to do so, subject to | |
15 | -the following conditions: | |
16 | - | |
17 | -The above copyright notice and this permission notice (including the | |
18 | -next paragraph) shall be included in all copies or substantial portions | |
19 | -of the Software. | |
20 | - | |
21 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
22 | -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
23 | -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |
24 | -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | |
25 | -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
26 | -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
27 | -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
28 | - | |
29 | -**************************************************************************/ | |
30 | - | |
31 | -/** | |
32 | - * \file xf86dri.h | |
33 | - * Protocol numbers and function prototypes for DRI X protocol. | |
34 | - * | |
35 | - * \author Kevin E. Martin <martin@valinux.com> | |
36 | - * \author Jens Owen <jens@tungstengraphics.com> | |
37 | - * \author Rickard E. (Rik) Faith <faith@valinux.com> | |
38 | - */ | |
39 | - | |
40 | -#ifndef _VA_DRI_H_ | |
41 | -#define _VA_DRI_H_ | |
42 | - | |
43 | -#include <X11/Xfuncproto.h> | |
44 | -#include <xf86drm.h> | |
45 | - | |
46 | -#define X_VA_DRIQueryVersion 0 | |
47 | -#define X_VA_DRIQueryDirectRenderingCapable 1 | |
48 | -#define X_VA_DRIOpenConnection 2 | |
49 | -#define X_VA_DRICloseConnection 3 | |
50 | -#define X_VA_DRIGetClientDriverName 4 | |
51 | -#define X_VA_DRICreateContext 5 | |
52 | -#define X_VA_DRIDestroyContext 6 | |
53 | -#define X_VA_DRICreateDrawable 7 | |
54 | -#define X_VA_DRIDestroyDrawable 8 | |
55 | -#define X_VA_DRIGetDrawableInfo 9 | |
56 | -#define X_VA_DRIGetDeviceInfo 10 | |
57 | -#define X_VA_DRIAuthConnection 11 | |
58 | -#define X_VA_DRIOpenFullScreen 12 /* Deprecated */ | |
59 | -#define X_VA_DRICloseFullScreen 13 /* Deprecated */ | |
60 | - | |
61 | -#define VA_DRINumberEvents 0 | |
62 | - | |
63 | -#define VA_DRIClientNotLocal 0 | |
64 | -#define VA_DRIOperationNotSupported 1 | |
65 | -#define VA_DRINumberErrors (VA_DRIOperationNotSupported + 1) | |
66 | - | |
67 | -typedef unsigned long __DRIid; | |
68 | -typedef void __DRInativeDisplay; | |
69 | - | |
70 | -_XFUNCPROTOBEGIN | |
71 | - | |
72 | -Bool VA_DRIQueryExtension( Display *dpy, int *event_base, int *error_base ); | |
73 | - | |
74 | -Bool VA_DRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion, | |
75 | - int *patchVersion ); | |
76 | - | |
77 | -Bool VA_DRIQueryDirectRenderingCapable( Display *dpy, int screen, | |
78 | - Bool *isCapable ); | |
79 | - | |
80 | -Bool VA_DRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA, | |
81 | - char **busIDString ); | |
82 | - | |
83 | -Bool VA_DRIAuthConnection( Display *dpy, int screen, drm_magic_t magic ); | |
84 | - | |
85 | -Bool VA_DRICloseConnection( Display *dpy, int screen ); | |
86 | - | |
87 | -Bool VA_DRIGetClientDriverName( Display *dpy, int screen, | |
88 | - int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, | |
89 | - int *ddxDriverPatchVersion, char **clientDriverName ); | |
90 | - | |
91 | -Bool VA_DRICreateContext( Display *dpy, int screen, Visual *visual, | |
92 | - XID *ptr_to_returned_context_id, drm_context_t *hHWContext ); | |
93 | - | |
94 | -Bool VA_DRICreateContextWithConfig( Display *dpy, int screen, int configID, | |
95 | - XID *ptr_to_returned_context_id, drm_context_t *hHWContext ); | |
96 | - | |
97 | -Bool VA_DRIDestroyContext( __DRInativeDisplay *dpy, int screen, | |
98 | - __DRIid context_id ); | |
99 | - | |
100 | -Bool VA_DRICreateDrawable( __DRInativeDisplay *dpy, int screen, | |
101 | - __DRIid drawable, drm_drawable_t *hHWDrawable ); | |
102 | - | |
103 | -Bool VA_DRIDestroyDrawable( __DRInativeDisplay *dpy, int screen, | |
104 | - __DRIid drawable); | |
105 | - | |
106 | -Bool VA_DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable, | |
107 | - unsigned int *index, unsigned int *stamp, | |
108 | - int *X, int *Y, int *W, int *H, | |
109 | - int *numClipRects, drm_clip_rect_t ** pClipRects, | |
110 | - int *backX, int *backY, | |
111 | - int *numBackClipRects, drm_clip_rect_t **pBackClipRects ); | |
112 | - | |
113 | -Bool VA_DRIGetDeviceInfo( Display *dpy, int screen, | |
114 | - drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize, | |
115 | - int *fbStride, int *devPrivateSize, void **pDevPrivate ); | |
116 | - | |
117 | -_XFUNCPROTOEND | |
118 | - | |
119 | -#endif /* _VA_DRI_H_ */ | |
120 | - |
@@ -1,307 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright © 2008 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 (krh@redhat.com) | |
31 | - */ | |
32 | - | |
33 | - | |
34 | -#define NEED_REPLIES | |
35 | -#include <X11/Xlibint.h> | |
36 | -#include <X11/extensions/Xext.h> | |
37 | -#include <X11/extensions/extutil.h> | |
38 | -#include "xf86drm.h" | |
39 | -#include "va_dri2.h" | |
40 | -#include "va_dri2str.h" | |
41 | -#include "va_dri2tokens.h" | |
42 | - | |
43 | -#ifndef DRI2DriverDRI | |
44 | -#define DRI2DriverDRI 0 | |
45 | -#endif | |
46 | - | |
47 | -static char va_dri2ExtensionName[] = DRI2_NAME; | |
48 | -static XExtensionInfo _va_dri2_info_data; | |
49 | -static XExtensionInfo *va_dri2Info = &_va_dri2_info_data; | |
50 | -static XEXT_GENERATE_CLOSE_DISPLAY (VA_DRI2CloseDisplay, va_dri2Info) | |
51 | -static /* const */ XExtensionHooks va_dri2ExtensionHooks = { | |
52 | - NULL, /* create_gc */ | |
53 | - NULL, /* copy_gc */ | |
54 | - NULL, /* flush_gc */ | |
55 | - NULL, /* free_gc */ | |
56 | - NULL, /* create_font */ | |
57 | - NULL, /* free_font */ | |
58 | - VA_DRI2CloseDisplay, /* close_display */ | |
59 | - NULL, /* wire_to_event */ | |
60 | - NULL, /* event_to_wire */ | |
61 | - NULL, /* error */ | |
62 | - NULL, /* error_string */ | |
63 | -}; | |
64 | - | |
65 | -static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, va_dri2Info, | |
66 | - va_dri2ExtensionName, | |
67 | - &va_dri2ExtensionHooks, | |
68 | - 0, NULL) | |
69 | - | |
70 | -Bool VA_DRI2QueryExtension(Display *dpy, int *eventBase, int *errorBase) | |
71 | -{ | |
72 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
73 | - | |
74 | - if (XextHasExtension(info)) { | |
75 | - *eventBase = info->codes->first_event; | |
76 | - *errorBase = info->codes->first_error; | |
77 | - return True; | |
78 | - } | |
79 | - | |
80 | - return False; | |
81 | -} | |
82 | - | |
83 | -Bool VA_DRI2QueryVersion(Display *dpy, int *major, int *minor) | |
84 | -{ | |
85 | - XExtDisplayInfo *info = DRI2FindDisplay (dpy); | |
86 | - xDRI2QueryVersionReply rep; | |
87 | - xDRI2QueryVersionReq *req; | |
88 | - | |
89 | - XextCheckExtension (dpy, info, va_dri2ExtensionName, False); | |
90 | - | |
91 | - LockDisplay(dpy); | |
92 | - GetReq(DRI2QueryVersion, req); | |
93 | - req->reqType = info->codes->major_opcode; | |
94 | - req->dri2ReqType = X_DRI2QueryVersion; | |
95 | - req->majorVersion = DRI2_MAJOR; | |
96 | - req->minorVersion = DRI2_MINOR; | |
97 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
98 | - UnlockDisplay(dpy); | |
99 | - SyncHandle(); | |
100 | - return False; | |
101 | - } | |
102 | - *major = rep.majorVersion; | |
103 | - *minor = rep.minorVersion; | |
104 | - UnlockDisplay(dpy); | |
105 | - SyncHandle(); | |
106 | - | |
107 | - return True; | |
108 | -} | |
109 | - | |
110 | -Bool VA_DRI2Connect(Display *dpy, XID window, | |
111 | - char **driverName, char **deviceName) | |
112 | -{ | |
113 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
114 | - xDRI2ConnectReply rep; | |
115 | - xDRI2ConnectReq *req; | |
116 | - | |
117 | - XextCheckExtension (dpy, info, va_dri2ExtensionName, False); | |
118 | - | |
119 | - LockDisplay(dpy); | |
120 | - GetReq(DRI2Connect, req); | |
121 | - req->reqType = info->codes->major_opcode; | |
122 | - req->dri2ReqType = X_DRI2Connect; | |
123 | - req->window = window; | |
124 | - req->driverType = DRI2DriverDRI; | |
125 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
126 | - UnlockDisplay(dpy); | |
127 | - SyncHandle(); | |
128 | - return False; | |
129 | - } | |
130 | - | |
131 | - if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) { | |
132 | - UnlockDisplay(dpy); | |
133 | - SyncHandle(); | |
134 | - return False; | |
135 | - } | |
136 | - | |
137 | - *driverName = Xmalloc(rep.driverNameLength + 1); | |
138 | - if (*driverName == NULL) { | |
139 | - _XEatData(dpy, | |
140 | - ((rep.driverNameLength + 3) & ~3) + | |
141 | - ((rep.deviceNameLength + 3) & ~3)); | |
142 | - UnlockDisplay(dpy); | |
143 | - SyncHandle(); | |
144 | - return False; | |
145 | - } | |
146 | - _XReadPad(dpy, *driverName, rep.driverNameLength); | |
147 | - (*driverName)[rep.driverNameLength] = '\0'; | |
148 | - | |
149 | - *deviceName = Xmalloc(rep.deviceNameLength + 1); | |
150 | - if (*deviceName == NULL) { | |
151 | - Xfree(*driverName); | |
152 | - _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3)); | |
153 | - UnlockDisplay(dpy); | |
154 | - SyncHandle(); | |
155 | - return False; | |
156 | - } | |
157 | - _XReadPad(dpy, *deviceName, rep.deviceNameLength); | |
158 | - (*deviceName)[rep.deviceNameLength] = '\0'; | |
159 | - | |
160 | - UnlockDisplay(dpy); | |
161 | - SyncHandle(); | |
162 | - | |
163 | - return True; | |
164 | -} | |
165 | - | |
166 | -Bool VA_DRI2Authenticate(Display *dpy, XID window, drm_magic_t magic) | |
167 | -{ | |
168 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
169 | - xDRI2AuthenticateReq *req; | |
170 | - xDRI2AuthenticateReply rep; | |
171 | - | |
172 | - XextCheckExtension (dpy, info, va_dri2ExtensionName, False); | |
173 | - | |
174 | - LockDisplay(dpy); | |
175 | - GetReq(DRI2Authenticate, req); | |
176 | - req->reqType = info->codes->major_opcode; | |
177 | - req->dri2ReqType = X_DRI2Authenticate; | |
178 | - req->window = window; | |
179 | - req->magic = magic; | |
180 | - | |
181 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
182 | - UnlockDisplay(dpy); | |
183 | - SyncHandle(); | |
184 | - return False; | |
185 | - } | |
186 | - | |
187 | - UnlockDisplay(dpy); | |
188 | - SyncHandle(); | |
189 | - | |
190 | - return rep.authenticated; | |
191 | -} | |
192 | - | |
193 | -void VA_DRI2CreateDrawable(Display *dpy, XID drawable) | |
194 | -{ | |
195 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
196 | - xDRI2CreateDrawableReq *req; | |
197 | - | |
198 | - XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName); | |
199 | - | |
200 | - LockDisplay(dpy); | |
201 | - GetReq(DRI2CreateDrawable, req); | |
202 | - req->reqType = info->codes->major_opcode; | |
203 | - req->dri2ReqType = X_DRI2CreateDrawable; | |
204 | - req->drawable = drawable; | |
205 | - UnlockDisplay(dpy); | |
206 | - SyncHandle(); | |
207 | -} | |
208 | - | |
209 | -void VA_DRI2DestroyDrawable(Display *dpy, XID drawable) | |
210 | -{ | |
211 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
212 | - xDRI2DestroyDrawableReq *req; | |
213 | - | |
214 | - XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName); | |
215 | - | |
216 | - XSync(dpy, False); | |
217 | - | |
218 | - LockDisplay(dpy); | |
219 | - GetReq(DRI2DestroyDrawable, req); | |
220 | - req->reqType = info->codes->major_opcode; | |
221 | - req->dri2ReqType = X_DRI2DestroyDrawable; | |
222 | - req->drawable = drawable; | |
223 | - UnlockDisplay(dpy); | |
224 | - SyncHandle(); | |
225 | -} | |
226 | - | |
227 | -VA_DRI2Buffer *VA_DRI2GetBuffers(Display *dpy, XID drawable, | |
228 | - int *width, int *height, | |
229 | - unsigned int *attachments, int count, | |
230 | - int *outCount) | |
231 | -{ | |
232 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
233 | - xDRI2GetBuffersReply rep; | |
234 | - xDRI2GetBuffersReq *req; | |
235 | - VA_DRI2Buffer *buffers; | |
236 | - xDRI2Buffer repBuffer; | |
237 | - CARD32 *p; | |
238 | - int i; | |
239 | - | |
240 | - XextCheckExtension (dpy, info, va_dri2ExtensionName, False); | |
241 | - | |
242 | - LockDisplay(dpy); | |
243 | - GetReqExtra(DRI2GetBuffers, count * 4, req); | |
244 | - req->reqType = info->codes->major_opcode; | |
245 | - req->dri2ReqType = X_DRI2GetBuffers; | |
246 | - req->drawable = drawable; | |
247 | - req->count = count; | |
248 | - p = (CARD32 *) &req[1]; | |
249 | - for (i = 0; i < count; i++) | |
250 | - p[i] = attachments[i]; | |
251 | - | |
252 | - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | |
253 | - UnlockDisplay(dpy); | |
254 | - SyncHandle(); | |
255 | - return NULL; | |
256 | - } | |
257 | - | |
258 | - *width = rep.width; | |
259 | - *height = rep.height; | |
260 | - *outCount = rep.count; | |
261 | - | |
262 | - buffers = Xmalloc(rep.count * sizeof buffers[0]); | |
263 | - if (buffers == NULL) { | |
264 | - _XEatData(dpy, rep.count * sizeof repBuffer); | |
265 | - UnlockDisplay(dpy); | |
266 | - SyncHandle(); | |
267 | - return NULL; | |
268 | - } | |
269 | - | |
270 | - for (i = 0; i < rep.count; i++) { | |
271 | - _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer); | |
272 | - buffers[i].attachment = repBuffer.attachment; | |
273 | - buffers[i].name = repBuffer.name; | |
274 | - buffers[i].pitch = repBuffer.pitch; | |
275 | - buffers[i].cpp = repBuffer.cpp; | |
276 | - buffers[i].flags = repBuffer.flags; | |
277 | - } | |
278 | - | |
279 | - UnlockDisplay(dpy); | |
280 | - SyncHandle(); | |
281 | - | |
282 | - return buffers; | |
283 | -} | |
284 | - | |
285 | -void VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region, | |
286 | - CARD32 dest, CARD32 src) | |
287 | -{ | |
288 | - XExtDisplayInfo *info = DRI2FindDisplay(dpy); | |
289 | - xDRI2CopyRegionReq *req; | |
290 | - xDRI2CopyRegionReply rep; | |
291 | - | |
292 | - XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName); | |
293 | - | |
294 | - LockDisplay(dpy); | |
295 | - GetReq(DRI2CopyRegion, req); | |
296 | - req->reqType = info->codes->major_opcode; | |
297 | - req->dri2ReqType = X_DRI2CopyRegion; | |
298 | - req->drawable = drawable; | |
299 | - req->region = region; | |
300 | - req->dest = dest; | |
301 | - req->src = src; | |
302 | - | |
303 | - _XReply(dpy, (xReply *)&rep, 0, xFalse); | |
304 | - | |
305 | - UnlockDisplay(dpy); | |
306 | - SyncHandle(); | |
307 | -} |
@@ -1,71 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright © 2007,2008 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 (krh@redhat.com) | |
31 | - */ | |
32 | - | |
33 | -#ifndef _VA_DRI2_H_ | |
34 | -#define _VA_DRI2_H_ | |
35 | - | |
36 | -#include <X11/extensions/Xfixes.h> | |
37 | -#include <X11/Xfuncproto.h> | |
38 | -#include <xf86drm.h> | |
39 | - | |
40 | -typedef struct { | |
41 | - unsigned int attachment; | |
42 | - unsigned int name; | |
43 | - unsigned int pitch; | |
44 | - unsigned int cpp; | |
45 | - unsigned int flags; | |
46 | -} VA_DRI2Buffer; | |
47 | - | |
48 | -extern Bool | |
49 | -VA_DRI2QueryExtension(Display *display, int *eventBase, int *errorBase); | |
50 | -extern Bool | |
51 | -VA_DRI2QueryVersion(Display *display, int *major, int *minor); | |
52 | -extern Bool | |
53 | -VA_DRI2Connect(Display *display, XID window, | |
54 | - char **driverName, char **deviceName); | |
55 | -extern Bool | |
56 | -VA_DRI2Authenticate(Display *display, XID window, drm_magic_t magic); | |
57 | -extern void | |
58 | -VA_DRI2CreateDrawable(Display *display, XID drawable); | |
59 | -extern void | |
60 | -VA_DRI2DestroyDrawable(Display *display, XID handle); | |
61 | -extern VA_DRI2Buffer * | |
62 | -VA_DRI2GetBuffers(Display *dpy, XID drawable, | |
63 | - int *width, int *height, | |
64 | - unsigned int *attachments, int count, | |
65 | - int *outCount); | |
66 | -#if 0 | |
67 | -extern void | |
68 | -VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region, | |
69 | - CARD32 dest, CARD32 src); | |
70 | -#endif | |
71 | -#endif |
@@ -1,193 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright © 2008 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 (krh@redhat.com) | |
31 | - */ | |
32 | - | |
33 | -#ifndef _DRI2_PROTO_H_ | |
34 | -#define _DRI2_PROTO_H_ | |
35 | - | |
36 | -#define DRI2_NAME "DRI2" | |
37 | -#define DRI2_MAJOR 1 | |
38 | -#define DRI2_MINOR 0 | |
39 | - | |
40 | -#define DRI2NumberErrors 0 | |
41 | -#define DRI2NumberEvents 0 | |
42 | -#define DRI2NumberRequests 7 | |
43 | - | |
44 | -#define X_DRI2QueryVersion 0 | |
45 | -#define X_DRI2Connect 1 | |
46 | -#define X_DRI2Authenticate 2 | |
47 | -#define X_DRI2CreateDrawable 3 | |
48 | -#define X_DRI2DestroyDrawable 4 | |
49 | -#define X_DRI2GetBuffers 5 | |
50 | -#define X_DRI2CopyRegion 6 | |
51 | - | |
52 | -typedef struct { | |
53 | - CARD32 attachment B32; | |
54 | - CARD32 name B32; | |
55 | - CARD32 pitch B32; | |
56 | - CARD32 cpp B32; | |
57 | - CARD32 flags B32; | |
58 | -} xDRI2Buffer; | |
59 | - | |
60 | -typedef struct { | |
61 | - CARD8 reqType; | |
62 | - CARD8 dri2ReqType; | |
63 | - CARD16 length B16; | |
64 | - CARD32 majorVersion B32; | |
65 | - CARD32 minorVersion B32; | |
66 | -} xDRI2QueryVersionReq; | |
67 | -#define sz_xDRI2QueryVersionReq 12 | |
68 | - | |
69 | -typedef struct { | |
70 | - BYTE type; /* X_Reply */ | |
71 | - BYTE pad1; | |
72 | - CARD16 sequenceNumber B16; | |
73 | - CARD32 length B32; | |
74 | - CARD32 majorVersion B32; | |
75 | - CARD32 minorVersion B32; | |
76 | - CARD32 pad2 B32; | |
77 | - CARD32 pad3 B32; | |
78 | - CARD32 pad4 B32; | |
79 | - CARD32 pad5 B32; | |
80 | -} xDRI2QueryVersionReply; | |
81 | -#define sz_xDRI2QueryVersionReply 32 | |
82 | - | |
83 | -typedef struct { | |
84 | - CARD8 reqType; | |
85 | - CARD8 dri2ReqType; | |
86 | - CARD16 length B16; | |
87 | - CARD32 window B32; | |
88 | - CARD32 driverType B32; | |
89 | -} xDRI2ConnectReq; | |
90 | -#define sz_xDRI2ConnectReq 12 | |
91 | - | |
92 | -typedef struct { | |
93 | - BYTE type; /* X_Reply */ | |
94 | - BYTE pad1; | |
95 | - CARD16 sequenceNumber B16; | |
96 | - CARD32 length B32; | |
97 | - CARD32 driverNameLength B32; | |
98 | - CARD32 deviceNameLength B32; | |
99 | - CARD32 pad2 B32; | |
100 | - CARD32 pad3 B32; | |
101 | - CARD32 pad4 B32; | |
102 | - CARD32 pad5 B32; | |
103 | -} xDRI2ConnectReply; | |
104 | -#define sz_xDRI2ConnectReply 32 | |
105 | - | |
106 | -typedef struct { | |
107 | - CARD8 reqType; | |
108 | - CARD8 dri2ReqType; | |
109 | - CARD16 length B16; | |
110 | - CARD32 window B32; | |
111 | - CARD32 magic B32; | |
112 | -} xDRI2AuthenticateReq; | |
113 | -#define sz_xDRI2AuthenticateReq 12 | |
114 | - | |
115 | -typedef struct { | |
116 | - BYTE type; /* X_Reply */ | |
117 | - BYTE pad1; | |
118 | - CARD16 sequenceNumber B16; | |
119 | - CARD32 length B32; | |
120 | - CARD32 authenticated B32; | |
121 | - CARD32 pad2 B32; | |
122 | - CARD32 pad3 B32; | |
123 | - CARD32 pad4 B32; | |
124 | - CARD32 pad5 B32; | |
125 | - CARD32 pad6 B32; | |
126 | -} xDRI2AuthenticateReply; | |
127 | -#define sz_xDRI2AuthenticateReply 32 | |
128 | - | |
129 | -typedef struct { | |
130 | - CARD8 reqType; | |
131 | - CARD8 dri2ReqType; | |
132 | - CARD16 length B16; | |
133 | - CARD32 drawable B32; | |
134 | -} xDRI2CreateDrawableReq; | |
135 | -#define sz_xDRI2CreateDrawableReq 8 | |
136 | - | |
137 | -typedef struct { | |
138 | - CARD8 reqType; | |
139 | - CARD8 dri2ReqType; | |
140 | - CARD16 length B16; | |
141 | - CARD32 drawable B32; | |
142 | -} xDRI2DestroyDrawableReq; | |
143 | -#define sz_xDRI2DestroyDrawableReq 8 | |
144 | - | |
145 | -typedef struct { | |
146 | - CARD8 reqType; | |
147 | - CARD8 dri2ReqType; | |
148 | - CARD16 length B16; | |
149 | - CARD32 drawable B32; | |
150 | - CARD32 count B32; | |
151 | -} xDRI2GetBuffersReq; | |
152 | -#define sz_xDRI2GetBuffersReq 12 | |
153 | - | |
154 | -typedef struct { | |
155 | - BYTE type; /* X_Reply */ | |
156 | - BYTE pad1; | |
157 | - CARD16 sequenceNumber B16; | |
158 | - CARD32 length B32; | |
159 | - CARD32 width B32; | |
160 | - CARD32 height B32; | |
161 | - CARD32 count B32; | |
162 | - CARD32 pad2 B32; | |
163 | - CARD32 pad3 B32; | |
164 | - CARD32 pad4 B32; | |
165 | -} xDRI2GetBuffersReply; | |
166 | -#define sz_xDRI2GetBuffersReply 32 | |
167 | - | |
168 | -typedef struct { | |
169 | - CARD8 reqType; | |
170 | - CARD8 dri2ReqType; | |
171 | - CARD16 length B16; | |
172 | - CARD32 drawable B32; | |
173 | - CARD32 region B32; | |
174 | - CARD32 dest B32; | |
175 | - CARD32 src B32; | |
176 | -} xDRI2CopyRegionReq; | |
177 | -#define sz_xDRI2CopyRegionReq 20 | |
178 | - | |
179 | -typedef struct { | |
180 | - BYTE type; /* X_Reply */ | |
181 | - BYTE pad1; | |
182 | - CARD16 sequenceNumber B16; | |
183 | - CARD32 length B32; | |
184 | - CARD32 pad2 B32; | |
185 | - CARD32 pad3 B32; | |
186 | - CARD32 pad4 B32; | |
187 | - CARD32 pad5 B32; | |
188 | - CARD32 pad6 B32; | |
189 | - CARD32 pad7 B32; | |
190 | -} xDRI2CopyRegionReply; | |
191 | -#define sz_xDRI2CopyRegionReply 32 | |
192 | - | |
193 | -#endif |
@@ -1,48 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright © 2008 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 (krh@redhat.com) | |
31 | - */ | |
32 | - | |
33 | -#ifndef _DRI2_TOKENS_H_ | |
34 | -#define _DRI2_TOKENS_H_ | |
35 | - | |
36 | -#define DRI2BufferFrontLeft 0 | |
37 | -#define DRI2BufferBackLeft 1 | |
38 | -#define DRI2BufferFrontRight 2 | |
39 | -#define DRI2BufferBackRight 3 | |
40 | -#define DRI2BufferDepth 4 | |
41 | -#define DRI2BufferStencil 5 | |
42 | -#define DRI2BufferAccum 6 | |
43 | -#define DRI2BufferFakeFrontLeft 7 | |
44 | -#define DRI2BufferFakeFrontRight 8 | |
45 | - | |
46 | -#define DRI2DriverDRI 0 | |
47 | - | |
48 | -#endif |
@@ -1,344 +0,0 @@ | ||
1 | -/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.10 2002/10/30 12:51:25 alanh Exp $ */ | |
2 | -/************************************************************************** | |
3 | - | |
4 | -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | |
5 | -Copyright 2000 VA Linux Systems, Inc. | |
6 | -Copyright 2007 Intel Corporation | |
7 | -All Rights Reserved. | |
8 | - | |
9 | -Permission is hereby granted, free of charge, to any person obtaining a | |
10 | -copy of this software and associated documentation files (the | |
11 | -"Software"), to deal in the Software without restriction, including | |
12 | -without limitation the rights to use, copy, modify, merge, publish, | |
13 | -distribute, sub license, and/or sell copies of the Software, and to | |
14 | -permit persons to whom the Software is furnished to do so, subject to | |
15 | -the following conditions: | |
16 | - | |
17 | -The above copyright notice and this permission notice (including the | |
18 | -next paragraph) shall be included in all copies or substantial portions | |
19 | -of the Software. | |
20 | - | |
21 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
22 | -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
23 | -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |
24 | -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | |
25 | -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
26 | -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
27 | -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
28 | - | |
29 | -**************************************************************************/ | |
30 | - | |
31 | -/* | |
32 | - * Authors: | |
33 | - * Kevin E. Martin <martin@valinux.com> | |
34 | - * Jens Owen <jens@tungstengraphics.com> | |
35 | - * Rickard E. (Rik) Fiath <faith@valinux.com> | |
36 | - * | |
37 | - */ | |
38 | - | |
39 | -#ifndef _VA_DRISTR_H_ | |
40 | -#define _VA_DRISTR_H_ | |
41 | - | |
42 | -#include "va_dri.h" | |
43 | - | |
44 | -#define VA_DRINAME "XFree86-DRI" | |
45 | - | |
46 | -/* The DRI version number. This was originally set to be the same of the | |
47 | - * XFree86 version number. However, this version is really indepedent of | |
48 | - * the XFree86 version. | |
49 | - * | |
50 | - * Version History: | |
51 | - * 4.0.0: Original | |
52 | - * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 | |
53 | - * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 | |
54 | - */ | |
55 | -#define VA_DRI_MAJOR_VERSION 4 | |
56 | -#define VA_DRI_MINOR_VERSION 1 | |
57 | -#define VA_DRI_PATCH_VERSION 0 | |
58 | - | |
59 | -typedef struct _VA_DRIQueryVersion { | |
60 | - CARD8 reqType; /* always DRIReqCode */ | |
61 | - CARD8 driReqType; /* always X_DRIQueryVersion */ | |
62 | - CARD16 length B16; | |
63 | -} xVA_DRIQueryVersionReq; | |
64 | -#define sz_xVA_DRIQueryVersionReq 4 | |
65 | - | |
66 | -typedef struct { | |
67 | - BYTE type; /* X_Reply */ | |
68 | - BOOL pad1; | |
69 | - CARD16 sequenceNumber B16; | |
70 | - CARD32 length B32; | |
71 | - CARD16 majorVersion B16; /* major version of DRI protocol */ | |
72 | - CARD16 minorVersion B16; /* minor version of DRI protocol */ | |
73 | - CARD32 patchVersion B32; /* patch version of DRI protocol */ | |
74 | - CARD32 pad3 B32; | |
75 | - CARD32 pad4 B32; | |
76 | - CARD32 pad5 B32; | |
77 | - CARD32 pad6 B32; | |
78 | -} xVA_DRIQueryVersionReply; | |
79 | -#define sz_xVA_DRIQueryVersionReply 32 | |
80 | - | |
81 | -typedef struct _VA_DRIQueryDirectRenderingCapable { | |
82 | - CARD8 reqType; /* always DRIReqCode */ | |
83 | - CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ | |
84 | - CARD16 length B16; | |
85 | - CARD32 screen B32; | |
86 | -} xVA_DRIQueryDirectRenderingCapableReq; | |
87 | -#define sz_xVA_DRIQueryDirectRenderingCapableReq 8 | |
88 | - | |
89 | -typedef struct { | |
90 | - BYTE type; /* X_Reply */ | |
91 | - BOOL pad1; | |
92 | - CARD16 sequenceNumber B16; | |
93 | - CARD32 length B32; | |
94 | - BOOL isCapable; | |
95 | - BOOL pad2; | |
96 | - BOOL pad3; | |
97 | - BOOL pad4; | |
98 | - CARD32 pad5 B32; | |
99 | - CARD32 pad6 B32; | |
100 | - CARD32 pad7 B32; | |
101 | - CARD32 pad8 B32; | |
102 | - CARD32 pad9 B32; | |
103 | -} xVA_DRIQueryDirectRenderingCapableReply; | |
104 | -#define sz_xVA_DRIQueryDirectRenderingCapableReply 32 | |
105 | - | |
106 | -typedef struct _VA_DRIOpenConnection { | |
107 | - CARD8 reqType; /* always DRIReqCode */ | |
108 | - CARD8 driReqType; /* always X_DRIOpenConnection */ | |
109 | - CARD16 length B16; | |
110 | - CARD32 screen B32; | |
111 | -} xVA_DRIOpenConnectionReq; | |
112 | -#define sz_xVA_DRIOpenConnectionReq 8 | |
113 | - | |
114 | -typedef struct { | |
115 | - BYTE type; /* X_Reply */ | |
116 | - BOOL pad1; | |
117 | - CARD16 sequenceNumber B16; | |
118 | - CARD32 length B32; | |
119 | - CARD32 hSAREALow B32; | |
120 | - CARD32 hSAREAHigh B32; | |
121 | - CARD32 busIdStringLength B32; | |
122 | - CARD32 pad6 B32; | |
123 | - CARD32 pad7 B32; | |
124 | - CARD32 pad8 B32; | |
125 | -} xVA_DRIOpenConnectionReply; | |
126 | -#define sz_xVA_DRIOpenConnectionReply 32 | |
127 | - | |
128 | -typedef struct _VA_DRIAuthConnection { | |
129 | - CARD8 reqType; /* always DRIReqCode */ | |
130 | - CARD8 driReqType; /* always X_DRICloseConnection */ | |
131 | - CARD16 length B16; | |
132 | - CARD32 screen B32; | |
133 | - CARD32 magic B32; | |
134 | -} xVA_DRIAuthConnectionReq; | |
135 | -#define sz_xVA_DRIAuthConnectionReq 12 | |
136 | - | |
137 | -typedef struct { | |
138 | - BYTE type; | |
139 | - BOOL pad1; | |
140 | - CARD16 sequenceNumber B16; | |
141 | - CARD32 length B32; | |
142 | - CARD32 authenticated B32; | |
143 | - CARD32 pad2 B32; | |
144 | - CARD32 pad3 B32; | |
145 | - CARD32 pad4 B32; | |
146 | - CARD32 pad5 B32; | |
147 | - CARD32 pad6 B32; | |
148 | -} xVA_DRIAuthConnectionReply; | |
149 | -#define zx_xVA_DRIAuthConnectionReply 32 | |
150 | - | |
151 | -typedef struct _VA_DRICloseConnection { | |
152 | - CARD8 reqType; /* always DRIReqCode */ | |
153 | - CARD8 driReqType; /* always X_DRICloseConnection */ | |
154 | - CARD16 length B16; | |
155 | - CARD32 screen B32; | |
156 | -} xVA_DRICloseConnectionReq; | |
157 | -#define sz_xVA_DRICloseConnectionReq 8 | |
158 | - | |
159 | -typedef struct _VA_DRIGetClientDriverName { | |
160 | - CARD8 reqType; /* always DRIReqCode */ | |
161 | - CARD8 driReqType; /* always X_DRIGetClientDriverName */ | |
162 | - CARD16 length B16; | |
163 | - CARD32 screen B32; | |
164 | -} xVA_DRIGetClientDriverNameReq; | |
165 | -#define sz_xVA_DRIGetClientDriverNameReq 8 | |
166 | - | |
167 | -typedef struct { | |
168 | - BYTE type; /* X_Reply */ | |
169 | - BOOL pad1; | |
170 | - CARD16 sequenceNumber B16; | |
171 | - CARD32 length B32; | |
172 | - CARD32 ddxDriverMajorVersion B32; | |
173 | - CARD32 ddxDriverMinorVersion B32; | |
174 | - CARD32 ddxDriverPatchVersion B32; | |
175 | - CARD32 clientDriverNameLength B32; | |
176 | - CARD32 pad5 B32; | |
177 | - CARD32 pad6 B32; | |
178 | -} xVA_DRIGetClientDriverNameReply; | |
179 | -#define sz_xVA_DRIGetClientDriverNameReply 32 | |
180 | - | |
181 | -typedef struct _VA_DRICreateContext { | |
182 | - CARD8 reqType; /* always DRIReqCode */ | |
183 | - CARD8 driReqType; /* always X_DRICreateContext */ | |
184 | - CARD16 length B16; | |
185 | - CARD32 screen B32; | |
186 | - CARD32 visual B32; | |
187 | - CARD32 context B32; | |
188 | -} xVA_DRICreateContextReq; | |
189 | -#define sz_xVA_DRICreateContextReq 16 | |
190 | - | |
191 | -typedef struct { | |
192 | - BYTE type; /* X_Reply */ | |
193 | - BOOL pad1; | |
194 | - CARD16 sequenceNumber B16; | |
195 | - CARD32 length B32; | |
196 | - CARD32 hHWContext B32; | |
197 | - CARD32 pad2 B32; | |
198 | - CARD32 pad3 B32; | |
199 | - CARD32 pad4 B32; | |
200 | - CARD32 pad5 B32; | |
201 | - CARD32 pad6 B32; | |
202 | -} xVA_DRICreateContextReply; | |
203 | -#define sz_xVA_DRICreateContextReply 32 | |
204 | - | |
205 | -typedef struct _VA_DRIDestroyContext { | |
206 | - CARD8 reqType; /* always DRIReqCode */ | |
207 | - CARD8 driReqType; /* always X_DRIDestroyContext */ | |
208 | - CARD16 length B16; | |
209 | - CARD32 screen B32; | |
210 | - CARD32 context B32; | |
211 | -} xVA_DRIDestroyContextReq; | |
212 | -#define sz_xVA_DRIDestroyContextReq 12 | |
213 | - | |
214 | -typedef struct _VA_DRICreateDrawable { | |
215 | - CARD8 reqType; /* always DRIReqCode */ | |
216 | - CARD8 driReqType; /* always X_DRICreateDrawable */ | |
217 | - CARD16 length B16; | |
218 | - CARD32 screen B32; | |
219 | - CARD32 drawable B32; | |
220 | -} xVA_DRICreateDrawableReq; | |
221 | -#define sz_xVA_DRICreateDrawableReq 12 | |
222 | - | |
223 | -typedef struct { | |
224 | - BYTE type; /* X_Reply */ | |
225 | - BOOL pad1; | |
226 | - CARD16 sequenceNumber B16; | |
227 | - CARD32 length B32; | |
228 | - CARD32 hHWDrawable B32; | |
229 | - CARD32 pad2 B32; | |
230 | - CARD32 pad3 B32; | |
231 | - CARD32 pad4 B32; | |
232 | - CARD32 pad5 B32; | |
233 | - CARD32 pad6 B32; | |
234 | -} xVA_DRICreateDrawableReply; | |
235 | -#define sz_xVA_DRICreateDrawableReply 32 | |
236 | - | |
237 | -typedef struct _VA_DRIDestroyDrawable { | |
238 | - CARD8 reqType; /* always DRIReqCode */ | |
239 | - CARD8 driReqType; /* always X_DRIDestroyDrawable */ | |
240 | - CARD16 length B16; | |
241 | - CARD32 screen B32; | |
242 | - CARD32 drawable B32; | |
243 | -} xVA_DRIDestroyDrawableReq; | |
244 | -#define sz_xVA_DRIDestroyDrawableReq 12 | |
245 | - | |
246 | -typedef struct _VA_DRIGetDrawableInfo { | |
247 | - CARD8 reqType; /* always DRIReqCode */ | |
248 | - CARD8 driReqType; /* always X_DRIGetDrawableInfo */ | |
249 | - CARD16 length B16; | |
250 | - CARD32 screen B32; | |
251 | - CARD32 drawable B32; | |
252 | -} xVA_DRIGetDrawableInfoReq; | |
253 | -#define sz_xVA_DRIGetDrawableInfoReq 12 | |
254 | - | |
255 | -typedef struct { | |
256 | - BYTE type; /* X_Reply */ | |
257 | - BOOL pad1; | |
258 | - CARD16 sequenceNumber B16; | |
259 | - CARD32 length B32; | |
260 | - CARD32 drawableTableIndex B32; | |
261 | - CARD32 drawableTableStamp B32; | |
262 | - INT16 drawableX B16; | |
263 | - INT16 drawableY B16; | |
264 | - INT16 drawableWidth B16; | |
265 | - INT16 drawableHeight B16; | |
266 | - CARD32 numClipRects B32; | |
267 | - INT16 backX B16; | |
268 | - INT16 backY B16; | |
269 | - CARD32 numBackClipRects B32; | |
270 | -} xVA_DRIGetDrawableInfoReply; | |
271 | - | |
272 | -#define sz_xVA_DRIGetDrawableInfoReply 36 | |
273 | - | |
274 | - | |
275 | -typedef struct _VA_DRIGetDeviceInfo { | |
276 | - CARD8 reqType; /* always DRIReqCode */ | |
277 | - CARD8 driReqType; /* always X_DRIGetDeviceInfo */ | |
278 | - CARD16 length B16; | |
279 | - CARD32 screen B32; | |
280 | -} xVA_DRIGetDeviceInfoReq; | |
281 | -#define sz_xVA_DRIGetDeviceInfoReq 8 | |
282 | - | |
283 | -typedef struct { | |
284 | - BYTE type; /* X_Reply */ | |
285 | - BOOL pad1; | |
286 | - CARD16 sequenceNumber B16; | |
287 | - CARD32 length B32; | |
288 | - CARD32 hFrameBufferLow B32; | |
289 | - CARD32 hFrameBufferHigh B32; | |
290 | - CARD32 framebufferOrigin B32; | |
291 | - CARD32 framebufferSize B32; | |
292 | - CARD32 framebufferStride B32; | |
293 | - CARD32 devPrivateSize B32; | |
294 | -} xVA_DRIGetDeviceInfoReply; | |
295 | -#define sz_xVA_DRIGetDeviceInfoReply 32 | |
296 | - | |
297 | -typedef struct _VA_DRIOpenFullScreen { | |
298 | - CARD8 reqType; /* always DRIReqCode */ | |
299 | - CARD8 driReqType; /* always X_DRIOpenFullScreen */ | |
300 | - CARD16 length B16; | |
301 | - CARD32 screen B32; | |
302 | - CARD32 drawable B32; | |
303 | -} xVA_DRIOpenFullScreenReq; | |
304 | -#define sz_xVA_DRIOpenFullScreenReq 12 | |
305 | - | |
306 | -typedef struct { | |
307 | - BYTE type; | |
308 | - BOOL pad1; | |
309 | - CARD16 sequenceNumber B16; | |
310 | - CARD32 length B32; | |
311 | - CARD32 isFullScreen B32; | |
312 | - CARD32 pad2 B32; | |
313 | - CARD32 pad3 B32; | |
314 | - CARD32 pad4 B32; | |
315 | - CARD32 pad5 B32; | |
316 | - CARD32 pad6 B32; | |
317 | -} xVA_DRIOpenFullScreenReply; | |
318 | -#define sz_xVA_DRIOpenFullScreenReply 32 | |
319 | - | |
320 | -typedef struct _VA_DRICloseFullScreen { | |
321 | - CARD8 reqType; /* always DRIReqCode */ | |
322 | - CARD8 driReqType; /* always X_DRICloseFullScreen */ | |
323 | - CARD16 length B16; | |
324 | - CARD32 screen B32; | |
325 | - CARD32 drawable B32; | |
326 | -} xVA_DRICloseFullScreenReq; | |
327 | -#define sz_xVA_DRICloseFullScreenReq 12 | |
328 | - | |
329 | -typedef struct { | |
330 | - BYTE type; | |
331 | - BOOL pad1; | |
332 | - CARD16 sequenceNumber B16; | |
333 | - CARD32 length B32; | |
334 | - CARD32 pad2 B32; | |
335 | - CARD32 pad3 B32; | |
336 | - CARD32 pad4 B32; | |
337 | - CARD32 pad5 B32; | |
338 | - CARD32 pad6 B32; | |
339 | - CARD32 pad7 B32; | |
340 | -} xVA_DRICloseFullScreenReply; | |
341 | -#define sz_xVA_DRICloseFullScreenReply 32 | |
342 | - | |
343 | - | |
344 | -#endif /* _VA_DRISTR_H_ */ |
@@ -1,304 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright (c) 2007 Intel Corporation. All Rights Reserved. | |
3 | - * | |
4 | - * Permission is hereby granted, free of charge, to any person obtaining a | |
5 | - * copy of this software and associated documentation files (the | |
6 | - * "Software"), to deal in the Software without restriction, including | |
7 | - * without limitation the rights to use, copy, modify, merge, publish, | |
8 | - * distribute, sub license, and/or sell copies of the Software, and to | |
9 | - * permit persons to whom the Software is furnished to do so, subject to | |
10 | - * the following conditions: | |
11 | - * | |
12 | - * The above copyright notice and this permission notice (including the | |
13 | - * next paragraph) shall be included in all copies or substantial portions | |
14 | - * of the Software. | |
15 | - * | |
16 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
17 | - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |
19 | - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | |
20 | - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
21 | - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
22 | - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
23 | - */ | |
24 | - | |
25 | -#include "config.h" | |
26 | -#include "va.h" | |
27 | -#include "va_backend.h" | |
28 | -#include "va_x11.h" | |
29 | -#include "va_dri.h" | |
30 | -#include "va_dri2.h" | |
31 | -#include <stdio.h> | |
32 | -#include <stdarg.h> | |
33 | -#include <string.h> | |
34 | -#include <sys/types.h> | |
35 | -#include <sys/stat.h> | |
36 | -#include <fcntl.h> | |
37 | -#include <errno.h> | |
38 | - | |
39 | -static VADisplayContextP pDisplayContexts = NULL; | |
40 | - | |
41 | -static void va_errorMessage(const char *msg, ...) | |
42 | -{ | |
43 | - va_list args; | |
44 | - | |
45 | - fprintf(stderr, "libva error: "); | |
46 | - va_start(args, msg); | |
47 | - vfprintf(stderr, msg, args); | |
48 | - va_end(args); | |
49 | -} | |
50 | - | |
51 | -static void va_infoMessage(const char *msg, ...) | |
52 | -{ | |
53 | - va_list args; | |
54 | - | |
55 | - fprintf(stderr, "libva: "); | |
56 | - va_start(args, msg); | |
57 | - vfprintf(stderr, msg, args); | |
58 | - va_end(args); | |
59 | -} | |
60 | - | |
61 | -static int va_DisplayContextIsValid ( | |
62 | - VADisplayContextP pDisplayContext | |
63 | -) | |
64 | -{ | |
65 | - VADisplayContextP ctx = pDisplayContexts; | |
66 | - | |
67 | - while (ctx) | |
68 | - { | |
69 | - if (ctx == pDisplayContext && pDisplayContext->pDriverContext) | |
70 | - return 1; | |
71 | - ctx = ctx->pNext; | |
72 | - } | |
73 | - return 0; | |
74 | -} | |
75 | - | |
76 | -static void va_DisplayContextDestroy ( | |
77 | - VADisplayContextP pDisplayContext | |
78 | -) | |
79 | -{ | |
80 | - VADisplayContextP *ctx = &pDisplayContexts; | |
81 | - | |
82 | - /* Throw away pDisplayContext */ | |
83 | - while (*ctx) | |
84 | - { | |
85 | - if (*ctx == pDisplayContext) | |
86 | - { | |
87 | - *ctx = pDisplayContext->pNext; | |
88 | - pDisplayContext->pNext = NULL; | |
89 | - break; | |
90 | - } | |
91 | - ctx = &((*ctx)->pNext); | |
92 | - } | |
93 | - free(pDisplayContext->pDriverContext); | |
94 | - free(pDisplayContext); | |
95 | -} | |
96 | - | |
97 | - | |
98 | -static VAStatus va_DRI2GetDriverName ( | |
99 | - VADisplayContextP pDisplayContext, | |
100 | - char **driver_name | |
101 | -) | |
102 | -{ | |
103 | - VADriverContextP ctx = pDisplayContext->pDriverContext; | |
104 | - VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; | |
105 | - int eventBase, errorBase; | |
106 | - char *device_name; | |
107 | - int driver_major; | |
108 | - int driver_minor; | |
109 | - int driver_patch; | |
110 | - Bool result = True; | |
111 | - | |
112 | - if (!VA_DRI2QueryExtension(ctx->x11_dpy, &eventBase, &errorBase)) { | |
113 | - va_infoMessage("DRI2 extension isn't present\n"); | |
114 | - return VA_STATUS_ERROR_UNKNOWN; | |
115 | - } | |
116 | - | |
117 | - if (!VA_DRI2QueryVersion(ctx->x11_dpy, &driver_major, &driver_minor)) { | |
118 | - va_errorMessage("VA_DRI2QueryVersion failed\n"); | |
119 | - return VA_STATUS_ERROR_UNKNOWN; | |
120 | - } | |
121 | - | |
122 | - if (!VA_DRI2Connect(ctx->x11_dpy, RootWindow(ctx->x11_dpy, ctx->x11_screen), | |
123 | - driver_name, &device_name)) { | |
124 | - va_infoMessage("DRI2 isn't enabled, fallback to DRI1\n"); | |
125 | - return VA_STATUS_ERROR_UNKNOWN; | |
126 | - } | |
127 | - | |
128 | - va_infoMessage("VA_DRI2Connect: %d.%d.%d %s (screen %d)\n", | |
129 | - driver_major, driver_minor, driver_patch, *driver_name, ctx->x11_screen); | |
130 | - ctx->dri2 = 1; | |
131 | - | |
132 | - return VA_STATUS_SUCCESS; | |
133 | -} | |
134 | - | |
135 | -static VAStatus va_DRIGetDriverName ( | |
136 | - VADisplayContextP pDisplayContext, | |
137 | - char **driver_name | |
138 | -) | |
139 | -{ | |
140 | - VADriverContextP ctx = pDisplayContext->pDriverContext; | |
141 | - VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; | |
142 | - int eventBase, errorBase; | |
143 | - int direct_capable; | |
144 | - int driver_major; | |
145 | - int driver_minor; | |
146 | - int driver_patch; | |
147 | - Bool result = True; | |
148 | - char *x_driver_name = NULL; | |
149 | - | |
150 | - if (!VA_DRIQueryExtension(ctx->x11_dpy, &eventBase, &errorBase)) { | |
151 | - va_errorMessage("VA_DRIQueryExtension failed\n"); | |
152 | - return VA_STATUS_ERROR_UNKNOWN; | |
153 | - } | |
154 | - | |
155 | - if (result) | |
156 | - { | |
157 | - result = VA_DRIQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable); | |
158 | - if (!result) | |
159 | - { | |
160 | - va_errorMessage("VA_DRIQueryDirectRenderingCapable failed\n"); | |
161 | - } | |
162 | - } | |
163 | - if (result) | |
164 | - { | |
165 | - result = direct_capable; | |
166 | - if (!result) | |
167 | - { | |
168 | - va_errorMessage("VA_DRIQueryDirectRenderingCapable returned false\n"); | |
169 | - } | |
170 | - } | |
171 | - if (result) | |
172 | - { | |
173 | - result = VA_DRIGetClientDriverName(ctx->x11_dpy, ctx->x11_screen, &driver_major, &driver_minor, | |
174 | - &driver_patch, &x_driver_name); | |
175 | - if (!result) | |
176 | - { | |
177 | - va_errorMessage("VA_DRIGetClientDriverName returned false\n"); | |
178 | - } | |
179 | - } | |
180 | - if (result) | |
181 | - { | |
182 | - vaStatus = VA_STATUS_SUCCESS; | |
183 | - va_infoMessage("VA_DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", | |
184 | - driver_major, driver_minor, driver_patch, x_driver_name, ctx->x11_screen); | |
185 | - if (driver_name) | |
186 | - *driver_name = strdup(x_driver_name); | |
187 | - } | |
188 | - if (x_driver_name) | |
189 | - XFree(x_driver_name); | |
190 | - | |
191 | - return vaStatus; | |
192 | -} | |
193 | - | |
194 | -static VAStatus va_DisplayContextGetDriverName ( | |
195 | - VADisplayContextP pDisplayContext, | |
196 | - char **driver_name | |
197 | -) | |
198 | -{ | |
199 | - VADriverContextP ctx = pDisplayContext->pDriverContext; | |
200 | - VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; | |
201 | - int direct_capable; | |
202 | - int driver_major; | |
203 | - int driver_minor; | |
204 | - int driver_patch; | |
205 | - Bool result = True; | |
206 | - char *x_driver_name = NULL; | |
207 | - | |
208 | - if (driver_name) | |
209 | - *driver_name = NULL; | |
210 | - | |
211 | - vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name); | |
212 | - if (vaStatus != VA_STATUS_SUCCESS) | |
213 | - vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name); | |
214 | - | |
215 | - if ((vaStatus == VA_STATUS_SUCCESS) | |
216 | - && geteuid() == getuid()) | |
217 | - { | |
218 | - /* don't allow setuid apps to use LIBVA_DRIVER_NAME */ | |
219 | - if (getenv("LIBVA_DRIVER_NAME")) | |
220 | - { | |
221 | - /* For easier debugging */ | |
222 | - if (*driver_name) | |
223 | - XFree(*driver_name); | |
224 | - | |
225 | - *driver_name = strdup(getenv("LIBVA_DRIVER_NAME")); | |
226 | - return VA_STATUS_SUCCESS; | |
227 | - } | |
228 | - } | |
229 | - | |
230 | - return vaStatus; | |
231 | -} | |
232 | - | |
233 | -int vaDisplayIsValid(VADisplay dpy) | |
234 | -{ | |
235 | - VADisplayContextP tmp=NULL; | |
236 | - VADisplayContextP pDisplayContext = pDisplayContexts; | |
237 | - | |
238 | - while (pDisplayContext) | |
239 | - { | |
240 | - if (pDisplayContext == (VADisplayContextP)dpy) | |
241 | - { | |
242 | - tmp = (VADisplay)pDisplayContext; | |
243 | - break; | |
244 | - } | |
245 | - pDisplayContext = pDisplayContext->pNext; | |
246 | - } | |
247 | - | |
248 | - if (!tmp) | |
249 | - return 0; | |
250 | - | |
251 | - return tmp->vaIsValid(pDisplayContext); | |
252 | -} | |
253 | - | |
254 | - | |
255 | -VADisplay vaGetDisplay ( | |
256 | - Display *native_dpy /* implementation specific */ | |
257 | -) | |
258 | -{ | |
259 | - VADisplay dpy = NULL; | |
260 | - VADisplayContextP pDisplayContext = pDisplayContexts; | |
261 | - | |
262 | - if (!native_dpy) | |
263 | - return NULL; | |
264 | - | |
265 | - while (pDisplayContext) | |
266 | - { | |
267 | - if (pDisplayContext->pDriverContext && | |
268 | - pDisplayContext->pDriverContext->x11_dpy == native_dpy) | |
269 | - { | |
270 | - dpy = (VADisplay)pDisplayContext; | |
271 | - break; | |
272 | - } | |
273 | - pDisplayContext = pDisplayContext->pNext; | |
274 | - } | |
275 | - | |
276 | - if (!dpy) | |
277 | - { | |
278 | - /* create new entry */ | |
279 | - VADriverContextP pDriverContext; | |
280 | - pDisplayContext = calloc(1, sizeof(*pDisplayContext)); | |
281 | - pDriverContext = calloc(1, sizeof(*pDriverContext)); | |
282 | - if (pDisplayContext && pDriverContext) | |
283 | - { | |
284 | - pDriverContext->old_pNext = (void *)(unsigned long)0xdeadbeef; | |
285 | - pDriverContext->x11_dpy = native_dpy; | |
286 | - pDisplayContext->pNext = pDisplayContexts; | |
287 | - pDisplayContext->pDriverContext = pDriverContext; | |
288 | - pDisplayContext->vaIsValid = va_DisplayContextIsValid; | |
289 | - pDisplayContext->vaDestroy = va_DisplayContextDestroy; | |
290 | - pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; | |
291 | - pDisplayContexts = pDisplayContext; | |
292 | - dpy = (VADisplay)pDisplayContext; | |
293 | - } | |
294 | - else | |
295 | - { | |
296 | - if (pDisplayContext) | |
297 | - free(pDisplayContext); | |
298 | - if (pDriverContext) | |
299 | - free(pDriverContext); | |
300 | - } | |
301 | - } | |
302 | - | |
303 | - return dpy; | |
304 | -} |
@@ -1,67 +0,0 @@ | ||
1 | -#ifndef _VA_X11_H_ | |
2 | -#define _VA_X11_H_ | |
3 | - | |
4 | -#ifdef IN_LIBVA | |
5 | -#include "va.h" | |
6 | -#else | |
7 | -#include <va/va.h> | |
8 | -#endif | |
9 | -#include <X11/Xlib.h> | |
10 | - | |
11 | -#ifdef __cplusplus | |
12 | -extern "C" { | |
13 | -#endif | |
14 | - | |
15 | -/* | |
16 | - * Returns a suitable VADisplay for VA API | |
17 | - */ | |
18 | -VADisplay vaGetDisplay ( | |
19 | - Display *dpy | |
20 | -); | |
21 | - | |
22 | -/* | |
23 | - * Output rendering | |
24 | - * Following is the rendering interface for X windows, | |
25 | - * to get the decode output surface to a X drawable | |
26 | - * It basically performs a de-interlacing (if needed), | |
27 | - * color space conversion and scaling to the destination | |
28 | - * rectangle | |
29 | - */ | |
30 | -/* de-interlacing flags for vaPutSurface */ | |
31 | -#define VA_FRAME_PICTURE 0x00000000 | |
32 | -#define VA_TOP_FIELD 0x00000001 | |
33 | -#define VA_BOTTOM_FIELD 0x00000002 | |
34 | - | |
35 | -/* | |
36 | - * clears the drawable with background color. | |
37 | - * for hardware overlay based implementation this flag | |
38 | - * can be used to turn off the overlay | |
39 | - */ | |
40 | -#define VA_CLEAR_DRAWABLE 0x00000008 | |
41 | - | |
42 | -/* color space conversion flags for vaPutSurface */ | |
43 | -#define VA_SRC_BT601 0x00000010 | |
44 | -#define VA_SRC_BT709 0x00000020 | |
45 | - | |
46 | -VAStatus vaPutSurface ( | |
47 | - VADisplay dpy, | |
48 | - VASurfaceID surface, | |
49 | - Drawable draw, /* X Drawable */ | |
50 | - short srcx, | |
51 | - short srcy, | |
52 | - unsigned short srcw, | |
53 | - unsigned short srch, | |
54 | - short destx, | |
55 | - short desty, | |
56 | - unsigned short destw, | |
57 | - unsigned short desth, | |
58 | - VARectangle *cliprects, /* client supplied destination clip list */ | |
59 | - unsigned int number_cliprects, /* number of clip rects in the clip list */ | |
60 | - unsigned int flags /* PutSurface flags */ | |
61 | -); | |
62 | - | |
63 | -#ifdef __cplusplus | |
64 | -} | |
65 | -#endif | |
66 | - | |
67 | -#endif /* _VA_X11_H_ */ |