Search:  
Gentoo Wiki

HOWTO_Dualhead_with_ATi_Open-Source_Drivers_with_enabled_compozite_extension

This howto will guide you throught instalation of drivers up to configuring xorg.conf

Warning: For using this howto you will need at least xorg 7.3

Chapter 1: Getting drivers from GIT

We need to install correct x11-drivers/xf86-video-ati and x11-base/x11-drm. So we need to set up local portage overlay.

Note: You should use some howto to create one, for lazy ones, there is bashscript expecting that you don't have any overlay
File: genoverlay.sh
#!/bin/bash
# run me under root please
mkdir -p /usr/local/portage/
echo "PORTDIR_OVERLAY=\"/usr/local/portage\"" >> /etc/make.conf

Now we should prepare directory enviroment for git ebuilds

 # mkdir -p /usr/local/portage/x11-base/x11-drm && mkdir -p /usr/local/portage/x11-drivers/xf86-video-ati

and put those two ebuilds into those dirs

File: xf86-video-ati-9999.ebuild
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-ati/xf86-video-ati-6.6.192.ebuild,v 1.1 2007/05/21 05:25:33 dberkholz Exp $

# Must be before x-modular eclass is inherited
SNAPSHOT="yes"
XDPVER=4

inherit x-modular git

EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/driver/${PN}"

DESCRIPTION="ATI video driver"
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
SRC_URI=""
IUSE="dri"

RDEPEND=">=x11-base/xorg-server-1.2"
DEPEND="${RDEPEND}
	>=x11-misc/util-macros-1.1.3
	x11-proto/fontsproto
	x11-proto/randrproto
	x11-proto/videoproto
	x11-proto/xextproto
	x11-proto/xineramaproto
	x11-proto/xf86miscproto
	x11-proto/xproto
	dri? ( x11-proto/glproto
			x11-proto/xf86driproto
			>=x11-libs/libdrm-2 )"

CONFIGURE_OPTIONS="$(use_enable dri)"

pkg_setup() {
	if use dri && ! built_with_use x11-base/xorg-server dri; then
		die "Build x11-base/xorg-server with USE=dri."
	fi
}

src_unpack() {
	x-modular_specs_check
	x-modular_server_supports_drivers_check
	x-modular_dri_check
	git_src_unpack
	cd ${S}
	x-modular_patch_source
	x-modular_reconf_source
}
File: x11-drm-99999999.ebuild

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-base/x11-drm/x11-drm-20070314.ebuild,v 1.2 2007/03/14 18:18:53 battousai Exp $

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="1.7"

#EGIT_BRANCH="vblank-rework"
EGIT_REPO_URI="git://anongit.freedesktop.org/git/mesa/drm"

inherit eutils x11 linux-mod autotools git

IUSE_VIDEO_CARDS="
	video_cards_i810
	video_cards_mach64
	video_cards_mga
	video_cards_nv
	video_cards_r128
	video_cards_radeon
	video_cards_savage
	video_cards_sis
	video_cards_sunffb
	video_cards_tdfx
	video_cards_via"
IUSE="${IUSE_VIDEO_CARDS} kernel_FreeBSD kernel_linux"

# Make sure Portage does _NOT_ strip symbols.  We will do it later and make sure
# that only we only strip stuff that are safe to strip ...
RESTRICT="strip"

S="${WORKDIR}/drm"
PATCHVER="0.2"
PATCHDIR="${WORKDIR}/patch"
EXCLUDED="${WORKDIR}/excluded"

DESCRIPTION="DRM Kernel Modules for X11"
HOMEPAGE="http://dri.sf.net"
SRC_URI="http://dev.gentoo.org/~dberkholz/distfiles/${P}-gentoo-${PATCHVER}.tar.bz2"

SLOT="0"
LICENSE="X11"
KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~x86 ~x86-fbsd"

DEPEND="kernel_linux? ( virtual/linux-sources )
	kernel_FreeBSD? ( sys-freebsd/freebsd-sources
			sys-freebsd/freebsd-mk-defs )"
RDEPEND=""

pkg_setup() {
	# Setup the kernel's stuff.
	kernel_setup

	# Set video cards to build for.
	set_vidcards

	# Determine which -core dir we build in.
	get_drm_build_dir

	return 0
}

src_unpack() {
	git_src_unpack
	cd "${WORKDIR}"

	unpack ${P}-gentoo-${PATCHVER}.tar.bz2

	cd ${S}

	patch_prepare

	# Apply patches
	EPATCH_SUFFIX="patch" epatch ${PATCHDIR}

	# Substitute new directory under /lib/modules/${KV_FULL}
	cd ${SRC_BUILD}
	sed -ie "s:/kernel/drivers/char/drm:/${PN}:g" Makefile

	cp ${S}/tests/*.c ${SRC_BUILD}

	src_unpack_os

	cd ${S}
	eautoreconf -v --install
}

src_compile() {
	unset LDFLAGS

	cd ${S}
	# Building the programs. These are useful for developers and getting info from DRI and DRM.
	#
	# libdrm objects are needed for drmstat.
	econf \
		--enable-static \
		--disable-shared \
		|| die "libdrm configure failed."
	emake || die "libdrm build failed."

	einfo "Building DRM in ${SRC_BUILD}..."
	src_compile_os
	einfo "DRM build finished".
}

src_install() {
	einfo "Installing DRM..."
	cd ${SRC_BUILD}

	src_install_os

	dodoc "${S}/linux-core/README.drm"

	dobin dristat
	dobin drmstat
}

pkg_postinst() {
	if use video_cards_sis
	then
		einfo "SiS direct rendering only works on 300 series chipsets."
		einfo "SiS framebuffer also needs to be enabled in the kernel."
	fi

	if use video_cards_mach64
	then
		einfo "The Mach64 DRI driver is insecure."
		einfo "Malicious clients can write to system memory."
		einfo "For more information, see:"
		einfo "http://dri.freedesktop.org/wiki/ATIMach64."
	fi

	pkg_postinst_os
}

# Functions used above are defined below:

kernel_setup() {
	if use kernel_FreeBSD
	then
		K_RV=${CHOST/*-freebsd/}
	elif use kernel_linux
	then
		linux-mod_pkg_setup

		if kernel_is 2 4
		then
			eerror "Upstream support for 2.4 kernels has been removed, so this package will no"
			eerror "longer support them."
			die "Please use in-kernel DRM or switch to a 2.6 kernel."
		fi

		linux_chkconfig_builtin "DRM" && \
			die "Please disable or modularize DRM in the kernel config. (CONFIG_DRM = n or m)"

		CONFIG_CHECK="AGP"
		ERROR_AGP="AGP support is not enabled in your kernel config (CONFIG_AGP)"
	fi
}

set_vidcards() {
	if use kernel_linux; then
		set_kvobj
		I810_VIDCARDS="i810.${KV_OBJ} i830.${KV_OBJ} i915.${KV_OBJ}"
	elif use kernel_FreeBSD; then
		KV_OBJ="ko"
		# bsd does not have i810/i830, only i915:
		I810_VIDCARDS="i915.${KV_OBJ}"
	fi

	VIDCARDS=""

	if [[ -n "${VIDEO_CARDS}" ]]; then
		use video_cards_i810 && \
			VIDCARDS="${VIDCARDS} ${I810_VIDCARDS}"
		use video_cards_mach64 && \
			VIDCARDS="${VIDCARDS} mach64.${KV_OBJ}"
		use video_cards_mga && \
			VIDCARDS="${VIDCARDS} mga.${KV_OBJ}"
		use video_cards_nv && \
			VIDCARDS="${VIDCARDS} nv.${KV_OBJ} nouveau.${KV_OBJ}"
		use video_cards_r128 && \
			VIDCARDS="${VIDCARDS} r128.${KV_OBJ}"
		use video_cards_radeon && \
			VIDCARDS="${VIDCARDS} radeon.${KV_OBJ}"
		use video_cards_savage && \
			VIDCARDS="${VIDCARDS} savage.${KV_OBJ}"
		use video_cards_sis && \
			VIDCARDS="${VIDCARDS} sis.${KV_OBJ}"
		use video_cards_via && \
			VIDCARDS="${VIDCARDS} via.${KV_OBJ}"
		use video_cards_sunffb && \
			VIDCARDS="${VIDCARDS} ffb.${KV_OBJ}"
		use video_cards_tdfx && \
			VIDCARDS="${VIDCARDS} tdfx.${KV_OBJ}"
	fi
}

get_drm_build_dir() {
	if use kernel_FreeBSD
	then
		SRC_BUILD="${S}/bsd-core"
	elif kernel_is 2 6
	then
		SRC_BUILD="${S}/linux-core"
	fi
}

patch_prepare() {
	# Handle exclusions based on the following...
	#     All trees (0**), Standard only (1**), Others (none right now)
	#     2.4 vs. 2.6 kernels
	if use kernel_linux
	then
	    kernel_is 2 6 && mv -f ${PATCHDIR}/*kernel-2.4* ${EXCLUDED}
	fi

	# There is only one tree being maintained now. No numeric exclusions need
	# to be done based on DRM tree.
}

src_unpack_linux() {
	convert_to_m "${SRC_BUILD}"/Makefile
}

src_unpack_freebsd() {
	# Link in freebsd kernel.
	ln -s "/usr/src/sys-${K_RV}" "${WORKDIR}/sys"
	# SUBDIR variable gets to all Makefiles, we need it only in the main one.
	SUBDIRS=${VIDCARDS//.ko}
	sed -ie "s:SUBDIR\ =.*:SUBDIR\ =\ drm ${SUBDIRS}:" ${SRC_BUILD}/Makefile
}

src_unpack_os() {
	if use kernel_linux; then
		src_unpack_linux
	elif use kernel_FreeBSD
	then
		src_unpack_freebsd
	fi
}

src_compile_os() {
	if use kernel_linux
	then
		src_compile_linux
	elif use kernel_FreeBSD
	then
		src_compile_freebsd
	fi
}

src_install_os() {
	if use kernel_linux
	then
		src_install_linux
	elif use kernel_FreeBSD
	then
		src_install_freebsd
	fi
}

src_compile_linux() {
	# This now uses an M= build system. Makefile does most of the work.
	cd ${SRC_BUILD}
	unset ARCH
	emake \
		M="${SRC_BUILD}" \
		LINUXDIR="${KERNEL_DIR}" \
		DRM_MODULES="${VIDCARDS}" \
		O="${KBUILD_OUTPUT}" \
		modules || die_error

	if linux_chkconfig_present DRM
	then
		echo "Please disable in-kernel DRM support to use this package."
	fi

	# LINUXDIR is needed to allow Makefiles to find kernel release.
	cd ${SRC_BUILD}
	emake LINUXDIR="${KERNEL_DIR}" dristat || die "Building dristat failed."
	emake LINUXDIR="${KERNEL_DIR}" drmstat || die "Building drmstat failed."
}

src_compile_freebsd() {
	cd ${SRC_BUILD}
	# Environment CFLAGS overwrite kernel CFLAGS which is bad.
	local svcflags=${CFLAGS}; local svldflags=${LDFLAGS}
	unset CFLAGS; unset LDFLAGS
	MAKE=make \
		emake \
		NO_WERROR= \
		SYSDIR="${WORKDIR}/sys" \
		KMODDIR="/boot/modules" \
		|| die "pmake failed."
	export CFLAGS=${svcflags}; export LDFLAGS=${svldflags}

	cd "${S}/tests"
	# -D_POSIX_SOURCE skips the definition of several stuff we need
	# for these two to compile
	sed -i -e "s/-D_POSIX_SOURCE//" Makefile
	emake dristat || die "Building dristat failed."
	emake drmstat || die "Building drmstat failed."
	# Move these where the linux stuff expects them
	mv dristat drmstat ${SRC_BUILD}
}

die_error() {
	eerror "Portage could not build the DRM modules. If you see an ACCESS DENIED error,"
	eerror "this could mean that you were using an unsupported kernel build system."
	eerror "Only 2.6 kernels at least as new as 2.6.6 are supported."
	die "Unable to build DRM modules."
}

src_install_linux() {
	for i in drm.${KV_OBJ} ${VIDCARDS}; do
		i=${i%.*}
		MODULE_NAMES="${MODULE_NAMES} ${i}(${PN}:${SRC_BUILD})"
		i=$(echo ${i} | tr '[:lower:]' '[:upper:]')
		eval MODULESD_${i}_ENABLED="yes"
	done

	linux-mod_src_install

	# Strip binaries, leaving /lib/modules untouched (bug #24415)
	strip_bins \/lib\/modules
}

src_install_freebsd() {
	cd ${SRC_BUILD}
	dodir "/boot/modules"
	MAKE=make \
		emake \
		install \
		NO_WERROR= \
		DESTDIR="${D}" \
		KMODDIR="/boot/modules" \
		|| die "Install failed."
}

pkg_postinst_os() {
	if use kernel_linux
	then
		linux-mod_pkg_postinst
	fi
}

Unmasking the packages and emerging them:

 # echo "x11-drivers/xf86-video-ati" >> /etc/portage/package.unmask
 # echo "x11-base/x11-drm" >> /etc/portage/package.unmask
 # echo "x11-drivers/xf86-video-ati **" >> /etc/portage/package.keywords
 # echo "x11-base/x11-drm **" >> /etc/portage/package.keywords
 # emerge -av x11-base/x11-drm x11-drivers/xf86-video-ati

If everything worked fine you should now have git sources of these two packages.

Chapter 2: Configuration

First we need to set up modules:

 # echo -e "drm\nradeon" >> /etc/modules/autoload.d/kernel2.6

and now configure /etc/X11/xorg.conf.

Note: Some sections are removed for better readability, read throught anotated parts and change it by your needs.
File: /etc/X11/xorg.conf
Section "Extensions"
	Option "Composite" "enable" #we want composite extension
EndSection
Section "ServerFlags"
	Option	"AIGLX" "on" #we use aiglx
	Option	"RandR" "on" #we use randr
	Option	"Xinerama" "off" #we don't want xinerama
EndSection
Section "Device"
	VendorName	"ATI"
	Identifier	"X700OS"
	Driver		"radeon"
#	Option		"MonitorLayout"			"NONE, CRT" #we do not specify monitor layout
	Option		"Monitor-LVDS"			"LCD"		#specify internal display #lcd is identify of first mon
	Option		"Monitor-VGA-0"			"LCD-E"		#specify external display identified by LCD-E 
	Option		"BIOSHotkeys"			"true"		#use bios hotkeys
	Option		"AccelMethod"			"XAA" #EXA	#if your GA is suppoted by EXA choose EXA and tag # all XAA aditional options
	Option		"AccelDFS"				"true"
	Option		"GARTSize"				"64"
	Option		"ColorTiling"			"true"
#	Option		"AGPMode" 				"1"
	Option		"DisableGLXRootClipping"	"true"
	Option		"EnablePageFlip" 			"true"
	Option		"XAANoOffscreenPixmaps"		"true"
	Option		"RenderAccel"			"true"
	Option		"DynamicClocks"			"true"
	Option		"backingstore"			"true"
	Option		"DRI"					"true"
	Option		"AllowGLXWithComposite"		"true"
	Option		"AddARGBGLXVisuals"			"true"
	Option		"TVOutput"					"PAL"	#specify tvout standard
	Option		"IgnoreEDID"				"true"	#we don't want to listen identification of what is lcd capable
#	Option		"AGPFastWrite"				"yes"
	Option		"XAANoScanlineImageWriteRect"	"true"
	Option		"XAANoScanlineCPUToScreenColorExpandFill"	"true"
EndSection
Section "Monitor"
	Identifier	"LCD"
	HorizSync	31.5 - 80.5
	VertRefresh	50.0 - 70.0
	Option		"ReducedBlanking"
	Option		"DPMS"	"true"
EndSection
Section "Monitor"
	Identifier	"LCD-E"
	Option		"RightOf" "LCD" #position of external lcd
	HorizSync	30.0 - 70.0
	VertRefresh	50.0 - 150.0
	Option		"ReducedBlanking"
	DisplaySize	502 424 #real size of external display
	Modeline	"1680x1050" 149.00  1680 1760 1944 2280  1050 1050 1052 1089 #modeline (if not detected automaticaly)
	Option		"PreferredMode" "1680x1050"	#what resolution do we want to try first and only
	Option		"DPMS" "true"
EndSection
Section "Screen"
	Identifier "MAIN"
	Device     "X700OS"
	DefaultDepth     24
	SubSection "Display"
		Virtual   3080 1050 #sum of resolution both displays
		Depth     24
		Modes    "3080x1050" "1400x1050" "1400x990" "1024x768" "640x480"
	EndSubSection
EndSection
Section "DRI"
	Mode 0666
EndSection

Now there is only one thing left to do before we reboot into our new enviroment:

 # eselect opengl set xorg-x11

Chapter 3: Playing with xrandr

If you want to try some features of xrandr 1.2 you really should look on this page: http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Dualhead_with_ATi_Open-Source_Drivers_with_enabled_compozite_extension"

Last modified: Thu, 04 Sep 2008 05:32:00 +0000 Hits: 487