1 2/* 3 * Print list of fbconfigs and test each to see if a pbuffer can be created 4 * for that config. 5 * 6 * Brian Paul 7 * April 1997 8 * Updated on 5 October 2002. 9 */ 10 11 12#include <X11/Xlib.h> 13#include <stdio.h> 14#include <string.h> 15#include "pbutil.h" 16 17 18 19 20static void 21PrintConfigs(Display *dpy, int screen, Bool horizFormat) 22{ 23 FBCONFIG *fbConfigs; 24 int nConfigs; 25 int i; 26 27 fbConfigs = GetAllFBConfigs(dpy, screen, &nConfigs); 28 if (!nConfigs || !fbConfigs) { 29 printf("Error: glxGetFBConfigs failed\n"); 30 XFree(fbConfigs); 31 return; 32 } 33 34 printf("Number of fbconfigs: %d\n", nConfigs); 35 36 if (horizFormat) { 37 printf(" ID VisualType Depth Lvl RGB CI DB Stereo R G B A"); 38 printf(" Z S AR AG AB AA MSbufs MSnum Pbuffer Float\n"); 39 } 40 41 /* Print config info */ 42 for (i = 0; i < nConfigs; i++) { 43 PrintFBConfigInfo(dpy, screen, fbConfigs[i], horizFormat); 44 } 45 46 /* free the list */ 47 XFree(fbConfigs); 48} 49 50 51 52static void 53PrintUsage(void) 54{ 55 printf("Options:\n"); 56 printf(" -display <display-name> specify X display name\n"); 57 printf(" -t print in tabular format\n"); 58 printf(" -v print in verbose format\n"); 59 printf(" -help print this information\n"); 60} 61 62 63int 64main(int argc, char *argv[]) 65{ 66 Display *dpy; 67 int scrn; 68 char *dpyName = NULL; 69 Bool horizFormat = True; 70 int i; 71 72 for (i=1; i<argc; i++) { 73 if (strcmp(argv[i],"-display")==0) { 74 if (i+1<argc) { 75 dpyName = argv[i+1]; 76 i++; 77 } 78 } 79 else if (strcmp(argv[i],"-t")==0) { 80 /* tabular format */ 81 horizFormat = True; 82 } 83 else if (strcmp(argv[i],"-v")==0) { 84 /* verbose format */ 85 horizFormat = False; 86 } 87 else if (strcmp(argv[i],"-help")==0) { 88 PrintUsage(); 89 return 0; 90 } 91 else { 92 printf("Unknown option: %s\n", argv[i]); 93 } 94 } 95 96 dpy = XOpenDisplay(dpyName); 97 98 if (!dpy) { 99 printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); 100 return 1; 101 } 102 103 scrn = DefaultScreen(dpy); 104 PrintConfigs(dpy, scrn, horizFormat); 105 XCloseDisplay(dpy); 106 return 0; 107} 108