From c6c2ef3e819434085ddaee19a3491f1b25844d7d Mon Sep 17 00:00:00 2001 From: Bryan Quigley Date: Wed, 13 May 2015 15:46:34 -0400 Subject: [PATCH] Adds -q quiet option to glxinfo. Just changes what is printed, not what is collected. --- src/xdemos/glinfo_common.c | 5 ++++- src/xdemos/glinfo_common.h | 3 ++- src/xdemos/glxinfo.c | 47 +++++++++++++++++++++++++++------------------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c index d3acc19..10d9aed 100644 --- a/src/xdemos/glinfo_common.c +++ b/src/xdemos/glinfo_common.c @@ -733,6 +733,7 @@ usage(void) printf("\t-display : Print GLX visuals on specified server.\n"); printf("\t-i: Force an indirect rendering context.\n"); #endif + printf("\t-q: quiet, print only the basics.\n"); printf("\t-v: Print visuals info in verbose form.\n"); printf("\t-t: Print verbose table.\n"); printf("\t-h: This information.\n"); @@ -741,7 +742,6 @@ usage(void) printf("\t-s: Print a single extension per line.\n"); } - void parse_args(int argc, char *argv[], struct options *options) { @@ -771,6 +771,9 @@ parse_args(int argc, char *argv[], struct options *options) else if (strcmp(argv[i], "-v") == 0) { options->mode = Verbose; } + else if (strcmp(argv[i], "-q") == 0) { + options->mode = Quiet; + } else if (strcmp(argv[i], "-b") == 0) { options->findBest = GL_TRUE; } diff --git a/src/xdemos/glinfo_common.h b/src/xdemos/glinfo_common.h index 0830c7f..f5b819a 100644 --- a/src/xdemos/glinfo_common.h +++ b/src/xdemos/glinfo_common.h @@ -67,7 +67,8 @@ typedef enum { Normal, Wide, - Verbose + Verbose, + Quiet } InfoMode; diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c index c3e4ca3..9d2fe4c 100644 --- a/src/xdemos/glxinfo.c +++ b/src/xdemos/glxinfo.c @@ -26,6 +26,7 @@ * -t print wide table * -v print verbose information * -display DisplayName specify the X display to interogate + * -q quiet, print only the basics * -b only print ID of "best" visual on screen 0 * -i use indirect rendering connection only * -l print interesting OpenGL limits (added 5 Sep 2002) @@ -392,7 +393,7 @@ query_renderer(void) static Bool print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool coreProfile, Bool es2Profile, Bool limits, - Bool singleLine, Bool coreWorked) + Bool singleLine, Bool coreWorked, InfoMode mode) { Window win; XSetWindowAttributes attr; @@ -529,17 +530,19 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, "LIBGL_DEBUG=verbose)\n"); } } - printf("server glx vendor string: %s\n", serverVendor); - printf("server glx version string: %s\n", serverVersion); - printf("server glx extensions:\n"); - print_extension_list(serverExtensions, singleLine); - printf("client glx vendor string: %s\n", clientVendor); - printf("client glx version string: %s\n", clientVersion); - printf("client glx extensions:\n"); - print_extension_list(clientExtensions, singleLine); - printf("GLX version: %u.%u\n", glxVersionMajor, glxVersionMinor); - printf("GLX extensions:\n"); - print_extension_list(glxExtensions, singleLine); + if(mode != Quiet) { + printf("server glx vendor string: %s\n", serverVendor); + printf("server glx version string: %s\n", serverVersion); + printf("server glx extensions:\n"); + print_extension_list(serverExtensions, singleLine); + printf("client glx vendor string: %s\n", clientVendor); + printf("client glx version string: %s\n", clientVersion); + printf("client glx extensions:\n"); + print_extension_list(clientExtensions, singleLine); + printf("GLX version: %u.%u\n", glxVersionMajor, glxVersionMinor); + printf("GLX extensions:\n"); + print_extension_list(glxExtensions, singleLine); + } if (strstr(glxExtensions, "GLX_MESA_query_renderer")) query_renderer(); printf("OpenGL vendor string: %s\n", glVendor); @@ -578,10 +581,12 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, CheckError(__LINE__); + if(mode != Quiet) { printf("%s extensions:\n", oglstring); print_extension_list(glExtensions, singleLine); CheckError(__LINE__); + } if (limits) { print_limits(glExtensions, oglstring, version, &extfuncs); @@ -1252,17 +1257,21 @@ main(int argc, char *argv[]) mesa_hack(dpy, scrnum); coreWorked = print_screen_info(dpy, scrnum, opts.allowDirect, True, False, opts.limits, - opts.singleLine, False); + opts.singleLine, False, opts.mode); print_screen_info(dpy, scrnum, opts.allowDirect, False, False, - opts.limits, opts.singleLine, coreWorked); + opts.limits, opts.singleLine, coreWorked, opts.mode); print_screen_info(dpy, scrnum, opts.allowDirect, False, True, False, - opts.singleLine, True); + opts.singleLine, True, opts.mode); printf("\n"); - print_visual_info(dpy, scrnum, opts.mode); -#ifdef GLX_VERSION_1_3 - print_fbconfig_info(dpy, scrnum, opts.mode); -#endif + + if(opts.mode != Quiet) { + print_visual_info(dpy, scrnum, opts.mode); + #ifdef GLX_VERSION_1_3 + print_fbconfig_info(dpy, scrnum, opts.mode); + #endif + } + if (scrnum + 1 < numScreens) printf("\n\n"); } -- 2.1.4