ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: community@lists.altlinux.org
Subject: Re: [Comm] Dual head ALD4
Date: Mon, 17 Sep 2007 18:45:03 +0300
Message-ID: <20070917154503.GL13893@osdn.org.ua> (raw)
In-Reply-To: <200709122206.33140.ave4600@mail.ru>

[-- Attachment #1: Type: text/plain, Size: 1784 bytes --]

On Wed, Sep 12, 2007 at 10:06:32PM +0300, Alexander Yereschenko wrote:
> 1) видюха видится как одно устройство по lspci:
> 01:00.0 VGA compatible controller: ATI Technologies Inc RV280
> [Radeon 9200] (rev 01)
> 
> Во всех примерах (см. ссылки выше) в xorg.conf требуется
> указать разные  BusID для каждого устройства вывода.

А на деле для 9200 нужен _один_ BusID для обоих устройств...
кажется, vsu@ это как-то рассказывал -- что второе там на PCI
в качестве объезда кривизны Windows(TM).

> Видюха ATI 9200 _умеет_ выводить два независимых изображения.
> Как это объяснить X-ам, если BusID у карточки только один?
> Для подробностей - в аттаче - моя заготовка для xorg.conf 
> (может еще какие грабли найдутся, кроме видео)

Эх... за приложенные костыли мне изрядно стыдно (даже в git.alt
не клал в надежде понять текущую схему с автонастройкой, к чему
вот недавно только подошёл по мотивам разборок около fglrx).
Но для случая "завести попавшееся железо в 2D, если это ATI --
с дуалхедом на :0.0 и :0.1" (по условиям задачи) оно работает.

Пояснения:

- xorg.conf.ati9200 -- то, с чем оно по факту работает
  (в болванке vesa)

- /usr/bin/x11updatedrv -- текущая внутренняя версия того,
  что опубликовано здесь:
  http://git.altlinux.org/people/mike/packages/?p=x11updatedrv.git;a=blob;f=x11updatedrv/x11updatedrv.sh;hb=HEAD

- /usr/bin/startxheads -- обёртка вокруг startx, выбирающая
  нужный ServerLayout.

:0 и :1 мне не были нужны, но на этих двух вполне работают
программы от разных пользователей, что и требуется.  Разные
dm, насколько понимаю, не заведутся.

PS: для того, чтобы поднять два монитора, они действительно
должны быть воткнуты при включении, как и упоминали.

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #2: x11updatedrv --]
[-- Type: text/plain, Size: 3185 bytes --]

#!/bin/sh
# a script to update Driver "..." in xorg.conf as seen on PCI
# by Michael Shigorin <mike@osdn.org.ua>, 2005, 2006
# use and modify freely

# thanks for tips to Sergey Vlasov <vsu@altlinux>
# and Sergey Bolshakov <sbolshakov@altlinux>

# init: avoid vesa but still have it as a fallback
VESA="Generic VESA compatible"
CARD=
DRIVER="vesa"

debug() {
	[ -n "$DEBUG" ] && echo $0: $* >&2
}

error() {
	echo $0: $* >&2; exit 1
}

( which x11createconfig && which x11setupdrv && \
  which x11setupdrv ) >&/dev/null || {
	error "needed utilities missing"
}

# put it to function since |while will go subshell
# and won't influence main process' vars
cards() {
		x11createconfig -c \
		| grep -v "$VESA" \
		| awk -F: '/^card:/ { print $2; }' \
		| while read type; do
			debug "considering non-vesa [$type]"
			[ -n "$type" ] && {
				[ -n "$CARD" ] && { 
				echo "$0: warning, overriding already acquired $CARD!" >&2
			}
			CARD="$type"
			echo "$CARD"
		} || echo "$0: hmm, empty card type in x11createconfig output?" >&2
	done
}

# read bus info for second ATI Radeon head, if any
# note that we drop function and force it to 0
secondary() {
       lspci -d 1002: \
       | grep Secondary \
       | while read bus device function rest; do
               busid="$bus:$device"
       done
       debug "secondary BusID: ${busid:-1:0}:0"
       echo ${busid:-1:0}:0
}


# x11setupdrv -s doesn't support multihead yet
# (actually all of this is a relatively quick hack
# to plug a hole with automatic more-or-less setup
# right at bootup...) -- taking presumably primary
# device available on higher numbered PCI bus
CARD=`cards | tail -1`
debug "card: [$CARD]"

[ -n "$CARD" ] && {
    xdriver=`vcardinfo "$CARD" | awk '/^xdriver\t/ { print $2; exit; }'` || {
    	error "pciscan failed"
    }
    
    # another one for Radeon 9550 and others set up with fglrx	// mike on 20070312
    [ "$xdriver" = "fglrx" ] && {
           debug "WARNING: fixing up preferred ATI driver (fglrx->ati)"
           xdriver="ati"
    }
    
    [ -n "$xdriver" ] && DRIVER="$xdriver"
} || {
	# is it some fancy new card not in hwdatabase yet?
	debug "WARNING: an empty CARD!"
	# NVIDIA might also be onboard
	pciscan -c 003 \
	| grep -q 'nVidia Corporation.*VGA compatible controller' \
	&& {
		debug "WARNING: some unknown NVIDIA videocard found, trying to use nvidia..."
		DRIVER="nvidia"
	}
	# ATI has less chance to be onboard, rather dualhead
	pciscan -c 003 \
	| grep -q 'ATI Technologies Inc.*VGA compatible controller' \
	&& {
		debug "WARNING: some unknown ATI videocard found, trying to use ati..."
		DRIVER="ati"
    }
	# else defaults to vesa
}
debug "driver: [$DRIVER]"

CURRENT=`x11setupdrv -d --nosetup | sed 's/driver name: //'` || {
	error "x11setupdrv failed"
}

debug "current: [$CURRENT]"

[ "$DRIVER" == "$CURRENT" ] && {
	debug "nothing to modify, driver is the same"
	exit 0	# nothing to be done
}

debug ">> setting driver to [$DRIVER]"

x11setupdrv -s "$DRIVER" || {
	error "x11setupdrv failed to modify configuration"
}

busid=`secondary`
[ -n "$busid" ] && subst \
       "s/\\(^[[:space:]]*BusID[[:space:]]*\"PCI:\\)1:0:0\"/\\1$busid\"/" \
       /etc/X11/xorg.conf

[-- Attachment #3: startxheads --]
[-- Type: text/plain, Size: 712 bytes --]

#!/bin/sh
# a script to wrap startx with single- or dual-head
# server layout chooser since using generic vesa/vga-based
# xorg.conf fails with dualhead chips (not dual-card setup)
# because vga or vesa grabs the whole chip and e.g. radeon
# configured for Screen1 will bail out taking the whole server
# down; you should have preconfigured ServerLayout "DualHead"
# 
# by Michael Shigorin <mike@osdn.org.ua>, 2006
# use freely

CARDS="`x11createconfig -c | grep ^card: | wc -l`" || {
	echo "$0: x11createconfig failed" >&2
	exit 1
}

case $CARDS in
		2) LAYOUT="-layout DualHead";;
		*) LAYOUT=;;
esac

# try to do plain startx just in case;
# needs fixed startx, see ALT bug #10245
startx -- $LAYOUT || startx

[-- Attachment #4: xorg.conf.ati9200 --]
[-- Type: text/plain, Size: 2557 bytes --]

Section "ServerLayout"
	Identifier     "SingleHead"
	Screen         "Screen0" 0 0
	InputDevice    "mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerLayout"
	Identifier     "DualHead"
	Screen      0  "Screen0" 0 0
	Screen      1  "Screen1" 0 0
	InputDevice    "mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
	Option	    "Clone" "off"
EndSection

Section "Files"
	FontPath     "unix/:-1"
EndSection

Section "Module"

	# don't load dri/glx by default: breakable and not crucial
#	Load  "glx"
#	Load  "v4l"
	Load  "dbe"
#	Load  "dri"
	Load  "extmod"
	Load  "type1"
	Load  "freetype"
#	SubSection  "extmod"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option	    "AutoRepeat" "250 30"
	Option	    "XkbModel" "pc105"
	Option	    "XkbLayout" "us,ru,ua"
	Option	    "XkbVariant" ",winkeys,winkeys"
	Option	    "XkbOptions" "grp:ctrl_shift_toggle,grp_led:scroll"
EndSection

Section "InputDevice"
	Identifier  "mouse0"
	Driver      "mouse"
	Option	    "Device" "/dev/input/mice"
EndSection

Section "Monitor"

	# hardwire DPI near 92 for cashdesk
	# NB: eostapets@ tells it's currently broken in xorg,
	# one needs to pass a server argument
	#DisplaySize  283	212
	Identifier   "Monitor0"
	Option	    "DPMS"
EndSection

Section "Monitor"

	# these are obviously in wrong place according to xorg.conf(5)
	# but ServerLayout is a bit too common between screens
	# so we'll really xset it in ~user/.icewm/startup
	#Option	    "DPMS" "off"
	#Option		"BlankTime" "32768"
	#Option		"StandbyTime" "32768"
	#Option		"SuspendTime" "32768"
	#Option		"OffTime" "32768"
#	HorizSync    31.5 - 48
#	VertRefresh  60.0 - 85.0
	Identifier   "Monitor1"
EndSection

Section "Device"

	# set default to vesa, x11updatedrv will take care at boot
	# NB: vga/vesa grab device in full, dualhead won't work
	Identifier  "Device0"
	Driver      "radeon"
	BusID       "PCI:1:0:0"
EndSection

Section "Device"
	Identifier  "Device1"
	Driver      "ati"
	BusID       "PCI:1:0:0"
	Screen      1
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Device0"
	Monitor    "Monitor0"
	DefaultDepth     16
	SubSection "Display"

		# provide safer fallback mode too
		Depth     16
		Modes    "1024x768" "800x600"
	EndSubSection
EndSection

Section "Screen"
	Identifier "Screen1"
	Device     "Device1"
	Monitor    "Monitor1"
	DefaultDepth     16
	SubSection "Display"
		Depth     16
		Modes    "1024x768"
	EndSubSection
EndSection

Section "DRI"
	Group        "xgrp"
	Mode         0660
EndSection


      parent reply	other threads:[~2007-09-17 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-13  6:51 ` Алексей Шенцев
2007-09-13  7:06   ` Alexander Yereschenko
2007-09-13  7:27 ` Алексей Шенцев
2007-09-13 11:52 ` Alexey I. Froloff
2007-09-17 15:45 ` Michael Shigorin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070917154503.GL13893@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=community@lists.altlinux.org \
    --cc=shigorin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git