On Tue, Jul 08, 2014 at 10:01:52AM -0400, Rob Clark wrote:
> This enables the xserver to associate the drm driver name "msm" to the
> xf86-video-freedreno driver.
> 
> Signed-off-by: Rob Clark <[email protected]>
> ---
> Not sure if anyone has a better suggestion for how to do that videodrv
> abi check in configure.ac.  The problem is, we don't want to install
> the .conf file snippet(s) for older xserver, as it will error out at
> startup complaining about unknown section "OutputClass".
> 
> If this is the best way, I'll push it and update some of the other
> drivers.  (I assume Thierry already has patches for tegra.)
> 
>  Makefile.am            |  2 +-
>  conf/42-freedreno.conf |  5 +++++
>  conf/Makefile.am       | 23 +++++++++++++++++++++++
>  configure.ac           | 26 ++++++++++++++++++++++++++
>  4 files changed, 55 insertions(+), 1 deletion(-)
>  create mode 100644 conf/42-freedreno.conf
>  create mode 100644 conf/Makefile.am

I came up with the attached patch. It's somewhat longer but I think the
version check becomes safer by using the header files of the server
that's being built against directly. Also it checks against a server
version number rather than a video ABI number. After all this isn't a
feature influenced by a change of video ABI.

Thierry
From d09a629792b3906feb14f785306fdd0c184eb275 Mon Sep 17 00:00:00 2001
From: Thierry Reding <[email protected]>
Date: Wed, 19 Feb 2014 11:32:12 +0100
Subject: [PATCH] Install OutputClass xorg.conf.d snippet

Newer versions of the X server allow matching DDX modules to kernel
drivers using an OutputClass configuration snippet. Install such a
snippet that help autoload this driver when the DRM device's driver
is the Tegra DRM driver.

Signed-off-by: Thierry Reding <[email protected]>
---
 Makefile.am    | 30 ++++++++++++++++++++++++++++++
 configure.ac   | 21 +++++++++++++++++++++
 opentegra.conf |  5 +++++
 3 files changed, 56 insertions(+)
 create mode 100644 opentegra.conf

diff --git a/Makefile.am b/Makefile.am
index d184700242c7..2f4eba7e00f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,11 @@ ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = src man
 
+if HAVE_OUTPUTCLASS
+sysconfig_DATA = \
+	opentegra.conf
+endif
+
 INSTALL:
 	$(INSTALL_CMD)
 
@@ -30,6 +35,31 @@ ChangeLog:
 
 dist-hook: ChangeLog INSTALL
 
+EXTRA_DIST = \
+	opentegra.conf
+
+#
+# This is needed to work around some weird behaviour in make distcheck. What
+# distcheck will try to do is run something like the following:
+#
+#   $ ./configure --prefix=$(distdir)/_inst
+#   $ make install
+#
+# However that will fail to install the opentegra.org file because the path
+# where it is to be installed is retrieved from the xorg-server.pc file's
+# sysconfigdir variable. Unfortunately that already has the ${prefix} value
+# expanded, so make distcheck will effectively try to install this file into
+# /usr/share/X11/xorg.conf.d, which will fail if run as normal user.
+#
+# We outsmart automake by overriding sysconfigdir on the configure command-
+# line, using ${datarootdir} as prefix so that the file ends up installed
+# somewhere below the prefix set by distcheck. Note that it's possible that
+# the path will not be what the X.Org X server was configured with, but the
+# workaround here is only used for sanity checking the distribution tarball
+# anyway, therefore the file will never be used, so the exact location does
+# not matter.
+#
+AM_DISTCHECK_CONFIGURE_FLAGS = sysconfigdir=\$${datarootdir}/X11/xorg.conf.d
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 
 .PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index a7bd0c0c51a1..518a44c8fd76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,27 @@ if test x"$udev" = xyes; then
 	AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
 fi
 
+AC_MSG_CHECKING([for OutputClass support in the X.Org X server])
+AC_PREPROC_IFELSE(
+	[AC_LANG_PROGRAM([
+		#include <xorg/xorg-server.h>
+		#include <xorg/xorgVersion.h>
+	], [
+		#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,15,99,904,0)
+		#  error xorg.conf OutputClass support requires 1.15.99.904
+		#endif
+	])], [have_outputclass=yes], [have_outputclass=no])
+AC_MSG_RESULT([$have_outputclass])
+
+if test "x$have_outputclass" = "xyes"; then
+	AC_MSG_CHECKING([for X.Org X server sysconfigdir variable])
+	PKG_CHECK_VAR([sysconfigdir], [xorg-server], [sysconfigdir])
+	AC_MSG_RESULT([$sysconfigdir])
+	AC_SUBST([sysconfigdir])
+fi
+
+AM_CONDITIONAL([HAVE_OUTPUTCLASS], [test "x$have_outputclass" = "xyes"])
+
 SAVE_CFLAGS=$CFLAGS
 SAVE_LIBS=$LIBS
 CFLAGS=$DRM_CFLAGS
diff --git a/opentegra.conf b/opentegra.conf
new file mode 100644
index 000000000000..aa28a99ebbd4
--- /dev/null
+++ b/opentegra.conf
@@ -0,0 +1,5 @@
+Section "OutputClass"
+    Identifier "NVIDIA Tegra open-source driver"
+    MatchDriver "tegra"
+    Driver "opentegra"
+EndSection
-- 
2.0.1

Attachment: pgpWo2PPuigE2.pgp
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to