FreeSource: DualScreenWithRadeon

Xrandr

a-la XINERAMA: один Screen, экран имеет ширину в два монитора

xorg.conf

Section "Server Layout"

Identifier “radeon”

Screen «radeon|0»

...

End Section

# остался от fglrx.

Section “Monitor”

Identifier «aticonfig-Monitor[0]"

Option "Vendor Name" “ATI Proprietary Driver”

Option "Model Name" “Generic Autodetecting Monitor”

Option “DPMS” “true”

Display Size 375 302

End Section

Section “Device”

Identifier «radeon|0»

Driver “radeon”

End Section

Section “Screen”

Identifier «radeon|0»

Device «radeon|0»

Monitor «aticonfig-Monitor[0]"

Default Depth 24

Option “Backingstore” “true”

Sub Section “Display”

Depth 24

Modes “1280x1024”

'Virtual 2560 1024'

End Sub Section

End Section

Обращаю внимание на выделенный жирным Virtual. не будет его, <tt>xrandr</tt> может начать ругаться (в моем случае)

xrandr: screen cannot be larger than 1280x1280 (desired size 2560x1024)

как я понял, причина, что <tt>xrandr</tt> работает в пределах Virtual и за них не вылезает.

в принципе это вся конфигурация <tt>xorg</tt>. остальное делается динамически.

xrandr invocation

получение списка выводов

перво-наперво смотрим, какие выводы мы имеем:

Screen 0: minimum 320 x 200, current 1280 x 1024, maximum '1280 x 1280'

<font color=red>DVI-0</font> connected 1280x1024+0+0 (normal left inverted right x axis y axis) 0mm x 0mm

1280x1024 59.9*+ 60.0

1280x960 60.0

1024x768 60.0

800x600 60.3

640x480 59.9

<font color=red>DVI-1</font> connected 1280x1024+0+0 (normal left inverted right x axis y axis) 0mm x 0mm

1280x1024 59.9*+ 60.0

1280x960 60.0

1024x768 60.0

800x600 60.3

640x480 59.9

<font color=red>DVI-0</font> и <font color=red>DVI-1</font> – выводы для <tt>xrandr</tt> ( подставляется в <tt>output</tt>).

обращаю внимание на выделенное 1280x1280: это тот самый region, на котором рабоатает xrandr. меняется через Virtual, как сказано выше.

запуск dual-head режима

xrandr --output DVI-0 --left-of DVI-1

в большинстве случаев после этой команды ничего делать тне нужно.

привязка выхода к монтору

так случилось, что после запуска <tt>xrandr</tt> с <tt>left-of</tt>, второй монитор начал показывать один в один то, что показывает первый. но по taskbar'у fluxbox'а заметно, что двойной режим-то включен. исправило ситуацию следующие команды:

xrandr output DVI-0 --crtc 0 --auto

xrandr --output DVI-1 --crtc 1 --auto

здесь устанавливается привязка монтора (crtc) и вывода (output). <tt>auto</tt> указан для того, чтобы после этих команда мониторы не выключались.

уменщились/увеличились шрифты

второй проблемой, с которой я столкнулся, были шрифты. после запуска <tt>xrandr</tt> с <tt>--left-of</tt> dpi шрифтов изменились, как и размеры монитора в выводе <tt>xdpyinfo</tt>:

...

screen #0:

print screen: no

'dimensions: 1280x1024 pixels (360x270 millimeters)

resolution: 96x96 dots per inch

depths (7): 24, 1, 4, 8, 15, 16, 32

root window id: 0xa1

depth of root window: 24 planes

...

мне же нужно было:

screen #0:

...

print screen: no

'dimensions: 1280x1024 pixels (375x302 millimeters)'

resolution: 87x86 dots per inch

depths (7): 24, 1, 4, 8, 15, 16, 32

root window id: 0xa1

depth of root window: 24 planes

...

для чего я и указывал DisplaySize 375 302 в xorg.conf, но после <tt>xrandr</tt> DisplaySIze'' к сожалению сбросился.

установка вручную происходит следующим образом:

xrandr --output DVI-0 --fbmm 375x302

xrandr --output DVI-1 --fbmm 375x302

после перезапуска программ (<tt>fluxbox</tt> restart, <tt>opera</tt>, etc) шрифты вернулись на место.

сброс dual-head

чисто случайно испробовал я следующую команду:

xrandr --output DVI-1 --same-as DVI-0

после неё X сервер вернулся к clone режиму.

Помещение в автозапуск

в <tt>/etc/X11/xinit</tt> есть файл <tt>xrandrrc</tt>. он считывает <tt>/etc/sysconfig/xrandr</tt> и <tt>$HOME/.Xrandr</tt> записи вида:

:[0–9]* <xrandr options>

поэтому для атвтоматического запуска <tt>xrandr</tt> достаточно поместить в один из этих файлов команды. мне хватило следующих:

:0 --output DVI-0 --fbmm 375x302

:0 --output DVI-1 --fbmm 375x302

:0 --output DVI-0 --crtc 0 --auto

:0 --output DVI-1 --crtc 1 --auto

:0 --output DVI-0 --left-of DVI-1

Dual Screen режим

как в <tt>XINERAMA</tt>, так и в <tt>xrandr</tt> мне не понравилось, что после их запуска программы экраном считают не один монитор, а оба сразу. например программа установки обев растягивала картинку на оба монитора.

с другой <tt>xrandr</tt> для этого и предназначен, потому нужен был иной подход: радзделение мониторов по разным Screen'ам.

я нашел только, как это сделать статически:

Section "Server Layout"

Identifier “radeon”

<font color=red>Screen «radeon|0»</font>

<font color=red>Screen «radeon|1» Right Of «radeon|0»</font>

...

End Section

Section “Monitor”

Identifier «aticonfig-Monitor[0]"

Option "Vendor Name" “ATI Proprietary Driver”

Option "Model Name" “Generic Autodetecting Monitor”

Option “DPMS” “true”

Display Size 375 302

End Section

Section “Monitor”

Identifier «aticonfig-Monitor[1]"

Option "Vendor Name" “ATI Proprietary Driver”

Option "Model Name" “Generic Autodetecting Monitor”

Option “DPMS” “true”

Display Size 375 302

End Section

Section “Device”

Identifier «radeon|0»

Driver “radeon”

Option “DRI” “off”

<font color=red>Screen 0</font>

End Section

Section “Device”

Identifier «radeon|1»

Driver “radeon”

Option “DRI” “off”

<font color=red>Screen 1</font>

End Section

Section “Screen”

Identifier «radeon|0»

Device «radeon|0»

Monitor «aticonfig-Monitor[0]"

Default Depth 24

Option “Backingstore” “true”

Sub Section “Display”

Depth 24

Modes “1280x1024”

End Sub Section

End Section

Section “Screen”

Identifier «radeon|1»

Device «radeon|1»

Monitor «aticonfig-Monitor[1]"

Default Depth 24

Option “Backingstore” “true”

Sub Section “Display”

Depth 24

Modes “1280x1024”

End Sub Section

End Section

красным выделены критичные строчки.

в <tt>Server Layout</tt> строка

Screen «radeon|0»

важна! в противном случае X сервер матерится, что не может найти подходящий screen для работы.