summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2010-03-21 17:46:55 +0100
committerLuc Verhaegen <libv@skynet.be>2010-03-21 17:46:55 +0100
commit6db325ed9fdebf96722f5a64956914564d7820b2 (patch)
tree4dd0316b78e8c2ed7a463b1de2ef400a2ae26145
parente15805645653cfcacb1f2dc3c370c19b163e4f55 (diff)
DRI: Add support for the dri sdk.unified
Fix building against SDK, while also keeping --with-mesa-dir support around.
-rw-r--r--configure.ac103
-rw-r--r--dri/Makefile.am65
-rw-r--r--dri/via_context.c14
-rw-r--r--dri/via_fb.c4
-rw-r--r--dri/via_ioctl.c2
-rw-r--r--dri/via_render.c4
-rw-r--r--dri/via_screen.c15
-rw-r--r--dri/via_span.c20
-rw-r--r--dri/via_state.c4
-rw-r--r--dri/via_tex.c4
-rw-r--r--dri/via_texcombine.c4
-rw-r--r--dri/via_tris.c4
-rw-r--r--src/Makefile.am2
-rw-r--r--wrapper/Makefile.am2
14 files changed, 147 insertions, 100 deletions
diff --git a/configure.ac b/configure.ac
index 13ecefd..8434951 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,7 +120,8 @@ AC_MSG_RESULT([$DRI])
AM_CONDITIONAL(DRI, test x$DRI = xyes)
if test "$DRI" = yes; then
- PKG_CHECK_MODULES(DRI, [libdrm xf86driproto])
+ PKG_CHECK_MODULES(DRM, [libdrm])
+ PKG_CHECK_MODULES(XF86DRIPROTO, [xf86driproto])
AC_DEFINE(DRIVER_DRI,1,[Enable DRI driver support])
fi
@@ -342,46 +343,63 @@ fi
# Figure out whether we can build the DRI driver.
#
#
-AC_MSG_CHECKING([MESA DRI directory to build against])
-if test "x$mesa_build_dir" != x; then
- AC_MSG_RESULT([$mesa_build_dir])
- build_dri_driver="yes"
-else
- AC_MSG_RESULT([none])
- build_dri_driver="no"
-fi
-# check version
-if test "x$build_dri_driver" = xyes; then
- AC_CHECK_FILE([${mesa_build_dir}/configs/default],
- , [build_dri_driver="no"])
-
- AC_MSG_CHECKING([MESA version])
+PKG_CHECK_MODULES([MESADRI], [libmesadri libmesadricommon],
+ mesa_dri_sdk=yes, mesa_dri_sdk=no)
+if test "x$mesa_dri_sdk" = xyes; then
+ build_dri_driver="yes"
+ build_dri_tree="no"
+ mesa_dri_include=$(pkg-config --variable=includedir libmesadri)
+else
+ # if the mesa SDK is not there, try direct building.
+ AC_MSG_CHECKING([MESA DRI directory to build against])
+ if test "x$mesa_build_dir" != x; then
+ AC_MSG_RESULT([$mesa_build_dir])
+ build_dri_driver="yes"
+ else
+ AC_MSG_RESULT([none])
+ build_dri_driver="no"
+ fi
+
+ # check version
if test "x$build_dri_driver" = xyes; then
- mesa_major=`grep "MESA_MAJOR=" ${mesa_build_dir}/configs/default | sed s/MESA_MAJOR=//`
- mesa_minor=`grep "MESA_MINOR=" ${mesa_build_dir}/configs/default | sed s/MESA_MINOR=//`
- mesa_tiny=`grep "MESA_TINY=" ${mesa_build_dir}/configs/default | sed s/MESA_TINY=//`
- if test "x$mesa_major" != x -a \
- "x$mesa_minor" != x -a \
- "x$mesa_tiny" != x; then
- build_dri_driver="yes"
+ AC_CHECK_FILE([${mesa_build_dir}/configs/default], ,
+ [build_dri_driver="no"])
+
+ AC_MSG_CHECKING([MESA version])
+
+ if test "x$build_dri_driver" = xyes; then
+ mesa_major=`grep "MESA_MAJOR=" ${mesa_build_dir}/configs/default | sed s/MESA_MAJOR=//`
+ mesa_minor=`grep "MESA_MINOR=" ${mesa_build_dir}/configs/default | sed s/MESA_MINOR=//`
+ mesa_tiny=`grep "MESA_TINY=" ${mesa_build_dir}/configs/default | sed s/MESA_TINY=//`
+ if test "x$mesa_major" != x -a \
+ "x$mesa_minor" != x -a \
+ "x$mesa_tiny" != x; then
+ build_dri_driver="yes"
+ else
+ build_dri_driver="no"
+ fi
+ fi
+
+ if test "x$build_dri_driver" = xyes; then
+ AC_MSG_RESULT([$mesa_major.$mesa_minor.$mesa_tiny])
else
- build_dri_driver="no"
+ AC_MSG_RESULT([failed])
fi
fi
+ # due to mesa's unique structure, we need to link statically to libmesa.a
if test "x$build_dri_driver" = xyes; then
- AC_MSG_RESULT([$mesa_major.$mesa_minor.$mesa_tiny])
- else
- AC_MSG_RESULT([failed])
+ AC_CHECK_FILE([${mesa_build_dir}/src/mesa/libmesa.a], ,
+ [build_dri_driver="no"])
fi
-fi
-# due to mesa's unique structure, we need to link statically to libmesa.a
-if test "x$build_dri_driver" = xyes; then
- AC_CHECK_FILE([${mesa_build_dir}/src/mesa/libmesa.a],
- , [build_dri_driver="no"])
+ if test "x$build_dri_driver" = xyes; then
+ build_dri_tree="yes"
+ mesa_dri_include=${mesa_build_dir}/src/
+ MESADRI_CFLAGS="-I${mesa_dri_include}/mesa/ -I${mesa_build_dir}/include/"
+ fi
fi
AC_MSG_CHECKING([whether we build the MESA DRI driver])
@@ -390,18 +408,20 @@ AC_MSG_RESULT([$build_dri_driver])
AM_CONDITIONAL(BUILD_DRI, test "x$build_dri_driver" = xyes)
if test "x$build_dri_driver" = xyes; then
AC_OUTPUT([dri/Makefile])
+fi
+
+if test "x$build_dri_tree" = xyes; then
MESA_DIR=$mesa_build_dir
AC_SUBST([MESA_DIR])
-fi
-if test "x$build_dri_driver" = xyes; then
AC_CHECK_FILE([${mesa_build_dir}/src/mesa/drivers/dri/common/dri_metaops.c],
[mesa_have_dri_metaops=yes],)
fi
+AM_CONDITIONAL(MESA_DRI_TREE, test "x$build_dri_tree" = xyes)
AM_CONDITIONAL(MESA_HAVE_DRI_METAOPS, test "x$mesa_have_dri_metaops" = xyes)
if test "x$build_dri_driver" = xyes; then
- AC_EGREP_HEADER([msaa_samples], [${mesa_build_dir}/src/mesa/drivers/dri/common/utils.h],
+ AC_EGREP_HEADER([msaa_samples], [${mesa_dri_include}/mesa/drivers/dri/common/utils.h],
[mesa_have_msaa=yes],)
if test "x$mesa_have_msaa" = xyes; then
AC_DEFINE(MESA_HAVE_MSAA, 1, [MESA has MSAA support.])
@@ -409,7 +429,7 @@ if test "x$build_dri_driver" = xyes; then
SAVED_CFLAGS="$CFLAGS"
- CFLAGS="-I${mesa_build_dir}/src/mesa/ $DRI_CFLAGS -I${mesa_build_dir}/include/"
+ CFLAGS="$DRM_CFLAGS $MESADRI_CFLAGS"
AC_CHECK_MEMBER([struct __DRIextensionRec.name],
[mesa_dri_screen_extension="yes"], ,
[#include "GL/gl.h"
@@ -433,7 +453,7 @@ if test "x$build_dri_driver" = xyes; then
# only run this test if the previous succeeded.
AC_CHECK_MEMBER([struct gl_framebuffer._ColorDrawBufferIndexes],
[mesa_gl_framebuffer_colordrawbufferindexes="yes"], ,
- [#include "${mesa_build_dir}/src/mesa/main/mtypes.h"])
+ [#include "${mesa_dri_include}/mesa/main/mtypes.h"])
fi
if test "x$mesa_gl_framebuffer_colordrawbufferindexes" = xyes; then
@@ -465,18 +485,25 @@ if test "x$build_dri_driver" = xyes; then
# only run this test if the previous succeeded.
AC_CHECK_MEMBER([struct gl_stencil_attrib._Enabled],
[mesa_gl_stencil_attrib__enabled=yes], ,
- [#include "${mesa_build_dir}/src/mesa/main/mtypes.h"])
+ [#include "${mesa_dri_include}/mesa/main/mtypes.h"])
fi
if test "x$mesa_gl_stencil_attrib__enabled" = xyes; then
AC_DEFINE(MESA_GL_STENCIL_ATTRIB__ENABLED, 1,
[Does struct gl_stencil_attrib have _Enabled])
+
+ AC_CHECK_FILE([${mesa_dri_include}/mesa/main/formats.h],
+ [reworked_texformat="yes"], [reworked_texformat="no"])
+ fi
+
+ if test "x$reworked_texformat" = xyes; then
+ AC_DEFINE(REWORKED_TEXFORMAT, 1, [Were Texture formats reworked?])
fi
CFLAGS="$SAVED_CFLAGS"
fi
-AC_SUBST([DRI_CFLAGS])
+#AC_SUBST([DRI_CFLAGS])
AC_SUBST([XORG_CFLAGS])
AC_SUBST([moduledir])
diff --git a/dri/Makefile.am b/dri/Makefile.am
index dd0f568..089aee6 100644
--- a/dri/Makefile.am
+++ b/dri/Makefile.am
@@ -1,35 +1,9 @@
-MESA_DRI_DIR = @MESA_DIR@/src/mesa/drivers/dri
+AM_CFLAGS = -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING
-AM_CFLAGS = -DIN_DRI_DRIVER -D_GNU_SOURCE -g -O0
-AM_CFLAGS += -DUSE_X86_64_ASM -DPTHREADS -DHAVE_POSIX_MEMALIGN
-AM_CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 -DGLX_DIRECT_RENDERING
-AM_CFLAGS += -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS
-# -DREWORKED_TEXFORMAT
-
-AM_CFLAGS += -I/usr/include/drm -I@MESA_DIR@/src/mesa -I@MESA_DIR@/include/
-AM_CFLAGS += -I@MESA_DIR@/src/mesa/main -I@MESA_DIR@/src/mesa/glapi
-
-# convenience library
-noinst_LTLIBRARIES = libdricommon.la
-libdricommon_la_CFLAGS = $(AM_CFLAGS) -I@MESA_DIR@/src/mesa/shader
-libdricommon_la_SOURCES = \
- $(MESA_DRI_DIR)/common/utils.c \
- $(MESA_DRI_DIR)/common/texmem.c \
- $(MESA_DRI_DIR)/common/vblank.c \
- $(MESA_DRI_DIR)/common/dri_util.c \
- $(MESA_DRI_DIR)/common/xmlconfig.c \
- $(MESA_DRI_DIR)/common/drirenderbuffer.c \
- $(MESA_DIR)/src/mesa/drivers/common/driverfuncs.c
-
-if MESA_HAVE_DRI_METAOPS
-libdricommon_la_SOURCES += $(MESA_DRI_DIR)/common/dri_metaops.c
-endif
-
-# actual driver
unichrome_dri_la_LTLIBRARIES = unichrome_dri.la
-unichrome_dri_la_CFLAGS = $(AM_CFLAGS) -I$(MESA_DRI_DIR)
-unichrome_dri_la_LDFLAGS = -module -noprefix -ldrm -lexpat -lm -lpthread -ldl
-unichrome_dri_la_LIBADD = @MESA_DIR@/src/mesa/libmesa.a libdricommon.la
+unichrome_dri_la_CFLAGS = $(AM_CFLAGS) $(DRM_CFLAGS) $(MESADRI_CFLAGS)
+unichrome_dri_la_LDFLAGS = -module -noprefix -avoid-version -lm -ldl \
+ $(DRM_LIBS) $(MESADRI_LIBS)
unichrome_dri_ladir = @libdir@/dri
unichrome_dri_la_SOURCES = \
via_context.c \
@@ -42,3 +16,34 @@ unichrome_dri_la_SOURCES = \
via_state.c \
via_texcombine.c \
via_tris.c
+
+# for building without SDK.
+if MESA_DRI_TREE
+
+MESA_DRI_DIR = @MESA_DIR@/src/mesa/drivers/dri/common
+
+MESADRI_CFLAGS += -DPTHREADS -I@MESA_DIR@/src/mesa/shader -I$(MESA_DRI_DIR)
+MESADRI_CFLAGS += -I@MESA_DIR@/src/mesa -I@MESA_DIR@/include/
+MESADRI_CFLAGS += -I@MESA_DIR@/src/mesa/main -I@MESA_DIR@/src/mesa/glapi
+
+MESADRI_LIBS += -lexpat -lpthread
+
+# convenience library
+noinst_LTLIBRARIES = libdricommon.la
+libdricommon_la_CFLAGS = $(AM_CFLAGS) $(DRM_CFLAGS) $(MESADRI_CFLAGS) -D_GNU_SOURCE
+libdricommon_la_SOURCES = \
+ $(MESA_DRI_DIR)/utils.c \
+ $(MESA_DRI_DIR)/texmem.c \
+ $(MESA_DRI_DIR)/vblank.c \
+ $(MESA_DRI_DIR)/dri_util.c \
+ $(MESA_DRI_DIR)/xmlconfig.c \
+ $(MESA_DRI_DIR)/drirenderbuffer.c \
+ $(MESA_DIR)/src/mesa/drivers/common/driverfuncs.c
+
+if MESA_HAVE_DRI_METAOPS
+libdricommon_la_SOURCES += $(MESA_DRI_DIR)/dri_metaops.c
+endif
+
+unichrome_dri_la_LIBADD = @MESA_DIR@/src/mesa/libmesa.a libdricommon.la
+
+endif \ No newline at end of file
diff --git a/dri/via_context.c b/dri/via_context.c
index aa9b1a7..eff01d0 100644
--- a/dri/via_context.c
+++ b/dri/via_context.c
@@ -24,7 +24,7 @@
/**
* \file via_context.c
- *
+ *
* \author John Sheng (presumably of either VIA Technologies or S3 Graphics)
* \author Others at VIA Technologies?
* \author Others at S3 Graphics?
@@ -40,13 +40,19 @@
#include "main/renderbuffer.h"
#include "main/simple_list.h"
-#include "common/drirenderbuffer.h"
-#include "common/vblank.h"
+#include "drirenderbuffer.h"
+#include "vblank.h"
+#include "utils.h"
#define need_GL_ARB_point_parameters
#define need_GL_EXT_fog_coord
#define need_GL_EXT_secondary_color
-#include "common/extension_helper.h"
+#if 0
+#include "extension_helper.h"
+#else
+#include "main/remap_helper.h"
+#endif
+
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
diff --git a/dri/via_fb.c b/dri/via_fb.c
index e95a30b..f25b556 100644
--- a/dri/via_fb.c
+++ b/dri/via_fb.c
@@ -28,8 +28,8 @@
#include <sys/ioctl.h>
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include "main/imports.h"
#include "main/simple_list.h"
diff --git a/dri/via_ioctl.c b/dri/via_ioctl.c
index d55d2bf..88e7670 100644
--- a/dri/via_ioctl.c
+++ b/dri/via_ioctl.c
@@ -30,7 +30,7 @@
#include "swrast/swrast.h"
-#include "common/vblank.h"
+#include "vblank.h"
#include <tnl/t_vertex.h>
diff --git a/dri/via_render.c b/dri/via_render.c
index bc3d0bd..6370bcb 100644
--- a/dri/via_render.c
+++ b/dri/via_render.c
@@ -34,8 +34,8 @@
#include "main/macros.h"
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include <tnl/t_vertex.h>
diff --git a/dri/via_screen.c b/dri/via_screen.c
index b589add..8918570 100644
--- a/dri/via_screen.c
+++ b/dri/via_screen.c
@@ -32,9 +32,9 @@
#include <main/framebuffer.h>
#include <main/renderbuffer.h>
-#include "common/utils.h"
-#include "common/vblank.h"
-#include "common/xmlpool.h"
+#include "utils.h"
+#include "vblank.h"
+#include "xmlpool.h"
#include "tnl/t_vertex.h"
@@ -448,7 +448,10 @@ viaInitScreen(__DRIscreenPrivate *psp)
VIA_DRIDDX_VERSION_MINOR,
VIA_DRIDDX_VERSION_PATCH };
static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 2, 3, 0 };
+ static const __DRIversion drm_expected = {VIA_DRM_DRIVER_MAJOR,
+ VIA_DRM_DRIVER_MINOR,
+ VIA_DRM_DRIVER_PATCHLEVEL};
+
static const char *driver_name = "Unichrome";
VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv;
@@ -510,7 +513,9 @@ __driCreateNewScreen_20050727(__DRInativeDisplay *dpy, int scrn,
VIA_DRIDDX_VERSION_MINOR,
VIA_DRIDDX_VERSION_PATCH };
static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 2, 3, 0 };
+ static const __DRIversion drm_expected = {VIA_DRM_DRIVER_MAJOR,
+ VIA_DRM_DRIVER_MINOR,
+ VIA_DRM_DRIVER_PATCHLEVEL};
static const char *driver_name = "Unichrome";
dri_interface = interface;
diff --git a/dri/via_span.c b/dri/via_span.c
index 59ffb09..160e961 100644
--- a/dri/via_span.c
+++ b/dri/via_span.c
@@ -26,12 +26,16 @@
#include <config.h>
#endif
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include "swrast/swrast.h"
#include <tnl/t_vertex.h>
+#ifdef REWORKED_TEXFORMAT
+#include "main/formats.h"
+#endif
+
#include <drm/drm.h>
#include "../drm/via_drm.h"
@@ -69,7 +73,7 @@
#define TAG(x) via##x##_565
#define TAG2(x,y) via##x##_565##y
-#include "common/spantmp2.h"
+#include "spantmp2.h"
/* 32 bit, ARGB8888 color spanline and pixel functions
@@ -80,7 +84,7 @@
#define TAG(x) via##x##_8888
#define TAG2(x,y) via##x##_8888##y
-#include "common/spantmp2.h"
+#include "spantmp2.h"
/* 16 bit depthbuffer functions.
@@ -103,7 +107,7 @@
d = *(volatile GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch);
#define TAG(x) via##x##_z16
-#include "common/depthtmp.h"
+#include "depthtmp.h"
/* 32 bit depthbuffer functions.
*/
@@ -117,7 +121,7 @@
d = *(volatile GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch);
#define TAG(x) via##x##_z32
-#include "common/depthtmp.h"
+#include "depthtmp.h"
@@ -137,7 +141,7 @@
#define TAG(x) via##x##_z24_s8
-#include "common/depthtmp.h"
+#include "depthtmp.h"
#define WRITE_STENCIL( _x, _y, d ) { \
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \
@@ -150,7 +154,7 @@
d = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) & 0xff;
#define TAG(x) via##x##_z24_s8
-#include "common/stenciltmp.h"
+#include "stenciltmp.h"
diff --git a/dri/via_state.c b/dri/via_state.c
index 7ba37c1..d80609b 100644
--- a/dri/via_state.c
+++ b/dri/via_state.c
@@ -31,8 +31,8 @@
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include "tnl/t_vertex.h"
diff --git a/dri/via_tex.c b/dri/via_tex.c
index 262eddc..3c9324d 100644
--- a/dri/via_tex.c
+++ b/dri/via_tex.c
@@ -41,8 +41,8 @@
#include "main/texstore.h"
#include "main/simple_list.h"
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include <tnl/t_vertex.h>
diff --git a/dri/via_texcombine.c b/dri/via_texcombine.c
index e325e5c..797bbed 100644
--- a/dri/via_texcombine.c
+++ b/dri/via_texcombine.c
@@ -34,8 +34,8 @@
#include "main/context.h"
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include "tnl/t_vertex.h"
diff --git a/dri/via_tris.c b/dri/via_tris.c
index ee34f89..568d71e 100644
--- a/dri/via_tris.c
+++ b/dri/via_tris.c
@@ -34,8 +34,8 @@
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
-#include "common/dri_util.h"
-#include "common/xmlconfig.h"
+#include "dri_util.h"
+#include "xmlconfig.h"
#include <drm/drm.h>
#include "../drm/via_drm.h"
diff --git a/src/Makefile.am b/src/Makefile.am
index 8c163fa..26544e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@
+AM_CFLAGS = @XORG_CFLAGS@ @DRM_CFLAGS@ @XF86DRIPROTO_CFLAGS@
unichrome_drv_la_LTLIBRARIES = unichrome_drv.la
unichrome_drv_la_LDFLAGS = -module -avoid-version
unichrome_drv_ladir = @moduledir@/drivers
diff --git a/wrapper/Makefile.am b/wrapper/Makefile.am
index 66b08ac..99a314f 100644
--- a/wrapper/Makefile.am
+++ b/wrapper/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@
+AM_CFLAGS = @XORG_CFLAGS@
EXTRA_DIST = wrapper.man
drivermandir = $(DRIVER_MAN_DIR)
SED = sed