1 Submitted By: DJ Lucas <dj@linuxfromscratch.org>
2 based on previous patches submitted
3 by Armin K and Fernando de Oliveira
5 Initial Package Version: 19.0.4
6 Upstream Status: Not applicable.
8 Description: This patch adds two OpenGL demos, glxinfo and
9 glxgears and respective man pages.
11 diff -Naurp mesa-20.2.1-orig/src/glx/meson.build mesa-20.2.1/src/glx/meson.build
12 --- mesa-20.2.1-orig/src/glx/meson.build 2020-10-14 12:19:10.623185200 -0500
13 +++ mesa-20.2.1/src/glx/meson.build 2020-10-15 23:06:45.823362439 -0500
14 @@ -165,6 +165,8 @@ libgl = shared_library(
23 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/glinfo_common.c mesa-20.2.1/src/glx/xdemos/glinfo_common.c
24 --- mesa-20.2.1-orig/src/glx/xdemos/glinfo_common.c 1969-12-31 18:00:00.000000000 -0600
25 +++ mesa-20.2.1/src/glx/xdemos/glinfo_common.c 2020-10-15 23:06:45.826695773 -0500
28 + * Copyright (C) 1999-2014 Brian Paul All Rights Reserved.
30 + * Permission is hereby granted, free of charge, to any person obtaining a
31 + * copy of this software and associated documentation files (the "Software"),
32 + * to deal in the Software without restriction, including without limitation
33 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
34 + * and/or sell copies of the Software, and to permit persons to whom the
35 + * Software is furnished to do so, subject to the following conditions:
37 + * The above copyright notice and this permission notice shall be included
38 + * in all copies or substantial portions of the Software.
40 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
41 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
43 + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
44 + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
53 +#include "glinfo_common.h"
56 +#define snprintf _snprintf
61 + * Return the GL enum name for a numeric value.
62 + * We really only care about the compressed texture formats for now.
65 +enum_name(GLenum val)
67 + static const struct {
71 + { "GL_COMPRESSED_ALPHA", 0x84E9 },
72 + { "GL_COMPRESSED_LUMINANCE", 0x84EA },
73 + { "GL_COMPRESSED_LUMINANCE_ALPHA", 0x84EB },
74 + { "GL_COMPRESSED_INTENSITY", 0x84EC },
75 + { "GL_COMPRESSED_RGB", 0x84ED },
76 + { "GL_COMPRESSED_RGBA", 0x84EE },
77 + { "GL_COMPRESSED_TEXTURE_FORMATS", 0x86A3 },
78 + { "GL_COMPRESSED_RGB", 0x84ED },
79 + { "GL_COMPRESSED_RGBA", 0x84EE },
80 + { "GL_COMPRESSED_TEXTURE_FORMATS", 0x86A3 },
81 + { "GL_COMPRESSED_ALPHA", 0x84E9 },
82 + { "GL_COMPRESSED_LUMINANCE", 0x84EA },
83 + { "GL_COMPRESSED_LUMINANCE_ALPHA", 0x84EB },
84 + { "GL_COMPRESSED_INTENSITY", 0x84EC },
85 + { "GL_COMPRESSED_SRGB", 0x8C48 },
86 + { "GL_COMPRESSED_SRGB_ALPHA", 0x8C49 },
87 + { "GL_COMPRESSED_SLUMINANCE", 0x8C4A },
88 + { "GL_COMPRESSED_SLUMINANCE_ALPHA", 0x8C4B },
89 + { "GL_COMPRESSED_RED", 0x8225 },
90 + { "GL_COMPRESSED_RG", 0x8226 },
91 + { "GL_COMPRESSED_RED_RGTC1", 0x8DBB },
92 + { "GL_COMPRESSED_SIGNED_RED_RGTC1", 0x8DBC },
93 + { "GL_COMPRESSED_RG_RGTC2", 0x8DBD },
94 + { "GL_COMPRESSED_SIGNED_RG_RGTC2", 0x8DBE },
95 + { "GL_COMPRESSED_RGB8_ETC2", 0x9274 },
96 + { "GL_COMPRESSED_SRGB8_ETC2", 0x9275 },
97 + { "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", 0x9276 },
98 + { "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", 0x9277 },
99 + { "GL_COMPRESSED_RGBA8_ETC2_EAC", 0x9278 },
100 + { "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", 0x9279 },
101 + { "GL_COMPRESSED_R11_EAC", 0x9270 },
102 + { "GL_COMPRESSED_SIGNED_R11_EAC", 0x9271 },
103 + { "GL_COMPRESSED_RG11_EAC", 0x9272 },
104 + { "GL_COMPRESSED_SIGNED_RG11_EAC", 0x9273 },
105 + { "GL_COMPRESSED_ALPHA_ARB", 0x84E9 },
106 + { "GL_COMPRESSED_LUMINANCE_ARB", 0x84EA },
107 + { "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", 0x84EB },
108 + { "GL_COMPRESSED_INTENSITY_ARB", 0x84EC },
109 + { "GL_COMPRESSED_RGB_ARB", 0x84ED },
110 + { "GL_COMPRESSED_RGBA_ARB", 0x84EE },
111 + { "GL_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A3 },
112 + { "GL_COMPRESSED_RGBA_BPTC_UNORM_ARB", 0x8E8C },
113 + { "GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB", 0x8E8D },
114 + { "GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB", 0x8E8E },
115 + { "GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB", 0x8E8F },
116 + { "GL_COMPRESSED_RGBA_ASTC_4x4_KHR", 0x93B0 },
117 + { "GL_COMPRESSED_RGBA_ASTC_5x4_KHR", 0x93B1 },
118 + { "GL_COMPRESSED_RGBA_ASTC_5x5_KHR", 0x93B2 },
119 + { "GL_COMPRESSED_RGBA_ASTC_6x5_KHR", 0x93B3 },
120 + { "GL_COMPRESSED_RGBA_ASTC_6x6_KHR", 0x93B4 },
121 + { "GL_COMPRESSED_RGBA_ASTC_8x5_KHR", 0x93B5 },
122 + { "GL_COMPRESSED_RGBA_ASTC_8x6_KHR", 0x93B6 },
123 + { "GL_COMPRESSED_RGBA_ASTC_8x8_KHR", 0x93B7 },
124 + { "GL_COMPRESSED_RGBA_ASTC_10x5_KHR", 0x93B8 },
125 + { "GL_COMPRESSED_RGBA_ASTC_10x6_KHR", 0x93B9 },
126 + { "GL_COMPRESSED_RGBA_ASTC_10x8_KHR", 0x93BA },
127 + { "GL_COMPRESSED_RGBA_ASTC_10x10_KHR", 0x93BB },
128 + { "GL_COMPRESSED_RGBA_ASTC_12x10_KHR", 0x93BC },
129 + { "GL_COMPRESSED_RGBA_ASTC_12x12_KHR", 0x93BD },
130 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR", 0x93D0 },
131 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR", 0x93D1 },
132 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR", 0x93D2 },
133 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR", 0x93D3 },
134 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR", 0x93D4 },
135 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR", 0x93D5 },
136 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR", 0x93D6 },
137 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR", 0x93D7 },
138 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR", 0x93D8 },
139 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR", 0x93D9 },
140 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR", 0x93DA },
141 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR", 0x93DB },
142 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR", 0x93DC },
143 + { "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR", 0x93DD },
144 + { "GL_COMPRESSED_RGB_FXT1_3DFX", 0x86B0 },
145 + { "GL_COMPRESSED_RGBA_FXT1_3DFX", 0x86B1 },
146 + { "GL_COMPRESSED_LUMINANCE_LATC1_EXT", 0x8C70 },
147 + { "GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT", 0x8C71 },
148 + { "GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT", 0x8C72 },
149 + { "GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT", 0x8C73 },
150 + { "GL_COMPRESSED_RED_RGTC1_EXT", 0x8DBB },
151 + { "GL_COMPRESSED_SIGNED_RED_RGTC1_EXT", 0x8DBC },
152 + { "GL_COMPRESSED_RED_GREEN_RGTC2_EXT", 0x8DBD },
153 + { "GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT", 0x8DBE },
154 + { "GL_COMPRESSED_RGB_S3TC_DXT1_EXT", 0x83F0 },
155 + { "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", 0x83F1 },
156 + { "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT", 0x83F2 },
157 + { "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT", 0x83F3 },
158 + { "GL_COMPRESSED_SRGB_EXT", 0x8C48 },
159 + { "GL_COMPRESSED_SRGB_ALPHA_EXT", 0x8C49 },
160 + { "GL_COMPRESSED_SLUMINANCE_EXT", 0x8C4A },
161 + { "GL_COMPRESSED_SLUMINANCE_ALPHA_EXT", 0x8C4B },
162 + { "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT", 0x8C4C },
163 + { "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", 0x8C4D },
164 + { "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", 0x8C4E },
165 + { "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", 0x8C4F },
166 + { "GL_PALETTE4_RGB8_OES", 0x8B90 },
167 + { "GL_PALETTE4_RGBA8_OES", 0x8B91 },
168 + { "GL_PALETTE4_R5_G6_B5_OES", 0x8B92 },
169 + { "GL_PALETTE4_RGBA4_OES", 0x8B93 },
170 + { "GL_PALETTE4_RGB5_A1_OES", 0x8B94 },
171 + { "GL_PALETTE8_RGB8_OES", 0x8B95 },
172 + { "GL_PALETTE8_RGBA8_OES", 0x8B96 },
173 + { "GL_PALETTE8_R5_G6_B5_OES", 0x8B97 },
174 + { "GL_PALETTE8_RGBA4_OES", 0x8B98 },
175 + { "GL_PALETTE8_RGB5_A1_OES", 0x8B99 }
177 + const int n = sizeof(enums) / sizeof(enums[0]);
178 + static char buffer[100];
180 + for (i = 0; i < n; i++) {
181 + if (enums[i].val == val) {
182 + return enums[i].name;
185 + /* enum val not found, just print hexadecimal value into static buffer */
186 + snprintf(buffer, sizeof(buffer), "0x%x", val);
192 + * qsort callback for string comparison.
195 +compare_string_ptr(const void *p1, const void *p2)
197 + return strcmp(* (char * const *) p1, * (char * const *) p2);
201 + * Print a list of extensions, with word-wrapping.
204 +print_extension_list(const char *ext, GLboolean singleLine)
207 + int num_extensions;
208 + const char *indentString = " ";
209 + const int indent = 4;
210 + const int max = 79;
211 + int width, i, j, k;
213 + if (!ext || !ext[0])
216 + /* count the number of extensions, ignoring successive spaces */
217 + num_extensions = 0;
220 + if ((ext[j] == ' ' || ext[j] == 0) && ext[j - 1] != ' ') {
225 + /* copy individual extensions to an array */
226 + extensions = malloc(num_extensions * sizeof *extensions);
228 + fprintf(stderr, "Error: malloc() failed\n");
233 + if (ext[j] == ' ' || ext[j] == 0) {
234 + /* found end of an extension name */
235 + const int len = j - i;
238 + assert(k < num_extensions);
240 + extensions[k] = malloc(len + 1);
241 + if (!extensions[k]) {
242 + fprintf(stderr, "Error: malloc() failed\n");
246 + memcpy(extensions[k], ext + i, len);
247 + extensions[k][len] = 0;
260 + assert(k == num_extensions);
262 + /* sort extensions alphabetically */
263 + qsort(extensions, num_extensions, sizeof extensions[0], compare_string_ptr);
265 + /* print the extensions */
267 + printf("%s", indentString);
268 + for (k = 0; k < num_extensions; ++k) {
269 + const int len = strlen(extensions[k]);
270 + if ((!singleLine) && (width + len > max)) {
271 + /* start a new line */
274 + printf("%s", indentString);
276 + /* print the extension name */
277 + printf("%s", extensions[k]);
279 + /* either we're all done, or we'll continue with next extension */
285 + printf("%s", indentString);
287 + else if (k < (num_extensions -1)) {
294 + for (k = 0; k < num_extensions; ++k) {
295 + free(extensions[k]);
304 + * Get list of OpenGL extensions using core profile's glGetStringi().
307 +build_core_profile_extension_list(const struct ext_functions *extfuncs)
309 + GLint i, n, totalLen;
312 + glGetIntegerv(GL_NUM_EXTENSIONS, &n);
314 + /* compute totalLen */
316 + for (i = 0; i < n; i++) {
317 + const char *ext = (const char *) extfuncs->GetStringi(GL_EXTENSIONS, i);
319 + totalLen += strlen(ext) + 1; /* plus a space */
325 + buffer = malloc(totalLen + 1);
328 + for (i = 0; i < n; i++) {
329 + const char *ext = (const char *) extfuncs->GetStringi(GL_EXTENSIONS, i);
330 + strcpy(buffer + pos, ext);
331 + pos += strlen(ext);
332 + buffer[pos++] = ' ';
334 + buffer[pos] = '\0';
340 +/** Is extension 'ext' supported? */
342 +extension_supported(const char *ext, const char *extensionsList)
345 + const char *p = strstr(extensionsList, ext);
347 + /* check that next char is a space or end of string */
348 + int extLen = strlen(ext);
349 + if (p[extLen] == 0 || p[extLen] == ' ') {
353 + /* We found a superset string, keep looking */
354 + extensionsList += extLen;
366 + * Is verNum >= verString?
367 + * \param verString such as "2.1", "3.0", etc.
368 + * \param verNum such as 20, 21, 30, 31, 32, etc.
371 +version_supported(const char *verString, int verNum)
376 + !isdigit(verString[0]) ||
377 + verString[1] != '.' ||
378 + !isdigit(verString[2])) {
382 + v = (verString[0] - '0') * 10 + (verString[2] - '0');
384 + return verNum >= v;
396 +print_shader_limit_list(const struct token_name *lim)
401 + for (i = 0; lim[i].token; i++) {
402 + glGetIntegerv(lim[i].token, max);
403 + if (glGetError() == GL_NO_ERROR) {
404 + printf(" %s = %d\n", lim[i].name, max[0]);
411 + * Print interesting limits for vertex/fragment shaders.
414 +print_shader_limits(GLenum target)
416 + static const struct token_name vertex_limits[] = {
417 + { GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB" },
418 + { GL_MAX_VARYING_FLOATS_ARB, "GL_MAX_VARYING_FLOATS_ARB" },
419 + { GL_MAX_VERTEX_ATTRIBS_ARB, "GL_MAX_VERTEX_ATTRIBS_ARB" },
420 + { GL_MAX_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_TEXTURE_IMAGE_UNITS_ARB" },
421 + { GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB" },
422 + { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB" },
423 + { GL_MAX_TEXTURE_COORDS_ARB, "GL_MAX_TEXTURE_COORDS_ARB" },
424 + { GL_MAX_VERTEX_OUTPUT_COMPONENTS , "GL_MAX_VERTEX_OUTPUT_COMPONENTS " },
425 + { (GLenum) 0, NULL }
427 + static const struct token_name fragment_limits[] = {
428 + { GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB" },
429 + { GL_MAX_TEXTURE_COORDS_ARB, "GL_MAX_TEXTURE_COORDS_ARB" },
430 + { GL_MAX_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_TEXTURE_IMAGE_UNITS_ARB" },
431 + { GL_MAX_FRAGMENT_INPUT_COMPONENTS , "GL_MAX_FRAGMENT_INPUT_COMPONENTS " },
432 + { (GLenum) 0, NULL }
434 + static const struct token_name geometry_limits[] = {
435 + { GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS" },
436 + { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS" },
437 + { GL_MAX_GEOMETRY_OUTPUT_VERTICES , "GL_MAX_GEOMETRY_OUTPUT_VERTICES " },
438 + { GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS" },
439 + { GL_MAX_GEOMETRY_INPUT_COMPONENTS , "GL_MAX_GEOMETRY_INPUT_COMPONENTS " },
440 + { GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, "GL_MAX_GEOMETRY_OUTPUT_COMPONENTS" },
441 + { (GLenum) 0, NULL }
445 + case GL_VERTEX_SHADER:
446 + printf(" GL_VERTEX_SHADER_ARB:\n");
447 + print_shader_limit_list(vertex_limits);
450 + case GL_FRAGMENT_SHADER:
451 + printf(" GL_FRAGMENT_SHADER_ARB:\n");
452 + print_shader_limit_list(fragment_limits);
455 + case GL_GEOMETRY_SHADER:
456 + printf(" GL_GEOMETRY_SHADER:\n");
457 + print_shader_limit_list(geometry_limits);
464 + * Print interesting limits for vertex/fragment programs.
467 +print_program_limits(GLenum target,
468 + const struct ext_functions *extfuncs)
470 +#if defined(GL_ARB_vertex_program) || defined(GL_ARB_fragment_program)
471 + struct token_name {
475 + static const struct token_name common_limits[] = {
476 + { GL_MAX_PROGRAM_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_INSTRUCTIONS_ARB" },
477 + { GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB" },
478 + { GL_MAX_PROGRAM_TEMPORARIES_ARB, "GL_MAX_PROGRAM_TEMPORARIES_ARB" },
479 + { GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB" },
480 + { GL_MAX_PROGRAM_PARAMETERS_ARB, "GL_MAX_PROGRAM_PARAMETERS_ARB" },
481 + { GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB" },
482 + { GL_MAX_PROGRAM_ATTRIBS_ARB, "GL_MAX_PROGRAM_ATTRIBS_ARB" },
483 + { GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB" },
484 + { GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB" },
485 + { GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB" },
486 + { GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB" },
487 + { GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB" },
488 + { (GLenum) 0, NULL }
490 + static const struct token_name fragment_limits[] = {
491 + { GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB" },
492 + { GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB" },
493 + { GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB" },
494 + { GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB" },
495 + { GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB" },
496 + { GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB" },
497 + { (GLenum) 0, NULL }
503 + if (target == GL_VERTEX_PROGRAM_ARB) {
504 + printf(" GL_VERTEX_PROGRAM_ARB:\n");
506 + else if (target == GL_FRAGMENT_PROGRAM_ARB) {
507 + printf(" GL_FRAGMENT_PROGRAM_ARB:\n");
510 + return; /* something's wrong */
513 + for (i = 0; common_limits[i].token; i++) {
514 + extfuncs->GetProgramivARB(target, common_limits[i].token, max);
515 + if (glGetError() == GL_NO_ERROR) {
516 + printf(" %s = %d\n", common_limits[i].name, max[0]);
519 + if (target == GL_FRAGMENT_PROGRAM_ARB) {
520 + for (i = 0; fragment_limits[i].token; i++) {
521 + extfuncs->GetProgramivARB(target, fragment_limits[i].token, max);
522 + if (glGetError() == GL_NO_ERROR) {
523 + printf(" %s = %d\n", fragment_limits[i].name, max[0]);
527 +#endif /* GL_ARB_vertex_program / GL_ARB_fragment_program */
532 + * Print interesting OpenGL implementation limits.
533 + * \param version 20, 21, 30, 31, 32, etc.
536 +print_limits(const char *extensions, const char *oglstring, int version,
537 + const struct ext_functions *extfuncs)
539 + struct token_name {
543 + const char *extension; /* NULL or GL extension name or version string */
545 + static const struct token_name limits[] = {
546 + { 1, GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH", NULL },
547 + { 1, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", NULL },
548 + { 1, GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES", NULL },
549 + { 1, GL_MAX_COLOR_MATRIX_STACK_DEPTH, "GL_MAX_COLOR_MATRIX_STACK_DEPTH", "GL_ARB_imaging" },
550 + { 1, GL_MAX_ELEMENTS_VERTICES, "GL_MAX_ELEMENTS_VERTICES", NULL },
551 + { 1, GL_MAX_ELEMENTS_INDICES, "GL_MAX_ELEMENTS_INDICES", NULL },
552 + { 1, GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER", NULL },
553 + { 1, GL_MAX_LIGHTS, "GL_MAX_LIGHTS", NULL },
554 + { 1, GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING", NULL },
555 + { 1, GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH", NULL },
556 + { 1, GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH", NULL },
557 + { 1, GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE", NULL },
558 + { 1, GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH", NULL },
559 + { 1, GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH", NULL },
560 + { 1, GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE", NULL },
561 + { 1, GL_MAX_3D_TEXTURE_SIZE, "GL_MAX_3D_TEXTURE_SIZE", NULL },
562 +#if defined(GL_EXT_texture_array)
563 + { 1, GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, "GL_MAX_ARRAY_TEXTURE_LAYERS", "GL_EXT_texture_array" },
565 + { 2, GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS", NULL },
566 + { 2, GL_ALIASED_LINE_WIDTH_RANGE, "GL_ALIASED_LINE_WIDTH_RANGE", NULL },
567 + { 2, GL_SMOOTH_LINE_WIDTH_RANGE, "GL_SMOOTH_LINE_WIDTH_RANGE", NULL },
568 + { 2, GL_ALIASED_POINT_SIZE_RANGE, "GL_ALIASED_POINT_SIZE_RANGE", NULL },
569 + { 2, GL_SMOOTH_POINT_SIZE_RANGE, "GL_SMOOTH_POINT_SIZE_RANGE", NULL },
570 +#if defined(GL_ARB_texture_cube_map)
571 + { 1, GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", "GL_ARB_texture_cube_map" },
573 +#if defined(GL_NV_texture_rectangle)
574 + { 1, GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", "GL_NV_texture_rectangle" },
576 +#if defined(GL_ARB_multitexture)
577 + { 1, GL_MAX_TEXTURE_UNITS_ARB, "GL_MAX_TEXTURE_UNITS_ARB", "GL_ARB_multitexture" },
579 +#if defined(GL_EXT_texture_lod_bias)
580 + { 1, GL_MAX_TEXTURE_LOD_BIAS_EXT, "GL_MAX_TEXTURE_LOD_BIAS_EXT", "GL_EXT_texture_lod_bias" },
582 +#if defined(GL_EXT_texture_filter_anisotropic)
583 + { 1, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", "GL_EXT_texture_filter_anisotropic" },
585 +#if defined(GL_ARB_draw_buffers)
586 + { 1, GL_MAX_DRAW_BUFFERS_ARB, "GL_MAX_DRAW_BUFFERS_ARB", "GL_ARB_draw_buffers" },
588 +#if defined(GL_ARB_blend_func_extended)
589 + { 1, GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, "GL_MAX_DUAL_SOURCE_DRAW_BUFFERS", "GL_ARB_blend_func_extended" },
591 +#if defined (GL_ARB_framebuffer_object)
592 + { 1, GL_MAX_RENDERBUFFER_SIZE, "GL_MAX_RENDERBUFFER_SIZE", "GL_ARB_framebuffer_object" },
593 + { 1, GL_MAX_COLOR_ATTACHMENTS, "GL_MAX_COLOR_ATTACHMENTS", "GL_ARB_framebuffer_object" },
594 + { 1, GL_MAX_SAMPLES, "GL_MAX_SAMPLES", "GL_ARB_framebuffer_object" },
596 +#if defined (GL_EXT_transform_feedback)
597 + { 1, GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, "GL_MAX_TRANSFORM_FEEDBACK_BUFFERS", "GL_EXT_transform_feedback" },
598 + { 1, GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT, "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "GL_EXT_transform_feedback" },
599 + { 1, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT, "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "GL_EXT_transform_feedback", },
600 + { 1, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT, "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", "GL_EXT_transform_feedback" },
602 +#if defined (GL_ARB_texture_buffer_object)
603 + { 1, GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, "GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT", "GL_ARB_texture_buffer_object" },
604 + { 1, GL_MAX_TEXTURE_BUFFER_SIZE, "GL_MAX_TEXTURE_BUFFER_SIZE", "GL_ARB_texture_buffer_object" },
606 +#if defined (GL_ARB_texture_multisample)
607 + { 1, GL_MAX_COLOR_TEXTURE_SAMPLES, "GL_MAX_COLOR_TEXTURE_SAMPLES", "GL_ARB_texture_multisample" },
608 + { 1, GL_MAX_DEPTH_TEXTURE_SAMPLES, "GL_MAX_DEPTH_TEXTURE_SAMPLES", "GL_ARB_texture_multisample" },
609 + { 1, GL_MAX_INTEGER_SAMPLES, "GL_MAX_INTEGER_SAMPLES", "GL_ARB_texture_multisample" },
611 +#if defined (GL_ARB_uniform_buffer_object)
612 + { 1, GL_MAX_VERTEX_UNIFORM_BLOCKS, "GL_MAX_VERTEX_UNIFORM_BLOCKS", "GL_ARB_uniform_buffer_object" },
613 + { 1, GL_MAX_FRAGMENT_UNIFORM_BLOCKS, "GL_MAX_FRAGMENT_UNIFORM_BLOCKS", "GL_ARB_uniform_buffer_object" },
614 + { 1, GL_MAX_GEOMETRY_UNIFORM_BLOCKS, "GL_MAX_GEOMETRY_UNIFORM_BLOCKS" , "GL_ARB_uniform_buffer_object" },
615 + { 1, GL_MAX_COMBINED_UNIFORM_BLOCKS, "GL_MAX_COMBINED_UNIFORM_BLOCKS", "GL_ARB_uniform_buffer_object" },
616 + { 1, GL_MAX_UNIFORM_BUFFER_BINDINGS, "GL_MAX_UNIFORM_BUFFER_BINDINGS", "GL_ARB_uniform_buffer_object" },
617 + { 1, GL_MAX_UNIFORM_BLOCK_SIZE, "GL_MAX_UNIFORM_BLOCK_SIZE", "GL_ARB_uniform_buffer_object" },
618 + { 1, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, "GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "GL_ARB_uniform_buffer_object" },
619 + { 1, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, "GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "GL_ARB_uniform_buffer_object" },
620 + { 1, GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, "GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "GL_ARB_uniform_buffer_object" },
621 + { 1, GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, "GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT", "GL_ARB_uniform_buffer_object" },
623 +#if defined (GL_ARB_vertex_attrib_binding)
624 + { 1, GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET, "GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "GL_ARB_vertex_attrib_binding" },
625 + { 1, GL_MAX_VERTEX_ATTRIB_BINDINGS, "GL_MAX_VERTEX_ATTRIB_BINDINGS", "GL_ARB_vertex_attrib_binding" },
627 +#if defined(GL_VERSION_4_4)
628 + { 1, GL_MAX_VERTEX_ATTRIB_STRIDE, "GL_MAX_VERTEX_ATTRIB_STRIDE", "4.4" },
630 + { 0, (GLenum) 0, NULL, NULL }
634 + printf("%s limits:\n", oglstring);
635 + for (i = 0; limits[i].count; i++) {
636 + if (!limits[i].extension ||
637 + version_supported(limits[i].extension, version) ||
638 + extension_supported(limits[i].extension, extensions)) {
639 + glGetIntegerv(limits[i].token, max);
640 + if (glGetError() == GL_NO_ERROR) {
641 + if (limits[i].count == 1)
642 + printf(" %s = %d\n", limits[i].name, max[0]);
643 + else /* XXX fix if we ever query something with more than 2 values */
644 + printf(" %s = %d, %d\n", limits[i].name, max[0], max[1]);
649 + /* these don't fit into the above mechanism, unfortunately */
650 + if (extension_supported("GL_ARB_imaging", extensions)) {
651 + extfuncs->GetConvolutionParameteriv(GL_CONVOLUTION_2D,
652 + GL_MAX_CONVOLUTION_WIDTH, max);
653 + extfuncs->GetConvolutionParameteriv(GL_CONVOLUTION_2D,
654 + GL_MAX_CONVOLUTION_HEIGHT, max+1);
655 + printf(" GL_MAX_CONVOLUTION_WIDTH/HEIGHT = %d, %d\n", max[0], max[1]);
658 + if (extension_supported("GL_ARB_texture_compression", extensions)) {
661 + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &n);
662 + printf(" GL_NUM_COMPRESSED_TEXTURE_FORMATS = %d\n", n);
663 + formats = (GLint *) malloc(n * sizeof(GLint));
664 + glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
665 + for (i = 0; i < n; i++) {
666 + printf(" %s\n", enum_name(formats[i]));
670 +#if defined(GL_ARB_vertex_program)
671 + if (extension_supported("GL_ARB_vertex_program", extensions)) {
672 + print_program_limits(GL_VERTEX_PROGRAM_ARB, extfuncs);
675 +#if defined(GL_ARB_fragment_program)
676 + if (extension_supported("GL_ARB_fragment_program", extensions)) {
677 + print_program_limits(GL_FRAGMENT_PROGRAM_ARB, extfuncs);
680 + if (extension_supported("GL_ARB_vertex_shader", extensions)) {
681 + print_shader_limits(GL_VERTEX_SHADER_ARB);
683 + if (extension_supported("GL_ARB_fragment_shader", extensions)) {
684 + print_shader_limits(GL_FRAGMENT_SHADER_ARB);
686 + if (version >= 32) {
687 + print_shader_limits(GL_GEOMETRY_SHADER);
694 + * Return string representation for bits in a bitmask.
697 +bitmask_to_string(const struct bit_info bits[], int numBits, int mask)
699 + static char buffer[256], *p;
702 + strcpy(buffer, "(none)");
704 + for (i = 0; i < numBits; i++) {
705 + if (mask & bits[i].bit) {
708 + strcpy(p, bits[i].name);
709 + p += strlen(bits[i].name);
717 + * Return string representation for the bitmask returned by
718 + * GL_CONTEXT_PROFILE_MASK (OpenGL 3.2 or later).
721 +profile_mask_string(int mask)
723 + const static struct bit_info bits[] = {
724 +#ifdef GL_CONTEXT_CORE_PROFILE_BIT
725 + { GL_CONTEXT_CORE_PROFILE_BIT, "core profile"},
727 +#ifdef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
728 + { GL_CONTEXT_COMPATIBILITY_PROFILE_BIT, "compatibility profile" }
732 + return bitmask_to_string(bits, ELEMENTS(bits), mask);
737 + * Return string representation for the bitmask returned by
738 + * GL_CONTEXT_FLAGS (OpenGL 3.0 or later).
741 +context_flags_string(int mask)
743 + const static struct bit_info bits[] = {
744 +#ifdef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT
745 + { GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "forward-compatible" },
747 +#ifdef GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB
748 + { GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, "robust-access" },
752 + return bitmask_to_string(bits, ELEMENTS(bits), mask);
760 + printf("Usage: wglinfo [-v] [-t] [-h] [-b] [-l] [-s]\n");
762 + printf("Usage: glxinfo [-v] [-t] [-h] [-b] [-l] [-s] [-i] [-display <dname>]\n");
763 + printf("\t-display <dname>: Print GLX visuals on specified server.\n");
764 + printf("\t-i: Force an indirect rendering context.\n");
766 + printf("\t-B: brief output, print only the basics.\n");
767 + printf("\t-v: Print visuals info in verbose form.\n");
768 + printf("\t-t: Print verbose table.\n");
769 + printf("\t-h: This information.\n");
770 + printf("\t-b: Find the 'best' visual and print its number.\n");
771 + printf("\t-l: Print interesting OpenGL limits.\n");
772 + printf("\t-s: Print a single extension per line.\n");
776 +parse_args(int argc, char *argv[], struct options *options)
780 + options->mode = Normal;
781 + options->findBest = GL_FALSE;
782 + options->limits = GL_FALSE;
783 + options->singleLine = GL_FALSE;
784 + options->displayName = NULL;
785 + options->allowDirect = GL_TRUE;
787 + for (i = 1; i < argc; i++) {
789 + if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
790 + options->displayName = argv[i + 1];
793 + else if (strcmp(argv[i], "-i") == 0) {
794 + options->allowDirect = GL_FALSE;
798 + if (strcmp(argv[i], "-t") == 0) {
799 + options->mode = Wide;
801 + else if (strcmp(argv[i], "-v") == 0) {
802 + options->mode = Verbose;
804 + else if (strcmp(argv[i], "-B") == 0) {
805 + options->mode = Brief;
807 + else if (strcmp(argv[i], "-b") == 0) {
808 + options->findBest = GL_TRUE;
810 + else if (strcmp(argv[i], "-l") == 0) {
811 + options->limits = GL_TRUE;
813 + else if (strcmp(argv[i], "-h") == 0) {
817 + else if(strcmp(argv[i], "-s") == 0) {
818 + options->singleLine = GL_TRUE;
821 + printf("Unknown option `%s'\n", argv[i]);
827 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/glinfo_common.h mesa-20.2.1/src/glx/xdemos/glinfo_common.h
828 --- mesa-20.2.1-orig/src/glx/xdemos/glinfo_common.h 1969-12-31 18:00:00.000000000 -0600
829 +++ mesa-20.2.1/src/glx/xdemos/glinfo_common.h 2020-10-15 23:06:45.826695773 -0500
832 + * Copyright (C) 1999-2014 Brian Paul All Rights Reserved.
834 + * Permission is hereby granted, free of charge, to any person obtaining a
835 + * copy of this software and associated documentation files (the "Software"),
836 + * to deal in the Software without restriction, including without limitation
837 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
838 + * and/or sell copies of the Software, and to permit persons to whom the
839 + * Software is furnished to do so, subject to the following conditions:
841 + * The above copyright notice and this permission notice shall be included
842 + * in all copies or substantial portions of the Software.
844 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
845 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
846 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
847 + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
848 + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
849 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
854 + * Common code shared by glxinfo and wglinfo.
857 +#ifndef GLINFO_COMMON_H
858 +#define GLINFO_COMMON_H
862 +/* GL/glext.h is not commonly available on Windows. */
863 +#include <GL/glew.h>
866 +#include <GL/glext.h>
869 +typedef void (APIENTRY * GETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
870 +typedef const GLubyte *(APIENTRY * GETSTRINGIPROC) (GLenum name, GLuint index);
871 +typedef void (APIENTRY * GETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
875 + * Ext functions needed in common code but must be provided by
876 + * glxinfo or wglinfo.
878 +struct ext_functions
880 + GETPROGRAMIVARBPROC GetProgramivARB;
881 + GETSTRINGIPROC GetStringi;
882 + GETCONVOLUTIONPARAMETERIVPROC GetConvolutionParameteriv;
886 +#define ELEMENTS(array) (sizeof(array) / sizeof(array[0]))
908 + GLboolean findBest;
910 + GLboolean singleLine;
913 + GLboolean allowDirect;
917 +/** list of known OpenGL versions */
918 +static const struct { int major, minor; } gl_versions[] = {
941 + {0, 0} /* end of list */
946 +print_extension_list(const char *ext, GLboolean singleLine);
949 +build_core_profile_extension_list(const struct ext_functions *extfuncs);
952 +extension_supported(const char *ext, const char *extensionsList);
955 +print_limits(const char *extensions, const char *oglstring, int version,
956 + const struct ext_functions *extfuncs);
959 +bitmask_to_string(const struct bit_info bits[], int numBits, int mask);
962 +profile_mask_string(int mask);
965 +context_flags_string(int mask);
969 +parse_args(int argc, char *argv[], struct options *options);
972 +#endif /* GLINFO_COMMON_H */
973 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/glxgears.1 mesa-20.2.1/src/glx/xdemos/glxgears.1
974 --- mesa-20.2.1-orig/src/glx/xdemos/glxgears.1 1969-12-31 18:00:00.000000000 -0600
975 +++ mesa-20.2.1/src/glx/xdemos/glxgears.1 2020-10-15 23:06:45.826695773 -0500
977 +.TH glxgears 1 "2006-11-29"
979 +glxgears \- ``gears'' demo for GLX
984 +The \fIglxgears\fP program is a port of the ``gears'' demo to GLX. It displays
985 +a set of rotating gears and prints out the frame rate at regular intervals. It
986 +has become quite popular as basic benchmarking tool.
989 +.B \-display \fIdisplay\fP
990 +Specify which X display to run on.
993 +Use a stereo enabled GLX visual.
995 +.B \-samples \fIN\fP
996 +Run in multisample mode with at least N samples.
999 +Run in fullscreen mode.
1002 +Display OpenGL renderer information.
1004 +.B \-geometry \fIWxH+X+Y\fP
1007 +glxgears was written by Brian Paul <brian.paul@tungstengraphics.com>.
1009 +This manual page was written by Thierry Reding <thierry@gilfi.de>, for the
1010 +Debian project and updated by Fernando de Oliveira <famobr at yahoo dot
1011 +com dot br>, for the Linux From Scratch (LFS) project (but may be used by
1014 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/glxgears.c mesa-20.2.1/src/glx/xdemos/glxgears.c
1015 --- mesa-20.2.1-orig/src/glx/xdemos/glxgears.c 1969-12-31 18:00:00.000000000 -0600
1016 +++ mesa-20.2.1/src/glx/xdemos/glxgears.c 2020-10-15 23:06:45.826695773 -0500
1019 + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
1021 + * Permission is hereby granted, free of charge, to any person obtaining a
1022 + * copy of this software and associated documentation files (the "Software"),
1023 + * to deal in the Software without restriction, including without limitation
1024 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1025 + * and/or sell copies of the Software, and to permit persons to whom the
1026 + * Software is furnished to do so, subject to the following conditions:
1028 + * The above copyright notice and this permission notice shall be included
1029 + * in all copies or substantial portions of the Software.
1031 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1032 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1033 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1034 + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1035 + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1036 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1040 + * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
1041 + * Port by Brian Paul 23 March 2001
1043 + * See usage() below for command line options.
1048 +#include <stdlib.h>
1050 +#include <string.h>
1051 +#include <X11/Xlib.h>
1052 +#include <X11/keysym.h>
1054 +#include <GL/glx.h>
1055 +#include <GL/glxext.h>
1057 +#ifndef GLX_MESA_swap_control
1058 +#define GLX_MESA_swap_control 1
1059 +typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
1067 +/* XXX this probably isn't very portable */
1069 +#include <sys/time.h>
1070 +#include <unistd.h>
1072 +/* return current time (in seconds) */
1076 + struct timeval tv;
1078 + (void) gettimeofday(&tv, NULL );
1080 + struct timezone tz;
1081 + (void) gettimeofday(&tv, &tz);
1083 + return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
1086 +#else /*BENCHMARK*/
1092 + /* update this function for other platforms! */
1093 + static double t = 0.0;
1094 + static int warn = 1;
1096 + fprintf(stderr, "Warning: current_time() not implemented!!\n");
1102 +#endif /*BENCHMARK*/
1107 +#define M_PI 3.14159265
1111 +/** Event handler results: */
1116 +static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
1117 +static GLint gear1, gear2, gear3;
1118 +static GLfloat angle = 0.0;
1120 +static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
1121 +static GLboolean stereo = GL_FALSE; /* Enable stereo. */
1122 +static GLint samples = 0; /* Choose visual with at least N samples. */
1123 +static GLboolean animate = GL_TRUE; /* Animation */
1124 +static GLfloat eyesep = 5.0; /* Eye separation. */
1125 +static GLfloat fix_point = 40.0; /* Fixation point distance. */
1126 +static GLfloat left, right, asp; /* Stereo frustum params. */
1131 + * Draw a gear wheel. You'll probably want to call this function when
1132 + * building a display list since we do a lot of trig here.
1134 + * Input: inner_radius - radius of hole at center
1135 + * outer_radius - radius at center of teeth
1136 + * width - width of gear
1137 + * teeth - number of teeth
1138 + * tooth_depth - depth of tooth
1141 +gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
1142 + GLint teeth, GLfloat tooth_depth)
1145 + GLfloat r0, r1, r2;
1146 + GLfloat angle, da;
1147 + GLfloat u, v, len;
1149 + r0 = inner_radius;
1150 + r1 = outer_radius - tooth_depth / 2.0;
1151 + r2 = outer_radius + tooth_depth / 2.0;
1153 + da = 2.0 * M_PI / teeth / 4.0;
1155 + glShadeModel(GL_FLAT);
1157 + glNormal3f(0.0, 0.0, 1.0);
1159 + /* draw front face */
1160 + glBegin(GL_QUAD_STRIP);
1161 + for (i = 0; i <= teeth; i++) {
1162 + angle = i * 2.0 * M_PI / teeth;
1163 + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
1164 + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
1166 + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
1167 + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
1173 + /* draw front sides of teeth */
1174 + glBegin(GL_QUADS);
1175 + da = 2.0 * M_PI / teeth / 4.0;
1176 + for (i = 0; i < teeth; i++) {
1177 + angle = i * 2.0 * M_PI / teeth;
1179 + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
1180 + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
1181 + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
1183 + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
1188 + glNormal3f(0.0, 0.0, -1.0);
1190 + /* draw back face */
1191 + glBegin(GL_QUAD_STRIP);
1192 + for (i = 0; i <= teeth; i++) {
1193 + angle = i * 2.0 * M_PI / teeth;
1194 + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
1195 + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
1197 + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
1199 + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
1204 + /* draw back sides of teeth */
1205 + glBegin(GL_QUADS);
1206 + da = 2.0 * M_PI / teeth / 4.0;
1207 + for (i = 0; i < teeth; i++) {
1208 + angle = i * 2.0 * M_PI / teeth;
1210 + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
1212 + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
1214 + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
1215 + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
1219 + /* draw outward faces of teeth */
1220 + glBegin(GL_QUAD_STRIP);
1221 + for (i = 0; i < teeth; i++) {
1222 + angle = i * 2.0 * M_PI / teeth;
1224 + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
1225 + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
1226 + u = r2 * cos(angle + da) - r1 * cos(angle);
1227 + v = r2 * sin(angle + da) - r1 * sin(angle);
1228 + len = sqrt(u * u + v * v);
1231 + glNormal3f(v, -u, 0.0);
1232 + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
1233 + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
1234 + glNormal3f(cos(angle), sin(angle), 0.0);
1235 + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
1237 + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
1239 + u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
1240 + v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
1241 + glNormal3f(v, -u, 0.0);
1242 + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
1244 + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
1246 + glNormal3f(cos(angle), sin(angle), 0.0);
1249 + glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
1250 + glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
1254 + glShadeModel(GL_SMOOTH);
1256 + /* draw inside radius cylinder */
1257 + glBegin(GL_QUAD_STRIP);
1258 + for (i = 0; i <= teeth; i++) {
1259 + angle = i * 2.0 * M_PI / teeth;
1260 + glNormal3f(-cos(angle), -sin(angle), 0.0);
1261 + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
1262 + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
1271 + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1274 + glRotatef(view_rotx, 1.0, 0.0, 0.0);
1275 + glRotatef(view_roty, 0.0, 1.0, 0.0);
1276 + glRotatef(view_rotz, 0.0, 0.0, 1.0);
1279 + glTranslatef(-3.0, -2.0, 0.0);
1280 + glRotatef(angle, 0.0, 0.0, 1.0);
1281 + glCallList(gear1);
1285 + glTranslatef(3.1, -2.0, 0.0);
1286 + glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
1287 + glCallList(gear2);
1291 + glTranslatef(-3.1, 4.2, 0.0);
1292 + glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
1293 + glCallList(gear3);
1304 + /* First left eye. */
1305 + glDrawBuffer(GL_BACK_LEFT);
1307 + glMatrixMode(GL_PROJECTION);
1309 + glFrustum(left, right, -asp, asp, 5.0, 60.0);
1311 + glMatrixMode(GL_MODELVIEW);
1314 + glTranslated(+0.5 * eyesep, 0.0, 0.0);
1318 + /* Then right eye. */
1319 + glDrawBuffer(GL_BACK_RIGHT);
1321 + glMatrixMode(GL_PROJECTION);
1323 + glFrustum(-right, -left, -asp, asp, 5.0, 60.0);
1325 + glMatrixMode(GL_MODELVIEW);
1328 + glTranslated(-0.5 * eyesep, 0.0, 0.0);
1338 +/** Draw single frame, do SwapBuffers, compute FPS */
1340 +draw_frame(Display *dpy, Window win)
1342 + static int frames = 0;
1343 + static double tRot0 = -1.0, tRate0 = -1.0;
1344 + double dt, t = current_time();
1352 + /* advance rotation for next frame */
1353 + angle += 70.0 * dt; /* 70 degrees per second */
1354 + if (angle > 3600.0)
1359 + glXSwapBuffers(dpy, win);
1365 + if (t - tRate0 >= 5.0) {
1366 + GLfloat seconds = t - tRate0;
1367 + GLfloat fps = frames / seconds;
1368 + printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
1377 +/* new window size or exposure */
1379 +reshape(int width, int height)
1381 + glViewport(0, 0, (GLint) width, (GLint) height);
1386 + asp = (GLfloat) height / (GLfloat) width;
1387 + w = fix_point * (1.0 / 5.0);
1389 + left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
1390 + right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
1393 + GLfloat h = (GLfloat) height / (GLfloat) width;
1395 + glMatrixMode(GL_PROJECTION);
1397 + glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
1400 + glMatrixMode(GL_MODELVIEW);
1402 + glTranslatef(0.0, 0.0, -40.0);
1410 + static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
1411 + static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
1412 + static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
1413 + static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
1415 + glLightfv(GL_LIGHT0, GL_POSITION, pos);
1416 + glEnable(GL_CULL_FACE);
1417 + glEnable(GL_LIGHTING);
1418 + glEnable(GL_LIGHT0);
1419 + glEnable(GL_DEPTH_TEST);
1421 + /* make the gears */
1422 + gear1 = glGenLists(1);
1423 + glNewList(gear1, GL_COMPILE);
1424 + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
1425 + gear(1.0, 4.0, 1.0, 20, 0.7);
1428 + gear2 = glGenLists(1);
1429 + glNewList(gear2, GL_COMPILE);
1430 + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
1431 + gear(0.5, 2.0, 2.0, 10, 0.7);
1434 + gear3 = glGenLists(1);
1435 + glNewList(gear3, GL_COMPILE);
1436 + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
1437 + gear(1.3, 2.0, 0.5, 10, 0.7);
1440 + glEnable(GL_NORMALIZE);
1445 + * Remove window border/decorations.
1448 +no_border( Display *dpy, Window w)
1450 + static const unsigned MWM_HINTS_DECORATIONS = (1 << 1);
1451 + static const int PROP_MOTIF_WM_HINTS_ELEMENTS = 5;
1455 + unsigned long flags;
1456 + unsigned long functions;
1457 + unsigned long decorations;
1459 + unsigned long status;
1460 + } PropMotifWmHints;
1462 + PropMotifWmHints motif_hints;
1463 + Atom prop, proptype;
1464 + unsigned long flags = 0;
1466 + /* setup the property */
1467 + motif_hints.flags = MWM_HINTS_DECORATIONS;
1468 + motif_hints.decorations = flags;
1470 + /* get the atom for the property */
1471 + prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );
1473 + /* something went wrong! */
1477 + /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
1480 + XChangeProperty( dpy, w, /* display, window */
1481 + prop, proptype, /* property, type */
1482 + 32, /* format: 32-bit datums */
1483 + PropModeReplace, /* mode */
1484 + (unsigned char *) &motif_hints, /* data */
1485 + PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */
1491 + * Create an RGB, double-buffered window.
1492 + * Return the window and context handles.
1495 +make_window( Display *dpy, const char *name,
1496 + int x, int y, int width, int height,
1497 + Window *winRet, GLXContext *ctxRet, VisualID *visRet)
1503 + XSetWindowAttributes attr;
1504 + unsigned long mask;
1508 + XVisualInfo *visinfo;
1510 + /* Singleton attributes. */
1511 + attribs[i++] = GLX_RGBA;
1512 + attribs[i++] = GLX_DOUBLEBUFFER;
1514 + attribs[i++] = GLX_STEREO;
1516 + /* Key/value attributes. */
1517 + attribs[i++] = GLX_RED_SIZE;
1519 + attribs[i++] = GLX_GREEN_SIZE;
1521 + attribs[i++] = GLX_BLUE_SIZE;
1523 + attribs[i++] = GLX_DEPTH_SIZE;
1525 + if (samples > 0) {
1526 + attribs[i++] = GLX_SAMPLE_BUFFERS;
1528 + attribs[i++] = GLX_SAMPLES;
1529 + attribs[i++] = samples;
1532 + attribs[i++] = None;
1534 + scrnum = DefaultScreen( dpy );
1535 + root = RootWindow( dpy, scrnum );
1537 + visinfo = glXChooseVisual(dpy, scrnum, attribs);
1539 + printf("Error: couldn't get an RGB, Double-buffered");
1541 + printf(", Stereo");
1543 + printf(", Multisample");
1544 + printf(" visual\n");
1548 + /* window attributes */
1549 + attr.background_pixel = 0;
1550 + attr.border_pixel = 0;
1551 + attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
1552 + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
1553 + /* XXX this is a bad way to get a borderless window! */
1554 + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
1556 + win = XCreateWindow( dpy, root, x, y, width, height,
1557 + 0, visinfo->depth, InputOutput,
1558 + visinfo->visual, mask, &attr );
1561 + no_border(dpy, win);
1563 + /* set hints and properties */
1565 + XSizeHints sizehints;
1568 + sizehints.width = width;
1569 + sizehints.height = height;
1570 + sizehints.flags = USSize | USPosition;
1571 + XSetNormalHints(dpy, win, &sizehints);
1572 + XSetStandardProperties(dpy, win, name, name,
1573 + None, (char **)NULL, 0, &sizehints);
1576 + ctx = glXCreateContext( dpy, visinfo, NULL, True );
1578 + printf("Error: glXCreateContext failed\n");
1584 + *visRet = visinfo->visualid;
1591 + * Determine whether or not a GLX extension is supported.
1594 +is_glx_extension_supported(Display *dpy, const char *query)
1596 + const int scrnum = DefaultScreen(dpy);
1597 + const char *glx_extensions = NULL;
1598 + const size_t len = strlen(query);
1601 + if (glx_extensions == NULL) {
1602 + glx_extensions = glXQueryExtensionsString(dpy, scrnum);
1605 + ptr = strstr(glx_extensions, query);
1606 + return ((ptr != NULL) && ((ptr[len] == ' ') || (ptr[len] == '\0')));
1611 + * Attempt to determine whether or not the display is synched to vblank.
1614 +query_vsync(Display *dpy, GLXDrawable drawable)
1618 +#if defined(GLX_EXT_swap_control)
1619 + if (is_glx_extension_supported(dpy, "GLX_EXT_swap_control")) {
1620 + unsigned int tmp = -1;
1621 + glXQueryDrawable(dpy, drawable, GLX_SWAP_INTERVAL_EXT, &tmp);
1625 + if (is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
1626 + PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA =
1627 + (PFNGLXGETSWAPINTERVALMESAPROC)
1628 + glXGetProcAddressARB((const GLubyte *) "glXGetSwapIntervalMESA");
1630 + interval = (*pglXGetSwapIntervalMESA)();
1631 + } else if (is_glx_extension_supported(dpy, "GLX_SGI_swap_control")) {
1632 + /* The default swap interval with this extension is 1. Assume that it
1633 + * is set to the default.
1635 + * Many Mesa-based drivers default to 0, but all of these drivers also
1636 + * export GLX_MESA_swap_control. In that case, this branch will never
1637 + * be taken, and the correct result should be reported.
1643 + if (interval > 0) {
1644 + printf("Running synchronized to the vertical refresh. The framerate should be\n");
1645 + if (interval == 1) {
1646 + printf("approximately the same as the monitor refresh rate.\n");
1647 + } else if (interval > 1) {
1648 + printf("approximately 1/%d the monitor refresh rate.\n",
1655 + * Handle one X event.
1656 + * \return NOP, EXIT or DRAW
1659 +handle_event(Display *dpy, Window win, XEvent *event)
1664 + switch (event->type) {
1667 + case ConfigureNotify:
1668 + reshape(event->xconfigure.width, event->xconfigure.height);
1674 + code = XLookupKeysym(&event->xkey, 0);
1675 + if (code == XK_Left) {
1678 + else if (code == XK_Right) {
1681 + else if (code == XK_Up) {
1684 + else if (code == XK_Down) {
1688 + XLookupString(&event->xkey, buffer, sizeof(buffer),
1690 + if (buffer[0] == 27) {
1694 + else if (buffer[0] == 'a' || buffer[0] == 'A') {
1695 + animate = !animate;
1706 +event_loop(Display *dpy, Window win)
1710 + while (!animate || XPending(dpy) > 0) {
1712 + XNextEvent(dpy, &event);
1713 + op = handle_event(dpy, win, &event);
1716 + else if (op == DRAW)
1720 + draw_frame(dpy, win);
1728 + printf("Usage:\n");
1729 + printf(" -display <displayname> set the display to run on\n");
1730 + printf(" -stereo run in stereo mode\n");
1731 + printf(" -samples N run in multisample mode with at least N samples\n");
1732 + printf(" -fullscreen run in fullscreen mode\n");
1733 + printf(" -info display OpenGL renderer info\n");
1734 + printf(" -geometry WxH+X+Y window geometry\n");
1739 +main(int argc, char *argv[])
1741 + unsigned int winWidth = 300, winHeight = 300;
1746 + char *dpyName = NULL;
1747 + GLboolean printInfo = GL_FALSE;
1751 + for (i = 1; i < argc; i++) {
1752 + if (strcmp(argv[i], "-display") == 0) {
1753 + dpyName = argv[i+1];
1756 + else if (strcmp(argv[i], "-info") == 0) {
1757 + printInfo = GL_TRUE;
1759 + else if (strcmp(argv[i], "-stereo") == 0) {
1762 + else if (i < argc-1 && strcmp(argv[i], "-samples") == 0) {
1763 + samples = strtod(argv[i+1], NULL );
1766 + else if (strcmp(argv[i], "-fullscreen") == 0) {
1767 + fullscreen = GL_TRUE;
1769 + else if (i < argc-1 && strcmp(argv[i], "-geometry") == 0) {
1770 + XParseGeometry(argv[i+1], &x, &y, &winWidth, &winHeight);
1779 + dpy = XOpenDisplay(dpyName);
1781 + printf("Error: couldn't open display %s\n",
1782 + dpyName ? dpyName : getenv("DISPLAY"));
1787 + int scrnum = DefaultScreen(dpy);
1790 + winWidth = DisplayWidth(dpy, scrnum);
1791 + winHeight = DisplayHeight(dpy, scrnum);
1794 + make_window(dpy, "glxgears", x, y, winWidth, winHeight, &win, &ctx, &visId);
1795 + XMapWindow(dpy, win);
1796 + glXMakeCurrent(dpy, win, ctx);
1797 + query_vsync(dpy, win);
1800 + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
1801 + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
1802 + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
1803 + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
1804 + printf("VisualID %d, 0x%x\n", (int) visId, (int) visId);
1809 + /* Set initial projection/viewing transformation.
1810 + * We can't be sure we'll get a ConfigureNotify event when the window
1813 + reshape(winWidth, winHeight);
1815 + event_loop(dpy, win);
1817 + glDeleteLists(gear1, 1);
1818 + glDeleteLists(gear2, 1);
1819 + glDeleteLists(gear3, 1);
1820 + glXMakeCurrent(dpy, None, NULL);
1821 + glXDestroyContext(dpy, ctx);
1822 + XDestroyWindow(dpy, win);
1823 + XCloseDisplay(dpy);
1827 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/glxinfo.1 mesa-20.2.1/src/glx/xdemos/glxinfo.1
1828 --- mesa-20.2.1-orig/src/glx/xdemos/glxinfo.1 1969-12-31 18:00:00.000000000 -0600
1829 +++ mesa-20.2.1/src/glx/xdemos/glxinfo.1 2020-10-15 23:06:45.826695773 -0500
1831 +.TH glxinfo 1 "2006-11-29"
1833 +glxinfo \- show information about the GLX implementation
1838 +The \fIglxinfo\fP program shows information about the OpenGL and GLX
1839 +implementations running on a given X display.
1841 +The information includes details about the server- and client-side GLX
1842 +implementation, the OpenGL and GLU implementations as well as a list
1843 +of available GLX visuals.
1847 +Print visuals info in verbose form.
1850 +Print verbose table.
1852 +.B \-display \fIdisplay\fP
1853 +Specify the X display to interrogate.
1856 +Print usage information.
1859 +Force an indirect rendering context.
1862 +Find the "best" visual and print its number.
1865 +Print interesting OpenGL limits.
1868 +Print a single extension per line.
1870 +glxinfo was written by Brian Paul <brian.paul@tungstengraphics.com>.
1872 +This manual page was written by Thierry Reding <thierry@gilfi.de>, for the
1873 +Debian project and updated by Fernando de Oliveira <famobr at yahoo dot
1874 +com dot br>, for the Linux From Scratch (LFS) project (but may be used by
1877 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/glxinfo.c mesa-20.2.1/src/glx/xdemos/glxinfo.c
1878 --- mesa-20.2.1-orig/src/glx/xdemos/glxinfo.c 1969-12-31 18:00:00.000000000 -0600
1879 +++ mesa-20.2.1/src/glx/xdemos/glxinfo.c 2020-10-15 23:06:45.826695773 -0500
1882 + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
1884 + * Permission is hereby granted, free of charge, to any person obtaining a
1885 + * copy of this software and associated documentation files (the "Software"),
1886 + * to deal in the Software without restriction, including without limitation
1887 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1888 + * and/or sell copies of the Software, and to permit persons to whom the
1889 + * Software is furnished to do so, subject to the following conditions:
1891 + * The above copyright notice and this permission notice shall be included
1892 + * in all copies or substantial portions of the Software.
1894 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1895 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1896 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1897 + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1898 + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1899 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1904 + * This program is a work-alike of the IRIX glxinfo program.
1905 + * Command line options:
1906 + * -t print wide table
1907 + * -v print verbose information
1908 + * -display DisplayName specify the X display to interogate
1909 + * -B brief, print only the basics
1910 + * -b only print ID of "best" visual on screen 0
1911 + * -i use indirect rendering connection only
1912 + * -l print interesting OpenGL limits (added 5 Sep 2002)
1914 + * Brian Paul 26 January 2000
1917 +#define GLX_GLXEXT_PROTOTYPES
1918 +#define GL_GLEXT_PROTOTYPES
1920 +#include <assert.h>
1921 +#include <X11/Xlib.h>
1922 +#include <X11/Xutil.h>
1924 +#include <GL/glx.h>
1926 +#include <string.h>
1927 +#include <stdlib.h>
1928 +#include "glinfo_common.h"
1931 +#ifndef GLX_NONE_EXT
1932 +#define GLX_NONE_EXT 0x8000
1935 +#ifndef GLX_TRANSPARENT_RGB
1936 +#define GLX_TRANSPARENT_RGB 0x8008
1939 +#ifndef GLX_RGBA_BIT
1940 +#define GLX_RGBA_BIT 0x00000001
1943 +#ifndef GLX_COLOR_INDEX_BIT
1944 +#define GLX_COLOR_INDEX_BIT 0x00000002
1948 +struct visual_attribs
1950 + /* X visual attribs */
1951 + int id; /* May be visual ID or FBConfig ID */
1952 + int vis_id; /* Visual ID. Only set for FBConfigs */
1955 + int redMask, greenMask, blueMask;
1959 + /* GL visual attribs */
1962 + int transparentType;
1963 + int transparentRedValue;
1964 + int transparentGreenValue;
1965 + int transparentBlueValue;
1966 + int transparentAlphaValue;
1967 + int transparentIndexValue;
1974 + int redSize, greenSize, blueSize, alphaSize;
1977 + int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize;
1978 + int numSamples, numMultisample;
1980 + int floatComponents;
1981 + int packedfloatComponents;
1987 + * Version of the context that was created
1989 + * 20, 21, 30, 31, 32, etc.
1991 +static int version;
1994 + * GL Error checking/warning.
1997 +CheckError(int line)
2002 + printf("Warning: GL error 0x%x at line %d\n", n, line);
2007 +print_display_info(Display *dpy)
2009 + printf("name of display: %s\n", DisplayString(dpy));
2014 + * Choose a simple FB Config.
2016 +static GLXFBConfig *
2017 +choose_fb_config(Display *dpy, int scrnum)
2019 + int fbAttribSingle[] = {
2020 + GLX_RENDER_TYPE, GLX_RGBA_BIT,
2022 + GLX_GREEN_SIZE, 1,
2024 + GLX_DOUBLEBUFFER, False,
2026 + int fbAttribDouble[] = {
2027 + GLX_RENDER_TYPE, GLX_RGBA_BIT,
2029 + GLX_GREEN_SIZE, 1,
2031 + GLX_DOUBLEBUFFER, True,
2033 + GLXFBConfig *configs;
2036 + configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs);
2038 + configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs);
2044 +static Bool CreateContextErrorFlag;
2047 +create_context_error_handler(Display *dpy, XErrorEvent *error)
2050 + (void) error->error_code;
2051 + CreateContextErrorFlag = True;
2057 + * Try to create a GLX context of the given version with flags/options.
2058 + * Note: A version number is required in order to get a core profile
2059 + * (at least w/ NVIDIA).
2062 +create_context_flags(Display *dpy, GLXFBConfig fbconfig, int major, int minor,
2063 + int contextFlags, int profileMask, Bool direct)
2065 +#ifdef GLX_ARB_create_context
2066 + static PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB_func = 0;
2067 + static Bool firstCall = True;
2068 + int (*old_handler)(Display *, XErrorEvent *);
2069 + GLXContext context;
2074 + /* See if we have GLX_ARB_create_context_profile and get pointer to
2075 + * glXCreateContextAttribsARB() function.
2077 + const char *glxExt = glXQueryExtensionsString(dpy, 0);
2078 + if (extension_supported("GLX_ARB_create_context_profile", glxExt)) {
2079 + glXCreateContextAttribsARB_func = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
2080 + glXGetProcAddress((const GLubyte *) "glXCreateContextAttribsARB");
2082 + firstCall = False;
2085 + if (!glXCreateContextAttribsARB_func)
2088 + /* setup attribute array */
2090 + attribs[n++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
2091 + attribs[n++] = major;
2092 + attribs[n++] = GLX_CONTEXT_MINOR_VERSION_ARB;
2093 + attribs[n++] = minor;
2095 + if (contextFlags) {
2096 + attribs[n++] = GLX_CONTEXT_FLAGS_ARB;
2097 + attribs[n++] = contextFlags;
2099 +#ifdef GLX_ARB_create_context_profile
2100 + if (profileMask) {
2101 + attribs[n++] = GLX_CONTEXT_PROFILE_MASK_ARB;
2102 + attribs[n++] = profileMask;
2107 + /* install X error handler */
2108 + old_handler = XSetErrorHandler(create_context_error_handler);
2109 + CreateContextErrorFlag = False;
2111 + /* try creating context */
2112 + context = glXCreateContextAttribsARB_func(dpy,
2114 + 0, /* share_context */
2118 + /* restore error handler */
2119 + XSetErrorHandler(old_handler);
2121 + if (CreateContextErrorFlag)
2124 + if (context && direct) {
2125 + if (!glXIsDirect(dpy, context)) {
2126 + glXDestroyContext(dpy, context);
2139 + * Try to create a GLX context of the newest version.
2142 +create_context_with_config(Display *dpy, GLXFBConfig config,
2143 + Bool coreProfile, Bool es2Profile, Bool direct)
2145 + GLXContext ctx = 0;
2147 + if (coreProfile) {
2148 + /* Try to create a core profile, starting with the newest version of
2149 + * GL that we're aware of. If we don't specify the version
2152 + for (i = 0; gl_versions[i].major > 0; i++) {
2153 + /* don't bother below GL 3.0 */
2154 + if (gl_versions[i].major == 3 &&
2155 + gl_versions[i].minor == 0)
2157 + ctx = create_context_flags(dpy, config,
2158 + gl_versions[i].major,
2159 + gl_versions[i].minor,
2161 + GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
2166 + /* couldn't get core profile context */
2171 +#ifdef GLX_CONTEXT_ES2_PROFILE_BIT_EXT
2172 + if (extension_supported("GLX_EXT_create_context_es2_profile",
2173 + glXQueryExtensionsString(dpy, 0))) {
2174 + ctx = create_context_flags(dpy, config, 2, 0, 0x0,
2175 + GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
2183 + /* GLX should return a context of the latest GL version that supports
2184 + * the full profile.
2186 + ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, direct);
2188 + /* make sure the context is direct, if direct was requested */
2189 + if (ctx && direct) {
2190 + if (!glXIsDirect(dpy, ctx)) {
2191 + glXDestroyContext(dpy, ctx);
2200 +static XVisualInfo *
2201 +choose_xvisinfo(Display *dpy, int scrnum)
2203 + int attribSingle[] = {
2206 + GLX_GREEN_SIZE, 1,
2209 + int attribDouble[] = {
2212 + GLX_GREEN_SIZE, 1,
2216 + XVisualInfo *visinfo;
2218 + visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
2220 + visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
2227 +query_renderer(void)
2229 +#ifdef GLX_MESA_query_renderer
2230 + PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC queryInteger;
2231 + PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC queryString;
2232 + unsigned int v[3];
2234 + queryInteger = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)
2235 + glXGetProcAddressARB((const GLubyte *)
2236 + "glXQueryCurrentRendererIntegerMESA");
2237 + queryString = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)
2238 + glXGetProcAddressARB((const GLubyte *)
2239 + "glXQueryCurrentRendererStringMESA");
2241 + printf("Extended renderer info (GLX_MESA_query_renderer):\n");
2242 + queryInteger(GLX_RENDERER_VENDOR_ID_MESA, v);
2243 + printf(" Vendor: %s (0x%x)\n",
2244 + queryString(GLX_RENDERER_VENDOR_ID_MESA), *v);
2245 + queryInteger(GLX_RENDERER_DEVICE_ID_MESA, v);
2246 + printf(" Device: %s (0x%x)\n",
2247 + queryString(GLX_RENDERER_DEVICE_ID_MESA), *v);
2248 + queryInteger(GLX_RENDERER_VERSION_MESA, v);
2249 + printf(" Version: %d.%d.%d\n", v[0], v[1], v[2]);
2250 + queryInteger(GLX_RENDERER_ACCELERATED_MESA, v);
2251 + printf(" Accelerated: %s\n", *v ? "yes" : "no");
2252 + queryInteger(GLX_RENDERER_VIDEO_MEMORY_MESA, v);
2253 + printf(" Video memory: %dMB\n", *v);
2254 + queryInteger(GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA, v);
2255 + printf(" Unified memory: %s\n", *v ? "yes" : "no");
2256 + queryInteger(GLX_RENDERER_PREFERRED_PROFILE_MESA, v);
2257 + printf(" Preferred profile: %s (0x%x)\n",
2258 + *v == GLX_CONTEXT_CORE_PROFILE_BIT_ARB ? "core" :
2259 + *v == GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB ? "compat" :
2261 + queryInteger(GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA, v);
2262 + printf(" Max core profile version: %d.%d\n", v[0], v[1]);
2263 + queryInteger(GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA, v);
2264 + printf(" Max compat profile version: %d.%d\n", v[0], v[1]);
2265 + queryInteger(GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA, v);
2266 + printf(" Max GLES1 profile version: %d.%d\n", v[0], v[1]);
2267 + queryInteger(GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA, v);
2268 + printf(" Max GLES[23] profile version: %d.%d\n", v[0], v[1]);
2274 +print_screen_info(Display *dpy, int scrnum,
2275 + const struct options *opts,
2276 + Bool coreProfile, Bool es2Profile, Bool limits,
2280 + XSetWindowAttributes attr;
2281 + unsigned long mask;
2283 + GLXContext ctx = NULL;
2284 + XVisualInfo *visinfo;
2285 + int width = 100, height = 100;
2286 + GLXFBConfig *fbconfigs;
2287 + const char *oglstring = coreProfile ? "OpenGL core profile" :
2288 + es2Profile ? "OpenGL ES profile" : "OpenGL";
2290 + root = RootWindow(dpy, scrnum);
2293 + * Choose FBConfig or XVisualInfo and create a context.
2295 + fbconfigs = choose_fb_config(dpy, scrnum);
2297 + ctx = create_context_with_config(dpy, fbconfigs[0],
2298 + coreProfile, es2Profile,
2299 + opts->allowDirect);
2300 + if (!ctx && opts->allowDirect && !coreProfile) {
2301 + /* try indirect */
2302 + ctx = create_context_with_config(dpy, fbconfigs[0],
2303 + coreProfile, es2Profile, False);
2306 + visinfo = glXGetVisualFromFBConfig(dpy, fbconfigs[0]);
2309 + else if (!coreProfile && !es2Profile) {
2310 + visinfo = choose_xvisinfo(dpy, scrnum);
2312 + ctx = glXCreateContext(dpy, visinfo, NULL, opts->allowDirect);
2316 + if (!visinfo && !coreProfile && !es2Profile) {
2317 + fprintf(stderr, "Error: couldn't find RGB GLX visual or fbconfig\n");
2322 + if (!coreProfile && !es2Profile)
2323 + fprintf(stderr, "Error: glXCreateContext failed\n");
2329 + * Create a window so that we can just bind the context.
2331 + attr.background_pixel = 0;
2332 + attr.border_pixel = 0;
2333 + attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
2334 + attr.event_mask = StructureNotifyMask | ExposureMask;
2335 + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
2336 + win = XCreateWindow(dpy, root, 0, 0, width, height,
2337 + 0, visinfo->depth, InputOutput,
2338 + visinfo->visual, mask, &attr);
2340 + if (glXMakeCurrent(dpy, win, ctx)) {
2341 + const char *serverVendor = glXQueryServerString(dpy, scrnum, GLX_VENDOR);
2342 + const char *serverVersion = glXQueryServerString(dpy, scrnum, GLX_VERSION);
2343 + const char *serverExtensions = glXQueryServerString(dpy, scrnum, GLX_EXTENSIONS);
2344 + const char *clientVendor = glXGetClientString(dpy, GLX_VENDOR);
2345 + const char *clientVersion = glXGetClientString(dpy, GLX_VERSION);
2346 + const char *clientExtensions = glXGetClientString(dpy, GLX_EXTENSIONS);
2347 + const char *glxExtensions = glXQueryExtensionsString(dpy, scrnum);
2348 + const char *glVendor = (const char *) glGetString(GL_VENDOR);
2349 + const char *glRenderer = (const char *) glGetString(GL_RENDERER);
2350 + const char *glVersion = (const char *) glGetString(GL_VERSION);
2351 + char *glExtensions = NULL;
2352 + int glxVersionMajor = 0;
2353 + int glxVersionMinor = 0;
2354 + char *displayName = NULL;
2355 + char *colon = NULL, *period = NULL;
2356 + struct ext_functions extfuncs;
2358 + CheckError(__LINE__);
2360 + /* Get some ext functions */
2361 + extfuncs.GetProgramivARB = (GETPROGRAMIVARBPROC)
2362 + glXGetProcAddressARB((GLubyte *) "glGetProgramivARB");
2363 + extfuncs.GetStringi = (GETSTRINGIPROC)
2364 + glXGetProcAddressARB((GLubyte *) "glGetStringi");
2365 + extfuncs.GetConvolutionParameteriv = (GETCONVOLUTIONPARAMETERIVPROC)
2366 + glXGetProcAddressARB((GLubyte *) "glGetConvolutionParameteriv");
2368 + if (!glXQueryVersion(dpy, & glxVersionMajor, & glxVersionMinor)) {
2369 + fprintf(stderr, "Error: glXQueryVersion failed\n");
2373 + /* Get list of GL extensions */
2374 + if (coreProfile && extfuncs.GetStringi)
2375 + glExtensions = build_core_profile_extension_list(&extfuncs);
2376 + if (!glExtensions) {
2377 + coreProfile = False;
2378 + glExtensions = (char *) glGetString(GL_EXTENSIONS);
2381 + CheckError(__LINE__);
2383 + if (!coreWorked) {
2384 + /* Strip the screen number from the display name, if present. */
2385 + if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {
2386 + fprintf(stderr, "Error: malloc() failed\n");
2389 + strcpy(displayName, DisplayString(dpy));
2390 + colon = strrchr(displayName, ':');
2392 + period = strchr(colon, '.');
2397 + printf("display: %s screen: %d\n", displayName, scrnum);
2398 + free(displayName);
2399 + printf("direct rendering: ");
2400 + if (glXIsDirect(dpy, ctx)) {
2404 + if (!opts->allowDirect) {
2405 + printf("No (-i specified)\n");
2407 + else if (getenv("LIBGL_ALWAYS_INDIRECT")) {
2408 + printf("No (LIBGL_ALWAYS_INDIRECT set)\n");
2411 + printf("No (If you want to find out why, try setting "
2412 + "LIBGL_DEBUG=verbose)\n");
2415 + if (opts->mode != Brief) {
2416 + printf("server glx vendor string: %s\n", serverVendor);
2417 + printf("server glx version string: %s\n", serverVersion);
2418 + printf("server glx extensions:\n");
2419 + print_extension_list(serverExtensions, opts->singleLine);
2420 + printf("client glx vendor string: %s\n", clientVendor);
2421 + printf("client glx version string: %s\n", clientVersion);
2422 + printf("client glx extensions:\n");
2423 + print_extension_list(clientExtensions, opts->singleLine);
2424 + printf("GLX version: %u.%u\n", glxVersionMajor, glxVersionMinor);
2425 + printf("GLX extensions:\n");
2426 + print_extension_list(glxExtensions, opts->singleLine);
2428 + if (strstr(glxExtensions, "GLX_MESA_query_renderer"))
2430 + printf("OpenGL vendor string: %s\n", glVendor);
2431 + printf("OpenGL renderer string: %s\n", glRenderer);
2435 + printf("%s version string: %s\n", oglstring, glVersion);
2437 + version = (glVersion[0] - '0') * 10 + (glVersion[2] - '0');
2439 + CheckError(__LINE__);
2441 +#ifdef GL_VERSION_2_0
2442 + if (version >= 20) {
2443 + char *v = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
2444 + printf("%s shading language version string: %s\n", oglstring, v);
2447 + CheckError(__LINE__);
2448 +#ifdef GL_VERSION_3_0
2449 + if (version >= 30 && !es2Profile) {
2451 + glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
2452 + printf("%s context flags: %s\n", oglstring, context_flags_string(flags));
2455 + CheckError(__LINE__);
2456 +#ifdef GL_VERSION_3_2
2457 + if (version >= 32 && !es2Profile) {
2459 + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
2460 + printf("%s profile mask: %s\n", oglstring, profile_mask_string(mask));
2464 + CheckError(__LINE__);
2466 + if (opts->mode != Brief) {
2467 + printf("%s extensions:\n", oglstring);
2468 + print_extension_list(glExtensions, opts->singleLine);
2472 + print_limits(glExtensions, oglstring, version, &extfuncs);
2476 + free(glExtensions);
2479 + fprintf(stderr, "Error: glXMakeCurrent failed\n");
2482 + glXDestroyContext(dpy, ctx);
2484 + XDestroyWindow(dpy, win);
2490 +static const char *
2491 +visual_class_name(int cls)
2495 + return "StaticColor";
2497 + return "PseudoColor";
2499 + return "StaticGray";
2501 + return "GrayScale";
2503 + return "TrueColor";
2505 + return "DirectColor";
2511 +static const char *
2512 +visual_drawable_type(int type)
2514 + const static struct bit_info bits[] = {
2515 + { GLX_WINDOW_BIT, "window" },
2516 + { GLX_PIXMAP_BIT, "pixmap" },
2517 + { GLX_PBUFFER_BIT, "pbuffer" }
2520 + return bitmask_to_string(bits, ELEMENTS(bits), type);
2523 +static const char *
2524 +visual_class_abbrev(int cls)
2544 +static const char *
2545 +visual_render_type_name(int type)
2548 + case GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT:
2550 + case GLX_RGBA_FLOAT_BIT_ARB:
2552 + case GLX_RGBA_BIT:
2554 + case GLX_COLOR_INDEX_BIT:
2556 + case GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT:
2563 +static const char *
2564 +caveat_string(int caveat)
2567 +#ifdef GLX_EXT_visual_rating
2568 + case GLX_SLOW_VISUAL_EXT:
2570 + case GLX_NON_CONFORMANT_VISUAL_EXT:
2572 + case GLX_NONE_EXT:
2573 + /* fall-through */
2576 + /* fall-through */
2584 +get_visual_attribs(Display *dpy, XVisualInfo *vInfo,
2585 + struct visual_attribs *attribs)
2587 + const char *ext = glXQueryExtensionsString(dpy, vInfo->screen);
2590 + memset(attribs, 0, sizeof(struct visual_attribs));
2592 + attribs->id = vInfo->visualid;
2593 +#if defined(__cplusplus) || defined(c_plusplus)
2594 + attribs->klass = vInfo->c_class;
2596 + attribs->klass = vInfo->class;
2598 + attribs->depth = vInfo->depth;
2599 + attribs->redMask = vInfo->red_mask;
2600 + attribs->greenMask = vInfo->green_mask;
2601 + attribs->blueMask = vInfo->blue_mask;
2602 + attribs->colormapSize = vInfo->colormap_size;
2603 + attribs->bitsPerRGB = vInfo->bits_per_rgb;
2605 + if (glXGetConfig(dpy, vInfo, GLX_USE_GL, &attribs->supportsGL) != 0 ||
2606 + !attribs->supportsGL)
2608 + glXGetConfig(dpy, vInfo, GLX_BUFFER_SIZE, &attribs->bufferSize);
2609 + glXGetConfig(dpy, vInfo, GLX_LEVEL, &attribs->level);
2610 + glXGetConfig(dpy, vInfo, GLX_RGBA, &rgba);
2612 + attribs->render_type = GLX_RGBA_BIT;
2614 + attribs->render_type = GLX_COLOR_INDEX_BIT;
2616 + glXGetConfig(dpy, vInfo, GLX_DRAWABLE_TYPE, &attribs->drawableType);
2617 + glXGetConfig(dpy, vInfo, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
2618 + glXGetConfig(dpy, vInfo, GLX_STEREO, &attribs->stereo);
2619 + glXGetConfig(dpy, vInfo, GLX_AUX_BUFFERS, &attribs->auxBuffers);
2620 + glXGetConfig(dpy, vInfo, GLX_RED_SIZE, &attribs->redSize);
2621 + glXGetConfig(dpy, vInfo, GLX_GREEN_SIZE, &attribs->greenSize);
2622 + glXGetConfig(dpy, vInfo, GLX_BLUE_SIZE, &attribs->blueSize);
2623 + glXGetConfig(dpy, vInfo, GLX_ALPHA_SIZE, &attribs->alphaSize);
2624 + glXGetConfig(dpy, vInfo, GLX_DEPTH_SIZE, &attribs->depthSize);
2625 + glXGetConfig(dpy, vInfo, GLX_STENCIL_SIZE, &attribs->stencilSize);
2626 + glXGetConfig(dpy, vInfo, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize);
2627 + glXGetConfig(dpy, vInfo, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize);
2628 + glXGetConfig(dpy, vInfo, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize);
2629 + glXGetConfig(dpy, vInfo, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize);
2631 + /* get transparent pixel stuff */
2632 + glXGetConfig(dpy, vInfo,GLX_TRANSPARENT_TYPE, &attribs->transparentType);
2633 + if (attribs->transparentType == GLX_TRANSPARENT_RGB) {
2634 + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue);
2635 + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue);
2636 + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue);
2637 + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue);
2639 + else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) {
2640 + glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue);
2643 + /* multisample attribs */
2644 +#ifdef GLX_ARB_multisample
2645 + if (ext && strstr(ext, "GLX_ARB_multisample")) {
2646 + glXGetConfig(dpy, vInfo, GLX_SAMPLE_BUFFERS_ARB, &attribs->numMultisample);
2647 + glXGetConfig(dpy, vInfo, GLX_SAMPLES_ARB, &attribs->numSamples);
2651 + attribs->numSamples = 0;
2652 + attribs->numMultisample = 0;
2655 +#if defined(GLX_EXT_visual_rating)
2656 + if (ext && strstr(ext, "GLX_EXT_visual_rating")) {
2657 + glXGetConfig(dpy, vInfo, GLX_VISUAL_CAVEAT_EXT, &attribs->visualCaveat);
2660 + attribs->visualCaveat = GLX_NONE_EXT;
2663 + attribs->visualCaveat = 0;
2666 +#if defined(GLX_EXT_framebuffer_sRGB)
2667 + if (ext && strstr(ext, "GLX_EXT_framebuffer_sRGB")) {
2668 + glXGetConfig(dpy, vInfo, GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, &attribs->srgb);
2675 +#ifdef GLX_VERSION_1_3
2678 +glx_token_to_visual_class(int visual_type)
2680 + switch (visual_type) {
2681 + case GLX_TRUE_COLOR:
2683 + case GLX_DIRECT_COLOR:
2684 + return DirectColor;
2685 + case GLX_PSEUDO_COLOR:
2686 + return PseudoColor;
2687 + case GLX_STATIC_COLOR:
2688 + return StaticColor;
2689 + case GLX_GRAY_SCALE:
2691 + case GLX_STATIC_GRAY:
2692 + return StaticGray;
2700 +get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
2701 + struct visual_attribs *attribs)
2703 + const char *ext = glXQueryExtensionsString(dpy, 0);
2705 + XVisualInfo *vInfo;
2707 + memset(attribs, 0, sizeof(struct visual_attribs));
2709 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_FBCONFIG_ID, &attribs->id);
2711 + vInfo = glXGetVisualFromFBConfig(dpy, fbconfig);
2713 + if (vInfo != NULL) {
2714 + attribs->vis_id = vInfo->visualid;
2715 + attribs->depth = vInfo->depth;
2716 + attribs->redMask = vInfo->red_mask;
2717 + attribs->greenMask = vInfo->green_mask;
2718 + attribs->blueMask = vInfo->blue_mask;
2719 + attribs->colormapSize = vInfo->colormap_size;
2720 + attribs->bitsPerRGB = vInfo->bits_per_rgb;
2723 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_X_VISUAL_TYPE, &visual_type);
2724 + attribs->klass = glx_token_to_visual_class(visual_type);
2726 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_DRAWABLE_TYPE, &attribs->drawableType);
2727 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_BUFFER_SIZE, &attribs->bufferSize);
2728 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_LEVEL, &attribs->level);
2729 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &attribs->render_type);
2730 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
2731 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_STEREO, &attribs->stereo);
2732 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_AUX_BUFFERS, &attribs->auxBuffers);
2734 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_RED_SIZE, &attribs->redSize);
2735 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_GREEN_SIZE, &attribs->greenSize);
2736 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_BLUE_SIZE, &attribs->blueSize);
2737 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_ALPHA_SIZE, &attribs->alphaSize);
2738 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_DEPTH_SIZE, &attribs->depthSize);
2739 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_STENCIL_SIZE, &attribs->stencilSize);
2741 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize);
2742 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize);
2743 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize);
2744 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize);
2746 + /* get transparent pixel stuff */
2747 + glXGetFBConfigAttrib(dpy, fbconfig,GLX_TRANSPARENT_TYPE, &attribs->transparentType);
2748 + if (attribs->transparentType == GLX_TRANSPARENT_RGB) {
2749 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue);
2750 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue);
2751 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue);
2752 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue);
2754 + else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) {
2755 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue);
2758 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_SAMPLE_BUFFERS, &attribs->numMultisample);
2759 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_SAMPLES, &attribs->numSamples);
2760 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &attribs->visualCaveat);
2762 +#if defined(GLX_NV_float_buffer)
2763 + if (ext && strstr(ext, "GLX_NV_float_buffer")) {
2764 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_FLOAT_COMPONENTS_NV, &attribs->floatComponents);
2767 +#if defined(GLX_ARB_fbconfig_float)
2768 + if (ext && strstr(ext, "GLX_ARB_fbconfig_float")) {
2769 + if (attribs->render_type & GLX_RGBA_FLOAT_BIT_ARB) {
2770 + attribs->floatComponents = True;
2774 +#if defined(GLX_EXT_fbconfig_packed_float)
2775 + if (ext && strstr(ext, "GLX_EXT_fbconfig_packed_float")) {
2776 + if (attribs->render_type & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) {
2777 + attribs->packedfloatComponents = True;
2782 +#if defined(GLX_EXT_framebuffer_sRGB)
2783 + if (ext && strstr(ext, "GLX_EXT_framebuffer_sRGB")) {
2784 + glXGetFBConfigAttrib(dpy, fbconfig, GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, &attribs->srgb);
2795 +print_visual_attribs_verbose(const struct visual_attribs *attribs,
2799 + printf("FBConfig ID: %x Visual ID=%x depth=%d class=%s, type=%s\n",
2800 + attribs->id, attribs->vis_id, attribs->depth,
2801 + visual_class_name(attribs->klass),
2802 + visual_drawable_type(attribs->drawableType));
2805 + printf("Visual ID: %x depth=%d class=%s, type=%s\n",
2806 + attribs->id, attribs->depth, visual_class_name(attribs->klass),
2807 + visual_drawable_type(attribs->drawableType));
2809 + printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
2810 + attribs->bufferSize, attribs->level,
2811 + visual_render_type_name(attribs->render_type),
2812 + attribs->doubleBuffer, attribs->stereo);
2813 + printf(" rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d float=%c sRGB=%c\n",
2814 + attribs->redSize, attribs->greenSize,
2815 + attribs->blueSize, attribs->alphaSize,
2816 + attribs->packedfloatComponents ? 'P' : attribs->floatComponents ? 'Y' : 'N',
2817 + attribs->srgb ? 'Y' : 'N');
2818 + printf(" auxBuffers=%d depthSize=%d stencilSize=%d\n",
2819 + attribs->auxBuffers, attribs->depthSize, attribs->stencilSize);
2820 + printf(" accum: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n",
2821 + attribs->accumRedSize, attribs->accumGreenSize,
2822 + attribs->accumBlueSize, attribs->accumAlphaSize);
2823 + printf(" multiSample=%d multiSampleBuffers=%d\n",
2824 + attribs->numSamples, attribs->numMultisample);
2825 +#ifdef GLX_EXT_visual_rating
2826 + if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0)
2827 + printf(" visualCaveat=None\n");
2828 + else if (attribs->visualCaveat == GLX_SLOW_VISUAL_EXT)
2829 + printf(" visualCaveat=Slow\n");
2830 + else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT)
2831 + printf(" visualCaveat=Nonconformant\n");
2833 + if (attribs->transparentType == GLX_NONE) {
2834 + printf(" Opaque.\n");
2836 + else if (attribs->transparentType == GLX_TRANSPARENT_RGB) {
2837 + printf(" Transparent RGB: Red=%d Green=%d Blue=%d Alpha=%d\n",attribs->transparentRedValue,attribs->transparentGreenValue,attribs->transparentBlueValue,attribs->transparentAlphaValue);
2839 + else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) {
2840 + printf(" Transparent index=%d\n",attribs->transparentIndexValue);
2846 +print_visual_attribs_short_header(void)
2848 + printf(" visual x bf lv rg d st colorbuffer sr ax dp st accumbuffer ms cav\n");
2849 + printf(" id dep cl sp sz l ci b ro r g b a F gb bf th cl r g b a ns b eat\n");
2850 + printf("----------------------------------------------------------------------------\n");
2855 +print_visual_attribs_short(const struct visual_attribs *attribs)
2857 + const char *caveat = caveat_string(attribs->visualCaveat);
2859 + printf("0x%03x %2d %2s %2d %3d %2d %c%c %c %c %2d %2d %2d %2d %c %c %2d %2d %2d",
2862 + visual_class_abbrev(attribs->klass),
2863 + attribs->transparentType != GLX_NONE,
2864 + attribs->bufferSize,
2866 + (attribs->render_type & GLX_RGBA_BIT) ? 'r' : ' ',
2867 + (attribs->render_type & GLX_COLOR_INDEX_BIT) ? 'c' : ' ',
2868 + attribs->doubleBuffer ? 'y' : '.',
2869 + attribs->stereo ? 'y' : '.',
2870 + attribs->redSize, attribs->greenSize,
2871 + attribs->blueSize, attribs->alphaSize,
2872 + attribs->packedfloatComponents ? 'u' : attribs->floatComponents ? 'f' : '.',
2873 + attribs->srgb ? 's' : '.',
2874 + attribs->auxBuffers,
2875 + attribs->depthSize,
2876 + attribs->stencilSize
2879 + printf(" %2d %2d %2d %2d %2d %1d %s\n",
2880 + attribs->accumRedSize, attribs->accumGreenSize,
2881 + attribs->accumBlueSize, attribs->accumAlphaSize,
2882 + attribs->numSamples, attribs->numMultisample,
2889 +print_visual_attribs_long_header(void)
2891 + printf("Vis Vis Visual Trans buff lev render DB ste r g b a s aux dep ste accum buffer MS MS \n");
2892 + printf(" ID Depth Type parent size el type reo sz sz sz sz flt rgb buf th ncl r g b a num bufs caveats\n");
2893 + printf("--------------------------------------------------------------------------------------------------------------------\n");
2898 +print_visual_attribs_long(const struct visual_attribs *attribs)
2900 + const char *caveat = caveat_string(attribs->visualCaveat);
2902 + printf("0x%3x %2d %-11s %2d %3d %2d %4s %3d %3d %3d %3d %3d %3d",
2905 + visual_class_name(attribs->klass),
2906 + attribs->transparentType != GLX_NONE,
2907 + attribs->bufferSize,
2909 + visual_render_type_name(attribs->render_type),
2910 + attribs->doubleBuffer,
2912 + attribs->redSize, attribs->greenSize,
2913 + attribs->blueSize, attribs->alphaSize
2916 + printf(" %c %c %3d %4d %2d %3d %3d %3d %3d %2d %2d %6s\n",
2917 + attribs->floatComponents ? 'f' : '.',
2918 + attribs->srgb ? 's' : '.',
2919 + attribs->auxBuffers,
2920 + attribs->depthSize,
2921 + attribs->stencilSize,
2922 + attribs->accumRedSize, attribs->accumGreenSize,
2923 + attribs->accumBlueSize, attribs->accumAlphaSize,
2924 + attribs->numSamples, attribs->numMultisample,
2931 +print_visual_info(Display *dpy, int scrnum, InfoMode mode)
2933 + XVisualInfo theTemplate;
2934 + XVisualInfo *visuals;
2935 + int numVisuals, numGlxVisuals;
2938 + struct visual_attribs attribs;
2940 + /* get list of all visuals on this screen */
2941 + theTemplate.screen = scrnum;
2942 + mask = VisualScreenMask;
2943 + visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
2945 + numGlxVisuals = 0;
2946 + for (i = 0; i < numVisuals; i++) {
2947 + if (get_visual_attribs(dpy, &visuals[i], &attribs))
2951 + if (numGlxVisuals == 0)
2954 + printf("%d GLX Visuals\n", numGlxVisuals);
2956 + if (mode == Normal)
2957 + print_visual_attribs_short_header();
2958 + else if (mode == Wide)
2959 + print_visual_attribs_long_header();
2961 + for (i = 0; i < numVisuals; i++) {
2962 + if (!get_visual_attribs(dpy, &visuals[i], &attribs))
2965 + if (mode == Verbose)
2966 + print_visual_attribs_verbose(&attribs, False);
2967 + else if (mode == Normal)
2968 + print_visual_attribs_short(&attribs);
2969 + else if (mode == Wide)
2970 + print_visual_attribs_long(&attribs);
2977 +#ifdef GLX_VERSION_1_3
2980 +print_fbconfig_info(Display *dpy, int scrnum, InfoMode mode)
2982 + int numFBConfigs = 0;
2983 + struct visual_attribs attribs;
2984 + GLXFBConfig *fbconfigs;
2987 + /* get list of all fbconfigs on this screen */
2988 + fbconfigs = glXGetFBConfigs(dpy, scrnum, &numFBConfigs);
2990 + if (numFBConfigs == 0) {
2995 + printf("%d GLXFBConfigs:\n", numFBConfigs);
2996 + if (mode == Normal)
2997 + print_visual_attribs_short_header();
2998 + else if (mode == Wide)
2999 + print_visual_attribs_long_header();
3001 + for (i = 0; i < numFBConfigs; i++) {
3002 + get_fbconfig_attribs(dpy, fbconfigs[i], &attribs);
3004 + if (mode == Verbose)
3005 + print_visual_attribs_verbose(&attribs, True);
3006 + else if (mode == Normal)
3007 + print_visual_attribs_short(&attribs);
3008 + else if (mode == Wide)
3009 + print_visual_attribs_long(&attribs);
3019 + * Stand-alone Mesa doesn't really implement the GLX protocol so it
3020 + * doesn't really know the GLX attributes associated with an X visual.
3021 + * The first time a visual is presented to Mesa's pseudo-GLX it
3022 + * attaches ancilliary buffers to it (like depth and stencil).
3023 + * But that usually only works if glXChooseVisual is used.
3024 + * This function calls glXChooseVisual() to sort of "prime the pump"
3025 + * for Mesa's GLX so that the visuals that get reported actually
3026 + * reflect what applications will see.
3027 + * This has no effect when using true GLX.
3030 +mesa_hack(Display *dpy, int scrnum)
3032 + static int attribs[] = {
3035 + GLX_GREEN_SIZE, 1,
3037 + GLX_DEPTH_SIZE, 1,
3038 + GLX_STENCIL_SIZE, 1,
3039 + GLX_ACCUM_RED_SIZE, 1,
3040 + GLX_ACCUM_GREEN_SIZE, 1,
3041 + GLX_ACCUM_BLUE_SIZE, 1,
3042 + GLX_ACCUM_ALPHA_SIZE, 1,
3046 + XVisualInfo *visinfo;
3048 + visinfo = glXChooseVisual(dpy, scrnum, attribs);
3055 + * Examine all visuals to find the so-called best one.
3056 + * We prefer deepest RGBA buffer with depth, stencil and accum
3057 + * that has no caveats.
3060 +find_best_visual(Display *dpy, int scrnum)
3062 + XVisualInfo theTemplate;
3063 + XVisualInfo *visuals;
3067 + struct visual_attribs bestVis;
3069 + /* get list of all visuals on this screen */
3070 + theTemplate.screen = scrnum;
3071 + mask = VisualScreenMask;
3072 + visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
3074 + /* init bestVis with first visual info */
3075 + get_visual_attribs(dpy, &visuals[0], &bestVis);
3077 + /* try to find a "better" visual */
3078 + for (i = 1; i < numVisuals; i++) {
3079 + struct visual_attribs vis;
3081 + get_visual_attribs(dpy, &visuals[i], &vis);
3083 + /* always skip visuals with caveats */
3084 + if (vis.visualCaveat != GLX_NONE_EXT)
3087 + /* see if this vis is better than bestVis */
3088 + if ((!bestVis.supportsGL && vis.supportsGL) ||
3089 + (bestVis.visualCaveat != GLX_NONE_EXT) ||
3090 + (!(bestVis.render_type & GLX_RGBA_BIT) && (vis.render_type & GLX_RGBA_BIT)) ||
3091 + (!bestVis.doubleBuffer && vis.doubleBuffer) ||
3092 + (bestVis.redSize < vis.redSize) ||
3093 + (bestVis.greenSize < vis.greenSize) ||
3094 + (bestVis.blueSize < vis.blueSize) ||
3095 + (bestVis.alphaSize < vis.alphaSize) ||
3096 + (bestVis.depthSize < vis.depthSize) ||
3097 + (bestVis.stencilSize < vis.stencilSize) ||
3098 + (bestVis.accumRedSize < vis.accumRedSize)) {
3099 + /* found a better visual */
3106 + return bestVis.id;
3111 +main(int argc, char *argv[])
3114 + int numScreens, scrnum;
3115 + struct options opts;
3118 + parse_args(argc, argv, &opts);
3120 + dpy = XOpenDisplay(opts.displayName);
3122 + fprintf(stderr, "Error: unable to open display %s\n",
3123 + XDisplayName(opts.displayName));
3127 + if (opts.findBest) {
3129 + mesa_hack(dpy, 0);
3130 + b = find_best_visual(dpy, 0);
3131 + printf("%d\n", b);
3134 + numScreens = ScreenCount(dpy);
3135 + print_display_info(dpy);
3136 + for (scrnum = 0; scrnum < numScreens; scrnum++) {
3137 + mesa_hack(dpy, scrnum);
3138 + coreWorked = print_screen_info(dpy, scrnum, &opts,
3139 + True, False, opts.limits, False);
3140 + print_screen_info(dpy, scrnum, &opts, False, False,
3141 + opts.limits, coreWorked);
3142 + print_screen_info(dpy, scrnum, &opts, False, True, False, True);
3146 + if (opts.mode != Brief) {
3147 + print_visual_info(dpy, scrnum, opts.mode);
3148 +#ifdef GLX_VERSION_1_3
3149 + print_fbconfig_info(dpy, scrnum, opts.mode);
3153 + if (scrnum + 1 < numScreens)
3158 + XCloseDisplay(dpy);
3162 diff -Naurp mesa-20.2.1-orig/src/glx/xdemos/meson.build mesa-20.2.1/src/glx/xdemos/meson.build
3163 --- mesa-20.2.1-orig/src/glx/xdemos/meson.build 1969-12-31 18:00:00.000000000 -0600
3164 +++ mesa-20.2.1/src/glx/xdemos/meson.build 2020-10-15 23:07:14.486696790 -0500
3166 +inc_xdemos = include_directories('.')
3168 +glxinfo_files = files(
3170 + 'glinfo_common.c',
3173 +x11_dep = dependency('x11', required: true)
3175 +executable('glxinfo', glxinfo_files,
3177 + #c_args : gl_lib_cargs,
3178 + link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl, '-lm'],
3179 + link_with : libgl,
3180 + include_directories : [ inc_src, inc_include, inc_mesa, inc_glx],
3181 + dependencies : [x11_dep]
3184 +executable('glxgears', 'glxgears.c',
3186 + #c_args : gl_lib_cargs,
3187 + link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl, '-lm'],
3188 + link_with : libgl,
3189 + include_directories : [inc_src, inc_include, inc_mesa, inc_glx],
3190 + dependencies : [x11_dep]
3193 +man_dir = get_option('prefix') + '/share/man/man1'
3194 +install_data(['glxinfo.1', 'glxgears.1'],
3195 + install_dir : man_dir