diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-01-24 18:41:05 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-07-07 18:00:36 +0100 |
commit | b67e80c84e4af54007aa1bd1e4a97a4d1b3d3765 (patch) | |
tree | bd617779480c7411a7c5feea159872b68db8cb97 | |
parent | 9915b169237e3b2d817bd3d4455f3c01dd7dd2b5 (diff) |
hw/xwin/glx: Handle failure to get any fbconfigs more gracefully.
Handle failure to get any useful pixel formats for GLX fbconfigs
more gracefully: If we didn't get any useful pixel formats from
wglGetPixelFormatAttribivARB(), fall back to using DescribePixelFormat().
If that doesn't give us any useful pixel formats, fallback to software
rendering.
This works around a problem with Intel 845G drivers, where
wglGetPixelFormatAttribivARB() doesn't seem to work as we expect it to...
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r-- | hw/xwin/glx/indirect.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index ea4f97bf7..478e0ec1a 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -668,17 +668,37 @@ glxWinScreenProbe(ScreenPtr pScreen) screen->base.swapInterval = glxWinScreenSwapInterval; screen->base.pScreen = pScreen; + // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs if (strstr(wgl_extensions, "WGL_ARB_pixel_format")) { glxWinCreateConfigsExt(hdc, screen); - screen->has_WGL_ARB_pixel_format = TRUE; + + /* + Some graphics drivers appear to advertise WGL_ARB_pixel_format, + but it doesn't work usefully, so we have to be prepared for it + to fail and fall back to using DescribePixelFormat() + */ + if (screen->base.numFBConfigs > 0) + { + screen->has_WGL_ARB_pixel_format = TRUE; + } } - else + + if (screen->base.numFBConfigs <= 0) { glxWinCreateConfigs(hdc, screen); screen->has_WGL_ARB_pixel_format = FALSE; } - // Initializes screen->base.fbconfigs and screen->base.numFBConfigs + + /* + If we still didn't get any fbConfigs, we can't provide GLX for this screen + */ + if (screen->base.numFBConfigs <= 0) + { + free(screen); + LogMessage(X_ERROR,"AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n"); + return NULL; + } /* These will be set by __glXScreenInit */ screen->base.visuals = NULL; |