diff --git a/src/gallium/frontends/glx/xlib/glx_api.c b/src/gallium/frontends/glx/xlib/glx_api.c index c23887c1da3..c7898accb24 100644 --- a/src/gallium/frontends/glx/xlib/glx_api.c +++ b/src/gallium/frontends/glx/xlib/glx_api.c @@ -192,7 +192,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, GLboolean ximageFlag = GL_TRUE; XMesaVisual xmvis; GLint i; - GLboolean comparePointers; if (!rgbFlag) return NULL; @@ -221,13 +220,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, if (stencil_size > 0 && depth_size > 0) depth_size = 24; - /* Comparing IDs uses less memory but sometimes fails. */ - /* XXX revisit this after 3.0 is finished. */ - if (os_get_option("MESA_GLX_VISUAL_HACK")) - comparePointers = GL_TRUE; - else - comparePointers = GL_FALSE; - /* Force the visual to have an alpha channel */ if (rgbFlag && os_get_option("MESA_GLX_FORCE_ALPHA")) alphaFlag = GL_TRUE; @@ -247,9 +239,8 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, && (v->mesa_visual.accumGreenBits >= accumGreenSize || accumGreenSize == 0) && (v->mesa_visual.accumBlueBits >= accumBlueSize || accumBlueSize == 0) && (v->mesa_visual.accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) { - /* now either compare XVisualInfo pointers or visual IDs */ - if ((!comparePointers && v->visinfo->visualid == vinfo->visualid) - || (comparePointers && v->vishandle == vinfo)) { + /* now compare visual IDs */ + if (v->visinfo->visualid == vinfo->visualid) { return v; } } @@ -264,10 +255,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, accumBlueSize, accumAlphaSize, num_samples, level, GLX_NONE_EXT ); if (xmvis) { - /* Save a copy of the pointer now so we can find this visual again - * if we need to search for it in find_glx_visual(). - */ - xmvis->vishandle = vinfo; /* Allocate more space for additional visual */ VisualTable = realloc(VisualTable, sizeof(XMesaVisual) * (NumVisuals + 1)); /* add xmvis to the list */ @@ -375,13 +362,6 @@ find_glx_visual( Display *dpy, XVisualInfo *vinfo ) } } - /* if that fails, try to match pointers */ - for (i=0;idisplay==dpy && VisualTable[i]->vishandle==vinfo) { - return VisualTable[i]; - } - } - return NULL; } @@ -1083,6 +1063,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize, level, numAux, num_samples ); + free(vis); } return xmvis; @@ -1099,12 +1080,11 @@ glXChooseVisual( Display *dpy, int screen, int *list ) xmvis = choose_visual(dpy, screen, list, GL_FALSE); if (xmvis) { - /* create a new vishandle - the cached one may be stale */ - xmvis->vishandle = malloc(sizeof(XVisualInfo)); - if (xmvis->vishandle) { - memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); + XVisualInfo* visinfo = malloc(sizeof(XVisualInfo)); + if (visinfo) { + memcpy(visinfo, xmvis->visinfo, sizeof(XVisualInfo)); } - return xmvis->vishandle; + return visinfo; } else return NULL; @@ -1866,16 +1846,11 @@ glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { if (dpy && config) { XMesaVisual xmvis = (XMesaVisual) config; -#if 0 - return xmvis->vishandle; -#else - /* create a new vishandle - the cached one may be stale */ - xmvis->vishandle = malloc(sizeof(XVisualInfo)); - if (xmvis->vishandle) { - memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); + XVisualInfo* visinfo = malloc(sizeof(XVisualInfo)); + if (visinfo) { + memcpy(visinfo, xmvis->visinfo, sizeof(XVisualInfo)); } - return xmvis->vishandle; -#endif + return visinfo; } else { return NULL; diff --git a/src/gallium/frontends/glx/xlib/xm_api.h b/src/gallium/frontends/glx/xlib/xm_api.h index 37face89b3b..78e598d5fd8 100644 --- a/src/gallium/frontends/glx/xlib/xm_api.h +++ b/src/gallium/frontends/glx/xlib/xm_api.h @@ -291,7 +291,6 @@ struct xmesa_visual { int screen, visualID, visualType; Display *display; /* The X11 display */ XVisualInfo * visinfo; /* X's visual info (pointer to private copy) */ - XVisualInfo *vishandle; /* Only used in fakeglx.c */ GLint BitsPerPixel; /* True bits per pixel for XImages */ GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */