1 /* $Id: glxinfo.c,v 1.18 2002/09/06 03:47:34 brianp Exp $ */
4 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * This program is a work-alike of the IRIX glxinfo program.
27 * Command line options:
29 * -v print verbose information
30 * -display DisplayName specify the X display to interogate
31 * -b only print ID of "best" visual on screen 0
32 * -i use indirect rendering connection only
33 * -l print interesting OpenGL limits (added 5 Sep 2002)
35 * Brian Paul 26 January 2000
38 #define DO_GLU /* may want to remove this for easier XFree86 building? */
41 #include <X11/Xutil.h>
53 #define GLX_NONE_EXT 0x8000
67 /* X visual attribs */
71 int redMask
, greenMask
, blueMask
;
75 /* GL visual attribs */
84 int redSize
, greenSize
, blueSize
, alphaSize
;
87 int accumRedSize
, accumGreenSize
, accumBlueSize
, accumAlphaSize
;
88 int numSamples
, numMultisample
;
94 * Print a list of extensions, with word-wrapping.
97 print_extension_list(const char *ext
)
99 const char *indentString
= " ";
100 const int indent
= 4;
108 printf(indentString
);
111 if (ext
[j
] == ' ' || ext
[j
] == 0) {
112 /* found end of an extension name */
113 const int len
= j
- i
;
114 if (width
+ len
> max
) {
115 /* start a new line */
118 printf(indentString
);
120 /* print the extension name between ext[i] and ext[j] */
122 printf("%c", ext
[i
]);
125 /* either we're all done, or we'll continue with next extension */
146 print_display_info(Display
*dpy
)
148 printf("name of display: %s\n", DisplayString(dpy
));
160 static const struct token_name limits
[] = {
161 { 1, GL_MAX_ATTRIB_STACK_DEPTH
, "GL_MAX_ATTRIB_STACK_DEPTH" },
162 { 1, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH
, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH" },
163 { 1, GL_MAX_CLIP_PLANES
, "GL_MAX_CLIP_PLANES" },
164 { 1, GL_MAX_COLOR_MATRIX_STACK_DEPTH
, "GL_MAX_COLOR_MATRIX_STACK_DEPTH" },
165 { 1, GL_MAX_CONVOLUTION_WIDTH_EXT
, "GL_MAX_CONVOLUTION_WIDTH_EXT" },
166 { 1, GL_MAX_CONVOLUTION_HEIGHT_EXT
, "GL_MAX_CONVOLUTION_HEIGHT_EXT" },
167 { 1, GL_MAX_ELEMENTS_VERTICES
, "GL_MAX_ELEMENTS_VERTICES" },
168 { 1, GL_MAX_ELEMENTS_INDICES
, "GL_MAX_ELEMENTS_INDICES" },
169 { 1, GL_MAX_EVAL_ORDER
, "GL_MAX_EVAL_ORDER" },
170 { 1, GL_MAX_LIGHTS
, "GL_MAX_LIGHTS" },
171 { 1, GL_MAX_LIST_NESTING
, "GL_MAX_LIST_NESTING" },
172 { 1, GL_MAX_MODELVIEW_STACK_DEPTH
, "GL_MAX_MODELVIEW_STACK_DEPTH" },
173 { 1, GL_MAX_NAME_STACK_DEPTH
, "GL_MAX_NAME_STACK_DEPTH" },
174 { 1, GL_MAX_PIXEL_MAP_TABLE
, "GL_MAX_PIXEL_MAP_TABLE" },
175 { 1, GL_MAX_PROJECTION_STACK_DEPTH
, "GL_MAX_PROJECTION_STACK_DEPTH" },
176 { 1, GL_MAX_TEXTURE_STACK_DEPTH
, "GL_MAX_TEXTURE_STACK_DEPTH" },
177 { 1, GL_MAX_TEXTURE_SIZE
, "GL_MAX_TEXTURE_SIZE" },
178 { 1, GL_MAX_3D_TEXTURE_SIZE
, "GL_MAX_3D_TEXTURE_SIZE" },
179 { 1, GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB
, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB" },
180 { 1, GL_MAX_RECTANGLE_TEXTURE_SIZE_NV
, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV" },
181 { 1, GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB
, "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB" },
182 { 1, GL_MAX_TEXTURE_UNITS_ARB
, "GL_MAX_TEXTURE_UNITS_ARB" },
183 { 1, GL_MAX_TEXTURE_LOD_BIAS_EXT
, "GL_MAX_TEXTURE_LOD_BIAS_EXT" },
184 { 1, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT" },
185 { 2, GL_MAX_VIEWPORT_DIMS
, "GL_MAX_VIEWPORT_DIMS" },
186 { 2, GL_ALIASED_LINE_WIDTH_RANGE
, "GL_ALIASED_LINE_WIDTH_RANGE" },
187 { 2, GL_SMOOTH_LINE_WIDTH_RANGE
, "GL_SMOOTH_LINE_WIDTH_RANGE" },
188 { 2, GL_ALIASED_POINT_SIZE_RANGE
, "GL_ALIASED_POINT_SIZE_RANGE" },
189 { 2, GL_SMOOTH_POINT_SIZE_RANGE
, "GL_SMOOTH_POINT_SIZE_RANGE" },
190 { 0, (GLenum
) 0, NULL
}
193 printf("OpenGL limits:\n");
194 for (i
= 0; limits
[i
].count
; i
++) {
195 glGetIntegerv(limits
[i
].token
, max
);
196 if (glGetError() == GL_NONE
) {
197 if (limits
[i
].count
== 1)
198 printf(" %s = %d\n", limits
[i
].name
, max
[0]);
199 else /* XXX fix if we ever query something with more than 2 values */
200 printf(" %s = %d, %d\n", limits
[i
].name
, max
[0], max
[1]);
207 print_screen_info(Display
*dpy
, int scrnum
, Bool allowDirect
, GLboolean limits
)
210 int attribSingle
[] = {
216 int attribDouble
[] = {
224 XSetWindowAttributes attr
;
228 XVisualInfo
*visinfo
;
229 int width
= 100, height
= 100;
231 root
= RootWindow(dpy
, scrnum
);
233 visinfo
= glXChooseVisual(dpy
, scrnum
, attribSingle
);
235 visinfo
= glXChooseVisual(dpy
, scrnum
, attribDouble
);
237 fprintf(stderr
, "Error: couldn't find RGB GLX visual\n");
242 attr
.background_pixel
= 0;
243 attr
.border_pixel
= 0;
244 attr
.colormap
= XCreateColormap(dpy
, root
, visinfo
->visual
, AllocNone
);
245 attr
.event_mask
= StructureNotifyMask
| ExposureMask
;
246 mask
= CWBackPixel
| CWBorderPixel
| CWColormap
| CWEventMask
;
247 win
= XCreateWindow(dpy
, root
, 0, 0, width
, height
,
248 0, visinfo
->depth
, InputOutput
,
249 visinfo
->visual
, mask
, &attr
);
251 ctx
= glXCreateContext( dpy
, visinfo
, NULL
, allowDirect
);
253 fprintf(stderr
, "Error: glXCreateContext failed\n");
254 XDestroyWindow(dpy
, win
);
258 if (glXMakeCurrent(dpy
, win
, ctx
)) {
259 const char *serverVendor
= glXQueryServerString(dpy
, scrnum
, GLX_VENDOR
);
260 const char *serverVersion
= glXQueryServerString(dpy
, scrnum
, GLX_VERSION
);
261 const char *serverExtensions
= glXQueryServerString(dpy
, scrnum
, GLX_EXTENSIONS
);
262 const char *clientVendor
= glXGetClientString(dpy
, GLX_VENDOR
);
263 const char *clientVersion
= glXGetClientString(dpy
, GLX_VERSION
);
264 const char *clientExtensions
= glXGetClientString(dpy
, GLX_EXTENSIONS
);
265 const char *glxExtensions
= glXQueryExtensionsString(dpy
, scrnum
);
266 const char *glVendor
= (const char *) glGetString(GL_VENDOR
);
267 const char *glRenderer
= (const char *) glGetString(GL_RENDERER
);
268 const char *glVersion
= (const char *) glGetString(GL_VERSION
);
269 const char *glExtensions
= (const char *) glGetString(GL_EXTENSIONS
);
270 char *displayName
= NULL
;
271 char *colon
= NULL
, *period
= NULL
;
273 const char *gluVersion
= (const char *) gluGetString(GLU_VERSION
);
274 const char *gluExtensions
= (const char *) gluGetString(GLU_EXTENSIONS
);
276 /* Strip the screen number from the display name, if present. */
277 if (!(displayName
= (char *) malloc(strlen(DisplayString(dpy
)) + 1))) {
278 fprintf(stderr
, "Error: malloc() failed\n");
281 strcpy(displayName
, DisplayString(dpy
));
282 colon
= strrchr(displayName
, ':');
284 period
= strchr(colon
, '.');
288 printf("display: %s screen: %d\n", displayName
, scrnum
);
290 printf("direct rendering: %s\n", glXIsDirect(dpy
, ctx
) ? "Yes" : "No");
291 printf("server glx vendor string: %s\n", serverVendor
);
292 printf("server glx version string: %s\n", serverVersion
);
293 printf("server glx extensions:\n");
294 print_extension_list(serverExtensions
);
295 printf("client glx vendor string: %s\n", clientVendor
);
296 printf("client glx version string: %s\n", clientVersion
);
297 printf("client glx extensions:\n");
298 print_extension_list(clientExtensions
);
299 printf("GLX extensions:\n");
300 print_extension_list(glxExtensions
);
301 printf("OpenGL vendor string: %s\n", glVendor
);
302 printf("OpenGL renderer string: %s\n", glRenderer
);
303 printf("OpenGL version string: %s\n", glVersion
);
304 printf("OpenGL extensions:\n");
305 print_extension_list(glExtensions
);
309 printf("glu version: %s\n", gluVersion
);
310 printf("glu extensions:\n");
311 print_extension_list(gluExtensions
);
315 fprintf(stderr
, "Error: glXMakeCurrent failed\n");
318 glXDestroyContext(dpy
, ctx
);
319 XDestroyWindow(dpy
, win
);
324 visual_class_name(int cls
)
328 return "StaticColor";
330 return "PseudoColor";
338 return "DirectColor";
346 visual_class_abbrev(int cls
)
368 get_visual_attribs(Display
*dpy
, XVisualInfo
*vInfo
,
369 struct visual_attribs
*attribs
)
371 const char *ext
= glXQueryExtensionsString(dpy
, vInfo
->screen
);
373 memset(attribs
, 0, sizeof(struct visual_attribs
));
375 attribs
->id
= vInfo
->visualid
;
376 #if defined(__cplusplus) || defined(c_plusplus)
377 attribs
->klass
= vInfo
->c_class
;
379 attribs
->klass
= vInfo
->class;
381 attribs
->depth
= vInfo
->depth
;
382 attribs
->redMask
= vInfo
->red_mask
;
383 attribs
->greenMask
= vInfo
->green_mask
;
384 attribs
->blueMask
= vInfo
->blue_mask
;
385 attribs
->colormapSize
= vInfo
->colormap_size
;
386 attribs
->bitsPerRGB
= vInfo
->bits_per_rgb
;
388 if (glXGetConfig(dpy
, vInfo
, GLX_USE_GL
, &attribs
->supportsGL
) != 0)
390 glXGetConfig(dpy
, vInfo
, GLX_BUFFER_SIZE
, &attribs
->bufferSize
);
391 glXGetConfig(dpy
, vInfo
, GLX_LEVEL
, &attribs
->level
);
392 glXGetConfig(dpy
, vInfo
, GLX_RGBA
, &attribs
->rgba
);
393 glXGetConfig(dpy
, vInfo
, GLX_DOUBLEBUFFER
, &attribs
->doubleBuffer
);
394 glXGetConfig(dpy
, vInfo
, GLX_STEREO
, &attribs
->stereo
);
395 glXGetConfig(dpy
, vInfo
, GLX_AUX_BUFFERS
, &attribs
->auxBuffers
);
396 glXGetConfig(dpy
, vInfo
, GLX_RED_SIZE
, &attribs
->redSize
);
397 glXGetConfig(dpy
, vInfo
, GLX_GREEN_SIZE
, &attribs
->greenSize
);
398 glXGetConfig(dpy
, vInfo
, GLX_BLUE_SIZE
, &attribs
->blueSize
);
399 glXGetConfig(dpy
, vInfo
, GLX_ALPHA_SIZE
, &attribs
->alphaSize
);
400 glXGetConfig(dpy
, vInfo
, GLX_DEPTH_SIZE
, &attribs
->depthSize
);
401 glXGetConfig(dpy
, vInfo
, GLX_STENCIL_SIZE
, &attribs
->stencilSize
);
402 glXGetConfig(dpy
, vInfo
, GLX_ACCUM_RED_SIZE
, &attribs
->accumRedSize
);
403 glXGetConfig(dpy
, vInfo
, GLX_ACCUM_GREEN_SIZE
, &attribs
->accumGreenSize
);
404 glXGetConfig(dpy
, vInfo
, GLX_ACCUM_BLUE_SIZE
, &attribs
->accumBlueSize
);
405 glXGetConfig(dpy
, vInfo
, GLX_ACCUM_ALPHA_SIZE
, &attribs
->accumAlphaSize
);
407 /* transparent pixel value not implemented yet */
408 attribs
->transparent
= 0;
410 /* multisample tests not implemented yet */
411 attribs
->numSamples
= 0;
412 attribs
->numMultisample
= 0;
414 #if defined(GLX_EXT_visual_rating)
415 if (ext
&& strstr(ext
, "GLX_EXT_visual_rating")) {
416 glXGetConfig(dpy
, vInfo
, GLX_VISUAL_CAVEAT_EXT
, &attribs
->visualCaveat
);
419 attribs
->visualCaveat
= GLX_NONE_EXT
;
422 attribs
->visualCaveat
= 0;
428 print_visual_attribs_verbose(const struct visual_attribs
*attribs
)
430 printf("Visual ID: %x depth=%d class=%s\n",
431 attribs
->id
, attribs
->depth
, visual_class_name(attribs
->klass
));
432 printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
433 attribs
->bufferSize
, attribs
->level
, attribs
->rgba
? "rgba" : "ci",
434 attribs
->doubleBuffer
, attribs
->stereo
);
435 printf(" rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n",
436 attribs
->redSize
, attribs
->greenSize
,
437 attribs
->blueSize
, attribs
->alphaSize
);
438 printf(" auxBuffers=%d depthSize=%d stencilSize=%d\n",
439 attribs
->auxBuffers
, attribs
->depthSize
, attribs
->stencilSize
);
440 printf(" accum: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n",
441 attribs
->accumRedSize
, attribs
->accumGreenSize
,
442 attribs
->accumBlueSize
, attribs
->accumAlphaSize
);
443 printf(" multiSample=%d multiSampleBuffers=%d\n",
444 attribs
->numSamples
, attribs
->numMultisample
);
445 #ifdef GLX_EXT_visual_rating
446 if (attribs
->visualCaveat
== GLX_NONE_EXT
|| attribs
->visualCaveat
== 0)
447 printf(" visualCaveat=None\n");
448 else if (attribs
->visualCaveat
== GLX_SLOW_VISUAL_EXT
)
449 printf(" visualCaveat=Slow\n");
450 else if (attribs
->visualCaveat
== GLX_NON_CONFORMANT_VISUAL_EXT
)
451 printf(" visualCaveat=Nonconformant\n");
453 printf(" %s\n", attribs
->transparent
? "Transparent." : "Opaque.");
458 print_visual_attribs_short_header(void)
460 printf(" visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav\n");
461 printf(" id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat\n");
462 printf("----------------------------------------------------------------------\n");
467 print_visual_attribs_short(const struct visual_attribs
*attribs
)
470 #ifdef GLX_EXT_visual_rating
471 if (attribs
->visualCaveat
== GLX_NONE_EXT
|| attribs
->visualCaveat
== 0)
473 else if (attribs
->visualCaveat
== GLX_SLOW_VISUAL_EXT
)
475 else if (attribs
->visualCaveat
== GLX_NON_CONFORMANT_VISUAL_EXT
)
483 printf("0x%2x %2d %2s %2d %2d %2d %1s %2s %2s %2d %2d %2d %2d %2d %2d %2d",
486 visual_class_abbrev(attribs
->klass
),
487 attribs
->transparent
,
490 attribs
->rgba
? "r" : "c",
491 attribs
->doubleBuffer
? "y" : ".",
492 attribs
->stereo
? "y" : ".",
493 attribs
->redSize
, attribs
->greenSize
,
494 attribs
->blueSize
, attribs
->alphaSize
,
500 printf(" %2d %2d %2d %2d %2d %1d %s\n",
501 attribs
->accumRedSize
, attribs
->accumGreenSize
,
502 attribs
->accumBlueSize
, attribs
->accumAlphaSize
,
503 attribs
->numSamples
, attribs
->numMultisample
,
510 print_visual_attribs_long_header(void)
512 printf("Vis Vis Visual Trans buff lev render DB ste r g b a aux dep ste accum buffers MS MS\n");
513 printf(" ID Depth Type parent size el type reo sz sz sz sz buf th ncl r g b a num bufs\n");
514 printf("----------------------------------------------------------------------------------------------------\n");
519 print_visual_attribs_long(const struct visual_attribs
*attribs
)
521 printf("0x%2x %2d %-11s %2d %2d %2d %4s %3d %3d %3d %3d %3d %3d",
524 visual_class_name(attribs
->klass
),
525 attribs
->transparent
,
528 attribs
->rgba
? "rgba" : "ci ",
529 attribs
->doubleBuffer
,
531 attribs
->redSize
, attribs
->greenSize
,
532 attribs
->blueSize
, attribs
->alphaSize
535 printf(" %3d %4d %2d %3d %3d %3d %3d %2d %2d\n",
538 attribs
->stencilSize
,
539 attribs
->accumRedSize
, attribs
->accumGreenSize
,
540 attribs
->accumBlueSize
, attribs
->accumAlphaSize
,
541 attribs
->numSamples
, attribs
->numMultisample
547 print_visual_info(Display
*dpy
, int scrnum
, InfoMode mode
)
549 XVisualInfo theTemplate
;
550 XVisualInfo
*visuals
;
555 /* get list of all visuals on this screen */
556 theTemplate
.screen
= scrnum
;
557 mask
= VisualScreenMask
;
558 visuals
= XGetVisualInfo(dpy
, mask
, &theTemplate
, &numVisuals
);
560 if (mode
== Verbose
) {
561 for (i
= 0; i
< numVisuals
; i
++) {
562 struct visual_attribs attribs
;
563 get_visual_attribs(dpy
, &visuals
[i
], &attribs
);
564 print_visual_attribs_verbose(&attribs
);
567 else if (mode
== Normal
) {
568 print_visual_attribs_short_header();
569 for (i
= 0; i
< numVisuals
; i
++) {
570 struct visual_attribs attribs
;
571 get_visual_attribs(dpy
, &visuals
[i
], &attribs
);
572 print_visual_attribs_short(&attribs
);
575 else if (mode
== Wide
) {
576 print_visual_attribs_long_header();
577 for (i
= 0; i
< numVisuals
; i
++) {
578 struct visual_attribs attribs
;
579 get_visual_attribs(dpy
, &visuals
[i
], &attribs
);
580 print_visual_attribs_long(&attribs
);
589 * Stand-alone Mesa doesn't really implement the GLX protocol so it
590 * doesn't really know the GLX attributes associated with an X visual.
591 * The first time a visual is presented to Mesa's pseudo-GLX it
592 * attaches ancilliary buffers to it (like depth and stencil).
593 * But that usually only works if glXChooseVisual is used.
594 * This function calls glXChooseVisual() to sort of "prime the pump"
595 * for Mesa's GLX so that the visuals that get reported actually
596 * reflect what applications will see.
597 * This has no effect when using true GLX.
600 mesa_hack(Display
*dpy
, int scrnum
)
602 static int attribs
[] = {
609 GLX_ACCUM_RED_SIZE
, 1,
610 GLX_ACCUM_GREEN_SIZE
, 1,
611 GLX_ACCUM_BLUE_SIZE
, 1,
612 GLX_ACCUM_ALPHA_SIZE
, 1,
616 XVisualInfo
*visinfo
;
618 visinfo
= glXChooseVisual(dpy
, scrnum
, attribs
);
625 * Examine all visuals to find the so-called best one.
626 * We prefer deepest RGBA buffer with depth, stencil and accum
627 * that has no caveats.
630 find_best_visual(Display
*dpy
, int scrnum
)
632 XVisualInfo theTemplate
;
633 XVisualInfo
*visuals
;
637 struct visual_attribs bestVis
;
639 /* get list of all visuals on this screen */
640 theTemplate
.screen
= scrnum
;
641 mask
= VisualScreenMask
;
642 visuals
= XGetVisualInfo(dpy
, mask
, &theTemplate
, &numVisuals
);
644 /* init bestVis with first visual info */
645 get_visual_attribs(dpy
, &visuals
[0], &bestVis
);
647 /* try to find a "better" visual */
648 for (i
= 1; i
< numVisuals
; i
++) {
649 struct visual_attribs vis
;
651 get_visual_attribs(dpy
, &visuals
[i
], &vis
);
653 /* always skip visuals with caveats */
654 if (vis
.visualCaveat
!= GLX_NONE_EXT
)
657 /* see if this vis is better than bestVis */
658 if ((!bestVis
.supportsGL
&& vis
.supportsGL
) ||
659 (bestVis
.visualCaveat
!= GLX_NONE_EXT
) ||
660 (!bestVis
.rgba
&& vis
.rgba
) ||
661 (!bestVis
.doubleBuffer
&& vis
.doubleBuffer
) ||
662 (bestVis
.redSize
< vis
.redSize
) ||
663 (bestVis
.greenSize
< vis
.greenSize
) ||
664 (bestVis
.blueSize
< vis
.blueSize
) ||
665 (bestVis
.alphaSize
< vis
.alphaSize
) ||
666 (bestVis
.depthSize
< vis
.depthSize
) ||
667 (bestVis
.stencilSize
< vis
.stencilSize
) ||
668 (bestVis
.accumRedSize
< vis
.accumRedSize
)) {
669 /* found a better visual */
683 printf("Usage: glxinfo [-v] [-t] [-h] [-i] [-b] [-display <dname>]\n");
684 printf("\t-v: Print visuals info in verbose form.\n");
685 printf("\t-t: Print verbose table.\n");
686 printf("\t-display <dname>: Print GLX visuals on specified server.\n");
687 printf("\t-h: This information.\n");
688 printf("\t-i: Force an indirect rendering context.\n");
689 printf("\t-b: Find the 'best' visual and print it's number.\n");
690 printf("\t-l: Print interesting OpenGLl imits.\n");
695 main(int argc
, char *argv
[])
697 char *displayName
= NULL
;
699 int numScreens
, scrnum
;
700 InfoMode mode
= Normal
;
701 GLboolean findBest
= GL_FALSE
;
702 GLboolean limits
= GL_FALSE
;
703 Bool allowDirect
= True
;
706 for (i
= 1; i
< argc
; i
++) {
707 if (strcmp(argv
[i
], "-display") == 0 && i
+ 1 < argc
) {
708 displayName
= argv
[i
+ 1];
711 else if (strcmp(argv
[i
], "-t") == 0) {
714 else if (strcmp(argv
[i
], "-v") == 0) {
717 else if (strcmp(argv
[i
], "-b") == 0) {
720 else if (strcmp(argv
[i
], "-i") == 0) {
723 else if (strcmp(argv
[i
], "-l") == 0) {
726 else if (strcmp(argv
[i
], "-h") == 0) {
731 printf("Unknown option `%s'\n", argv
[i
]);
737 dpy
= XOpenDisplay(displayName
);
739 fprintf(stderr
, "Error: unable to open display %s\n", displayName
);
746 b
= find_best_visual(dpy
, 0);
750 numScreens
= ScreenCount(dpy
);
751 print_display_info(dpy
);
752 for (scrnum
= 0; scrnum
< numScreens
; scrnum
++) {
753 mesa_hack(dpy
, scrnum
);
754 print_screen_info(dpy
, scrnum
, allowDirect
, limits
);
756 print_visual_info(dpy
, scrnum
, mode
);
757 if (scrnum
+ 1 < numScreens
)