From f8de6396b0e190363c04bfac87738854799b2b42 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Wed, 6 Dec 2006 06:49:28 +0200 Subject: [PATCH] Clean and update XMesa/XFree86 interface. Drop XMesaSetVisualDisplay(), XMesaReset(), no longer used. Add XMesaCopyContext() and move the GlxSetRenderTables() call for XGL within XMesaForceCurrent(). This is to make xserver/GL/mesa/X/xf86glx.c unaware of Mesa internals. Also, clean some ifdef's to make it clear that USE_XSHM and XFree86Server are mutually exclusive. Lastly, - move gcstruct.h from glxheader.h up to xmesa_xf86.h since it calls *gc->ops - drop GL/glxtokens.h from xm_api|dd.c, GLX tokens come from glcore.h and are used irrelevant of XFree86. --- include/GL/xmesa_xf86.h | 1 + src/mesa/drivers/x11/glxheader.h | 1 - src/mesa/drivers/x11/xm_api.c | 39 ++++++++++++-------------------------- src/mesa/drivers/x11/xm_buffer.c | 13 ++++++------- src/mesa/drivers/x11/xm_dd.c | 4 ---- src/mesa/drivers/x11/xmesaP.h | 5 +++-- 6 files changed, 22 insertions(+), 41 deletions(-) diff --git a/include/GL/xmesa_xf86.h b/include/GL/xmesa_xf86.h index 3c3d204..c84ffe8 100644 --- a/include/GL/xmesa_xf86.h +++ b/include/GL/xmesa_xf86.h @@ -41,6 +41,7 @@ #define _XMESA_XF86_H_ #include "scrnintstr.h" #include "pixmapstr.h" +#include "gcstruct.h" typedef struct _XMesaImageRec XMesaImage; diff --git a/src/mesa/drivers/x11/glxheader.h b/src/mesa/drivers/x11/glxheader.h index 844a783..8c5c696 100644 --- a/src/mesa/drivers/x11/glxheader.h +++ b/src/mesa/drivers/x11/glxheader.h @@ -36,7 +36,6 @@ #ifdef XFree86Server # include "resource.h" # include "windowstr.h" -# include "gcstruct.h" # include "xf86glx_util.h" #else diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index b50c475..c3739da 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -80,10 +80,6 @@ #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" -#ifdef XFree86Server -#include -#endif - /** * Global X driver lock */ @@ -179,9 +175,7 @@ #endif */ static int check_for_xshm( XMesaDisplay *display ) { -#if defined(XFree86Server) - return 0; -#elif defined(USE_XSHM) +#if defined(USE_XSHM) && !defined(XFree86Server) int major, minor, ignore; Bool pixmaps; @@ -1366,11 +1360,6 @@ #endif return NULL; } - /* - * In the X server, NULL is passed in for the display. It will have - * to be set before using this visual. See XMesaSetVisualDisplay() - * below. - */ v->display = display; /* Save a copy of the XVisualInfo struct because the user may X_mesa_free() @@ -1476,12 +1465,6 @@ #endif } -void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ) -{ - v->display = dpy; -} - - void XMesaDestroyVisual( XMesaVisual v ) { #ifndef XFree86Server @@ -1993,6 +1976,13 @@ XMesaContext XMesaGetCurrentContext( voi } +GLboolean XMesaCopyContext( XMesaContext xm_src, XMesaContext xm_dst, GLuint mask ) +{ + _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask); + return GL_TRUE; +} + + XMesaBuffer XMesaGetCurrentBuffer( void ) { GET_CURRENT_CONTEXT(ctx); @@ -2022,6 +2012,10 @@ XMesaBuffer XMesaGetCurrentReadBuffer( v GLboolean XMesaForceCurrent(XMesaContext c) { if (c) { +#ifdef XGLServer + _glapi_set_dispatch(c->mesa.CurrentDispatch); +#endif + if (&(c->mesa) != _mesa_get_current_context()) { _mesa_make_current(&c->mesa, c->mesa.DrawBuffer, c->mesa.ReadBuffer); } @@ -2459,15 +2453,6 @@ #endif } -void XMesaReset( void ) -{ - while (XMesaBufferList) - XMesaDestroyBuffer(XMesaBufferList); - - XMesaBufferList = NULL; -} - - unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 490c479..97e6771 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -36,7 +36,7 @@ #include "imports.h" #include "renderbuffer.h" -#ifndef XFree86Server +#if defined(USE_XSHM) && !defined(XFree86Server) static volatile int mesaXErrorFlag = 0; /** @@ -50,18 +50,14 @@ mesaHandleXError(XMesaDisplay *dpy, XErr mesaXErrorFlag = 1; return 0; } -#endif - /** * Allocate a shared memory XImage back buffer for the given XMesaBuffer. * Return: GL_TRUE if success, GL_FALSE if error */ -#ifndef XFree86Server static GLboolean alloc_back_shm_ximage(XMesaBuffer b, GLuint width, GLuint height) { -#ifdef USE_XSHM /* * We have to do a _lot_ of error checking here to be sure we can * really use the XSHM extension. It seems different servers trigger @@ -151,10 +147,13 @@ #ifdef USE_XSHM } return GL_TRUE; -#else +} +#elif !defined(XFree86Server) +static GLboolean +alloc_back_shm_ximage(XMesaBuffer b, GLuint width, GLuint height) +{ /* Can't compile XSHM support */ return GL_FALSE; -#endif } #endif diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index d272630..a5202ff 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -54,10 +54,6 @@ #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" -#ifdef XFree86Server -#include -#endif - /* diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index e332fb5..5962e80 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -571,10 +571,11 @@ extern XMesaBuffer XMesaCreateWindowBuff * These are the extra routines required for integration with XFree86. * None of these routines should be user visible. -KEM */ -extern void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ); extern GLboolean XMesaForceCurrent(XMesaContext c); extern GLboolean XMesaLoseCurrent(XMesaContext c); -extern void XMesaReset( void ); +extern GLboolean XMesaCopyContext( XMesaContext src, + XMesaContext dst, + GLuint mask ); #define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */ -- 1.4.0-dirty