[Mesa-dev] [PATCH 1/3] glxinfo/wglinfo: add brief (-B) output mode
Brian Paul
brianp at vmware.com
Wed May 20 10:14:55 PDT 2015
Based on a patch by Bryan Quigley <gquigs+bugs at gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90438
---
src/wgl/wglinfo.c | 19 +++++++++++-------
src/xdemos/glinfo_common.c | 5 ++++-
src/xdemos/glinfo_common.h | 3 ++-
src/xdemos/glxinfo.c | 49 ++++++++++++++++++++++++++--------------------
4 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/src/wgl/wglinfo.c b/src/wgl/wglinfo.c
index b6285ec..42bf3a7 100644
--- a/src/wgl/wglinfo.c
+++ b/src/wgl/wglinfo.c
@@ -80,7 +80,7 @@ WndProc(HWND hWnd,
static void
print_screen_info(HDC _hdc, GLboolean limits, GLboolean singleLine,
- GLboolean coreProfile)
+ GLboolean coreProfile, InfoMode mode)
{
WNDCLASS wc;
HWND win;
@@ -253,7 +253,7 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean singleLine,
*/
if (!coreProfile) {
- if (wglExtensions) {
+ if (wglExtensions && mode != Brief) {
printf("WGL extensions:\n");
print_extension_list(wglExtensions, singleLine);
}
@@ -286,8 +286,11 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean singleLine,
}
#endif
- printf("%s extensions:\n", oglString);
- print_extension_list(glExtensions, singleLine);
+ if (mode != Brief) {
+ printf("%s extensions:\n", oglString);
+ print_extension_list(glExtensions, singleLine);
+ }
+
if (limits) {
print_limits(glExtensions, oglString, version, &extfuncs);
}
@@ -643,11 +646,13 @@ main(int argc, char *argv[])
printf("%d\n", b);
}
else {
- print_screen_info(hdc, opts.limits, opts.singleLine, GL_FALSE);
+ print_screen_info(hdc, opts.limits, opts.singleLine, GL_FALSE, opts.mode);
printf("\n");
- print_screen_info(hdc, opts.limits, opts.singleLine, GL_TRUE);
+ print_screen_info(hdc, opts.limits, opts.singleLine, GL_TRUE, opts.mode);
printf("\n");
- print_visual_info(hdc, opts.mode);
+ if (opts.mode != Brief) {
+ print_visual_info(hdc, opts.mode);
+ }
}
return 0;
diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c
index d3acc19..f4c359d 100644
--- a/src/xdemos/glinfo_common.c
+++ b/src/xdemos/glinfo_common.c
@@ -733,6 +733,7 @@ usage(void)
printf("\t-display <dname>: 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], "-B") == 0) {
+ options->mode = Brief;
+ }
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..ad867ee 100644
--- a/src/xdemos/glinfo_common.h
+++ b/src/xdemos/glinfo_common.h
@@ -67,7 +67,8 @@ typedef enum
{
Normal,
Wide,
- Verbose
+ Verbose,
+ Brief
} InfoMode;
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index c3e4ca3..b25186b 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
+ * -B brief, 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 != Brief) {
+ 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,10 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect,
CheckError(__LINE__);
- printf("%s extensions:\n", oglstring);
- print_extension_list(glExtensions, singleLine);
-
- CheckError(__LINE__);
+ if (mode != Brief) {
+ printf("%s extensions:\n", oglstring);
+ print_extension_list(glExtensions, singleLine);
+ }
if (limits) {
print_limits(glExtensions, oglstring, version, &extfuncs);
@@ -1252,17 +1255,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);
+
+ if (opts.mode != Brief) {
+ print_visual_info(dpy, scrnum, opts.mode);
#ifdef GLX_VERSION_1_3
- print_fbconfig_info(dpy, scrnum, opts.mode);
+ print_fbconfig_info(dpy, scrnum, opts.mode);
#endif
+ }
+
if (scrnum + 1 < numScreens)
printf("\n\n");
}
--
1.9.1
More information about the mesa-dev
mailing list