summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2007-04-20 14:30:45 -0700
committerAaron Plattner <aplattner@nvidia.com>2007-04-20 15:20:12 -0700
commit7a07a765c2a3816e8cd0487e8f66bc767024142d (patch)
tree2981090528cac9ab5172749708a621fce4dd1b0a
parent2971fd0a18e947c5d39d6af78b0b77d6e4fe00d8 (diff)
Steal RandR1.2 compat code from the Intel driver.
Spruce it up a bit so that --with-xserver-source works even if there's a local compat copy.
-rw-r--r--Makefile.am2
-rw-r--r--compat/.gitignore2
-rw-r--r--compat/Makefile.am15
-rw-r--r--compat/README7
-rw-r--r--configure.ac48
-rw-r--r--src/Makefile.am23
-rw-r--r--src/local_xf86Rename.h23
7 files changed, 118 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 3924813..5acfc99 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src man
+SUBDIRS = src man compat
EXTRA_DIST = README.NV1 ChangeLog
diff --git a/compat/.gitignore b/compat/.gitignore
new file mode 100644
index 0000000..8d30df6
--- /dev/null
+++ b/compat/.gitignore
@@ -0,0 +1,2 @@
+modes
+parser
diff --git a/compat/Makefile.am b/compat/Makefile.am
new file mode 100644
index 0000000..f5f8d93
--- /dev/null
+++ b/compat/Makefile.am
@@ -0,0 +1,15 @@
+EXTRA_DIST = \
+ parser/xf86Parser.h \
+ parser/xf86Optrec.h \
+ modes/xf86Crtc.c \
+ modes/xf86Crtc.h \
+ modes/xf86Cursors.c \
+ modes/xf86cvt.c \
+ modes/xf86DiDGA.c \
+ modes/xf86EdidModes.c \
+ modes/xf86Modes.c \
+ modes/xf86Modes.h \
+ modes/xf86RandR12.c \
+ modes/xf86RandR12.h \
+ modes/xf86Rename.h \
+ modes/xf86Rotate.c
diff --git a/compat/README b/compat/README
new file mode 100644
index 0000000..3e2b089
--- /dev/null
+++ b/compat/README
@@ -0,0 +1,7 @@
+This directory contains a copy of the mode and parser code from RandR 1.2.
+
+If you are building from git and you don't have xorg-server-1.3 or higher or you
+want to be able to make dist, you should create symlinks to the modes and parser
+directories from a RandR 1.2-enabled server here:
+
+ $ ln -s /path/to/xorg/xserver/hw/xfree86/{modes,parser} .
diff --git a/configure.ac b/configure.ac
index 9bb243a..b4fd037 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,12 +41,18 @@ AC_PROG_CC
AH_TOP([#include "xorg-server.h"])
+# Options
AC_ARG_WITH(xorg-module-dir,
AC_HELP_STRING([--with-xorg-module-dir=DIR],
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
[moduledir="$withval"],
[moduledir="$libdir/xorg/modules"])
+AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE],
+ [Path to X server source tree]),
+ [ XSERVER_SOURCE="$withval" ],
+ [ XSERVER_SOURCE="" ])
+
# Checks for extensions
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
@@ -68,6 +74,47 @@ sdkdir=$(pkg-config --variable=sdkdir xorg-server)
# Checks for header files.
AC_HEADER_STDC
+save_CFLAGS="$CFLAGS"
+CFLAGS="$XORG_CFLAGS"
+AC_CHECK_HEADER(xf86Modes.h,[BUILD_XMODES=no],[BUILD_XMODES=yes],[#include "xorg-server.h"])
+CFLAGS="$save_CFLAGS"
+AM_CONDITIONAL(BUILD_XMODES, test "x$BUILD_XMODES" = xyes)
+if test "x$XSERVER_SOURCE" != x; then
+ if test -d "$XSERVER_SOURCE"; then
+ XSERVER_SOURCE=`cd "$XSERVER_SOURCE" && pwd`
+ if test -f "$XSERVER_SOURCE/hw/xfree86/modes/xf86Modes.h" -a -f "$XSERVER_SOURCE/hw/xfree86/parser/xf86Parser.h"; then
+ :
+ else
+ AC_ERROR([Server source at $XSERVER_SOURCE doesn't have the new mode code])
+ fi
+ else
+ AC_ERROR([Can't find xserver-source path $XSERVER_SOURCE])
+ fi
+fi
+if test "x$BUILD_XMODES" = xno; then
+ AC_MSG_NOTICE([X server has new mode code])
+ XMODES_CFLAGS=
+ parser_dir=
+ modes_dir=
+else
+ if test "x$XSERVER_SOURCE" = x; then
+ AC_MSG_NOTICE([X server is missing new mode code and --with-xserver-source not specified, using local copy])
+ AC_MSG_NOTICE([If you're building from git, please read compat/README])
+ parser_dir='$(top_srcdir)/compat/parser'
+ modes_dir='$(top_srcdir)/compat/modes'
+ else
+ AC_MSG_NOTICE([Using mode code from $XSERVER_SOURCE])
+ parser_dir="$XSERVER_SOURCE/hw/xfree86/parser"
+ modes_dir="$XSERVER_SOURCE/hw/xfree86/modes"
+ fi
+ XMODES_CFLAGS="-DXF86_MODES_RENAME -I\"$modes_dir\" -I\"$parser_dir\""
+ AC_DEFINE(BUILD_XMODES, 1,[X server doesn't have built-in mode code, so we need to build it])
+fi
+AC_SUBST([XMODES_CFLAGS])
+AC_SUBST([parser_dir])
+AC_SUBST([modes_dir])
+
+# Substitutions
AC_SUBST([XORG_CFLAGS])
AC_SUBST([moduledir])
@@ -81,4 +128,5 @@ AC_OUTPUT([
Makefile
src/Makefile
man/Makefile
+ compat/Makefile
])
diff --git a/src/Makefile.am b/src/Makefile.am
index b31ebea..52b6b47 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,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@
+AM_CFLAGS = @XMODES_CFLAGS@ @XORG_CFLAGS@
nv_drv_la_LTLIBRARIES = nv_drv.la
nv_drv_la_LDFLAGS = -module -avoid-version
nv_drv_ladir = @moduledir@/drivers
@@ -81,3 +81,24 @@ g80_sources = \
g80_type.h \
g80_xaa.c \
g80_xaa.h
+
+xmode_sources = \
+ @parser_dir@/xf86Parser.h \
+ @parser_dir@/xf86Optrec.h \
+ @modes_dir@/xf86Modes.h \
+ @modes_dir@/xf86Modes.c \
+ @modes_dir@/xf86cvt.c \
+ @modes_dir@/xf86Crtc.h \
+ @modes_dir@/xf86Crtc.c \
+ @modes_dir@/xf86Cursors.c \
+ @modes_dir@/xf86EdidModes.c \
+ @modes_dir@/xf86RandR12.c \
+ @modes_dir@/xf86RandR12.h \
+ @modes_dir@/xf86Rename.h \
+ @modes_dir@/xf86Rotate.c \
+ @modes_dir@/xf86DiDGA.c
+
+if BUILD_XMODES
+EXTRA_nv_drv_la_SOURCES = local_xf86Rename.h
+nodist_nv_drv_la_SOURCES = $(xmode_sources)
+endif
diff --git a/src/local_xf86Rename.h b/src/local_xf86Rename.h
new file mode 100644
index 0000000..f3a07c6
--- /dev/null
+++ b/src/local_xf86Rename.h
@@ -0,0 +1,23 @@
+/*
+ *Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#define XF86NAME(x) nv_##x