On Sun, Feb 01, 2015 at 06:39:39PM -0500, Bryan Steele wrote:
> This was committed to the upstream demos, but we include
> glxinfo/glxgears in xenocara.
> 
> http://cgit.freedesktop.org/mesa/demos/patch/?id=999b6950c644266bb871e79438751bdba2fa2a08
> 
> Does this show useful output for anyone?

While that commit is not in a released version of mesa demos
yet I agree it is worth having.

I'd rather update all of glinxfo than just pull this commit though.
Here is a diff which does that and I've converted the man page
to mdoc and updated it as it doesn't seem to be present in mesa demos.

Index: glinfo_common.c
===================================================================
RCS file: /cvs/xenocara/app/glxinfo/glinfo_common.c,v
retrieving revision 1.1
diff -u -p -r1.1 glinfo_common.c
--- glinfo_common.c     13 Jul 2014 09:47:57 -0000      1.1
+++ glinfo_common.c     2 Feb 2015 01:27:26 -0000
@@ -573,6 +573,11 @@ print_limits(const char *extensions, con
       { 1, GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, 
"GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT", "GL_ARB_texture_buffer_object" },
       { 1, GL_MAX_TEXTURE_BUFFER_SIZE, "GL_MAX_TEXTURE_BUFFER_SIZE", 
"GL_ARB_texture_buffer_object" },
 #endif
+#if defined (GL_ARB_texture_multisample)
+      { 1, GL_MAX_COLOR_TEXTURE_SAMPLES, "GL_MAX_COLOR_TEXTURE_SAMPLES", 
"GL_ARB_texture_multisample" },
+      { 1, GL_MAX_DEPTH_TEXTURE_SAMPLES, "GL_MAX_DEPTH_TEXTURE_SAMPLES", 
"GL_ARB_texture_multisample" },
+      { 1, GL_MAX_INTEGER_SAMPLES, "GL_MAX_INTEGER_SAMPLES", 
"GL_ARB_texture_multisample" },
+#endif
 #if defined (GL_ARB_uniform_buffer_object)
       { 1, GL_MAX_VERTEX_UNIFORM_BLOCKS, "GL_MAX_VERTEX_UNIFORM_BLOCKS", 
"GL_ARB_uniform_buffer_object" },
       { 1, GL_MAX_FRAGMENT_UNIFORM_BLOCKS, "GL_MAX_FRAGMENT_UNIFORM_BLOCKS", 
"GL_ARB_uniform_buffer_object" },
@@ -718,3 +723,71 @@ context_flags_string(int mask)
 }
 
 
+static void
+usage(void)
+{
+#ifdef _WIN32
+   printf("Usage: wglinfo [-v] [-t] [-h] [-b] [-l] [-s]\n");
+#else
+   printf("Usage: glxinfo [-v] [-t] [-h] [-b] [-l] [-s] [-i] [-display 
<dname>]\n");
+   printf("\t-display <dname>: Print GLX visuals on specified server.\n");
+   printf("\t-i: Force an indirect rendering context.\n");
+#endif
+   printf("\t-v: Print visuals info in verbose form.\n");
+   printf("\t-t: Print verbose table.\n");
+   printf("\t-h: This information.\n");
+   printf("\t-b: Find the 'best' visual and print its number.\n");
+   printf("\t-l: Print interesting OpenGL limits.\n");
+   printf("\t-s: Print a single extension per line.\n");
+}
+
+
+void
+parse_args(int argc, char *argv[], struct options *options)
+{
+   int i;
+
+   options->mode = Normal;
+   options->findBest = GL_FALSE;
+   options->limits = GL_FALSE;
+   options->singleLine = GL_FALSE;
+   options->displayName = NULL;
+   options->allowDirect = GL_TRUE;
+
+   for (i = 1; i < argc; i++) {
+#ifndef _WIN32
+      if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
+         options->displayName = argv[i + 1];
+         i++;
+      }
+      else if (strcmp(argv[i], "-i") == 0) {
+         options->allowDirect = GL_FALSE;
+      }
+      else
+#endif
+      if (strcmp(argv[i], "-t") == 0) {
+         options->mode = Wide;
+      }
+      else if (strcmp(argv[i], "-v") == 0) {
+         options->mode = Verbose;
+      }
+      else if (strcmp(argv[i], "-b") == 0) {
+         options->findBest = GL_TRUE;
+      }
+      else if (strcmp(argv[i], "-l") == 0) {
+         options->limits = GL_TRUE;
+      }
+      else if (strcmp(argv[i], "-h") == 0) {
+         usage();
+         exit(0);
+      }
+      else if(strcmp(argv[i], "-s") == 0) {
+         options->singleLine = GL_TRUE;
+      }
+      else {
+         printf("Unknown option `%s'\n", argv[i]);
+         usage();
+         exit(0);
+      }
+   }
+}
Index: glinfo_common.h
===================================================================
RCS file: /cvs/xenocara/app/glxinfo/glinfo_common.h,v
retrieving revision 1.1
diff -u -p -r1.1 glinfo_common.h
--- glinfo_common.h     13 Jul 2014 09:47:57 -0000      1.1
+++ glinfo_common.h     2 Feb 2015 01:27:26 -0000
@@ -63,6 +63,54 @@ struct bit_info
 };
 
 
+typedef enum
+{
+   Normal,
+   Wide,
+   Verbose
+} InfoMode;
+
+
+struct options
+{
+   InfoMode mode;
+   GLboolean findBest;
+   GLboolean limits;
+   GLboolean singleLine;
+   /* GLX only */
+   char *displayName;
+   GLboolean allowDirect;
+};
+
+
+/** list of known OpenGL versions */
+static const struct { int major, minor; } gl_versions[] = {
+   {4, 5},
+   {4, 4},
+   {4, 3},
+   {4, 2},
+   {4, 1},
+   {4, 0},
+
+   {3, 3},
+   {3, 2},
+   {3, 1},
+   {3, 0},
+
+   {2, 1},
+   {2, 0},
+
+   {1, 5},
+   {1, 4},
+   {1, 3},
+   {1, 2},
+   {1, 1},
+   {1, 0},
+
+   {0, 0} /* end of list */
+};
+
+
 void
 print_extension_list(const char *ext, GLboolean singleLine);
 
@@ -84,6 +132,10 @@ profile_mask_string(int mask);
 
 const char *
 context_flags_string(int mask);
+
+
+void
+parse_args(int argc, char *argv[], struct options *options);
 
 
 #endif /* GLINFO_COMMON_H */
Index: glxinfo.1
===================================================================
RCS file: /cvs/xenocara/app/glxinfo/glxinfo.1,v
retrieving revision 1.1
diff -u -p -r1.1 glxinfo.1
--- glxinfo.1   26 Nov 2006 11:23:56 -0000      1.1
+++ glxinfo.1   2 Feb 2015 01:59:22 -0000
@@ -1,3 +1,4 @@
+.\" $OpenBSD$
 .\" $TOG: xdpyinfo.man /main/22 1998/02/09 13:57:10 kaleb $
 .\" Copyright 1988, 1989, 1994, 1998  The Open Group
 .\" 
@@ -25,55 +26,54 @@
 .\"
 .\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.5 2001/12/14 20:00:47 dawes 
Exp $
 .\"
-.TH GLXINFO 1 __vendorversion__
-.SH NAME
-glxinfo \- display info about a GLX extension and OpenGL renderer.
-.SH SYNOPSIS
-.B "glxinfo"
-[\-t]
-[\-v]
-[\-b]
-[\-display \fIdisplayname\fP]
-.SH DESCRIPTION
-.PP
-.I glxinfo
+.Dd $Mdocdate$
+.Dt GLXINFO 1
+.Os
+.Sh NAME
+.Nm glxinfo
+.Nd display info about a GLX extension and OpenGL renderer.
+.Sh SYNOPSIS
+.Nm glxinfo
+.Op Fl bhilstv
+.Op Fl display Ar displayname
+.Sh DESCRIPTION
+.Nm
 lists information about the GLX extension, OpenGL capable visuals, and the
 OpenGL renderer on an X server. The GLX and renderer info includes the version
-and extension attributes. The visual info lists the GLX visual attributes 
+and extension attributes. The visual info lists the GLX visual attributes
 available for each OpenGL capable visual (e.g. whether the visual is double
 buffered, the component sizes, Z-buffering depth, etc).
-.PP
+.Pp
 Command line options include:
-.TP 8
-.B \-t
+.Bl -tag -width Ds
+.It Fl b
+Find the 'best' visual and print its number.
+.It Fl h
+Print a short help message.
+.It Fl i
+Force an indirect rendering context.
+.It Fl l
+Print interesting OpenGL limits.
+.It Fl s
+Print a single extension per line.
+.It Fl t
 By default the visual info is presented in a concise 80 character wide
 tabular format. The -t option directs glxinfo to produce a wider, more readable
 tabular format.
-.TP 8
-.B \-v
+.It Fl v
 Directs glxinfo to generate a verbose format output style for
 the visual list similar to the info of xdpyinfo.
-.TP 8
-.B \-b
-Print the ID of the "best" visual on screen 0.
-.TP 8
-.B \-l
-Print interesting OpenGL limits.
-.TP 8
-.B \-i
-Use indirect rendering connection only.
-.TP 8
-.BI "\-display " "displayname"
+.It Fl display Ar displayname
 Specify the display to query.
-.PP
-.SH ENVIRONMENT
-.PP
-.TP 8
-.B DISPLAY
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width Ds -compact
+.It Ev DISPLAY
 To get the default host, display number, and screen.
-.SH "SEE ALSO"
+.El
+.Sh "SEE ALSO"
 xdpyinfo(1)
-.SH AUTHOR
+.Sh AUTHOR
 Brian Paul
 .br
-Modifications for __xservername__ added by Mark Paton
+Modifications for XFree86 added by Mark Paton
Index: glxinfo.c
===================================================================
RCS file: /cvs/xenocara/app/glxinfo/glxinfo.c,v
retrieving revision 1.2
diff -u -p -r1.2 glxinfo.c
--- glxinfo.c   13 Jul 2014 09:47:57 -0000      1.2
+++ glxinfo.c   2 Feb 2015 01:27:26 -0000
@@ -63,13 +63,6 @@
 #define GLX_COLOR_INDEX_BIT            0x00000002
 #endif
 
-typedef enum
-{
-   Normal,
-   Wide,
-   Verbose
-} InfoMode;
-
 
 struct visual_attribs
 {
@@ -109,30 +102,6 @@ struct visual_attribs
 };
 
    
-/** list of known OpenGL versions */
-static const struct { int major, minor; } gl_versions[] = {
-   {1, 0},
-   {1, 1},
-   {1, 2},
-   {1, 3},
-   {1, 4},
-   {1, 5},
-   {2, 0},
-   {2, 1},
-   {3, 0},
-   {3, 1},
-   {3, 2},
-   {3, 3},
-   {4, 0},
-   {4, 1},
-   {4, 2},
-   {4, 3},
-   {4, 4},
-   {0, 0} /* end of list */
-};
-
-#define NUM_GL_VERSIONS ELEMENTS(gl_versions)
-
 /**
  * Version of the context that was created
  *
@@ -299,7 +268,7 @@ create_context_with_config(Display *dpy,
        * GL that we're aware of.  If we don't specify the version
        */
       int i;
-      for (i = NUM_GL_VERSIONS - 2; i > 0 ; i--) {
+      for (i = 0; gl_versions[i].major > 0; i++) {
           /* don't bother below GL 3.0 */
           if (gl_versions[i].major == 3 &&
               gl_versions[i].minor == 0)
@@ -373,6 +342,53 @@ choose_xvisinfo(Display *dpy, int scrnum
 }
 
 
+static void
+query_renderer(void)
+{
+#ifdef GLX_MESA_query_renderer
+    PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC queryInteger;
+    PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC queryString;
+    unsigned int v[3];
+
+    queryInteger = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)
+       glXGetProcAddressARB((const GLubyte *)
+                            "glXQueryCurrentRendererIntegerMESA");
+    queryString = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)
+       glXGetProcAddressARB((const GLubyte *)
+                            "glXQueryCurrentRendererStringMESA");
+
+    printf("Extended renderer info (GLX_MESA_query_renderer):\n");
+    queryInteger(GLX_RENDERER_VENDOR_ID_MESA, v);
+    printf("    Vendor: %s (0x%x)\n",
+          queryString(GLX_RENDERER_VENDOR_ID_MESA), *v);
+    queryInteger(GLX_RENDERER_DEVICE_ID_MESA, v);
+    printf("    Device: %s (0x%x)\n",
+          queryString(GLX_RENDERER_DEVICE_ID_MESA), *v);
+    queryInteger(GLX_RENDERER_VERSION_MESA, v);
+    printf("    Version: %d.%d.%d\n", v[0], v[1], v[2]);
+    queryInteger(GLX_RENDERER_ACCELERATED_MESA, v);
+    printf("    Accelerated: %s\n", *v ? "yes" : "no");
+    queryInteger(GLX_RENDERER_VIDEO_MEMORY_MESA, v);
+    printf("    Video memory: %dMB\n", *v);
+    queryInteger(GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA, v);
+    printf("    Unified memory: %s\n", *v ? "yes" : "no");
+    queryInteger(GLX_RENDERER_PREFERRED_PROFILE_MESA, v);
+    printf("    Preferred profile: %s (0x%x)\n",
+          *v == GLX_CONTEXT_CORE_PROFILE_BIT_ARB ? "core" :
+          *v == GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB ? "compat" :
+          "unknown", *v);
+    queryInteger(GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA, v);
+    printf("    Max core profile version: %d.%d\n", v[0], v[1]);
+    queryInteger(GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA, v);
+    printf("    Max compat profile version: %d.%d\n", v[0], v[1]);
+    queryInteger(GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA, v);
+    printf("    Max GLES1 profile version: %d.%d\n", v[0], v[1]);
+    queryInteger(GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA, v);
+    printf("    Max GLES[23] profile version: %d.%d\n", v[0], v[1]);
+#endif
+}
+
+
 static Bool
 print_screen_info(Display *dpy, int scrnum, Bool allowDirect,
                   Bool coreProfile, Bool es2Profile, Bool limits,
@@ -524,6 +540,8 @@ print_screen_info(Display *dpy, int scrn
          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);
          printf("OpenGL renderer string: %s\n", glRenderer);
       } else
@@ -1204,76 +1222,24 @@ find_best_visual(Display *dpy, int scrnu
 }
 
 
-static void
-usage(void)
-{
-   printf("Usage: glxinfo [-v] [-t] [-h] [-i] [-b] [-s] [-display <dname>]\n");
-   printf("\t-v: Print visuals info in verbose form.\n");
-   printf("\t-t: Print verbose table.\n");
-   printf("\t-display <dname>: Print GLX visuals on specified server.\n");
-   printf("\t-h: This information.\n");
-   printf("\t-i: Force an indirect rendering context.\n");
-   printf("\t-b: Find the 'best' visual and print its number.\n");
-   printf("\t-l: Print interesting OpenGL limits.\n");
-   printf("\t-s: Print a single extension per line.\n");
-}
-
-
 int
 main(int argc, char *argv[])
 {
-   char *displayName = NULL;
    Display *dpy;
    int numScreens, scrnum;
-   InfoMode mode = Normal;
-   Bool findBest = False;
-   Bool limits = False;
-   Bool allowDirect = True;
-   Bool singleLine = False;
+   struct options opts;
    Bool coreWorked;
-   int i;
 
-   for (i = 1; i < argc; i++) {
-      if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
-         displayName = argv[i + 1];
-         i++;
-      }
-      else if (strcmp(argv[i], "-t") == 0) {
-         mode = Wide;
-      }
-      else if (strcmp(argv[i], "-v") == 0) {
-         mode = Verbose;
-      }
-      else if (strcmp(argv[i], "-b") == 0) {
-         findBest = True;
-      }
-      else if (strcmp(argv[i], "-i") == 0) {
-         allowDirect = False;
-      }
-      else if (strcmp(argv[i], "-l") == 0) {
-         limits = True;
-      }
-      else if (strcmp(argv[i], "-h") == 0) {
-         usage();
-         return 0;
-      }
-      else if (strcmp(argv[i], "-s") == 0) {
-         singleLine = True;
-      }
-      else {
-         printf("Unknown option `%s'\n", argv[i]);
-         usage();
-         return 0;
-      }
-   }
+   parse_args(argc, argv, &opts);
 
-   dpy = XOpenDisplay(displayName);
+   dpy = XOpenDisplay(opts.displayName);
    if (!dpy) {
-      fprintf(stderr, "Error: unable to open display %s\n", 
XDisplayName(displayName));
+      fprintf(stderr, "Error: unable to open display %s\n",
+              XDisplayName(opts.displayName));
       return -1;
    }
 
-   if (findBest) {
+   if (opts.findBest) {
       int b;
       mesa_hack(dpy, 0);
       b = find_best_visual(dpy, 0);
@@ -1284,14 +1250,18 @@ main(int argc, char *argv[])
       print_display_info(dpy);
       for (scrnum = 0; scrnum < numScreens; scrnum++) {
          mesa_hack(dpy, scrnum);
-         coreWorked = print_screen_info(dpy, scrnum, allowDirect, True, False, 
limits, singleLine, False);
-         print_screen_info(dpy, scrnum, allowDirect, False, False, limits, 
singleLine, coreWorked);
-         print_screen_info(dpy, scrnum, allowDirect, False, True, False, 
singleLine, True);
+         coreWorked = print_screen_info(dpy, scrnum, opts.allowDirect,
+                                        True, False, opts.limits,
+                                        opts.singleLine, False);
+         print_screen_info(dpy, scrnum, opts.allowDirect, False, False,
+                           opts.limits, opts.singleLine, coreWorked);
+         print_screen_info(dpy, scrnum, opts.allowDirect, False, True, False,
+                           opts.singleLine, True);
 
          printf("\n");
-         print_visual_info(dpy, scrnum, mode);
+         print_visual_info(dpy, scrnum, opts.mode);
 #ifdef GLX_VERSION_1_3
-         print_fbconfig_info(dpy, scrnum, mode);
+         print_fbconfig_info(dpy, scrnum, opts.mode);
 #endif
          if (scrnum + 1 < numScreens)
             printf("\n\n");

Reply via email to