Prefer i830_dri.so for gen2 chipsets

Probe for i830_dri.so and, if it exists, use that driver in preference
to i915_dri.so for DRI (i.e. GL clients). This was suggested in the
context of distributions supplying i915g as the main DRI driver for
gen3, in which case we need to provide a separate DRI driver for gen2.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-04-17 15:24:10 +01:00
parent ddd75d6539
commit 1bf0d869ae
5 changed files with 80 additions and 5 deletions

View File

@ -18,7 +18,7 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # 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. # 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 SUBDIRS = man

View File

@ -28,6 +28,7 @@ AC_INIT([xf86-video-intel],
[xf86-video-intel]) [xf86-video-intel])
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(.) AC_CONFIG_AUX_DIR(.)
# Initialize Automake # Initialize Automake
@ -168,6 +169,8 @@ AC_ARG_WITH(xorg-module-dir,
AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri], AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
[Disable DRI support [[default=auto]]])) [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], AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
[Disable XvMC support [[default=yes]]]), [Disable XvMC support [[default=yes]]]),

49
m4/ac_define_dir.m4 Normal file
View File

@ -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
])

View File

@ -1523,13 +1523,24 @@ out_complete:
static int dri2_server_generation; static int dri2_server_generation;
#endif #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) static const char *dri_driver_name(intel_screen_private *intel)
{ {
const char *s = xf86GetOptValString(intel->Options, OPTION_DRI); const char *s = xf86GetOptValString(intel->Options, OPTION_DRI);
Bool dummy; Bool dummy;
if (s == NULL || xf86getBoolValue(&dummy, s)) if (s == NULL || xf86getBoolValue(&dummy, s)) {
return INTEL_INFO(intel)->gen < 040 ? "i915" : "i965"; 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; return s;
} }

View File

@ -39,6 +39,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "sna.h" #include "sna.h"
#include "sna_reg.h" #include "sna_reg.h"
@ -2381,13 +2382,24 @@ out_complete:
} }
#endif #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) static const char *dri_driver_name(struct sna *sna)
{ {
const char *s = xf86GetOptValString(sna->Options, OPTION_DRI); const char *s = xf86GetOptValString(sna->Options, OPTION_DRI);
Bool dummy; Bool dummy;
if (s == NULL || xf86getBoolValue(&dummy, s)) if (s == NULL || xf86getBoolValue(&dummy, s)) {
return sna->kgem.gen < 040 ? "i915" : "i965"; if (sna->kgem.gen < 030)
return has_i830_dri() ? "i830" : "i915";
else if (sna->kgem.gen < 040)
return "i915";
else
return "i965";
}
return s; return s;
} }