From aeab661c5df12e6f3d225597643530f08792c4b6 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 19 Apr 2010 16:55:36 +0200 Subject: Make client start if screen is 16bpp The current glx code is looking for a rgb32 visual and always failing if there is none. This means not even software rendering starts up on e.g. 16bit visuals. This commit makes it pick software fallbacks on 16bit visuals. Long term we need to fix the gl implementation to do 16bpp too. --- client/x11/platform.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'client') diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 228069f9..dba276de 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -2016,7 +2016,9 @@ static void cleanup(void) } if (fb_config) { for (i = 0; i < ScreenCount(x_display); ++i) { - XFree(fb_config[i]); + if (fb_config[i]) { + XFree(fb_config[i]); + } } delete fb_config; fb_config = NULL; @@ -2209,22 +2211,29 @@ void Platform::init() }; for (int i = 0; i < ScreenCount(x_display); ++i) { - if (!(fb_config[i] = glXChooseFBConfig(x_display, i, attrlist, &num_configs))) { - vinfo[i] = get_x_vis_info(i); - } else { + fb_config[i] = glXChooseFBConfig(x_display, i, attrlist, &num_configs); + if (fb_config[i] != NULL) { ASSERT(num_configs > 0); vinfo[i] = glXGetVisualFromFBConfig(x_display, fb_config[i][0]); } - if (!vinfo[i]) { - THROW("XGetVisualInfo failed"); + if (vinfo[i] == NULL) { + if (fb_config[i]) { + XFree(fb_config[i]); + fb_config[i] = NULL; + } + vinfo[i] = get_x_vis_info(i); } } } else { for (int i = 0; i < ScreenCount(x_display); ++i) { - if (!(vinfo[i] = get_x_vis_info(i))) { - THROW("XGetVisualInfo failed"); - } + vinfo[i] = get_x_vis_info(i); + } + } + + for (int i = 0; i < ScreenCount(x_display); ++i) { + if (vinfo[i] == NULL) { + THROW("Unable to find a visual for screen"); } } -- cgit