summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac3
-rw-r--r--m4/ac_define_dir.m449
-rw-r--r--src/intel_dri.c15
-rw-r--r--src/sna/sna_dri.c16
5 files changed, 80 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 5001674e..b4b027d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
+ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
SUBDIRS = man
diff --git a/configure.ac b/configure.ac
index 9411e174..d30686ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ AC_INIT([xf86-video-intel],
[xf86-video-intel])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(.)
# Initialize Automake
@@ -168,6 +169,8 @@ AC_ARG_WITH(xorg-module-dir,
AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
[Disable DRI support [[default=auto]]]))
+dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
+AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
[Disable XvMC support [[default=yes]]]),
diff --git a/m4/ac_define_dir.m4 b/m4/ac_define_dir.m4
new file mode 100644
index 00000000..db42d3eb
--- /dev/null
+++ b/m4/ac_define_dir.m4
@@ -0,0 +1,49 @@
+# ===========================================================================
+# http://autoconf-archive.cryp.to/ac_define_dir.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+#
+# DESCRIPTION
+#
+# This macro sets VARNAME to the expansion of the DIR variable, taking
+# care of fixing up ${prefix} and such.
+#
+# VARNAME is then offered as both an output variable and a C preprocessor
+# symbol.
+#
+# Example:
+#
+# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+#
+# LAST MODIFICATION
+#
+# 2008-04-12
+#
+# COPYLEFT
+#
+# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
+# Copyright (c) 2008 Andreas Schwab <schwab@suse.de>
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2008 Alexandre Oliva
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+
+AC_DEFUN([AC_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}. Thus we have to use `eval' twice.
+ eval ac_define_dir="\"[$]$2\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ AC_SUBST($1, "$ac_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 8f279216..0df99120 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -1523,13 +1523,24 @@ out_complete:
static int dri2_server_generation;
#endif
+static bool has_i830_dri(void)
+{
+ return access(DRI_DRIVER_PATH "/i830_dri.so", R_OK) == 0;
+}
+
static const char *dri_driver_name(intel_screen_private *intel)
{
const char *s = xf86GetOptValString(intel->Options, OPTION_DRI);
Bool dummy;
- if (s == NULL || xf86getBoolValue(&dummy, s))
- return INTEL_INFO(intel)->gen < 040 ? "i915" : "i965";
+ if (s == NULL || xf86getBoolValue(&dummy, s)) {
+ if (INTEL_INFO(intel)->gen < 030)
+ return has_i830_dri() ? "i830" : "i915";
+ else if (INTEL_INFO(intel)->gen < 040)
+ return "i915";
+ else
+ return "i965";
+ }
return s;
}
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 5fb16623..98e0d6af 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -39,6 +39,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <errno.h>
#include <time.h>
#include <string.h>
+#include <unistd.h>
#include "sna.h"
#include "sna_reg.h"
@@ -2381,13 +2382,24 @@ out_complete:
}
#endif
+static bool has_i830_dri(void)
+{
+ return access(DRI_DRIVER_PATH "/i830_dri.so", R_OK) == 0;
+}
+
static const char *dri_driver_name(struct sna *sna)
{
const char *s = xf86GetOptValString(sna->Options, OPTION_DRI);
Bool dummy;
- if (s == NULL || xf86getBoolValue(&dummy, s))
- return sna->kgem.gen < 040 ? "i915" : "i965";
+ if (s == NULL || xf86getBoolValue(&dummy, s)) {
+ if (sna->kgem.gen < 030)
+ return has_i830_dri() ? "i830" : "i915";
+ else if (sna->kgem.gen < 040)
+ return "i915";
+ else
+ return "i965";
+ }
return s;
}