[Backport to xf86-video-ati 6.8]

From f9d6c0de231357f96e2e0de71e6c9221bcb36bd4 Mon Sep 17 00:00:00 2001
From: Gaetan Nadon <memsize@videotron.ca>
Date: Fri, 23 Jul 2010 13:28:42 -0400
Subject: [PATCH] The local copy of the modes code is no longer required.

The server 1.2 as shipped in the tarball on the web does not contain the
modes code. It was added just after and found in git branch server-1.2-branch.

The modes code was initially included in version ati 6.8.0 and fails to compile
with server 1.2 as it requires randr 1.2. The modes code is included in server
versions 1.3 and later, so there is no need to provide an unknown version of
the modes code in the ati driver tarball. It will never be used.

This patch makes the ati driver requiring server 1.3 or later.
Version 6.8.0 configures and builds ok on server 1.3
Master branch post 6.13.1  configures and builds ok on server 1.3

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
---
 configure.ac           |   54 +-----------------------------------------------
 src/Makefile.am        |   24 ---------------------
 src/local_xf86Rename.h |   23 --------------------
 3 files changed, 1 insertions(+), 100 deletions(-)
 delete mode 100644 src/local_xf86Rename.h

diff --git a/configure.ac b/configure.ac
index fe4c057..a5140fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,11 +62,6 @@ AC_ARG_ENABLE(exa,
               [EXA="$enableval"],
               [EXA=yes])
 
-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(XINERAMA, xineramaproto)
 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
@@ -76,7 +71,7 @@ XORG_DRIVER_CHECK_EXT(XF86MISC, xf86miscproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES])
 sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 
 # Checks for libraries.
@@ -117,11 +112,6 @@ if test "$DRI" = yes; then
 	fi
 fi
 
-save_CFLAGS="$CFLAGS"
-CFLAGS="$XORG_CFLAGS"
-AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
-CFLAGS="$save_CFLAGS"
-
 # Note that this is sort of inverted from drivers/ati/Imakefile in
 # the monolith.  We test for foo, not for !foo (i.e. ATMISC_CPIO, not
 # ATIMISC_AVOID_CPIO), but the defines are negative.  So beware.  Oh yeah,
@@ -232,48 +222,6 @@ AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
 	      [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
 	      [#include "xorg-server.h"])
 
-AM_CONDITIONAL(XMODES, test "x$XMODES" = xno)
-
-if test "x$XSERVER_SOURCE" = x; then
-        if test -d ../../xserver; then
-                XSERVER_SOURCE="`cd ../../xserver && pwd`"
-        fi
-fi
-
-if test -d "$XSERVER_SOURCE"; then
-        case "$XSERVER_SOURCE" in
-        /*)
-                ;;
-        *)
-                XSERVER_SOURCE="`cd $XSERVER_SOURCE && pwd`"
-        esac
-        if test -f src/modes/xf86Modes.h; then
-                :
-        else
-                ln -sf $XSERVER_SOURCE/hw/xfree86/modes src/modes
-        fi
-
-        if test -f src/parser/xf86Parser.h; then
-                :
-        else
-                ln -sf $XSERVER_SOURCE/hw/xfree86/parser src/parser
-        fi
-fi
-if test "x$XMODES" = xyes; then
-        AC_MSG_NOTICE([X server has new mode code])
-        AC_DEFINE(XMODES, 1,[X server has built-in mode code])
-        XMODES_CFLAGS=
-else
-        if test -f src/modes/xf86Modes.h -a -f src/parser/xf86Parser.h; then
-                AC_MSG_NOTICE([X server is missing new mode code, using local copy])
-        else
-                AC_MSG_ERROR([Must have X server >= 1.3 source tree for mode setting code. Please specify --with-xserver-source])
-        fi
-        XMODES_CFLAGS='-DXF86_MODES_RENAME -I$(top_srcdir)/src -I$(top_srcdir)/src/modes -I$(top_srcdir)/src/parser'
-fi
-
-AC_SUBST([XMODES_CFLAGS])
-
 CPPFLAGS="$SAVE_CPPFLAGS"
 
 AM_CONDITIONAL(USE_EXA, test "x$USE_EXA" = xyes)
diff --git a/src/Makefile.am b/src/Makefile.am
index a146df3..052bca6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,23 +47,6 @@ RADEON_ATOMBIOS_SOURCES = \
         AtomBios/includes/ObjectID.h \
         AtomBios/includes/regsdef.h
 
-XMODE_SRCS=\
-        local_xf86Rename.h \
-	parser/xf86Parser.h \
-        parser/xf86Optrec.h \
-        modes/xf86Modes.h \
-        modes/xf86Modes.c \
-        modes/xf86cvt.c \
-        modes/xf86Crtc.h \
-        modes/xf86Crtc.c \
-        modes/xf86Cursors.c \
-        modes/xf86EdidModes.c \
-        modes/xf86RandR12.c \
-        modes/xf86RandR12.h \
-        modes/xf86Rename.h \
-        modes/xf86Rotate.c \
-        modes/xf86DiDGA.c
-
 if ATIMISC_CPIO
 ATIMISC_CPIO_SOURCES = ativga.c ativgaio.c atibank.c atiwonder.c atiwonderio.c
 endif
@@ -77,7 +60,7 @@ ATIMISC_EXA_SOURCES = atimach64exa.c
 RADEON_EXA_SOURCES = radeon_exa.c
 endif
 
-AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ @XMODES_CFLAGS@ -DDISABLE_EASF -DENABLE_ALL_SERVICE_FUNCTIONS -DATOM_BIOS -DATOM_BIOS_PARSER -DFGL_LINUX -DDRIVER_PARSER
+AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -DDISABLE_EASF -DENABLE_ALL_SERVICE_FUNCTIONS -DATOM_BIOS -DATOM_BIOS_PARSER -DFGL_LINUX -DDRIVER_PARSER
 INCLUDES = -I$(srcdir)/AtomBios/includes
 
 ati_drv_la_LTLIBRARIES = ati_drv.la
@@ -118,11 +101,6 @@ radeon_drv_la_SOURCES = \
 	$(RADEON_ATOMBIOS_SOURCES) radeon_atombios.c radeon_atomwrapper.c \
 	$(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES) atombios_output.c atombios_crtc.c
 
-if XMODES
-radeon_drv_la_SOURCES += \
-	$(XMODE_SRCS)
-endif
-
 theatre_detect_drv_la_LTLIBRARIES = theatre_detect_drv.la
 theatre_detect_drv_la_LDFLAGS = -module -avoid-version
 theatre_detect_drv_ladir = @moduledir@/multimedia
@@ -145,7 +123,6 @@ theatre200_drv_la_SOURCES = \
 	theatre200.c theatre200_module.c
 
 EXTRA_DIST = \
-	$(XMODE_SRCS) \
 	atimach64render.c \
 	radeon_render.c \
 	radeon_accelfuncs.c \
diff --git a/src/local_xf86Rename.h b/./prev/xf86-video-ati-6.8.0/src/local_xf86Rename.h
deleted file mode 100644
index 5102170..0000000
--- a/src/local_xf86Rename.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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) radeon_##x
