From 3291de6d06ea4d51f3aeef2936c726064b9648ab Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 27 Oct 2004 17:50:09 +0000 Subject: [PATCH] Bug #1713: Some rare libGL's have __glXFindDRIScreen defined but do not export it via glXGetProcAddress. These are not supported anymore, so print an error message to that effect. --- src/mesa/drivers/dri/common/dri_util.c | 32 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index dd83080cca0..a9faaa24efe 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -141,6 +141,26 @@ __driUtilMessage(const char *f, ...) } } +/* + * fd.o bug #1713: Some rare libGL's have __glXFindDRIScreen defined but do not + * export it via glXGetProcAddress. These are not supported anymore, so print + * an error message to that effect. - ajax 2004-10-26 + */ +typedef __DRIscreen *(*PFNGLXFINDDRISCREEN)(__DRInativeDisplay *, int); + +static __DRIscreen *glx_find_dri_screen(__DRInativeDisplay *d, int i) +{ + PFNGLXFINDDRISCREEN findscreen = + (PFNGLXFINDDRISCREEN)glXGetProcAddress("__glXFindDRIScreen"); + + if (!findscreen) + { + __driUtilMessage("glXGetProcAddress(\"__glXFindDRIScreen\") failed!"); + __driUtilMessage("Your libGL is too old, please upgrade."); + return NULL; + } + else return findscreen(d, i); +} /*****************************************************************/ /** \name Visual utility functions */ @@ -353,7 +373,7 @@ static GLboolean driUnbindContext3(__DRInativeDisplay *dpy, int scrn, return GL_FALSE; } - pDRIScreen = __glXFindDRIScreen(dpy, scrn); + pDRIScreen = glx_find_dri_screen(dpy, scrn); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return GL_FALSE; @@ -529,7 +549,7 @@ static GLboolean driBindContext3(__DRInativeDisplay *dpy, int scrn, return GL_FALSE; } - pDRIScreen = __glXFindDRIScreen(dpy, scrn); + pDRIScreen = glx_find_dri_screen(dpy, scrn); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return GL_FALSE; @@ -563,7 +583,7 @@ static GLboolean driBindContext2(Display *dpy, int scrn, return GL_FALSE; } - pDRIScreen = __glXFindDRIScreen(dpy, scrn); + pDRIScreen = glx_find_dri_screen(dpy, scrn); modes = (driCompareGLXAPIVersion( 20040317 ) >= 0) ? gc->driContext.mode : findConfigMode( dpy, scrn, gc->vid, pDRIScreen ); @@ -793,7 +813,7 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, int renderType, const int *attrs) { - __DRIscreen * const pDRIScreen = __glXFindDRIScreen(dpy, modes->screen); + __DRIscreen * const pDRIScreen = glx_find_dri_screen(dpy, modes->screen); __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -988,7 +1008,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, __DRIscreenPrivate *psp; void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; - pDRIScreen = __glXFindDRIScreen(dpy, modes->screen); + pDRIScreen = glx_find_dri_screen(dpy, modes->screen); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return NULL; @@ -1088,7 +1108,7 @@ static void *driCreateContext(Display *dpy, XVisualInfo *vis, __DRIscreen *pDRIScreen; const __GLcontextModes *modes; - pDRIScreen = __glXFindDRIScreen(dpy, vis->screen); + pDRIScreen = glx_find_dri_screen(dpy, vis->screen); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return NULL; -- 2.30.2