mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 09:50:08 +01:00
Fix several internal problems with generating the list of configs.
This commit is contained in:
parent
c1082804a8
commit
d06da50888
3 changed files with 63 additions and 23 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -26,6 +27,62 @@ TestScreens(EGLDisplay dpy)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print table of all available configurations.
|
||||
*/
|
||||
static void
|
||||
PrintConfigs(EGLDisplay d)
|
||||
{
|
||||
EGLConfig *configs;
|
||||
EGLint numConfigs, i;
|
||||
|
||||
eglGetConfigs(d, NULL, 0, &numConfigs);
|
||||
configs = malloc(sizeof(*configs) *numConfigs);
|
||||
eglGetConfigs(d, configs, numConfigs, &numConfigs);
|
||||
|
||||
printf("Configurations:\n");
|
||||
printf(" bf lv d st colorbuffer dp st supported \n");
|
||||
printf(" id sz l b ro r g b a th cl surfaces \n");
|
||||
printf("----------------------------------------------\n");
|
||||
for (i = 0; i < numConfigs; i++) {
|
||||
EGLint id, size, level;
|
||||
EGLint red, green, blue, alpha;
|
||||
EGLint depth, stencil;
|
||||
EGLint surfaces;
|
||||
EGLint doubleBuf = 1, stereo = 0;
|
||||
char surfString[100] = "";
|
||||
|
||||
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
|
||||
|
||||
eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
|
||||
|
||||
if (surfaces & EGL_WINDOW_BIT)
|
||||
strcat(surfString, "win,");
|
||||
if (surfaces & EGL_PBUFFER_BIT)
|
||||
strcat(surfString, "pb,");
|
||||
if (surfaces & EGL_PIXMAP_BIT)
|
||||
strcat(surfString, "pix,");
|
||||
if (strlen(surfString) > 0)
|
||||
surfString[strlen(surfString) - 1] = 0;
|
||||
|
||||
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
|
||||
id, size, level,
|
||||
doubleBuf ? 'y' : '.',
|
||||
stereo ? 'y' : '.',
|
||||
red, green, blue, alpha,
|
||||
depth, stencil, surfString);
|
||||
}
|
||||
free(configs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
|
|
@ -57,15 +114,7 @@ main(int argc, char *argv[])
|
|||
printf("EGL version = %d.%d\n", maj, min);
|
||||
printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
|
||||
|
||||
eglGetConfigs(d, configs, 10, &numConfigs);
|
||||
printf("Got %d EGL configs:\n", numConfigs);
|
||||
for (i = 0; i < numConfigs; i++) {
|
||||
EGLint id, red, depth;
|
||||
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
|
||||
printf("%2d: Red Size = %d Depth Size = %d\n", id, red, depth);
|
||||
}
|
||||
PrintConfigs(d);
|
||||
|
||||
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
|
||||
if (ctx == EGL_NO_CONTEXT) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
/**
|
||||
* Convert an _EGLConfig to a __GLcontextModes object.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode)
|
||||
{
|
||||
memset(mode, 0, sizeof(*mode));
|
||||
|
|
@ -185,6 +185,7 @@ _eglAddConfig(_EGLDisplay *display, const _EGLConfig *config)
|
|||
if (newConfigs) {
|
||||
display->Configs = newConfigs;
|
||||
display->Configs[n] = *config; /* copy struct */
|
||||
display->Configs[n].Handle = n;
|
||||
display->NumConfigs++;
|
||||
return display->Configs + n;
|
||||
}
|
||||
|
|
@ -633,7 +634,7 @@ _eglFillInConfigs(_EGLConfig * configs,
|
|||
config->glmode.visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG;
|
||||
|
||||
_eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]);
|
||||
_eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[k]);
|
||||
_eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]);
|
||||
|
||||
config->glmode.visualType = visType;
|
||||
config->glmode.renderType = GLX_RGBA_BIT;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ fbFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
|
|||
u_int8_t depth_bits_array[2];
|
||||
u_int8_t stencil_bits_array[2];
|
||||
|
||||
depth_bits_array[0] = depth_bits;
|
||||
depth_bits_array[0] = 0;
|
||||
depth_bits_array[1] = depth_bits;
|
||||
|
||||
/* Just like with the accumulation buffer, always provide some modes
|
||||
|
|
@ -122,7 +122,7 @@ fbFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
|
|||
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
|
||||
back_buffer_factor = (have_back_buffer) ? 2 : 1;
|
||||
|
||||
num_configs = depth_buffer_factor * back_buffer_factor * 4;
|
||||
num_configs = depth_buffer_factor * back_buffer_factor * 2;
|
||||
|
||||
if (pixel_bits == 16) {
|
||||
fb_format = GL_RGB;
|
||||
|
|
@ -143,16 +143,6 @@ fbFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
|
|||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
c = &configs[depth_buffer_factor * back_buffer_factor * 2];
|
||||
if (!_eglFillInConfigs(c, fb_format, fb_type,
|
||||
depth_bits_array, stencil_bits_array, depth_buffer_factor,
|
||||
back_buffer_modes, back_buffer_factor,
|
||||
GLX_DIRECT_COLOR)) {
|
||||
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
|
||||
__func__, __LINE__);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
/* Mark the visual as slow if there are "fake" stencil bits.
|
||||
*/
|
||||
for (i = 0, c = configs; i < num_configs; i++, c++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue