Debian etch でデュアルディスプレイ(nvidia)

デュアルディスプレイはずいぶん前からやってるけど, 今日の変更でおちつきそうなのでエントリとして残しとく〜.

構成


たぶんこんなん.

  • 1400x1050ディスプレイ(Acer)
  • 1280x1024ディスプレイ(Hitachi?)
  • Geforce 6200 (PCI-Bus)

1280x1024の方がプライマリ(といったらいいのかな)として認識されてるっぽい.
# 要は, ログイン画面でユーザ名とかパスワードを入れる画面が出る方.

デュアルディスプレイのしかた

自分がやったのは, 主にこんな感じだったと思う(うろ覚え).

  1. nvidiaの本家からドライバを取ってくる
  2. apt で nvidia-kernel-source を入れる*1
  3. /etc/X11/xorg.confを適当にいじってXを無理矢理落とす
  4. 「sh ./落としてきたドライバ」として, ドライバを入れる
  5. xorg.confを書換える
  6. startxなり再起動なりで上手くいくまで5-6を繰り返す.

xorg.confを壊して無理矢理Xを落とさないもっとスマートな方法あるんだろうけど, ついこれでやってしまった.
一応Debianには, 手動でドライバを落としてこないでもいいように自動でやるスクリプトあるみたいやけど,
それは自分の環境じゃ駄目だった.
# インストールは成功するけど, その後がうまくいかなかった.
その方法は, aptでmodule-assistantを入れて, 「m-a a-i nvidia」とするだけ(やったと思う).
# それやった後にnvidia-glx入れないと駄目なのかな?

xorg.confの設定


んでxorg.confをいじくる.
デュアルディスプレイは, xineramaを使う方法とtwinviewを使う方法の2つがあるみたい.
うちは今までxineramaの方をやってたけど, JavaScriptが動いてるときにスクロールが重くなっちゃう問題が軽減されたので,
今は, twinviewの方でやってる.
あと, この記述が正しいかとうかは分からない.
うちの環境では, 両方動いているけど, よく分からないで動けばいいやで書いてるから, 無駄な記述とかまずい記述とかあるかもしない.
参考にする人がもし居たら, そこらへん了承の上お願いします.

xinerama

前やってた方.
こっちでやるとJavaScriptが動いてるとスクロールが重たくなった.
# たぶんうちだけなんだと思う. 重たくなるのは. 普通はこれで何も問題ないんだと思う.

Section "Files"
    FontPath        "/usr/share/fonts/X11/misc"
    FontPath        "/usr/X11R6/lib/X11/fonts/misc"
    FontPath        "/usr/share/fonts/X11/cyrillic"
    FontPath        "/usr/X11R6/lib/X11/fonts/cyrillic"
    FontPath        "/usr/share/fonts/X11/100dpi/:unscaled"
    FontPath        "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    FontPath        "/usr/share/fonts/X11/75dpi/:unscaled"
    FontPath        "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    FontPath        "/usr/share/fonts/X11/Type1"
    FontPath        "/usr/X11R6/lib/X11/fonts/Type1"
    FontPath        "/usr/share/fonts/X11/100dpi"
    FontPath        "/usr/X11R6/lib/X11/fonts/100dpi"
    FontPath        "/usr/share/fonts/X11/75dpi"
    FontPath        "/usr/X11R6/lib/X11/fonts/75dpi"
    FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
    FontPath        "unix/:7100"
EndSection

Section "Module"
    Load           "i2c"
    Load           "bitmap"
    Load           "ddc"
    Load           "dri"
    Load           "extmod"
    Load           "freetype"
    Load           "glx"
    Load           "int10"
    Load           "vbe"
EndSection

Section "InputDevice"
    Identifier     "Generic Keyboard"
    Driver         "kbd"
    Option         "CoreKeyboard"
    Option         "XkbRules" "xorg"
    Option         "XkbModel" "jp106"
    Option         "XkbLayout" "jp"
EndSection

Section "InputDevice"
    Identifier     "Configured Mouse"
    Driver         "mouse"
    Option         "CorePointer"
    Option         "Device" "/dev/input/mice"
    Option         "Protocol" "ImPS/2"
    Option         "Emulate3Buttons" "true"
EndSection

Section "Device"
    Identifier     "Videocard0"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
    Option         "XaaNoOffscreenPixmaps" "true"
    Option         "RandRRotation" "true"
    Option         "RenderAccel" "true"
    Screen         0
EndSection

Section "Device"
    Identifier     "Videocard1"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
    Option         "XaaNoOffscreenPixmaps" "true"
    Option         "RandRRotation" "true"
    Option         "RenderAccel" "true"
    Screen         1
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    Option         "DPMS"
EndSection

Section "Screen"
    Identifier     "screen0"
    Device         "Videocard0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       1
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       4
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       8
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       15
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       16
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       24
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "screen1"
    Device         "Videocard1"
    Monitor        "Monitor1"
    DefaultDepth    24
    SubSection     "Display"
        Depth       1
        Modes      "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       4
        Modes      "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       8
        Modes      "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       15
        Modes      "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       16
        Modes      "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       24
        Modes      "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" "720x400" "640x480"
    EndSubSection
EndSection

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen         0 "screen0"
    Screen         1 "screen1" LeftOf "screen0"
    InputDevice    "Generic Keyboard"
    InputDevice    "Configured Mouse"
    Option         "Xinerama" "true"
EndSection

Section "DRI"
    Mode    0666
EndSection
twinview

今日こっちにしてみた.
今のJavaScriptが動いてるときスクロールが重くなる問題は, かなり軽減された.
でも, Gnomeパネル上部の方のメニューが何故かごちゃごちゃになってしまった.
まあ見栄えが悪いだけで, 実害無いからほうっておく.

Section "Files"
    FontPath        "/usr/share/fonts/X11/misc"
    FontPath        "/usr/X11R6/lib/X11/fonts/misc"
    FontPath        "/usr/share/fonts/X11/cyrillic"
    FontPath        "/usr/X11R6/lib/X11/fonts/cyrillic"
    FontPath        "/usr/share/fonts/X11/100dpi/:unscaled"
    FontPath        "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    FontPath        "/usr/share/fonts/X11/75dpi/:unscaled"
    FontPath        "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    FontPath        "/usr/share/fonts/X11/Type1"
    FontPath        "/usr/X11R6/lib/X11/fonts/Type1"
    FontPath        "/usr/share/fonts/X11/100dpi"
    FontPath        "/usr/X11R6/lib/X11/fonts/100dpi"
    FontPath        "/usr/share/fonts/X11/75dpi"
    FontPath        "/usr/X11R6/lib/X11/fonts/75dpi"
    FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
    FontPath        "unix/:7100"
EndSection

Section "Module"
    Load           "i2c"
    Load           "bitmap"
    Load           "ddc"
    Load           "dri"
    Load           "extmod"
    Load           "freetype"
    Load           "glx"
    Load           "int10"
    Load           "vbe"
EndSection

Section "InputDevice"
    Identifier     "Generic Keyboard"
    Driver         "kbd"
    Option         "CoreKeyboard"
    Option         "XkbRules" "xorg"
    Option         "XkbModel" "jp106"
    Option         "XkbLayout" "jp"
EndSection

Section "InputDevice"
    Identifier     "Configured Mouse"
    Driver         "mouse"
    Option         "CorePointer"
    Option         "Device" "/dev/input/mice"
    Option         "Protocol" "ImPS/2"
    Option         "Emulate3Buttons" "true"
EndSection

Section "Device"
    Identifier     "Videocard0"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
    Screen         0
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    Option         "DPMS"
EndSection

Section "Screen"
    Identifier     "screen0"
    Device         "Videocard0"
    Monitor        "Monitor0"
    DefaultDepth    24

    Option         "TwinView"

#    Option         "MetaModes" "CRT-0: 1280x1024, DFP-0: 1400x1050"
    Option         "MetaModes" "1280x1024,1400x1050"
    Option         "TwinViewOrientation" "CRT-0 LeftOf DFP-0"
    Option         "UseEdidFreqs" "true"
    Option         "RenderAccel"
    Option         "HWcursor"

    SubSection     "Display"
        Depth       1
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       4
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       8
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       15
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       16
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       24
        Modes      "1280x1024" "1024x768" "832x624" "800x600" "640x480"
    EndSubSection
EndSection

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen         "screen0"
    InputDevice    "Generic Keyboard"
    InputDevice    "Configured Mouse"
EndSection

Section "ServerFlags"
    Option         "Xinerama"        "false"
EndSection

Section "DRI"
    Mode    0666
EndSection

はまったこと

はまったことは, 最初テケトーにnvidia-*のを入れまくってたら, xorg.confの設定が上手くいって, いざ再起動としたとき,
/etc/init.d/にある, nvidia-glxのスクリプトのせいでシンボリックリング(たぶん)が削除されてドライバ入れ直しになること.
これは, nvidia-glxの該当の部分を#でコメントアウトしてやって対処した.
# remove_links()の中のthenからfiまでの部分をコメントアウトした.
たぶん, うちの環境が特殊なのだと思う.
普通は大丈夫なんだろうな. nvidia-glxを入れてても. というかそっちでやるんだろうな.

おわりに


Xの設定面倒. ほんとに.
Ubuntuは, デュアルなら自動でできるらしいけど, 良いなあと思うよい(というか思った).
でもこのデュアルディスプレイの設定のお陰でかなりxorg.confをいじるのが怖くなくなったw
今度OSをインスコする機会があったら, Caps_Lockを消す設定をこのxorg.conf側でやってしまおう.
そしたら, たぶんrootでも同じくcapsが消えるだろうし.


あー, あとマウスの設定も気が向いたときにでもやらないと.
横にボタンがあるやつ使ってるから.
まあ使えるようにしてもほとんど使わないだろうけど, あるのに設定してないというのはね, あんまりだし.

更新時刻

2008年, 1月10日, 23:55

*1:nvidia-kernel-srcかも?まあそこらへん