summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2003-11-09 08:24:56 +0000
committerEric Anholt <anholt@FreeBSD.org>2003-11-09 08:24:56 +0000
commita5954ed93ba0727d96be84e495b3c0e1e73d2f64 (patch)
tree891c8e19fb04b2d639e819a14d96a3571b7cb146
parentFix trailing spaces following a \ (diff)
Add new port "dri". This port contains the split-out DRI client drivers from
XFree86-4-Server. I decided the history from XFree86-4-Server wasn't significant enough, and will hopefully be obsolete soon when Mesa starts providing the DRI drivers.
Notes
Notes: svn path=/head/; revision=93503
-rw-r--r--graphics/Makefile1
-rw-r--r--graphics/dri/Makefile40
-rw-r--r--graphics/dri/distinfo4
-rw-r--r--graphics/dri/files/patch-GL-Imakefile11
-rw-r--r--graphics/dri/files/patch-dri_util.c26
-rw-r--r--graphics/dri/files/patch-r200_vtxtmp_x86.S11
-rw-r--r--graphics/dri/files/patch-radeon_vtxtmp_x86.S11
-rw-r--r--graphics/dri/files/patch-radeondri234
-rw-r--r--graphics/dri/pkg-descr8
-rw-r--r--graphics/dri/pkg-plist8
-rw-r--r--graphics/dri/scripts/configure46
-rw-r--r--graphics/xfree86-dri/Makefile40
-rw-r--r--graphics/xfree86-dri/distinfo4
-rw-r--r--graphics/xfree86-dri/files/patch-GL-Imakefile11
-rw-r--r--graphics/xfree86-dri/files/patch-dri_util.c26
-rw-r--r--graphics/xfree86-dri/files/patch-r200_vtxtmp_x86.S11
-rw-r--r--graphics/xfree86-dri/files/patch-radeon_vtxtmp_x86.S11
-rw-r--r--graphics/xfree86-dri/files/patch-radeondri234
-rw-r--r--graphics/xfree86-dri/pkg-descr8
-rw-r--r--graphics/xfree86-dri/pkg-plist8
-rw-r--r--graphics/xfree86-dri/scripts/configure46
21 files changed, 799 insertions, 0 deletions
diff --git a/graphics/Makefile b/graphics/Makefile
index 10003ee3e176..b0f081ea38e4 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -43,6 +43,7 @@
SUBDIR += divxcalc
SUBDIR += djvulibre
SUBDIR += dore
+ SUBDIR += dri
SUBDIR += dri-devel
SUBDIR += drm-kmod
SUBDIR += duhdraw
diff --git a/graphics/dri/Makefile b/graphics/dri/Makefile
new file mode 100644
index 000000000000..ba63f6997cfa
--- /dev/null
+++ b/graphics/dri/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: dri
+# Date created: 08 Nov 2003
+# Whom: anholt@FreeBSD.org
+#
+# $FreeBSD$
+#
+
+PORTNAME= dri
+PORTVERSION= 4.3.0
+PORTEPOCH= 1
+CATEGORIES= graphics
+MASTER_SITES= ${MASTER_SITE_XFREE}
+MASTER_SITE_SUBDIR= ${PORTVERSION}
+DISTFILES= X430src-1.tgz \
+ X430src-2.tgz \
+ X430src-3.tgz
+
+MAINTAINER= anholt@FreeBSD.org
+COMMENT= OpenGL hardware acceleration drivers for XFree86
+
+.for pf in \
+ patch-GL-Imakefile \
+ patch-radeondri \
+ patch-r200_vtxtmp_x86.S \
+ patch-radeon_vtxtmp_x86.S \
+ patch-dri_util.c
+EXTRA_PATCHES+= ${FILESDIR}/${pf}
+.endfor
+
+XBUILD_DIRS= lib/GL
+XINSTALL_DIRS= lib/GL/mesa/src/drv
+
+.include "${.CURDIR}/../../x11/XFree86-4-libraries/Makefile.inc"
+.include <bsd.port.pre.mk>
+.if ${ARCH} == i386
+PLIST_SUB+= I386=""
+.else
+PLIST_SUB+= I386="@comment "
+.endif
+.include <bsd.port.post.mk>
diff --git a/graphics/dri/distinfo b/graphics/dri/distinfo
new file mode 100644
index 000000000000..86966f90fbd3
--- /dev/null
+++ b/graphics/dri/distinfo
@@ -0,0 +1,4 @@
+MD5 (xc/X430src-1.tgz) = 4f241a4f867363f40efa2b00dca292af
+MD5 (xc/X430src-2.tgz) = 844c2ee908d21dbf8911fd13115bf8b4
+MD5 (xc/X430src-3.tgz) = b82a0443e1b7bf860e4343e6b6766cb6
+MD5 (xc/Wraphelp2.gz) = bd1910492087442288d885412e2e5535
diff --git a/graphics/dri/files/patch-GL-Imakefile b/graphics/dri/files/patch-GL-Imakefile
new file mode 100644
index 000000000000..94e8b7e8875a
--- /dev/null
+++ b/graphics/dri/files/patch-GL-Imakefile
@@ -0,0 +1,11 @@
+--- lib/GL/Imakefile.orig Sat Nov 8 23:54:33 2003
++++ lib/GL/Imakefile Sat Nov 8 23:55:05 2003
+@@ -106,7 +106,7 @@
+ #if BuildXF86DRI && GlxUseBuiltInDRIDriver
+ SUBDIRS = $(MESADIRS) $(DRIDIRS) $(DRIVERDIRS) $(GLXDIRS) $(LIBGLBUILDDIR) $(OSMESADIRS)
+ #else
+-SUBDIRS = $(MESADIRS) $(GLXDIRS) $(DRIDIRS) $(LIBGLBUILDDIR) $(OSMESADIRS) $(DRIVERDIRS)
++SUBDIRS = $(MESADIRS) $(GLXDIRS) $(DRIDIRS) $(DRIVERDIRS)
+ #endif
+
+ MakeSubdirs($(SUBDIRS))
diff --git a/graphics/dri/files/patch-dri_util.c b/graphics/dri/files/patch-dri_util.c
new file mode 100644
index 000000000000..0084acff7a3e
--- /dev/null
+++ b/graphics/dri/files/patch-dri_util.c
@@ -0,0 +1,26 @@
+Index: lib/GL/dri/dri_util.c
+===================================================================
+RCS file: /home/ncvs/xfree/xc/lib/GL/dri/dri_util.c,v
+retrieving revision 1.6
+retrieving revision 1.7
+diff -u -u -r1.6 -r1.7
+--- lib/GL/dri/dri_util.c 15 Feb 2003 22:12:29 -0000 1.6
++++ lib/GL/dri/dri_util.c 28 Apr 2003 17:01:25 -0000 1.7
+@@ -921,7 +921,7 @@
+ int directCapable;
+ __DRIscreenPrivate *psp;
+ drmHandle hFB, hSAREA;
+- char *BusID, *driverName;
++ char *BusID, *driverName = NULL;
+ drmMagic magic;
+
+ if (!XF86DRIQueryDirectRenderingCapable(dpy, scrn, &directCapable)) {
+@@ -1010,6 +1010,8 @@
+ (void)XF86DRICloseConnection(dpy, scrn);
+ return NULL;
+ }
++ if (driverName)
++ Xfree(driverName);
+
+ /* install driver's callback functions */
+ memcpy(&psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec));
diff --git a/graphics/dri/files/patch-r200_vtxtmp_x86.S b/graphics/dri/files/patch-r200_vtxtmp_x86.S
new file mode 100644
index 000000000000..c77182d8b85f
--- /dev/null
+++ b/graphics/dri/files/patch-r200_vtxtmp_x86.S
@@ -0,0 +1,11 @@
+--- lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S.orig Wed Jul 16 13:48:41 2003
++++ lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S Wed Jul 16 13:48:56 2003
+@@ -28,7 +28,7 @@
+
+ #define GLOBL( x ) \
+ .globl x; \
+-x##:
++x:
+
+ .data
+ .align 4
diff --git a/graphics/dri/files/patch-radeon_vtxtmp_x86.S b/graphics/dri/files/patch-radeon_vtxtmp_x86.S
new file mode 100644
index 000000000000..6703e2c952fe
--- /dev/null
+++ b/graphics/dri/files/patch-radeon_vtxtmp_x86.S
@@ -0,0 +1,11 @@
+--- lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S.orig Wed Jul 16 13:47:09 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S Wed Jul 16 13:47:10 2003
+@@ -28,7 +28,7 @@
+
+ #define GLOBL( x ) \
+ .globl x; \
+-x##:
++x:
+
+ .data
+ .align 4
diff --git a/graphics/dri/files/patch-radeondri b/graphics/dri/files/patch-radeondri
new file mode 100644
index 000000000000..33d2bc6562b4
--- /dev/null
+++ b/graphics/dri/files/patch-radeondri
@@ -0,0 +1,234 @@
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_context.c lib/GL/mesa/src/drv/r200/r200_context.c
+--- lib/GL/mesa/src/drv.orig/r200/r200_context.c Tue Mar 11 17:51:23 2003
++++ lib/GL/mesa/src/drv/r200/r200_context.c Tue Mar 11 17:46:57 2003
+@@ -391,6 +391,7 @@
+ */
+ _tnl_destroy_pipeline( ctx );
+ _tnl_install_pipeline( ctx, r200_pipeline );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+
+ /* Try and keep materials and vertices separate:
+ */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_swtcl.c lib/GL/mesa/src/drv/r200/r200_swtcl.c
+--- lib/GL/mesa/src/drv.orig/r200/r200_swtcl.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/r200/r200_swtcl.c Tue Mar 11 17:46:57 2003
+@@ -44,6 +44,7 @@
+ #include "math/m_translate.h"
+ #include "tnl/tnl.h"
+ #include "tnl/t_context.h"
++#include "tnl/t_imm_exec.h"
+ #include "tnl/t_pipeline.h"
+
+ #include "r200_context.h"
+@@ -1220,6 +1221,14 @@
+ r200ChooseVertexState( ctx );
+ }
+
++
++void r200FlushVertices( GLcontext *ctx, GLuint flags )
++{
++ _tnl_flush_vertices( ctx, flags );
++
++ if (flags & FLUSH_STORED_VERTICES)
++ R200_FIREVERTICES( R200_CONTEXT( ctx ) );
++}
+
+ /**********************************************************************/
+ /* Initialization. */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_swtcl.h lib/GL/mesa/src/drv/r200/r200_swtcl.h
+--- lib/GL/mesa/src/drv.orig/r200/r200_swtcl.h Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/r200/r200_swtcl.h Tue Mar 11 17:46:57 2003
+@@ -42,6 +42,7 @@
+ extern void r200InitSwtcl( GLcontext *ctx );
+ extern void r200DestroySwtcl( GLcontext *ctx );
+
++extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
+ extern void r200ChooseRenderState( GLcontext *ctx );
+ extern void r200ChooseVertexState( GLcontext *ctx );
+
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_vtxfmt.c lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
+--- lib/GL/mesa/src/drv.orig/r200/r200_vtxfmt.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/r200/r200_vtxfmt.c Tue Mar 11 17:47:00 2003
+@@ -38,6 +38,7 @@
+ #include "r200_ioctl.h"
+ #include "r200_tex.h"
+ #include "r200_tcl.h"
++#include "r200_swtcl.h"
+ #include "r200_vtxfmt.h"
+
+ #include "api_noop.h"
+@@ -59,7 +60,7 @@
+
+ struct r200_vb vb;
+
+-static void r200FlushVertices( GLcontext *, GLuint );
++static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
+
+ static void count_func( const char *name, struct dynfn *l )
+ {
+@@ -357,12 +358,13 @@
+ fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
+
+ if (ctx->Driver.NeedFlush)
+- r200FlushVertices( ctx, ctx->Driver.NeedFlush );
++ r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
+
+ if (ctx->NewState)
+ _mesa_update_state( ctx ); /* clear state so fell_back sticks */
+
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+
+ assert( rmesa->dma.flush == 0 );
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -404,6 +406,7 @@
+ prim = rmesa->vb.prim[0];
+ ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+
+ assert(rmesa->dma.flush == 0);
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -756,7 +759,7 @@
+ fprintf(stderr, "reinstall (new install)\n");
+
+ _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
+- ctx->Driver.FlushVertices = r200FlushVertices;
++ ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
+ ctx->Driver.NewList = r200NewList;
+ rmesa->vb.installed = GL_TRUE;
+ vb.context = ctx;
+@@ -772,6 +775,7 @@
+ if (rmesa->dma.flush)
+ rmesa->dma.flush( rmesa );
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+ rmesa->vb.installed = GL_FALSE;
+ vb.context = 0;
+ }
+@@ -931,7 +935,7 @@
+ return GL_TRUE;
+ }
+
+-static void r200FlushVertices( GLcontext *ctx, GLuint flags )
++static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
+ {
+ r200ContextPtr rmesa = R200_CONTEXT( ctx );
+
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_context.c lib/GL/mesa/src/drv/radeon/radeon_context.c
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_context.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_context.c Tue Mar 11 17:47:00 2003
+@@ -382,6 +382,7 @@
+ */
+ _tnl_destroy_pipeline( ctx );
+ _tnl_install_pipeline( ctx, radeon_pipeline );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+
+ /* Try and keep materials and vertices separate:
+ */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.c lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_swtcl.c Tue Mar 11 17:47:00 2003
+@@ -45,6 +45,7 @@
+ #include "math/m_translate.h"
+ #include "tnl/tnl.h"
+ #include "tnl/t_context.h"
++#include "tnl/t_imm_exec.h"
+ #include "tnl/t_pipeline.h"
+
+ #include "radeon_context.h"
+@@ -1133,6 +1134,14 @@
+ }
+ }
+
++
++void radeonFlushVertices( GLcontext *ctx, GLuint flags )
++{
++ _tnl_flush_vertices( ctx, flags );
++
++ if (flags & FLUSH_STORED_VERTICES)
++ RADEON_FIREVERTICES( RADEON_CONTEXT( ctx ) );
++}
+
+ /**********************************************************************/
+ /* Initialization. */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.h lib/GL/mesa/src/drv/radeon/radeon_swtcl.h
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.h Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_swtcl.h Tue Mar 11 17:47:00 2003
+@@ -43,6 +43,7 @@
+ extern void radeonInitSwtcl( GLcontext *ctx );
+ extern void radeonDestroySwtcl( GLcontext *ctx );
+
++extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
+ extern void radeonChooseRenderState( GLcontext *ctx );
+ extern void radeonChooseVertexState( GLcontext *ctx );
+
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_vtxfmt.c lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_vtxfmt.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c Tue Mar 11 17:47:01 2003
+@@ -38,6 +38,7 @@
+ #include "radeon_ioctl.h"
+ #include "radeon_tex.h"
+ #include "radeon_tcl.h"
++#include "radeon_swtcl.h"
+ #include "radeon_vtxfmt.h"
+
+ #include "api_noop.h"
+@@ -59,7 +60,7 @@
+
+ struct radeon_vb vb;
+
+-static void radeonFlushVertices( GLcontext *, GLuint );
++static void radeonVtxfmtFlushVertices( GLcontext *, GLuint );
+
+ static void count_func( const char *name, struct dynfn *l )
+ {
+@@ -336,12 +337,13 @@
+ fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
+
+ if (ctx->Driver.NeedFlush)
+- radeonFlushVertices( ctx, ctx->Driver.NeedFlush );
++ radeonVtxfmtFlushVertices( ctx, ctx->Driver.NeedFlush );
+
+ if (ctx->NewState)
+ _mesa_update_state( ctx ); /* clear state so fell_back sticks */
+
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+
+ assert( rmesa->dma.flush == 0 );
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -382,6 +384,7 @@
+ prim = rmesa->vb.prim[0];
+ ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+
+ assert(rmesa->dma.flush == 0);
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -731,7 +734,7 @@
+ fprintf(stderr, "reinstall (new install)\n");
+
+ _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
+- ctx->Driver.FlushVertices = radeonFlushVertices;
++ ctx->Driver.FlushVertices = radeonVtxfmtFlushVertices;
+ ctx->Driver.NewList = radeonNewList;
+ rmesa->vb.installed = GL_TRUE;
+ vb.context = ctx;
+@@ -747,6 +750,7 @@
+ if (rmesa->dma.flush)
+ rmesa->dma.flush( rmesa );
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+ rmesa->vb.installed = GL_FALSE;
+ vb.context = 0;
+ }
+@@ -905,7 +909,7 @@
+ return GL_TRUE;
+ }
+
+-static void radeonFlushVertices( GLcontext *ctx, GLuint flags )
++static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags )
+ {
+ radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
+
diff --git a/graphics/dri/pkg-descr b/graphics/dri/pkg-descr
new file mode 100644
index 000000000000..cae2b2e00e06
--- /dev/null
+++ b/graphics/dri/pkg-descr
@@ -0,0 +1,8 @@
+This package contains the client drivers for the DRI, included with XFree86.
+With an X Server configured for the DRI they allow direct rendering of
+hardware-accelerated OpenGL.
+
+WWW: http://www.xfree86.org/
+
+- Eric Anholt
+anholt@FreeBSD.org
diff --git a/graphics/dri/pkg-plist b/graphics/dri/pkg-plist
new file mode 100644
index 000000000000..e165729f00d9
--- /dev/null
+++ b/graphics/dri/pkg-plist
@@ -0,0 +1,8 @@
+lib/modules/dri/gamma_dri.so
+%%I386%%lib/modules/dri/i810_dri.so
+%%I386%%lib/modules/dri/i830_dri.so
+lib/modules/dri/mga_dri.so
+lib/modules/dri/r128_dri.so
+lib/modules/dri/r200_dri.so
+lib/modules/dri/radeon_dri.so
+lib/modules/dri/tdfx_dri.so
diff --git a/graphics/dri/scripts/configure b/graphics/dri/scripts/configure
new file mode 100644
index 000000000000..609c55af6fe5
--- /dev/null
+++ b/graphics/dri/scripts/configure
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# This script does the following:
+# (1) cp xf86site.def, installed by imake-4 port,
+# to ${WRKDIR}/xc/config/cf.
+# this provides settings for the ports system.
+# (2) Create a host.def for this specific port, using
+# host.def as a base.
+
+ORIGDEF=$PREFIX/lib/X11/config/xf86site.def
+DESTDEF=$WRKDIR/xc/config/cf/xf86site.def
+ORIGHOSTDEF=$PREFIX/lib/X11/config/host.def
+LOCALDEF=$WRKDIR/.config
+HOSTDEF=$WRKDIR/xc/config/cf/host.def
+
+# Use original host.def as initial config file
+rm -f $LOCALDEF
+grep -v '#define.*ProjectRoot' $ORIGHOSTDEF >> $LOCALDEF
+echo "#define ProjectRoot $PREFIX" >> $LOCALDEF
+echo "#define X11ProjectRoot $PREFIX" >> $LOCALDEF
+
+# This is also defined in xf86site.def, but doesn't get
+# picked up for some reason.
+echo "#define NothingOutsideProjectRoot YES" >> $LOCALDEF
+
+echo "#define BuildXF86DRI YES" >> $LOCALDEF
+echo "#define BuildXF86DRM NO" >> $LOCALDEF
+echo "#define HasGlide3 YES" >> $LOCALDEF
+
+echo "#define BuildGLXLibrary YES" >> $LOCALDEF
+echo "#define UseInstalledPrograms YES" >> $LOCALDEF
+echo "#define UseInstalled YES" >> $LOCALDEF
+echo "#define StandardIncludes -I${PREFIX}/include" >> $LOCALDEF
+
+echo "#define FreeBSDCC ${CC}" >> $LOCALDEF
+echo "#define FreeBSDCXX ${CXX}" >> $LOCALDEF
+echo "#define FreeBSDCFLAGS ${CFLAGS}" >> $LOCALDEF
+
+# Copy ORIGDEF to DESTDEF
+rm -f $DESTDEF
+cp -f $ORIGDEF $DESTDEF
+
+# copy generated config to host.def
+cp -f $LOCALDEF $HOSTDEF
+
+exit 0
diff --git a/graphics/xfree86-dri/Makefile b/graphics/xfree86-dri/Makefile
new file mode 100644
index 000000000000..ba63f6997cfa
--- /dev/null
+++ b/graphics/xfree86-dri/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: dri
+# Date created: 08 Nov 2003
+# Whom: anholt@FreeBSD.org
+#
+# $FreeBSD$
+#
+
+PORTNAME= dri
+PORTVERSION= 4.3.0
+PORTEPOCH= 1
+CATEGORIES= graphics
+MASTER_SITES= ${MASTER_SITE_XFREE}
+MASTER_SITE_SUBDIR= ${PORTVERSION}
+DISTFILES= X430src-1.tgz \
+ X430src-2.tgz \
+ X430src-3.tgz
+
+MAINTAINER= anholt@FreeBSD.org
+COMMENT= OpenGL hardware acceleration drivers for XFree86
+
+.for pf in \
+ patch-GL-Imakefile \
+ patch-radeondri \
+ patch-r200_vtxtmp_x86.S \
+ patch-radeon_vtxtmp_x86.S \
+ patch-dri_util.c
+EXTRA_PATCHES+= ${FILESDIR}/${pf}
+.endfor
+
+XBUILD_DIRS= lib/GL
+XINSTALL_DIRS= lib/GL/mesa/src/drv
+
+.include "${.CURDIR}/../../x11/XFree86-4-libraries/Makefile.inc"
+.include <bsd.port.pre.mk>
+.if ${ARCH} == i386
+PLIST_SUB+= I386=""
+.else
+PLIST_SUB+= I386="@comment "
+.endif
+.include <bsd.port.post.mk>
diff --git a/graphics/xfree86-dri/distinfo b/graphics/xfree86-dri/distinfo
new file mode 100644
index 000000000000..86966f90fbd3
--- /dev/null
+++ b/graphics/xfree86-dri/distinfo
@@ -0,0 +1,4 @@
+MD5 (xc/X430src-1.tgz) = 4f241a4f867363f40efa2b00dca292af
+MD5 (xc/X430src-2.tgz) = 844c2ee908d21dbf8911fd13115bf8b4
+MD5 (xc/X430src-3.tgz) = b82a0443e1b7bf860e4343e6b6766cb6
+MD5 (xc/Wraphelp2.gz) = bd1910492087442288d885412e2e5535
diff --git a/graphics/xfree86-dri/files/patch-GL-Imakefile b/graphics/xfree86-dri/files/patch-GL-Imakefile
new file mode 100644
index 000000000000..94e8b7e8875a
--- /dev/null
+++ b/graphics/xfree86-dri/files/patch-GL-Imakefile
@@ -0,0 +1,11 @@
+--- lib/GL/Imakefile.orig Sat Nov 8 23:54:33 2003
++++ lib/GL/Imakefile Sat Nov 8 23:55:05 2003
+@@ -106,7 +106,7 @@
+ #if BuildXF86DRI && GlxUseBuiltInDRIDriver
+ SUBDIRS = $(MESADIRS) $(DRIDIRS) $(DRIVERDIRS) $(GLXDIRS) $(LIBGLBUILDDIR) $(OSMESADIRS)
+ #else
+-SUBDIRS = $(MESADIRS) $(GLXDIRS) $(DRIDIRS) $(LIBGLBUILDDIR) $(OSMESADIRS) $(DRIVERDIRS)
++SUBDIRS = $(MESADIRS) $(GLXDIRS) $(DRIDIRS) $(DRIVERDIRS)
+ #endif
+
+ MakeSubdirs($(SUBDIRS))
diff --git a/graphics/xfree86-dri/files/patch-dri_util.c b/graphics/xfree86-dri/files/patch-dri_util.c
new file mode 100644
index 000000000000..0084acff7a3e
--- /dev/null
+++ b/graphics/xfree86-dri/files/patch-dri_util.c
@@ -0,0 +1,26 @@
+Index: lib/GL/dri/dri_util.c
+===================================================================
+RCS file: /home/ncvs/xfree/xc/lib/GL/dri/dri_util.c,v
+retrieving revision 1.6
+retrieving revision 1.7
+diff -u -u -r1.6 -r1.7
+--- lib/GL/dri/dri_util.c 15 Feb 2003 22:12:29 -0000 1.6
++++ lib/GL/dri/dri_util.c 28 Apr 2003 17:01:25 -0000 1.7
+@@ -921,7 +921,7 @@
+ int directCapable;
+ __DRIscreenPrivate *psp;
+ drmHandle hFB, hSAREA;
+- char *BusID, *driverName;
++ char *BusID, *driverName = NULL;
+ drmMagic magic;
+
+ if (!XF86DRIQueryDirectRenderingCapable(dpy, scrn, &directCapable)) {
+@@ -1010,6 +1010,8 @@
+ (void)XF86DRICloseConnection(dpy, scrn);
+ return NULL;
+ }
++ if (driverName)
++ Xfree(driverName);
+
+ /* install driver's callback functions */
+ memcpy(&psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec));
diff --git a/graphics/xfree86-dri/files/patch-r200_vtxtmp_x86.S b/graphics/xfree86-dri/files/patch-r200_vtxtmp_x86.S
new file mode 100644
index 000000000000..c77182d8b85f
--- /dev/null
+++ b/graphics/xfree86-dri/files/patch-r200_vtxtmp_x86.S
@@ -0,0 +1,11 @@
+--- lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S.orig Wed Jul 16 13:48:41 2003
++++ lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S Wed Jul 16 13:48:56 2003
+@@ -28,7 +28,7 @@
+
+ #define GLOBL( x ) \
+ .globl x; \
+-x##:
++x:
+
+ .data
+ .align 4
diff --git a/graphics/xfree86-dri/files/patch-radeon_vtxtmp_x86.S b/graphics/xfree86-dri/files/patch-radeon_vtxtmp_x86.S
new file mode 100644
index 000000000000..6703e2c952fe
--- /dev/null
+++ b/graphics/xfree86-dri/files/patch-radeon_vtxtmp_x86.S
@@ -0,0 +1,11 @@
+--- lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S.orig Wed Jul 16 13:47:09 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S Wed Jul 16 13:47:10 2003
+@@ -28,7 +28,7 @@
+
+ #define GLOBL( x ) \
+ .globl x; \
+-x##:
++x:
+
+ .data
+ .align 4
diff --git a/graphics/xfree86-dri/files/patch-radeondri b/graphics/xfree86-dri/files/patch-radeondri
new file mode 100644
index 000000000000..33d2bc6562b4
--- /dev/null
+++ b/graphics/xfree86-dri/files/patch-radeondri
@@ -0,0 +1,234 @@
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_context.c lib/GL/mesa/src/drv/r200/r200_context.c
+--- lib/GL/mesa/src/drv.orig/r200/r200_context.c Tue Mar 11 17:51:23 2003
++++ lib/GL/mesa/src/drv/r200/r200_context.c Tue Mar 11 17:46:57 2003
+@@ -391,6 +391,7 @@
+ */
+ _tnl_destroy_pipeline( ctx );
+ _tnl_install_pipeline( ctx, r200_pipeline );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+
+ /* Try and keep materials and vertices separate:
+ */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_swtcl.c lib/GL/mesa/src/drv/r200/r200_swtcl.c
+--- lib/GL/mesa/src/drv.orig/r200/r200_swtcl.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/r200/r200_swtcl.c Tue Mar 11 17:46:57 2003
+@@ -44,6 +44,7 @@
+ #include "math/m_translate.h"
+ #include "tnl/tnl.h"
+ #include "tnl/t_context.h"
++#include "tnl/t_imm_exec.h"
+ #include "tnl/t_pipeline.h"
+
+ #include "r200_context.h"
+@@ -1220,6 +1221,14 @@
+ r200ChooseVertexState( ctx );
+ }
+
++
++void r200FlushVertices( GLcontext *ctx, GLuint flags )
++{
++ _tnl_flush_vertices( ctx, flags );
++
++ if (flags & FLUSH_STORED_VERTICES)
++ R200_FIREVERTICES( R200_CONTEXT( ctx ) );
++}
+
+ /**********************************************************************/
+ /* Initialization. */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_swtcl.h lib/GL/mesa/src/drv/r200/r200_swtcl.h
+--- lib/GL/mesa/src/drv.orig/r200/r200_swtcl.h Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/r200/r200_swtcl.h Tue Mar 11 17:46:57 2003
+@@ -42,6 +42,7 @@
+ extern void r200InitSwtcl( GLcontext *ctx );
+ extern void r200DestroySwtcl( GLcontext *ctx );
+
++extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
+ extern void r200ChooseRenderState( GLcontext *ctx );
+ extern void r200ChooseVertexState( GLcontext *ctx );
+
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/r200/r200_vtxfmt.c lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
+--- lib/GL/mesa/src/drv.orig/r200/r200_vtxfmt.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/r200/r200_vtxfmt.c Tue Mar 11 17:47:00 2003
+@@ -38,6 +38,7 @@
+ #include "r200_ioctl.h"
+ #include "r200_tex.h"
+ #include "r200_tcl.h"
++#include "r200_swtcl.h"
+ #include "r200_vtxfmt.h"
+
+ #include "api_noop.h"
+@@ -59,7 +60,7 @@
+
+ struct r200_vb vb;
+
+-static void r200FlushVertices( GLcontext *, GLuint );
++static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
+
+ static void count_func( const char *name, struct dynfn *l )
+ {
+@@ -357,12 +358,13 @@
+ fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
+
+ if (ctx->Driver.NeedFlush)
+- r200FlushVertices( ctx, ctx->Driver.NeedFlush );
++ r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
+
+ if (ctx->NewState)
+ _mesa_update_state( ctx ); /* clear state so fell_back sticks */
+
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+
+ assert( rmesa->dma.flush == 0 );
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -404,6 +406,7 @@
+ prim = rmesa->vb.prim[0];
+ ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+
+ assert(rmesa->dma.flush == 0);
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -756,7 +759,7 @@
+ fprintf(stderr, "reinstall (new install)\n");
+
+ _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
+- ctx->Driver.FlushVertices = r200FlushVertices;
++ ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
+ ctx->Driver.NewList = r200NewList;
+ rmesa->vb.installed = GL_TRUE;
+ vb.context = ctx;
+@@ -772,6 +775,7 @@
+ if (rmesa->dma.flush)
+ rmesa->dma.flush( rmesa );
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = r200FlushVertices;
+ rmesa->vb.installed = GL_FALSE;
+ vb.context = 0;
+ }
+@@ -931,7 +935,7 @@
+ return GL_TRUE;
+ }
+
+-static void r200FlushVertices( GLcontext *ctx, GLuint flags )
++static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
+ {
+ r200ContextPtr rmesa = R200_CONTEXT( ctx );
+
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_context.c lib/GL/mesa/src/drv/radeon/radeon_context.c
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_context.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_context.c Tue Mar 11 17:47:00 2003
+@@ -382,6 +382,7 @@
+ */
+ _tnl_destroy_pipeline( ctx );
+ _tnl_install_pipeline( ctx, radeon_pipeline );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+
+ /* Try and keep materials and vertices separate:
+ */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.c lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_swtcl.c Tue Mar 11 17:47:00 2003
+@@ -45,6 +45,7 @@
+ #include "math/m_translate.h"
+ #include "tnl/tnl.h"
+ #include "tnl/t_context.h"
++#include "tnl/t_imm_exec.h"
+ #include "tnl/t_pipeline.h"
+
+ #include "radeon_context.h"
+@@ -1133,6 +1134,14 @@
+ }
+ }
+
++
++void radeonFlushVertices( GLcontext *ctx, GLuint flags )
++{
++ _tnl_flush_vertices( ctx, flags );
++
++ if (flags & FLUSH_STORED_VERTICES)
++ RADEON_FIREVERTICES( RADEON_CONTEXT( ctx ) );
++}
+
+ /**********************************************************************/
+ /* Initialization. */
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.h lib/GL/mesa/src/drv/radeon/radeon_swtcl.h
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_swtcl.h Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_swtcl.h Tue Mar 11 17:47:00 2003
+@@ -43,6 +43,7 @@
+ extern void radeonInitSwtcl( GLcontext *ctx );
+ extern void radeonDestroySwtcl( GLcontext *ctx );
+
++extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
+ extern void radeonChooseRenderState( GLcontext *ctx );
+ extern void radeonChooseVertexState( GLcontext *ctx );
+
+diff -ru -x CVS lib/GL/mesa/src/drv.orig/radeon/radeon_vtxfmt.c lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
+--- lib/GL/mesa/src/drv.orig/radeon/radeon_vtxfmt.c Tue Mar 11 17:51:29 2003
++++ lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c Tue Mar 11 17:47:01 2003
+@@ -38,6 +38,7 @@
+ #include "radeon_ioctl.h"
+ #include "radeon_tex.h"
+ #include "radeon_tcl.h"
++#include "radeon_swtcl.h"
+ #include "radeon_vtxfmt.h"
+
+ #include "api_noop.h"
+@@ -59,7 +60,7 @@
+
+ struct radeon_vb vb;
+
+-static void radeonFlushVertices( GLcontext *, GLuint );
++static void radeonVtxfmtFlushVertices( GLcontext *, GLuint );
+
+ static void count_func( const char *name, struct dynfn *l )
+ {
+@@ -336,12 +337,13 @@
+ fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
+
+ if (ctx->Driver.NeedFlush)
+- radeonFlushVertices( ctx, ctx->Driver.NeedFlush );
++ radeonVtxfmtFlushVertices( ctx, ctx->Driver.NeedFlush );
+
+ if (ctx->NewState)
+ _mesa_update_state( ctx ); /* clear state so fell_back sticks */
+
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+
+ assert( rmesa->dma.flush == 0 );
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -382,6 +384,7 @@
+ prim = rmesa->vb.prim[0];
+ ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+
+ assert(rmesa->dma.flush == 0);
+ rmesa->vb.fell_back = GL_TRUE;
+@@ -731,7 +734,7 @@
+ fprintf(stderr, "reinstall (new install)\n");
+
+ _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
+- ctx->Driver.FlushVertices = radeonFlushVertices;
++ ctx->Driver.FlushVertices = radeonVtxfmtFlushVertices;
+ ctx->Driver.NewList = radeonNewList;
+ rmesa->vb.installed = GL_TRUE;
+ vb.context = ctx;
+@@ -747,6 +750,7 @@
+ if (rmesa->dma.flush)
+ rmesa->dma.flush( rmesa );
+ _tnl_wakeup_exec( ctx );
++ ctx->Driver.FlushVertices = radeonFlushVertices;
+ rmesa->vb.installed = GL_FALSE;
+ vb.context = 0;
+ }
+@@ -905,7 +909,7 @@
+ return GL_TRUE;
+ }
+
+-static void radeonFlushVertices( GLcontext *ctx, GLuint flags )
++static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags )
+ {
+ radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
+
diff --git a/graphics/xfree86-dri/pkg-descr b/graphics/xfree86-dri/pkg-descr
new file mode 100644
index 000000000000..cae2b2e00e06
--- /dev/null
+++ b/graphics/xfree86-dri/pkg-descr
@@ -0,0 +1,8 @@
+This package contains the client drivers for the DRI, included with XFree86.
+With an X Server configured for the DRI they allow direct rendering of
+hardware-accelerated OpenGL.
+
+WWW: http://www.xfree86.org/
+
+- Eric Anholt
+anholt@FreeBSD.org
diff --git a/graphics/xfree86-dri/pkg-plist b/graphics/xfree86-dri/pkg-plist
new file mode 100644
index 000000000000..e165729f00d9
--- /dev/null
+++ b/graphics/xfree86-dri/pkg-plist
@@ -0,0 +1,8 @@
+lib/modules/dri/gamma_dri.so
+%%I386%%lib/modules/dri/i810_dri.so
+%%I386%%lib/modules/dri/i830_dri.so
+lib/modules/dri/mga_dri.so
+lib/modules/dri/r128_dri.so
+lib/modules/dri/r200_dri.so
+lib/modules/dri/radeon_dri.so
+lib/modules/dri/tdfx_dri.so
diff --git a/graphics/xfree86-dri/scripts/configure b/graphics/xfree86-dri/scripts/configure
new file mode 100644
index 000000000000..609c55af6fe5
--- /dev/null
+++ b/graphics/xfree86-dri/scripts/configure
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# This script does the following:
+# (1) cp xf86site.def, installed by imake-4 port,
+# to ${WRKDIR}/xc/config/cf.
+# this provides settings for the ports system.
+# (2) Create a host.def for this specific port, using
+# host.def as a base.
+
+ORIGDEF=$PREFIX/lib/X11/config/xf86site.def
+DESTDEF=$WRKDIR/xc/config/cf/xf86site.def
+ORIGHOSTDEF=$PREFIX/lib/X11/config/host.def
+LOCALDEF=$WRKDIR/.config
+HOSTDEF=$WRKDIR/xc/config/cf/host.def
+
+# Use original host.def as initial config file
+rm -f $LOCALDEF
+grep -v '#define.*ProjectRoot' $ORIGHOSTDEF >> $LOCALDEF
+echo "#define ProjectRoot $PREFIX" >> $LOCALDEF
+echo "#define X11ProjectRoot $PREFIX" >> $LOCALDEF
+
+# This is also defined in xf86site.def, but doesn't get
+# picked up for some reason.
+echo "#define NothingOutsideProjectRoot YES" >> $LOCALDEF
+
+echo "#define BuildXF86DRI YES" >> $LOCALDEF
+echo "#define BuildXF86DRM NO" >> $LOCALDEF
+echo "#define HasGlide3 YES" >> $LOCALDEF
+
+echo "#define BuildGLXLibrary YES" >> $LOCALDEF
+echo "#define UseInstalledPrograms YES" >> $LOCALDEF
+echo "#define UseInstalled YES" >> $LOCALDEF
+echo "#define StandardIncludes -I${PREFIX}/include" >> $LOCALDEF
+
+echo "#define FreeBSDCC ${CC}" >> $LOCALDEF
+echo "#define FreeBSDCXX ${CXX}" >> $LOCALDEF
+echo "#define FreeBSDCFLAGS ${CFLAGS}" >> $LOCALDEF
+
+# Copy ORIGDEF to DESTDEF
+rm -f $DESTDEF
+cp -f $ORIGDEF $DESTDEF
+
+# copy generated config to host.def
+cp -f $LOCALDEF $HOSTDEF
+
+exit 0