dri: Reuse dri_message to implement our other message handlers.
[mesa.git] / src / glx / dri_common.c
1 /*
2 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright © 2008 Red Hat, Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Soft-
7 * ware"), to deal in the Software without restriction, including without
8 * limitation the rights to use, copy, modify, merge, publish, distribute,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, provided that the above copyright
11 * notice(s) and this permission notice appear in all copies of the Soft-
12 * ware and that both the above copyright notice(s) and this permission
13 * notice appear in supporting documentation.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17 * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
18 * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
19 * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
20 * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
23 * MANCE OF THIS SOFTWARE.
24 *
25 * Except as contained in this notice, the name of a copyright holder shall
26 * not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization of
28 * the copyright holder.
29 *
30 * Authors:
31 * Kevin E. Martin <kevin@precisioninsight.com>
32 * Brian Paul <brian@precisioninsight.com>
33 * Kristian Høgsberg (krh@redhat.com)
34 */
35
36 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
37
38 #include <unistd.h>
39 #include <dlfcn.h>
40 #include <stdarg.h>
41 #include "glxclient.h"
42 #include "dri_common.h"
43 #include "loader.h"
44
45 #ifndef RTLD_NOW
46 #define RTLD_NOW 0
47 #endif
48 #ifndef RTLD_GLOBAL
49 #define RTLD_GLOBAL 0
50 #endif
51
52 _X_HIDDEN void
53 dri_message(int level, const char *f, ...)
54 {
55 va_list args;
56 int threshold = _LOADER_WARNING;
57 const char *libgl_debug;
58
59 libgl_debug = getenv("LIBGL_DEBUG");
60 if (libgl_debug) {
61 if (strstr(libgl_debug, "quiet"))
62 threshold = _LOADER_FATAL;
63 else if (strstr(libgl_debug, "verbose"))
64 threshold = _LOADER_DEBUG;
65 }
66
67 /* Note that the _LOADER_* levels are lower numbers for more severe. */
68 if (level <= threshold) {
69 fprintf(stderr, "libGL%s: ", level <= _LOADER_WARNING ? " error" : "");
70 va_start(args, f);
71 vfprintf(stderr, f, args);
72 va_end(args);
73 }
74 }
75
76 #ifndef DEFAULT_DRIVER_DIR
77 /* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
78 #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
79 #endif
80
81 /**
82 * Try to \c dlopen the named driver.
83 *
84 * This function adds the "_dri.so" suffix to the driver name and searches the
85 * directories specified by the \c LIBGL_DRIVERS_PATH environment variable in
86 * order to find the driver.
87 *
88 * \param driverName - a name like "i965", "radeon", "nouveau", etc.
89 *
90 * \returns
91 * A handle from \c dlopen, or \c NULL if driver file not found.
92 */
93 _X_HIDDEN void *
94 driOpenDriver(const char *driverName)
95 {
96 void *glhandle, *handle;
97 const char *libPaths, *p, *next;
98 char realDriverName[200];
99 int len;
100
101 /* Attempt to make sure libGL symbols will be visible to the driver */
102 glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
103
104 libPaths = NULL;
105 if (geteuid() == getuid()) {
106 /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
107 libPaths = getenv("LIBGL_DRIVERS_PATH");
108 if (!libPaths)
109 libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */
110 }
111 if (libPaths == NULL)
112 libPaths = DEFAULT_DRIVER_DIR;
113
114 handle = NULL;
115 for (p = libPaths; *p; p = next) {
116 next = strchr(p, ':');
117 if (next == NULL) {
118 len = strlen(p);
119 next = p + len;
120 }
121 else {
122 len = next - p;
123 next++;
124 }
125
126 #ifdef GLX_USE_TLS
127 snprintf(realDriverName, sizeof realDriverName,
128 "%.*s/tls/%s_dri.so", len, p, driverName);
129 InfoMessageF("OpenDriver: trying %s\n", realDriverName);
130 handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
131 #endif
132
133 if (handle == NULL) {
134 snprintf(realDriverName, sizeof realDriverName,
135 "%.*s/%s_dri.so", len, p, driverName);
136 InfoMessageF("OpenDriver: trying %s\n", realDriverName);
137 handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
138 }
139
140 if (handle != NULL)
141 break;
142 else
143 ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
144 }
145
146 if (!handle)
147 ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
148
149 if (glhandle)
150 dlclose(glhandle);
151
152 return handle;
153 }
154
155 _X_HIDDEN const __DRIextension **
156 driGetDriverExtensions(void *handle, const char *driver_name)
157 {
158 const __DRIextension **extensions = NULL;
159 const __DRIextension **(*get_extensions)(void);
160 char *get_extensions_name;
161
162 if (asprintf(&get_extensions_name, "%s_%s",
163 __DRI_DRIVER_GET_EXTENSIONS, driver_name) != -1) {
164 get_extensions = dlsym(handle, get_extensions_name);
165 if (get_extensions) {
166 free(get_extensions_name);
167 return get_extensions();
168 } else {
169 InfoMessageF("driver does not expose %s(): %s\n",
170 get_extensions_name, dlerror());
171 free(get_extensions_name);
172 }
173 }
174
175 extensions = dlsym(handle, __DRI_DRIVER_EXTENSIONS);
176 if (extensions == NULL) {
177 ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
178 return NULL;
179 }
180
181 return extensions;
182 }
183
184 static GLboolean
185 __driGetMSCRate(__DRIdrawable *draw,
186 int32_t * numerator, int32_t * denominator,
187 void *loaderPrivate)
188 {
189 __GLXDRIdrawable *glxDraw = loaderPrivate;
190
191 return __glxGetMscRate(glxDraw->psc, numerator, denominator);
192 }
193
194 _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
195 {__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
196 __glXGetUST,
197 __driGetMSCRate
198 };
199
200 #define __ATTRIB(attrib, field) \
201 { attrib, offsetof(struct glx_config, field) }
202
203 static const struct
204 {
205 unsigned int attrib, offset;
206 } attribMap[] = {
207 __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
208 __ATTRIB(__DRI_ATTRIB_LEVEL, level),
209 __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
210 __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
211 __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
212 __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
213 __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
214 __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
215 __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
216 __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
217 __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
218 __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
219 __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
220 __ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
221 __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
222 __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
223 __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
224 #if 0
225 __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
226 __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
227 __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
228 __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
229 __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
230 __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
231 __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
232 __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
233 __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
234 __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
235 #endif
236 __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
237 __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
238 __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
239 __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
240 __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
241 #if 0
242 __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
243 #endif
244 __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
245 __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
246 __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,
247 bindToMipmapTexture),
248 __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
249 __ATTRIB(__DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE, sRGBCapable)
250 };
251
252 static int
253 scalarEqual(struct glx_config *mode, unsigned int attrib, unsigned int value)
254 {
255 unsigned int glxValue;
256 int i;
257
258 for (i = 0; i < ARRAY_SIZE(attribMap); i++)
259 if (attribMap[i].attrib == attrib) {
260 glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
261 return glxValue == GLX_DONT_CARE || glxValue == value;
262 }
263
264 return GL_TRUE; /* Is a non-existing attribute equal to value? */
265 }
266
267 static int
268 driConfigEqual(const __DRIcoreExtension *core,
269 struct glx_config *config, const __DRIconfig *driConfig)
270 {
271 unsigned int attrib, value, glxValue;
272 int i;
273
274 i = 0;
275 while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
276 switch (attrib) {
277 case __DRI_ATTRIB_RENDER_TYPE:
278 glxValue = 0;
279 if (value & __DRI_ATTRIB_RGBA_BIT) {
280 glxValue |= GLX_RGBA_BIT;
281 }
282 if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
283 glxValue |= GLX_COLOR_INDEX_BIT;
284 }
285 if (value & __DRI_ATTRIB_FLOAT_BIT) {
286 glxValue |= GLX_RGBA_FLOAT_BIT_ARB;
287 }
288 if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT) {
289 glxValue |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT;
290 }
291 if (glxValue != config->renderType)
292 return GL_FALSE;
293 break;
294
295 case __DRI_ATTRIB_CONFIG_CAVEAT:
296 if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
297 glxValue = GLX_NON_CONFORMANT_CONFIG;
298 else if (value & __DRI_ATTRIB_SLOW_BIT)
299 glxValue = GLX_SLOW_CONFIG;
300 else
301 glxValue = GLX_NONE;
302 if (glxValue != config->visualRating)
303 return GL_FALSE;
304 break;
305
306 case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
307 glxValue = 0;
308 if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
309 glxValue |= GLX_TEXTURE_1D_BIT_EXT;
310 if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
311 glxValue |= GLX_TEXTURE_2D_BIT_EXT;
312 if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
313 glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
314 if (config->bindToTextureTargets != GLX_DONT_CARE &&
315 glxValue != config->bindToTextureTargets)
316 return GL_FALSE;
317 break;
318
319 default:
320 if (!scalarEqual(config, attrib, value))
321 return GL_FALSE;
322 }
323 }
324
325 return GL_TRUE;
326 }
327
328 static struct glx_config *
329 createDriMode(const __DRIcoreExtension * core,
330 struct glx_config *config, const __DRIconfig **driConfigs)
331 {
332 __GLXDRIconfigPrivate *driConfig;
333 int i;
334
335 for (i = 0; driConfigs[i]; i++) {
336 if (driConfigEqual(core, config, driConfigs[i]))
337 break;
338 }
339
340 if (driConfigs[i] == NULL)
341 return NULL;
342
343 driConfig = malloc(sizeof *driConfig);
344 if (driConfig == NULL)
345 return NULL;
346
347 driConfig->base = *config;
348 driConfig->driConfig = driConfigs[i];
349
350 return &driConfig->base;
351 }
352
353 _X_HIDDEN struct glx_config *
354 driConvertConfigs(const __DRIcoreExtension * core,
355 struct glx_config *configs, const __DRIconfig **driConfigs)
356 {
357 struct glx_config head, *tail, *m;
358
359 tail = &head;
360 head.next = NULL;
361 for (m = configs; m; m = m->next) {
362 tail->next = createDriMode(core, m, driConfigs);
363 if (tail->next == NULL) {
364 /* no matching dri config for m */
365 continue;
366 }
367
368
369 tail = tail->next;
370 }
371
372 return head.next;
373 }
374
375 _X_HIDDEN void
376 driDestroyConfigs(const __DRIconfig **configs)
377 {
378 int i;
379
380 for (i = 0; configs[i]; i++)
381 free((__DRIconfig *) configs[i]);
382 free(configs);
383 }
384
385 _X_HIDDEN __GLXDRIdrawable *
386 driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
387 {
388 struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
389 __GLXDRIdrawable *pdraw;
390 struct glx_screen *psc;
391
392 if (priv == NULL)
393 return NULL;
394
395 psc = priv->screens[gc->screen];
396 if (priv->drawHash == NULL)
397 return NULL;
398
399 if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0) {
400 pdraw->refcount ++;
401 return pdraw;
402 }
403
404 pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
405 glxDrawable, gc->config);
406
407 if (pdraw == NULL) {
408 ErrorMessageF("failed to create drawable\n");
409 return NULL;
410 }
411
412 if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) {
413 (*pdraw->destroyDrawable) (pdraw);
414 return NULL;
415 }
416 pdraw->refcount = 1;
417
418 return pdraw;
419 }
420
421 _X_HIDDEN void
422 driReleaseDrawables(struct glx_context *gc)
423 {
424 const struct glx_display *priv = gc->psc->display;
425 __GLXDRIdrawable *pdraw;
426
427 if (priv == NULL)
428 return;
429
430 if (__glxHashLookup(priv->drawHash,
431 gc->currentDrawable, (void *) &pdraw) == 0) {
432 if (pdraw->drawable == pdraw->xDrawable) {
433 pdraw->refcount --;
434 if (pdraw->refcount == 0) {
435 (*pdraw->destroyDrawable)(pdraw);
436 __glxHashDelete(priv->drawHash, gc->currentDrawable);
437 }
438 }
439 }
440
441 if (__glxHashLookup(priv->drawHash,
442 gc->currentReadable, (void *) &pdraw) == 0) {
443 if (pdraw->drawable == pdraw->xDrawable) {
444 pdraw->refcount --;
445 if (pdraw->refcount == 0) {
446 (*pdraw->destroyDrawable)(pdraw);
447 __glxHashDelete(priv->drawHash, gc->currentReadable);
448 }
449 }
450 }
451
452 gc->currentDrawable = None;
453 gc->currentReadable = None;
454
455 }
456
457 _X_HIDDEN bool
458 dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
459 unsigned *major_ver, unsigned *minor_ver,
460 uint32_t *render_type, uint32_t *flags, unsigned *api,
461 int *reset, unsigned *error)
462 {
463 unsigned i;
464 bool got_profile = false;
465 uint32_t profile;
466
467 *major_ver = 1;
468 *minor_ver = 0;
469 *render_type = GLX_RGBA_TYPE;
470 *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
471 *flags = 0;
472 *api = __DRI_API_OPENGL;
473
474 if (num_attribs == 0) {
475 return true;
476 }
477
478 /* This is actually an internal error, but what the heck.
479 */
480 if (attribs == NULL) {
481 *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
482 return false;
483 }
484
485 for (i = 0; i < num_attribs; i++) {
486 switch (attribs[i * 2]) {
487 case GLX_CONTEXT_MAJOR_VERSION_ARB:
488 *major_ver = attribs[i * 2 + 1];
489 break;
490 case GLX_CONTEXT_MINOR_VERSION_ARB:
491 *minor_ver = attribs[i * 2 + 1];
492 break;
493 case GLX_CONTEXT_FLAGS_ARB:
494 *flags = attribs[i * 2 + 1];
495 break;
496 case GLX_CONTEXT_PROFILE_MASK_ARB:
497 profile = attribs[i * 2 + 1];
498 got_profile = true;
499 break;
500 case GLX_RENDER_TYPE:
501 *render_type = attribs[i * 2 + 1];
502 break;
503 case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
504 switch (attribs[i * 2 + 1]) {
505 case GLX_NO_RESET_NOTIFICATION_ARB:
506 *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
507 break;
508 case GLX_LOSE_CONTEXT_ON_RESET_ARB:
509 *reset = __DRI_CTX_RESET_LOSE_CONTEXT;
510 break;
511 default:
512 *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
513 return false;
514 }
515 break;
516 default:
517 /* If an unknown attribute is received, fail.
518 */
519 *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
520 return false;
521 }
522 }
523
524 if (!got_profile) {
525 if (*major_ver > 3 || (*major_ver == 3 && *minor_ver >= 2))
526 *api = __DRI_API_OPENGL_CORE;
527 } else {
528 switch (profile) {
529 case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
530 /* There are no profiles before OpenGL 3.2. The
531 * GLX_ARB_create_context_profile spec says:
532 *
533 * "If the requested OpenGL version is less than 3.2,
534 * GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality
535 * of the context is determined solely by the requested version."
536 */
537 *api = (*major_ver > 3 || (*major_ver == 3 && *minor_ver >= 2))
538 ? __DRI_API_OPENGL_CORE : __DRI_API_OPENGL;
539 break;
540 case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
541 *api = __DRI_API_OPENGL;
542 break;
543 case GLX_CONTEXT_ES2_PROFILE_BIT_EXT:
544 *api = __DRI_API_GLES2;
545 break;
546 default:
547 *error = __DRI_CTX_ERROR_BAD_API;
548 return false;
549 }
550 }
551
552 /* Unknown flag value.
553 */
554 if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE
555 | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)) {
556 *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
557 return false;
558 }
559
560 /* There are no forward-compatible contexts before OpenGL 3.0. The
561 * GLX_ARB_create_context spec says:
562 *
563 * "Forward-compatible contexts are defined only for OpenGL versions
564 * 3.0 and later."
565 */
566 if (*major_ver < 3 && (*flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) {
567 *error = __DRI_CTX_ERROR_BAD_FLAG;
568 return false;
569 }
570
571 if (*major_ver >= 3 && *render_type == GLX_COLOR_INDEX_TYPE) {
572 *error = __DRI_CTX_ERROR_BAD_FLAG;
573 return false;
574 }
575
576 /* The GLX_EXT_create_context_es2_profile spec says:
577 *
578 * "... If the version requested is 2.0, and the
579 * GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the
580 * GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context
581 * returned will implement OpenGL ES 2.0. This is the only way in which
582 * an implementation may request an OpenGL ES 2.0 context."
583 */
584 if (*api == __DRI_API_GLES2 && (*major_ver != 2 || *minor_ver != 0)) {
585 *error = __DRI_CTX_ERROR_BAD_API;
586 return false;
587 }
588
589 *error = __DRI_CTX_ERROR_SUCCESS;
590 return true;
591 }
592
593 #endif /* GLX_DIRECT_RENDERING */