From a191184ae9b2c3f7d94fd39c3674066fe79494b7 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Thu, 3 Dec 2009 21:12:26 +0100 Subject: [PATCH] wgl: Add a direct rendering check to new winediag channel. --- dlls/winex11.drv/opengl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 19e3fe3bfce..aadb7f13b62 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -29,12 +29,20 @@ #include #include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_SYS_UN_H +#include +#endif + #include "x11drv.h" #include "winternl.h" #include "wine/library.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wgl); +WINE_DECLARE_DEBUG_CHANNEL(winediag); #ifdef SONAME_LIBGL @@ -351,6 +359,19 @@ static BOOL X11DRV_WineGL_InitOpenglInfo(void) TRACE("Client GLX vendor: : %s.\n", WineGLInfo.glxClientVendor); TRACE("Direct rendering enabled: %s\n", WineGLInfo.glxDirect ? "True" : "False"); + if(!WineGLInfo.glxDirect) + { + int fd = ConnectionNumber(gdi_display); + struct sockaddr_un uaddr; + unsigned int uaddrlen = sizeof(struct sockaddr_un); + + /* In general indirect rendering on a local X11 server indicates a driver problem. + * Detect a local X11 server by checking whether the X11 socket is a Unix socket. + */ + if(!getsockname(fd, &uaddr, &uaddrlen) && uaddr.sun_family == AF_UNIX) + ERR_(winediag)("Direct rendering is disabled, most likely your OpenGL drivers haven't been installed correctly\n"); + } + if(vis) XFree(vis); if(ctx) { pglXMakeCurrent(gdi_display, None, NULL);