Merge branch 'gallium-vertexelementcso'
[mesa.git] / src / glx / dri2.c
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 #ifdef GLX_DIRECT_RENDERING
35
36 #define NEED_REPLIES
37 #include <stdio.h>
38 #include <X11/Xlibint.h>
39 #include <X11/extensions/Xext.h>
40 #include <X11/extensions/extutil.h>
41 #include <X11/extensions/dri2proto.h>
42 #include "xf86drm.h"
43 #include "dri2.h"
44 #include "glxclient.h"
45 #include "GL/glxext.h"
46
47 /* Allow the build to work with an older versions of dri2proto.h and
48 * dri2tokens.h.
49 */
50 #if DRI2_MINOR < 1
51 #undef DRI2_MINOR
52 #define DRI2_MINOR 1
53 #define X_DRI2GetBuffersWithFormat 7
54 #endif
55
56
57 static char dri2ExtensionName[] = DRI2_NAME;
58 static XExtensionInfo *dri2Info;
59 static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
60
61 static Bool
62 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire);
63 static Status
64 DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire);
65
66 static /* const */ XExtensionHooks dri2ExtensionHooks = {
67 NULL, /* create_gc */
68 NULL, /* copy_gc */
69 NULL, /* flush_gc */
70 NULL, /* free_gc */
71 NULL, /* create_font */
72 NULL, /* free_font */
73 DRI2CloseDisplay, /* close_display */
74 DRI2WireToEvent, /* wire_to_event */
75 DRI2EventToWire, /* event_to_wire */
76 NULL, /* error */
77 NULL, /* error_string */
78 };
79
80 static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
81 dri2Info,
82 dri2ExtensionName,
83 &dri2ExtensionHooks,
84 0, NULL)
85
86 static Bool
87 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
88 {
89 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
90 XExtDisplayInfo *glx_info = __glXFindDisplay(dpy);
91
92 XextCheckExtension(dpy, info, dri2ExtensionName, False);
93
94 switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
95
96 #ifdef X_DRI2SwapBuffers
97 case DRI2_BufferSwapComplete:
98 {
99 GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
100 xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
101 aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
102 aevent->type =
103 (glx_info->codes->first_event + GLX_BufferSwapComplete) & 0x75;
104 aevent->send_event = (awire->type & 0x80) != 0;
105 aevent->display = dpy;
106 aevent->drawable = awire->drawable;
107 switch (awire->event_type) {
108 case DRI2_EXCHANGE_COMPLETE:
109 aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
110 break;
111 case DRI2_BLIT_COMPLETE:
112 aevent->event_type = GLX_BLIT_COMPLETE_INTEL;
113 break;
114 case DRI2_FLIP_COMPLETE:
115 aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
116 break;
117 default:
118 /* unknown swap completion type */
119 return False;
120 }
121 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
122 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
123 aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
124 return True;
125 }
126 #endif
127 #ifdef DRI2_InvalidateBuffers
128 case DRI2_InvalidateBuffers:
129 {
130 xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire;
131
132 dri2InvalidateBuffers(dpy, awire->drawable);
133 return False;
134 }
135 #endif
136 default:
137 /* client doesn't support server event */
138 break;
139 }
140
141 return False;
142 }
143
144 /* We don't actually support this. It doesn't make sense for clients to
145 * send each other DRI2 events.
146 */
147 static Status
148 DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire)
149 {
150 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
151
152 XextCheckExtension(dpy, info, dri2ExtensionName, False);
153
154 switch (event->type) {
155 default:
156 /* client doesn't support server event */
157 break;
158 }
159
160 return Success;
161 }
162
163 Bool
164 DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
165 {
166 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
167
168 if (XextHasExtension(info)) {
169 *eventBase = info->codes->first_event;
170 *errorBase = info->codes->first_error;
171 return True;
172 }
173
174 return False;
175 }
176
177 Bool
178 DRI2QueryVersion(Display * dpy, int *major, int *minor)
179 {
180 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
181 xDRI2QueryVersionReply rep;
182 xDRI2QueryVersionReq *req;
183 int i, nevents;
184
185 XextCheckExtension(dpy, info, dri2ExtensionName, False);
186
187 LockDisplay(dpy);
188 GetReq(DRI2QueryVersion, req);
189 req->reqType = info->codes->major_opcode;
190 req->dri2ReqType = X_DRI2QueryVersion;
191 req->majorVersion = DRI2_MAJOR;
192 req->minorVersion = DRI2_MINOR;
193 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
194 UnlockDisplay(dpy);
195 SyncHandle();
196 return False;
197 }
198 *major = rep.majorVersion;
199 *minor = rep.minorVersion;
200 UnlockDisplay(dpy);
201 SyncHandle();
202
203 switch (rep.minorVersion) {
204 case 1:
205 nevents = 0;
206 break;
207 case 2:
208 nevents = 1;
209 break;
210 case 3:
211 default:
212 nevents = 2;
213 break;
214 }
215
216 for (i = 0; i < nevents; i++) {
217 XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent);
218 XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire);
219 }
220
221 return True;
222 }
223
224 Bool
225 DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
226 {
227 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
228 xDRI2ConnectReply rep;
229 xDRI2ConnectReq *req;
230
231 XextCheckExtension(dpy, info, dri2ExtensionName, False);
232
233 LockDisplay(dpy);
234 GetReq(DRI2Connect, req);
235 req->reqType = info->codes->major_opcode;
236 req->dri2ReqType = X_DRI2Connect;
237 req->window = window;
238 req->driverType = DRI2DriverDRI;
239 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
240 UnlockDisplay(dpy);
241 SyncHandle();
242 return False;
243 }
244
245 if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
246 UnlockDisplay(dpy);
247 SyncHandle();
248 return False;
249 }
250
251 *driverName = Xmalloc(rep.driverNameLength + 1);
252 if (*driverName == NULL) {
253 _XEatData(dpy,
254 ((rep.driverNameLength + 3) & ~3) +
255 ((rep.deviceNameLength + 3) & ~3));
256 UnlockDisplay(dpy);
257 SyncHandle();
258 return False;
259 }
260 _XReadPad(dpy, *driverName, rep.driverNameLength);
261 (*driverName)[rep.driverNameLength] = '\0';
262
263 *deviceName = Xmalloc(rep.deviceNameLength + 1);
264 if (*deviceName == NULL) {
265 Xfree(*driverName);
266 _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
267 UnlockDisplay(dpy);
268 SyncHandle();
269 return False;
270 }
271 _XReadPad(dpy, *deviceName, rep.deviceNameLength);
272 (*deviceName)[rep.deviceNameLength] = '\0';
273
274 UnlockDisplay(dpy);
275 SyncHandle();
276
277 return True;
278 }
279
280 Bool
281 DRI2Authenticate(Display * dpy, XID window, drm_magic_t magic)
282 {
283 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
284 xDRI2AuthenticateReq *req;
285 xDRI2AuthenticateReply rep;
286
287 XextCheckExtension(dpy, info, dri2ExtensionName, False);
288
289 LockDisplay(dpy);
290 GetReq(DRI2Authenticate, req);
291 req->reqType = info->codes->major_opcode;
292 req->dri2ReqType = X_DRI2Authenticate;
293 req->window = window;
294 req->magic = magic;
295
296 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
297 UnlockDisplay(dpy);
298 SyncHandle();
299 return False;
300 }
301
302 UnlockDisplay(dpy);
303 SyncHandle();
304
305 return rep.authenticated;
306 }
307
308 void
309 DRI2CreateDrawable(Display * dpy, XID drawable)
310 {
311 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
312 xDRI2CreateDrawableReq *req;
313
314 XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
315
316 LockDisplay(dpy);
317 GetReq(DRI2CreateDrawable, req);
318 req->reqType = info->codes->major_opcode;
319 req->dri2ReqType = X_DRI2CreateDrawable;
320 req->drawable = drawable;
321 UnlockDisplay(dpy);
322 SyncHandle();
323 }
324
325 void
326 DRI2DestroyDrawable(Display * dpy, XID drawable)
327 {
328 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
329 xDRI2DestroyDrawableReq *req;
330
331 XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
332
333 XSync(dpy, False);
334
335 LockDisplay(dpy);
336 GetReq(DRI2DestroyDrawable, req);
337 req->reqType = info->codes->major_opcode;
338 req->dri2ReqType = X_DRI2DestroyDrawable;
339 req->drawable = drawable;
340 UnlockDisplay(dpy);
341 SyncHandle();
342 }
343
344 DRI2Buffer *
345 DRI2GetBuffers(Display * dpy, XID drawable,
346 int *width, int *height,
347 unsigned int *attachments, int count, int *outCount)
348 {
349 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
350 xDRI2GetBuffersReply rep;
351 xDRI2GetBuffersReq *req;
352 DRI2Buffer *buffers;
353 xDRI2Buffer repBuffer;
354 CARD32 *p;
355 int i;
356
357 XextCheckExtension(dpy, info, dri2ExtensionName, False);
358
359 LockDisplay(dpy);
360 GetReqExtra(DRI2GetBuffers, count * 4, req);
361 req->reqType = info->codes->major_opcode;
362 req->dri2ReqType = X_DRI2GetBuffers;
363 req->drawable = drawable;
364 req->count = count;
365 p = (CARD32 *) & req[1];
366 for (i = 0; i < count; i++)
367 p[i] = attachments[i];
368
369 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
370 UnlockDisplay(dpy);
371 SyncHandle();
372 return NULL;
373 }
374
375 *width = rep.width;
376 *height = rep.height;
377 *outCount = rep.count;
378
379 buffers = Xmalloc(rep.count * sizeof buffers[0]);
380 if (buffers == NULL) {
381 _XEatData(dpy, rep.count * sizeof repBuffer);
382 UnlockDisplay(dpy);
383 SyncHandle();
384 return NULL;
385 }
386
387 for (i = 0; i < rep.count; i++) {
388 _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
389 buffers[i].attachment = repBuffer.attachment;
390 buffers[i].name = repBuffer.name;
391 buffers[i].pitch = repBuffer.pitch;
392 buffers[i].cpp = repBuffer.cpp;
393 buffers[i].flags = repBuffer.flags;
394 }
395
396 UnlockDisplay(dpy);
397 SyncHandle();
398
399 return buffers;
400 }
401
402
403 DRI2Buffer *
404 DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
405 int *width, int *height,
406 unsigned int *attachments, int count, int *outCount)
407 {
408 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
409 xDRI2GetBuffersReply rep;
410 xDRI2GetBuffersReq *req;
411 DRI2Buffer *buffers;
412 xDRI2Buffer repBuffer;
413 CARD32 *p;
414 int i;
415
416 XextCheckExtension(dpy, info, dri2ExtensionName, False);
417
418 LockDisplay(dpy);
419 GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
420 req->reqType = info->codes->major_opcode;
421 req->dri2ReqType = X_DRI2GetBuffersWithFormat;
422 req->drawable = drawable;
423 req->count = count;
424 p = (CARD32 *) & req[1];
425 for (i = 0; i < (count * 2); i++)
426 p[i] = attachments[i];
427
428 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
429 UnlockDisplay(dpy);
430 SyncHandle();
431 return NULL;
432 }
433
434 *width = rep.width;
435 *height = rep.height;
436 *outCount = rep.count;
437
438 buffers = Xmalloc(rep.count * sizeof buffers[0]);
439 if (buffers == NULL) {
440 _XEatData(dpy, rep.count * sizeof repBuffer);
441 UnlockDisplay(dpy);
442 SyncHandle();
443 return NULL;
444 }
445
446 for (i = 0; i < rep.count; i++) {
447 _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
448 buffers[i].attachment = repBuffer.attachment;
449 buffers[i].name = repBuffer.name;
450 buffers[i].pitch = repBuffer.pitch;
451 buffers[i].cpp = repBuffer.cpp;
452 buffers[i].flags = repBuffer.flags;
453 }
454
455 UnlockDisplay(dpy);
456 SyncHandle();
457
458 return buffers;
459 }
460
461
462 void
463 DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
464 CARD32 dest, CARD32 src)
465 {
466 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
467 xDRI2CopyRegionReq *req;
468 xDRI2CopyRegionReply rep;
469
470 XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
471
472 LockDisplay(dpy);
473 GetReq(DRI2CopyRegion, req);
474 req->reqType = info->codes->major_opcode;
475 req->dri2ReqType = X_DRI2CopyRegion;
476 req->drawable = drawable;
477 req->region = region;
478 req->dest = dest;
479 req->src = src;
480
481 _XReply(dpy, (xReply *) & rep, 0, xFalse);
482
483 UnlockDisplay(dpy);
484 SyncHandle();
485 }
486
487 #ifdef X_DRI2SwapBuffers
488 static void
489 load_swap_req(xDRI2SwapBuffersReq *req, CARD64 target, CARD64 divisor,
490 CARD64 remainder)
491 {
492 req->target_msc_hi = target >> 32;
493 req->target_msc_lo = target & 0xffffffff;
494 req->divisor_hi = divisor >> 32;
495 req->divisor_lo = divisor & 0xffffffff;
496 req->remainder_hi = remainder >> 32;
497 req->remainder_lo = remainder & 0xffffffff;
498 }
499
500 static CARD64
501 vals_to_card64(CARD32 lo, CARD32 hi)
502 {
503 return (CARD64)hi << 32 | lo;
504 }
505
506 void DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
507 CARD64 divisor, CARD64 remainder, CARD64 *count)
508 {
509 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
510 xDRI2SwapBuffersReq *req;
511 xDRI2SwapBuffersReply rep;
512
513 XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
514
515 LockDisplay(dpy);
516 GetReq(DRI2SwapBuffers, req);
517 req->reqType = info->codes->major_opcode;
518 req->dri2ReqType = X_DRI2SwapBuffers;
519 req->drawable = drawable;
520 load_swap_req(req, target_msc, divisor, remainder);
521
522 _XReply(dpy, (xReply *)&rep, 0, xFalse);
523
524 *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
525
526 UnlockDisplay(dpy);
527 SyncHandle();
528 }
529 #endif
530
531 #ifdef X_DRI2GetMSC
532 Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc,
533 CARD64 *sbc)
534 {
535 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
536 xDRI2GetMSCReq *req;
537 xDRI2MSCReply rep;
538
539 XextCheckExtension (dpy, info, dri2ExtensionName, False);
540
541 LockDisplay(dpy);
542 GetReq(DRI2GetMSC, req);
543 req->reqType = info->codes->major_opcode;
544 req->dri2ReqType = X_DRI2GetMSC;
545 req->drawable = drawable;
546
547 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
548 UnlockDisplay(dpy);
549 SyncHandle();
550 return False;
551 }
552
553 *ust = vals_to_card64(rep.ust_lo, rep.ust_hi);
554 *msc = vals_to_card64(rep.msc_lo, rep.msc_hi);
555 *sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi);
556
557 UnlockDisplay(dpy);
558 SyncHandle();
559
560 return True;
561 }
562 #endif
563
564 #ifdef X_DRI2WaitMSC
565 static void
566 load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor,
567 CARD64 remainder)
568 {
569 req->target_msc_hi = target >> 32;
570 req->target_msc_lo = target & 0xffffffff;
571 req->divisor_hi = divisor >> 32;
572 req->divisor_lo = divisor & 0xffffffff;
573 req->remainder_hi = remainder >> 32;
574 req->remainder_lo = remainder & 0xffffffff;
575 }
576
577 Bool DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
578 CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
579 {
580 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
581 xDRI2WaitMSCReq *req;
582 xDRI2MSCReply rep;
583
584 XextCheckExtension (dpy, info, dri2ExtensionName, False);
585
586 LockDisplay(dpy);
587 GetReq(DRI2WaitMSC, req);
588 req->reqType = info->codes->major_opcode;
589 req->dri2ReqType = X_DRI2WaitMSC;
590 req->drawable = drawable;
591 load_msc_req(req, target_msc, divisor, remainder);
592
593 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
594 UnlockDisplay(dpy);
595 SyncHandle();
596 return False;
597 }
598
599 *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo;
600 *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo;
601 *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo;
602
603 UnlockDisplay(dpy);
604 SyncHandle();
605
606 return True;
607 }
608 #endif
609
610 #ifdef X_DRI2WaitSBC
611 static void
612 load_sbc_req(xDRI2WaitSBCReq *req, CARD64 target)
613 {
614 req->target_sbc_hi = target >> 32;
615 req->target_sbc_lo = target & 0xffffffff;
616 }
617
618 Bool DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
619 CARD64 *msc, CARD64 *sbc)
620 {
621 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
622 xDRI2WaitSBCReq *req;
623 xDRI2MSCReply rep;
624
625 XextCheckExtension (dpy, info, dri2ExtensionName, False);
626
627 LockDisplay(dpy);
628 GetReq(DRI2WaitSBC, req);
629 req->reqType = info->codes->major_opcode;
630 req->dri2ReqType = X_DRI2WaitSBC;
631 req->drawable = drawable;
632 load_sbc_req(req, target_sbc);
633
634 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
635 UnlockDisplay(dpy);
636 SyncHandle();
637 return False;
638 }
639
640 *ust = ((CARD64)rep.ust_hi << 32) | rep.ust_lo;
641 *msc = ((CARD64)rep.msc_hi << 32) | rep.msc_lo;
642 *sbc = ((CARD64)rep.sbc_hi << 32) | rep.sbc_lo;
643
644 UnlockDisplay(dpy);
645 SyncHandle();
646
647 return True;
648 }
649 #endif
650
651 #ifdef X_DRI2SwapInterval
652 void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
653 {
654 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
655 xDRI2SwapIntervalReq *req;
656
657 XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
658
659 LockDisplay(dpy);
660 GetReq(DRI2SwapInterval, req);
661 req->reqType = info->codes->major_opcode;
662 req->dri2ReqType = X_DRI2SwapInterval;
663 req->drawable = drawable;
664 req->interval = interval;
665 UnlockDisplay(dpy);
666 SyncHandle();
667 }
668 #endif
669
670 #endif /* GLX_DIRECT_RENDERING */