From cb638ed9c81f07d8603b07db395e31a41fed8685 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 21 Jun 2012 18:55:57 +0100 Subject: [PATCH] hw/xwin/glx: Blacklist 'GDI generic' GL renderer If the native GL renderer is the GDI generic renderer (as can happen if we are in safe mode, or the video driver is VGA, or we have hybrid graphics which hasn't noticed that xwin requires 3d acceleration), don't use it. It's not accelerated and we will probably get better conformance and perfomance from swrast. Fix so we don't install screen function wrappers in glxWinScreenProbe unless we are succesful. Also, move fbConfig dumping to after GLX version has been determined from extensions Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/glx/indirect.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 41b4cd8b3..058256974 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -517,6 +517,7 @@ glxWinScreenProbe(ScreenPtr pScreen) { glxWinScreen *screen; const char *gl_extensions; + const char *gl_renderer; const char *wgl_extensions; HWND hwnd; HDC hdc; @@ -540,14 +541,6 @@ glxWinScreenProbe(ScreenPtr pScreen) if (NULL == screen) return NULL; - /* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */ - screen->RealizeWindow = pScreen->RealizeWindow; - pScreen->RealizeWindow = glxWinRealizeWindow; - screen->UnrealizeWindow = pScreen->UnrealizeWindow; - pScreen->UnrealizeWindow = glxWinUnrealizeWindow; - screen->CopyWindow = pScreen->CopyWindow; - pScreen->CopyWindow = glxWinCopyWindow; - /* Dump out some useful information about the native renderer */ // create window class @@ -597,7 +590,8 @@ glxWinScreenProbe(ScreenPtr pScreen) ErrorF("GL_VERSION: %s\n", glGetStringWrapperNonstatic(GL_VERSION)); ErrorF("GL_VENDOR: %s\n", glGetStringWrapperNonstatic(GL_VENDOR)); - ErrorF("GL_RENDERER: %s\n", glGetStringWrapperNonstatic(GL_RENDERER)); + gl_renderer = (const char *) glGetStringWrapperNonstatic(GL_RENDERER); + ErrorF("GL_RENDERER: %s\n", gl_renderer); gl_extensions = (const char *) glGetStringWrapperNonstatic(GL_EXTENSIONS); glxLogExtensions("GL_EXTENSIONS: ", gl_extensions); wgl_extensions = wglGetExtensionsStringARBWrapper(hdc); @@ -605,6 +599,13 @@ glxWinScreenProbe(ScreenPtr pScreen) wgl_extensions = ""; glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions); + if (strcasecmp(gl_renderer, "GDI Generic") == 0) { + free(screen); + LogMessage(X_ERROR, + "AIGLX: Won't use generic native renderer as it is not accelerated\n"); + return NULL; + } + // Can you see the problem here? The extensions string is DC specific // Different DCs for windows on a multimonitor system driven by multiple cards // might have completely different capabilities. Of course, good luck getting @@ -722,9 +723,6 @@ glxWinScreenProbe(ScreenPtr pScreen) __glXScreenInit(&screen->base, pScreen); - // dump out fbConfigs now fbConfigIds and visualIDs have been assigned - fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs); - // Override the GL extensions string set by __glXScreenInit() screen->base.GLextensions = strdup(gl_extensions); @@ -767,6 +765,17 @@ glxWinScreenProbe(ScreenPtr pScreen) ReleaseDC(hwnd, hdc); DestroyWindow(hwnd); + // dump out fbConfigs now fbConfigIds and visualIDs have been assigned + fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs); + + /* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */ + screen->RealizeWindow = pScreen->RealizeWindow; + pScreen->RealizeWindow = glxWinRealizeWindow; + screen->UnrealizeWindow = pScreen->UnrealizeWindow; + pScreen->UnrealizeWindow = glxWinUnrealizeWindow; + screen->CopyWindow = pScreen->CopyWindow; + pScreen->CopyWindow = glxWinCopyWindow; + return &screen->base; }