[Xorg-commit] xc/lib/GL/glx glxcmds.c,1.1.4.1,1.1.4.2 glxext.c,1.1.4.1,1.1.4.2

Kaleb Keithley xorg-commit at pdx.freedesktop.org
Sat Dec 20 02:28:57 EET 2003


Committed by: kaleb

Update of /cvs/xorg/xc/lib/GL/glx
In directory pdx:/home/kaleb/xorg/xc.XORG-CURRENT/lib/GL/glx

Modified Files:
      Tag: XORG-CURRENT
	glxcmds.c glxext.c 
Log Message:
merge XFree86 RC2 (4.3.99.902) from vendor branch

Index: glxcmds.c
===================================================================
RCS file: /cvs/xorg/xc/lib/GL/glx/glxcmds.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- glxcmds.c	26 Nov 2003 22:48:31 -0000	1.1.4.1
+++ glxcmds.c	20 Dec 2003 00:28:21 -0000	1.1.4.2
@@ -1,4 +1,5 @@
-/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.27 2003/11/17 03:10:42 dawes Exp $ */
+/* $XdotOrg$ */
+/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.28 2003/12/08 00:53:59 alanh Exp $ */
 /*
 ** License Applicability. Except to the extent portions of this file are
 ** made subject to an alternative license as permitted in the SGI Free
@@ -246,8 +247,8 @@
 
 	for ( i = 0 ; i < screen_count ; i++ ) {
 	    __DRIscreen * const psc = &priv->screenConfigs[i].driScreen;
-	    __DRIdrawable * const pdraw = (*psc->getDrawable)(dpy, drawable,
-							      psc->private);
+	    __DRIdrawable * const pdraw = (psc->private != NULL)
+	       ? (*psc->getDrawable)(dpy, drawable, psc->private) : NULL;
 
 	    if ( pdraw != NULL ) {
 		if ( scrn_num != NULL ) {

Index: glxext.c
===================================================================
RCS file: /cvs/xorg/xc/lib/GL/glx/glxext.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- glxext.c	26 Nov 2003 22:48:31 -0000	1.1.4.1
+++ glxext.c	20 Dec 2003 00:28:21 -0000	1.1.4.2
@@ -1,4 +1,5 @@
-/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.21 2003/10/23 15:30:08 tsi Exp $ */
+/* $XdotOrg$ */
+/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.22 2003/12/08 17:35:28 dawes Exp $ */
 
 /*
 ** License Applicability. Except to the extent portions of this file are
@@ -62,6 +63,37 @@
 void __glXDumpDrawBuffer(__GLXcontext *ctx);
 #endif
 
+#ifdef USE_SPARC_ASM
+/*
+ * This is where our dispatch table's bounds are.
+ * And the static mesa_init is taken directly from
+ * Mesa's 'sparc.c' initializer.
+ *
+ * We need something like this here, because this version
+ * of openGL/glx never initializes a Mesa context, and so
+ * the address of the dispatch table pointer never gets stuffed
+ * into the dispatch jump table otherwise.
+ *
+ * It matters only on SPARC, and only if you are using assembler
+ * code instead of C-code indirect dispatch.
+ *
+ * -- FEM, 04.xii.03
+ */
+extern unsigned int _mesa_sparc_glapi_begin;
+extern unsigned int _mesa_sparc_glapi_end;
+extern void __glapi_sparc_icache_flush(unsigned int *);
+static void _glx_mesa_init_sparc_glapi_relocs(void);
+static int _mesa_sparc_needs_init = 1;
+#define INIT_MESA_SPARC { \
+    if(_mesa_sparc_needs_init) { \
+      _glx_mesa_init_sparc_glapi_relocs(); \
+      _mesa_sparc_needs_init = 0; \
+  } \
+}
+#else
+#define INIT_MESA_SPARC
+#endif
+
 static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
     GLXDrawable read, GLXContext gc);
 
@@ -831,6 +863,7 @@
     }
 #endif
 
+    INIT_MESA_SPARC
     /* The one and only long long lock */
     __glXLock();
 
@@ -945,6 +978,7 @@
 
 	if (gc->currentDpy == dpy) {
 	    /* Use opcode from gc because its right */
+            INIT_MESA_SPARC
 	    return gc->majorOpcode;
 	} else {
 	    /*
@@ -1448,3 +1482,61 @@
     }	    
 }
 #endif
+
+#ifdef  USE_SPARC_ASM
+/*
+ * Used only when we are sparc, using sparc assembler.
+ *
+ */
+
+static void
+_glx_mesa_init_sparc_glapi_relocs(void)
+{
+	unsigned int *insn_ptr, *end_ptr;
+	unsigned long disp_addr;
+
+	insn_ptr = &_mesa_sparc_glapi_begin;
+	end_ptr = &_mesa_sparc_glapi_end;
+	disp_addr = (unsigned long) &_glapi_Dispatch;
+
+	/*
+         * Verbatim from Mesa sparc.c.  It's needed because there doesn't
+         * seem to be a better way to do this:
+         *
+         * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
+         *
+         * This code is patching in the ADDRESS of the pointer to the
+         * dispatch table.  Hence, it must be called exactly once, because
+         * that address is not going to change.
+         *
+         * What it points to can change, but Mesa (and hence, we) assume
+         * that there is only one pointer.
+         *
+	 */
+	while (insn_ptr < end_ptr) {
+#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )	
+/*
+	This code patches for 64-bit addresses.  This had better
+	not happen for Sparc/Linux, no matter what architecture we
+	are building for.  So, don't do this.
+
+        The 'defined(__linux_64__)' is used here as a placeholder for
+        when we do do 64-bit usermode on sparc linux.
+	*/
+		insn_ptr[0] |= (disp_addr >> (32 + 10));
+		insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
+		__glapi_sparc_icache_flush(&insn_ptr[0]);
+		insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
+		insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
+		__glapi_sparc_icache_flush(&insn_ptr[2]);
+		insn_ptr += 11;
+#else
+		insn_ptr[0] |= (disp_addr >> 10);
+		insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
+		__glapi_sparc_icache_flush(&insn_ptr[0]);
+		insn_ptr += 5;
+#endif
+	}
+}
+#endif  /* sparc ASM in use */
+





More information about the xorg-commit mailing list