OSDN Git Service

Clean and update XMesa/XFree86 interface.
authorGeorge Sapountzis <gsap7@yahoo.gr>
Wed, 6 Dec 2006 04:49:28 +0000 (06:49 +0200)
committerGeorge Sapountzis <gsap7@yahoo.gr>
Fri, 30 Mar 2007 16:19:00 +0000 (19:19 +0300)
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
src/mesa/drivers/x11/glxheader.h
src/mesa/drivers/x11/xm_api.c
src/mesa/drivers/x11/xm_buffer.c
src/mesa/drivers/x11/xm_dd.c
src/mesa/drivers/x11/xmesaP.h

index 3c3d204..c84ffe8 100644 (file)
@@ -41,6 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "scrnintstr.h"
 #include "pixmapstr.h"
+#include "gcstruct.h"
 
 typedef struct _XMesaImageRec XMesaImage;
 
index 844a783..8c5c696 100644 (file)
@@ -36,7 +36,6 @@
 
 # include "resource.h"
 # include "windowstr.h"
-# include "gcstruct.h"
 # include "xf86glx_util.h"
 
 #else
index 24b19d8..63b9ac5 100644 (file)
 #include "tnl/t_pipeline.h"
 #include "drivers/common/driverfuncs.h"
 
-#ifdef XFree86Server
-#include <GL/glxtokens.h>
-#endif
-
 /**
  * Global X driver lock
  */
@@ -179,9 +175,7 @@ static int host_byte_order( void )
  */
 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;
 
@@ -1359,11 +1353,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
       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()
@@ -1469,12 +1458,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
 }
 
 
-void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v )
-{
-    v->display = dpy;
-}
-
-
 void XMesaDestroyVisual( XMesaVisual v )
 {
 #ifndef XFree86Server
@@ -1986,6 +1969,10 @@ XMesaBuffer XMesaGetCurrentReadBuffer( void )
 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);
       }
@@ -2005,6 +1992,13 @@ GLboolean XMesaLoseCurrent(XMesaContext c)
 }
 
 
+GLboolean XMesaCopyContext( XMesaContext xm_src, XMesaContext xm_dst, GLuint mask )
+{
+   _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask);
+   return GL_TRUE;
+}
+
+
 /*
  * Switch 3Dfx support hack between window and full-screen mode.
  */
@@ -2426,15 +2420,6 @@ void XMesaGarbageCollect( void )
 }
 
 
-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 )
index bb8fe31..10621cb 100644 (file)
@@ -37,7 +37,7 @@
 #include "renderbuffer.h"
 
 
-#ifndef XFree86Server
+#if defined(USE_XSHM) && !defined(XFree86Server)
 static volatile int mesaXErrorFlag = 0;
 
 /**
@@ -51,18 +51,14 @@ mesaHandleXError(XMesaDisplay *dpy, XErrorEvent *event)
    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
@@ -152,10 +148,13 @@ alloc_back_shm_ximage(XMesaBuffer b, GLuint width, GLuint height)
    }
 
    return GL_TRUE;
+}
 #else
+static GLboolean
+alloc_back_shm_ximage(XMesaBuffer b, GLuint width, GLuint height)
+{
    /* Can't compile XSHM support */
    return GL_FALSE;
-#endif
 }
 #endif
 
@@ -187,14 +186,12 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
          return;
 
       /* Allocate new back buffer */
-#ifdef XFree86Server
-      /* Allocate a regular XImage for the back buffer. */
-      b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel,
-                                            width, height, NULL);
-      {
-#else
       if (b->shm == 0 || !alloc_back_shm_ximage(b, width, height)) {
         /* Allocate a regular XImage for the back buffer. */
+#ifdef XFree86Server
+        b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel,
+                                               width, height, NULL);
+#else
         b->backxrb->ximage = XCreateImage(b->xm_visual->display,
                                       b->xm_visual->visinfo->visual,
                                       GET_VISUAL_DEPTH(b->xm_visual),
index dbac3b8..543ff69 100644 (file)
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
 
-#ifdef XFree86Server
-#include <GL/glxtokens.h>
-#endif
-
 
 
 /*
index 85cb6b6..aab138f 100644 (file)
@@ -579,10 +579,11 @@ extern XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v,
  * 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 */