Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pbinfo.c 2.1KB

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