From 10d7fa53f81d4ce3874f9fc3d9e4c90f90bd24bc Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 13 Nov 2023 13:57:41 +0300 Subject: [PATCH] Revert "glamor/glxprov: Stop exposing non-db(-capable) configs" The recent commit a563f530 - "glamor/glxprov: Stop exposing non-db (-capable) configs" was aiming at reducing the number of advertised visuals for optimizing GLX initialization. Unfortunately, GL applications which rely exclusively on single-buffered visuals will fail to find a suitable visual with this. Revert the commit to expose the single-buffered visuals and restore the compatibility with applications which rely on single-buffered configs. This reverts commit a563f530f637badd485727f6cdfc7972654133ca Signed-off-by: Konstantin --- glamor/glamor_glx_provider.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/glamor/glamor_glx_provider.c b/glamor/glamor_glx_provider.c index 8a8239f68..77ccc3c8b 100644 --- a/glamor/glamor_glx_provider.c +++ b/glamor/glamor_glx_provider.c @@ -142,7 +142,8 @@ egl_create_glx_drawable(ClientPtr client, __GLXscreen *screen, static struct egl_config * translate_eglconfig(struct egl_screen *screen, EGLConfig hc, struct egl_config *chain, Bool direct_color, - Bool duplicate_for_composite, Bool srgb_only) + Bool double_buffer, Bool duplicate_for_composite, + Bool srgb_only) { EGLint value; struct egl_config *c = calloc(1, sizeof *c); @@ -190,8 +191,10 @@ translate_eglconfig(struct egl_screen *screen, EGLConfig hc, else c->base.visualType = GLX_TRUE_COLOR; - /* We choose not to implement front-buffer-only configs */ - c->base.doubleBufferMode = GL_TRUE; + if (double_buffer) + c->base.doubleBufferMode = GL_TRUE; + else + c->base.doubleBufferMode = GL_FALSE; /* direct-mapped state */ #define GET(attr, slot) \ @@ -317,7 +320,7 @@ translate_eglconfig(struct egl_screen *screen, EGLConfig hc, static __GLXconfig * egl_mirror_configs(ScreenPtr pScreen, struct egl_screen *screen) { - int i, j, nconfigs; + int i, j, k, nconfigs; struct egl_config *c = NULL; EGLConfig *host_configs = NULL; bool can_srgb = epoxy_has_gl_extension("GL_ARB_framebuffer_sRGB") || @@ -334,18 +337,21 @@ egl_mirror_configs(ScreenPtr pScreen, struct egl_screen *screen) * ->next chain easier. */ for (i = nconfigs - 1; i >= 0; i--) - for (j = 0; j < 3; j++) { /* direct_color */ - if (can_srgb) + for (j = 0; j < 3; j++) /* direct_color */ + for (k = 0; k < 2; k++) /* double_buffer */ { + if (can_srgb) + c = translate_eglconfig(screen, host_configs[i], c, + /* direct_color */ j == 1, + /* double_buffer */ k > 0, + /* duplicate_for_composite */ j == 0, + /* srgb_only */ true); + c = translate_eglconfig(screen, host_configs[i], c, /* direct_color */ j == 1, + /* double_buffer */ k > 0, /* duplicate_for_composite */ j == 0, - /* srgb_only */ true); - - c = translate_eglconfig(screen, host_configs[i], c, - /* direct_color */ j == 1, - /* duplicate_for_composite */ j == 0, - /* srgb_only */ false); - } + /* srgb_only */ false); + } screen->configs = host_configs; return c ? &c->base : NULL;