<div dir="ltr">I also noticed that the core profile reports:<div><br></div><div><div> GL_OES_read_format, GL_S3_s3tc, k^?, </div></div><div><br></div><div style>As extensions on r600g - the "k^?" does not show up on i965</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 12 January 2013 22:15, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Brian Paul <<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>><br>
<br>
[airlied: Based on Brian's patch, I've fixed it up to always report a non-core<br>
and core profile, after each other, and dropped the -c flag as its redunant<br>
now]<br>
<br>
The -c flag says to try to create a core profile (no legacy features)<br>
using glXCreateContextAttribsARB(). A core profile may advertise a<br>
different set of extensions than a compatibility profile (though,<br>
the only difference with NVIDIA's driver is the presence of<br>
GL_ARB_compatibility). Also note that extensions need to be queried<br>
one at a time with glGetStringi().<br>
<br>
Be more careful with creating direct vs. indirect contexts. If<br>
we're trying to get a direct context, don't immediately settle for<br>
indirect. Try indirect only after failing to get direct.<br>
<br>
xsync workaround from Kaelyn Uhrain<br>
v2.1: add xsync to stop wierd xcb bug, drop [-c]<br>
<br>
Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
---<br>
src/xdemos/glxinfo.c | 565 +++++++++++++++++++++++++++++++++++++++++----------<br>
1 file changed, 457 insertions(+), 108 deletions(-)<br>
<br>
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c<br>
index 38bd384..c1ecdfd 100644<br>
--- a/src/xdemos/glxinfo.c<br>
+++ b/src/xdemos/glxinfo.c<br>
@@ -29,6 +29,7 @@<br>
* -b only print ID of "best" visual on screen 0<br>
* -i use indirect rendering connection only<br>
* -l print interesting OpenGL limits (added 5 Sep 2002)<br>
+ * -c request a core profile rendering context<br>
*<br>
* Brian Paul 26 January 2000<br>
*/<br>
@@ -62,6 +63,8 @@<br>
#define GLX_COLOR_INDEX_BIT 0x00000002<br>
#endif<br>
<br>
+#define ELEMENTS(array) (sizeof(array) / sizeof(array[0]))<br>
+<br>
typedef enum<br>
{<br>
Normal,<br>
@@ -108,6 +111,43 @@ struct visual_attribs<br>
};<br>
<br>
<br>
+/** list of known OpenGL versions */<br>
+static struct { int major, minor; } gl_versions[] = {<br>
+ {1, 0},<br>
+ {1, 1},<br>
+ {1, 2},<br>
+ {1, 3},<br>
+ {1, 4},<br>
+ {1, 5},<br>
+ {2, 0},<br>
+ {2, 1},<br>
+ {3, 0},<br>
+ {3, 1},<br>
+ {3, 2},<br>
+ {3, 3},<br>
+ {4, 0},<br>
+ {4, 1},<br>
+ {4, 2},<br>
+ {4, 3},<br>
+ {0, 0} /* end of list */<br>
+};<br>
+<br>
+#define NUM_GL_VERSIONS ELEMENTS(gl_versions)<br>
+<br>
+<br>
+/**<br>
+ * GL Error checking/warning.<br>
+ */<br>
+static void<br>
+CheckError(int line)<br>
+{<br>
+ int n;<br>
+ n = glGetError();<br>
+ if (n)<br>
+ printf("Warning: GL error 0x%x at line %d\n", n, line);<br>
+}<br>
+<br>
+<br>
/*<br>
* qsort callback for string comparison.<br>
*/<br>
@@ -219,6 +259,45 @@ print_extension_list(const char *ext, Bool singleLine)<br>
}<br>
<br>
<br>
+/**<br>
+ * Get list of OpenGL extensions using core profile's glGetStringi().<br>
+ */<br>
+static char *<br>
+build_core_profile_extension_list(void)<br>
+{<br>
+ GLint i, n, totalLen;<br>
+ char *buffer;<br>
+ static PFNGLGETSTRINGIPROC glGetStringi_func = NULL;<br>
+<br>
+ if (!glGetStringi_func) {<br>
+ glGetStringi_func = (PFNGLGETSTRINGIPROC)<br>
+ glXGetProcAddressARB((GLubyte *) "glGetStringi");<br>
+ }<br>
+<br>
+ glGetIntegerv(GL_NUM_EXTENSIONS, &n);<br>
+<br>
+ /* compute totalLen */<br>
+ totalLen = 0;<br>
+ for (i = 0; i < n; i++) {<br>
+ const char *ext = (const char *) glGetStringi_func(GL_EXTENSIONS, i);<br>
+ totalLen += strlen(ext) + 1; /* plus a space */<br>
+ }<br>
+<br>
+ buffer = malloc(totalLen);<br>
+ if (buffer) {<br>
+ int pos = 0;<br>
+ for (i = 0; i < n; i++) {<br>
+ const char *ext = (const char *) glGetStringi_func(GL_EXTENSIONS, i);<br>
+ strcpy(buffer + pos, ext);<br>
+ pos += strlen(ext);<br>
+ buffer[pos++] = ' ';<br>
+ }<br>
+ }<br>
+ return buffer;<br>
+}<br>
+<br>
+<br>
+<br>
static void<br>
print_display_info(Display *dpy)<br>
{<br>
@@ -373,7 +452,7 @@ extension_supported(const char *ext, const char *extensionsList)<br>
* Print interesting OpenGL implementation limits.<br>
*/<br>
static void<br>
-print_limits(const char *extensions)<br>
+print_limits(const char *extensions, const char *oglstring)<br>
{<br>
struct token_name {<br>
GLuint count;<br>
@@ -436,7 +515,7 @@ print_limits(const char *extensions)<br>
};<br>
GLint i, max[2];<br>
<br>
- printf("OpenGL limits:\n");<br>
+ printf("%s limits:\n", oglstring);<br>
for (i = 0; limits[i].count; i++) {<br>
if (!limits[i].extension ||<br>
extension_supported(limits[i].extension, extensions)) {<br>
@@ -480,10 +559,249 @@ print_limits(const char *extensions)<br>
}<br>
<br>
<br>
-static void<br>
-print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, Bool singleLine)<br>
+struct bit_info<br>
+{<br>
+ int bit;<br>
+ const char *name;<br>
+};<br>
+<br>
+<br>
+/**<br>
+ * Return string representation for bits in a bitmask.<br>
+ */<br>
+static const char *<br>
+bitmask_to_string(const struct bit_info bits[], int numBits, int mask)<br>
+{<br>
+ static char buffer[256], *p;<br>
+ int i;<br>
+<br>
+ strcpy(buffer, "(none)");<br>
+ p = buffer;<br>
+ for (i = 0; i < numBits; i++) {<br>
+ if (mask & bits[i].bit) {<br>
+ if (p > buffer)<br>
+ *p++ = ',';<br>
+ strcpy(p, bits[i].name);<br>
+ p += strlen(bits[i].name);<br>
+ }<br>
+ }<br>
+<br>
+ return buffer;<br>
+}<br>
+<br>
+/**<br>
+ * Return string representation for the bitmask returned by<br>
+ * GL_CONTEXT_PROFILE_MASK (OpenGL 3.2 or later).<br>
+ */<br>
+static const char *<br>
+profile_mask_string(int mask)<br>
+{<br>
+ const static struct bit_info bits[] = {<br>
+#ifdef GL_CONTEXT_CORE_PROFILE_BIT<br>
+ { GL_CONTEXT_CORE_PROFILE_BIT, "core profile"},<br>
+#endif<br>
+#ifdef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT<br>
+ { GL_CONTEXT_COMPATIBILITY_PROFILE_BIT, "compatibility profile" }<br>
+#endif<br>
+ };<br>
+<br>
+ return bitmask_to_string(bits, ELEMENTS(bits), mask);<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Return string representation for the bitmask returned by<br>
+ * GL_CONTEXT_FLAGS (OpenGL 3.0 or later).<br>
+ */<br>
+static const char *<br>
+context_flags_string(int mask)<br>
+{<br>
+ const static struct bit_info bits[] = {<br>
+#ifdef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT<br>
+ { GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "forward-compatible" },<br>
+#endif<br>
+#ifdef GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB<br>
+ { GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, "robust-access" },<br>
+#endif<br>
+ };<br>
+<br>
+ return bitmask_to_string(bits, ELEMENTS(bits), mask);<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Choose a simple FB Config.<br>
+ */<br>
+static GLXFBConfig *<br>
+choose_fb_config(Display *dpy, int scrnum)<br>
+{<br>
+ int fbAttribSingle[] = {<br>
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,<br>
+ GLX_RED_SIZE, 1,<br>
+ GLX_GREEN_SIZE, 1,<br>
+ GLX_BLUE_SIZE, 1,<br>
+ GLX_DOUBLEBUFFER, False,<br>
+ None };<br>
+ int fbAttribDouble[] = {<br>
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,<br>
+ GLX_RED_SIZE, 1,<br>
+ GLX_GREEN_SIZE, 1,<br>
+ GLX_BLUE_SIZE, 1,<br>
+ GLX_DOUBLEBUFFER, True,<br>
+ None };<br>
+ GLXFBConfig *configs;<br>
+ int nConfigs;<br>
+<br>
+ configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs);<br>
+ if (!configs)<br>
+ configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs);<br>
+<br>
+ return configs;<br>
+}<br>
+<br>
+<br>
+static Bool CreateContextErrorFlag;<br>
+<br>
+static int<br>
+create_context_error_handler(Display *dpy, XErrorEvent *error)<br>
+{<br>
+ (void) dpy;<br>
+ (void) error->error_code;<br>
+ CreateContextErrorFlag = True;<br>
+ return 0;<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Try to create a GLX context of the given version with flags/options.<br>
+ * Note: A version number is required in order to get a core profile<br>
+ * (at least w/ NVIDIA).<br>
+ */<br>
+static GLXContext<br>
+create_context_flags(Display *dpy, GLXFBConfig fbconfig, int major, int minor,<br>
+ int contextFlags, int profileMask, Bool direct)<br>
+{<br>
+#ifdef GLX_ARB_create_context<br>
+ static PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB_func = 0;<br>
+ static Bool firstCall = True;<br>
+ int (*old_handler)(Display *, XErrorEvent *);<br>
+ GLXContext context;<br>
+ int attribs[20];<br>
+ int n = 0;<br>
+<br>
+ if (firstCall) {<br>
+ /* See if we have GLX_ARB_create_context_profile and get pointer to<br>
+ * glXCreateContextAttribsARB() function.<br>
+ */<br>
+ const char *glxExt = glXQueryExtensionsString(dpy, 0);<br>
+ if (extension_supported("GLX_ARB_create_context_profile", glxExt)) {<br>
+ glXCreateContextAttribsARB_func = (PFNGLXCREATECONTEXTATTRIBSARBPROC)<br>
+ glXGetProcAddress((const GLubyte *) "glXCreateContextAttribsARB");<br>
+ }<br>
+ firstCall = False;<br>
+ }<br>
+<br>
+ if (!glXCreateContextAttribsARB_func)<br>
+ return 0;<br>
+<br>
+ /* setup attribute array */<br>
+ if (major) {<br>
+ attribs[n++] = GLX_CONTEXT_MAJOR_VERSION_ARB;<br>
+ attribs[n++] = major;<br>
+ attribs[n++] = GLX_CONTEXT_MINOR_VERSION_ARB;<br>
+ attribs[n++] = minor;<br>
+ }<br>
+ if (contextFlags) {<br>
+ attribs[n++] = GLX_CONTEXT_FLAGS_ARB;<br>
+ attribs[n++] = contextFlags;<br>
+ }<br>
+#ifdef GLX_ARB_create_context_profile<br>
+ if (profileMask) {<br>
+ attribs[n++] = GLX_CONTEXT_PROFILE_MASK_ARB;<br>
+ attribs[n++] = profileMask;<br>
+ }<br>
+#endif<br>
+ attribs[n++] = 0;<br>
+<br>
+ /* install X error handler */<br>
+ old_handler = XSetErrorHandler(create_context_error_handler);<br>
+ CreateContextErrorFlag = False;<br>
+<br>
+ /* try creating context */<br>
+ context = glXCreateContextAttribsARB_func(dpy,<br>
+ fbconfig,<br>
+ 0, /* share_context */<br>
+ direct,<br>
+ attribs);<br>
+<br>
+ /* restore error handler */<br>
+ XSetErrorHandler(old_handler);<br>
+<br>
+ if (CreateContextErrorFlag)<br>
+ context = 0;<br>
+<br>
+ if (direct) {<br>
+ if (!glXIsDirect(dpy, context)) {<br>
+ glXDestroyContext(dpy, context);<br>
+ return 0;<br>
+ }<br>
+ }<br>
+<br>
+ return context;<br>
+#else<br>
+ return 0;<br>
+#endif<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Try to create a GLX context of the newest version.<br>
+ */<br>
+static GLXContext<br>
+create_context_with_config(Display *dpy, GLXFBConfig config,<br>
+ Bool coreProfile, Bool direct)<br>
+{<br>
+ GLXContext ctx = 0;<br>
+<br>
+ if (coreProfile) {<br>
+ /* Try to create a core profile, starting with the newest version of<br>
+ * GL that we're aware of. If we don't specify the version<br>
+ */<br>
+ int i;<br>
+ for (i = NUM_GL_VERSIONS - 2; i > 0 ; i--) {<br>
+ ctx = create_context_flags(dpy, config,<br>
+ gl_versions[i].major,<br>
+ gl_versions[i].minor,<br>
+ 0x0,<br>
+ GLX_CONTEXT_CORE_PROFILE_BIT_ARB,<br>
+ direct);<br>
+ if (ctx)<br>
+ return ctx;<br>
+ }<br>
+ /* couldn't get core profile context */<br>
+ return 0;<br>
+ }<br>
+<br>
+ /* GLX should return a context of the latest GL version that supports<br>
+ * the full profile.<br>
+ */<br>
+ ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, direct);<br>
+<br>
+ /* make sure the context is direct, if direct was requested */<br>
+ if (ctx && direct) {<br>
+ if (!glXIsDirect(dpy, ctx)) {<br>
+ glXDestroyContext(dpy, ctx);<br>
+ return 0;<br>
+ }<br>
+ }<br>
+<br>
+ return ctx;<br>
+}<br>
+<br>
+<br>
+static XVisualInfo *<br>
+choose_xvisinfo(Display *dpy, int scrnum)<br>
{<br>
- Window win;<br>
int attribSingle[] = {<br>
GLX_RGBA,<br>
GLX_RED_SIZE, 1,<br>
@@ -497,60 +815,53 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, Bool<br>
GLX_BLUE_SIZE, 1,<br>
GLX_DOUBLEBUFFER,<br>
None };<br>
+ XVisualInfo *visinfo;<br>
+<br>
+ visinfo = glXChooseVisual(dpy, scrnum, attribSingle);<br>
+ if (!visinfo)<br>
+ visinfo = glXChooseVisual(dpy, scrnum, attribDouble);<br>
+<br>
+ return visinfo;<br>
+}<br>
+<br>
<br>
+static void<br>
+print_screen_info(Display *dpy, int scrnum, Bool allowDirect,<br>
+ Bool coreProfile, Bool limits, Bool singleLine)<br>
+{<br>
+ Window win;<br>
XSetWindowAttributes attr;<br>
unsigned long mask;<br>
Window root;<br>
GLXContext ctx = NULL;<br>
XVisualInfo *visinfo;<br>
int width = 100, height = 100;<br>
+ GLXFBConfig *fbconfigs;<br>
+ const char *oglstring = coreProfile ? "OpenGL core profile" : "OpenGL";<br>
<br>
root = RootWindow(dpy, scrnum);<br>
<br>
/*<br>
- * Find a basic GLX visual. We'll then create a rendering context and<br>
- * query various info strings.<br>
- */<br>
- visinfo = glXChooseVisual(dpy, scrnum, attribSingle);<br>
- if (!visinfo)<br>
- visinfo = glXChooseVisual(dpy, scrnum, attribDouble);<br>
-<br>
- if (visinfo)<br>
- ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect );<br>
-<br>
-#ifdef GLX_VERSION_1_3<br>
- /* Try glXChooseFBConfig() if glXChooseVisual didn't work.<br>
- * XXX when would that happen?<br>
+ * Choose FBConfig or XVisualInfo and create a context.<br>
*/<br>
- if (!visinfo) {<br>
- int fbAttribSingle[] = {<br>
- GLX_RENDER_TYPE, GLX_RGBA_BIT,<br>
- GLX_RED_SIZE, 1,<br>
- GLX_GREEN_SIZE, 1,<br>
- GLX_BLUE_SIZE, 1,<br>
- GLX_DOUBLEBUFFER, False,<br>
- None };<br>
- int fbAttribDouble[] = {<br>
- GLX_RENDER_TYPE, GLX_RGBA_BIT,<br>
- GLX_RED_SIZE, 1,<br>
- GLX_GREEN_SIZE, 1,<br>
- GLX_BLUE_SIZE, 1,<br>
- GLX_DOUBLEBUFFER, True,<br>
- None };<br>
- GLXFBConfig *configs = NULL;<br>
- int nConfigs;<br>
-<br>
- configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs);<br>
- if (!configs)<br>
- configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs);<br>
-<br>
- if (configs) {<br>
- visinfo = glXGetVisualFromFBConfig(dpy, configs[0]);<br>
- ctx = glXCreateNewContext(dpy, configs[0], GLX_RGBA_TYPE, NULL, allowDirect);<br>
- XFree(configs);<br>
+ fbconfigs = choose_fb_config(dpy, scrnum);<br>
+ if (fbconfigs) {<br>
+ ctx = create_context_with_config(dpy, fbconfigs[0],<br>
+ coreProfile, allowDirect);<br>
+ if (!ctx && allowDirect) {<br>
+ /* try indirect */<br>
+ ctx = create_context_with_config(dpy, fbconfigs[0],<br>
+ coreProfile, False);<br>
}<br>
+<br>
+ visinfo = glXGetVisualFromFBConfig(dpy, fbconfigs[0]);<br>
+ XFree(fbconfigs);<br>
+ }<br>
+ else {<br>
+ visinfo = choose_xvisinfo(dpy, scrnum);<br>
+ if (visinfo)<br>
+ ctx = glXCreateContext(dpy, visinfo, NULL, allowDirect);<br>
}<br>
-#endif<br>
<br>
if (!visinfo) {<br>
fprintf(stderr, "Error: couldn't find RGB GLX visual or fbconfig\n");<br>
@@ -563,6 +874,9 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, Bool<br>
return;<br>
}<br>
<br>
+ /*<br>
+ * Create a window so that we can just bind the context.<br>
+ */<br>
attr.background_pixel = 0;<br>
attr.border_pixel = 0;<br>
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);<br>
@@ -583,72 +897,118 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, Bool<br>
const char *glVendor = (const char *) glGetString(GL_VENDOR);<br>
const char *glRenderer = (const char *) glGetString(GL_RENDERER);<br>
const char *glVersion = (const char *) glGetString(GL_VERSION);<br>
- const char *glExtensions = (const char *) glGetString(GL_EXTENSIONS);<br>
+ char *glExtensions;<br>
int glxVersionMajor;<br>
int glxVersionMinor;<br>
char *displayName = NULL;<br>
char *colon = NULL, *period = NULL;<br>
-<br>
+ int version; /* 20, 21, 30, 31, 32, etc */<br>
+<br>
+ CheckError(__LINE__);<br>
+ /* Get list of GL extensions */<br>
+ if (coreProfile) {<br>
+ glExtensions = build_core_profile_extension_list();<br>
+ }<br>
+ else {<br>
+ glExtensions = (char *) glGetString(GL_EXTENSIONS);<br>
+ }<br>
+<br>
+ CheckError(__LINE__);<br>
+<br>
if (! glXQueryVersion( dpy, & glxVersionMajor, & glxVersionMinor )) {<br>
fprintf(stderr, "Error: glXQueryVersion failed\n");<br>
exit(1);<br>
}<br>
<br>
- /* Strip the screen number from the display name, if present. */<br>
- if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {<br>
- fprintf(stderr, "Error: malloc() failed\n");<br>
- exit(1);<br>
- }<br>
- strcpy(displayName, DisplayString(dpy));<br>
- colon = strrchr(displayName, ':');<br>
- if (colon) {<br>
- period = strchr(colon, '.');<br>
- if (period)<br>
- *period = '\0';<br>
- }<br>
- printf("display: %s screen: %d\n", displayName, scrnum);<br>
- free(displayName);<br>
- printf("direct rendering: ");<br>
- if (glXIsDirect(dpy, ctx)) {<br>
- printf("Yes\n");<br>
- }<br>
- else {<br>
- if (!allowDirect) {<br>
- printf("No (-i specified)\n");<br>
+ if (!coreProfile) {<br>
+ /* Strip the screen number from the display name, if present. */<br>
+ if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {<br>
+ fprintf(stderr, "Error: malloc() failed\n");<br>
+ exit(1);<br>
}<br>
- else if (getenv("LIBGL_ALWAYS_INDIRECT")) {<br>
- printf("No (LIBGL_ALWAYS_INDIRECT set)\n");<br>
+ strcpy(displayName, DisplayString(dpy));<br>
+ colon = strrchr(displayName, ':');<br>
+ if (colon) {<br>
+ period = strchr(colon, '.');<br>
+ if (period)<br>
+ *period = '\0';<br>
+ }<br>
+<br>
+ printf("display: %s screen: %d\n", displayName, scrnum);<br>
+ free(displayName);<br>
+ printf("direct rendering: ");<br>
+ if (glXIsDirect(dpy, ctx)) {<br>
+ printf("Yes\n");<br>
}<br>
else {<br>
- printf("No (If you want to find out why, try setting "<br>
- "LIBGL_DEBUG=verbose)\n");<br>
+ if (!allowDirect) {<br>
+ printf("No (-i specified)\n");<br>
+ }<br>
+ else if (getenv("LIBGL_ALWAYS_INDIRECT")) {<br>
+ printf("No (LIBGL_ALWAYS_INDIRECT set)\n");<br>
+ }<br>
+ else {<br>
+ printf("No (If you want to find out why, try setting "<br>
+ "LIBGL_DEBUG=verbose)\n");<br>
+ }<br>
}<br>
- }<br>
- printf("server glx vendor string: %s\n", serverVendor);<br>
- printf("server glx version string: %s\n", serverVersion);<br>
- printf("server glx extensions:\n");<br>
- print_extension_list(serverExtensions, singleLine);<br>
- printf("client glx vendor string: %s\n", clientVendor);<br>
- printf("client glx version string: %s\n", clientVersion);<br>
- printf("client glx extensions:\n");<br>
- print_extension_list(clientExtensions, singleLine);<br>
- printf("GLX version: %u.%u\n", glxVersionMajor, glxVersionMinor);<br>
- printf("GLX extensions:\n");<br>
- print_extension_list(glxExtensions, singleLine);<br>
- printf("OpenGL vendor string: %s\n", glVendor);<br>
- printf("OpenGL renderer string: %s\n", glRenderer);<br>
- printf("OpenGL version string: %s\n", glVersion);<br>
+ printf("server glx vendor string: %s\n", serverVendor);<br>
+ printf("server glx version string: %s\n", serverVersion);<br>
+ printf("server glx extensions:\n");<br>
+ print_extension_list(serverExtensions, singleLine);<br>
+ printf("client glx vendor string: %s\n", clientVendor);<br>
+ printf("client glx version string: %s\n", clientVersion);<br>
+ printf("client glx extensions:\n");<br>
+ print_extension_list(clientExtensions, singleLine);<br>
+ printf("GLX version: %u.%u\n", glxVersionMajor, glxVersionMinor);<br>
+ printf("GLX extensions:\n");<br>
+ print_extension_list(glxExtensions, singleLine);<br>
+ printf("OpenGL vendor string: %s\n", glVendor);<br>
+ printf("OpenGL renderer string: %s\n", glRenderer);<br>
+ } else<br>
+ printf("\n");<br>
+<br>
+ printf("%s version string: %s\n", oglstring, glVersion);<br>
+<br>
+ version = (glVersion[0] - '0') * 10 + (glVersion[2] - '0');<br>
+<br>
+ CheckError(__LINE__);<br>
+<br>
#ifdef GL_VERSION_2_0<br>
- if (glVersion[0] >= '2' && glVersion[1] == '.') {<br>
+ if (version >= 20) {<br>
char *v = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION);<br>
- printf("OpenGL shading language version string: %s\n", v);<br>
+ printf("%s shading language version string: %s\n", oglstring, v);<br>
+ }<br>
+#endif<br>
+ CheckError(__LINE__);<br>
+#ifdef GL_VERSION_3_0<br>
+ if (version >= 30) {<br>
+ GLint flags;<br>
+ glGetIntegerv(GL_CONTEXT_FLAGS, &flags);<br>
+ printf("%s context flags: %s\n", oglstring, context_flags_string(flags));<br>
}<br>
#endif<br>
+ CheckError(__LINE__);<br>
+#ifdef GL_VERSION_3_2<br>
+ if (version >= 32) {<br>
+ GLint mask;<br>
+ glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);<br>
+ printf("%s profile mask: %s\n", oglstring, profile_mask_string(mask));<br>
+ }<br>
+#endif<br>
+<br>
+ CheckError(__LINE__);<br>
<br>
- printf("OpenGL extensions:\n");<br>
+ printf("%s extensions:\n", oglstring);<br>
print_extension_list(glExtensions, singleLine);<br>
+<br>
+ CheckError(__LINE__);<br>
+<br>
if (limits)<br>
- print_limits(glExtensions);<br>
+ print_limits(glExtensions, oglstring);<br>
+<br>
+ if (coreProfile)<br>
+ free(glExtensions);<br>
}<br>
else {<br>
fprintf(stderr, "Error: glXMakeCurrent failed\n");<br>
@@ -657,6 +1017,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, Bool<br>
glXDestroyContext(dpy, ctx);<br>
XFree(visinfo);<br>
XDestroyWindow(dpy, win);<br>
+ XSync(dpy, 1);<br>
}<br>
<br>
<br>
@@ -684,26 +1045,13 @@ visual_class_name(int cls)<br>
static const char *<br>
visual_drawable_type(int type)<br>
{<br>
- static char buffer[256], *p;<br>
- const static struct { int bit; const char *name; } bits[] = {<br>
+ const static struct bit_info bits[] = {<br>
{ GLX_WINDOW_BIT, "window" },<br>
{ GLX_PIXMAP_BIT, "pixmap" },<br>
{ GLX_PBUFFER_BIT, "pbuffer" }<br>
};<br>
- int i;<br>
-<br>
- strcpy(buffer, "(none)");<br>
- p = buffer;<br>
- for (i = 0; i < 3; i++) {<br>
- if (type & bits[i].bit) {<br>
- if (p > buffer)<br>
- *p++ = ',';<br>
- strcpy(p, bits[i].name);<br>
- p += strlen(bits[i].name);<br>
- }<br>
- }<br>
<br>
- return buffer;<br>
+ return bitmask_to_string(bits, ELEMENTS(bits), type);<br>
}<br>
<br>
static const char *<br>
@@ -1296,7 +1644,7 @@ find_best_visual(Display *dpy, int scrnum)<br>
static void<br>
usage(void)<br>
{<br>
- printf("Usage: glxinfo [-v] [-t] [-h] [-i] [-b] [-s] ][-display <dname>]\n");<br>
+ printf("Usage: glxinfo [-v] [-t] [-h] [-i] [-b] [-s] [-display <dname>]\n");<br>
printf("\t-v: Print visuals info in verbose form.\n");<br>
printf("\t-t: Print verbose table.\n");<br>
printf("\t-display <dname>: Print GLX visuals on specified server.\n");<br>
@@ -1372,7 +1720,8 @@ main(int argc, char *argv[])<br>
print_display_info(dpy);<br>
for (scrnum = 0; scrnum < numScreens; scrnum++) {<br>
mesa_hack(dpy, scrnum);<br>
- print_screen_info(dpy, scrnum, allowDirect, limits, singleLine);<br>
+ print_screen_info(dpy, scrnum, allowDirect, 0, limits, singleLine);<br>
+ print_screen_info(dpy, scrnum, allowDirect, 1, limits, singleLine);<br>
printf("\n");<br>
print_visual_info(dpy, scrnum, mode);<br>
#ifdef GLX_VERSION_1_3<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.0.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>