[linux]Vaio TypeZ のHDMIを(個人的に)有効活用する

休みじゃないとできないこととは言え、結局一日かかってしまいました。

現在私の部屋には、

  • Macbook (2008年のアルミ)
    • 休眠中。というか数ヶ月起動していない。
  • デスクトップ
  • Vaio Type Z
    • 現在メイン。Gentoo + HHKProJP

という感じになんでか三台もPGがあります。で、このうちデスクトップには24インチのモニタが繋がっています。デスクトップはある役割があるので常時起動していますが、大抵動画か音楽を垂れ流すしかやってません。

Type Zは、1600x900の解像度ではありますが、喫茶店とかで利用するならまだしも、部屋で利用するには、どっかり腰を据えて使うには、ちょっと画面が小さいです。
MacbookはもうMac OSXに興味がなくなったので、基本触る気にはなりません。

メインで利用しているType Zが一番画面が小さいというのは、なかなかに痛いと最近特に思うようになってきており、なんとかデスクトップのモニタを使えんものか、と考えていました。

私のType Zには、グラフィックボードとして、nVidia GeForce 9300Mが積まれており、HDMI接続端子が付いています。これならデュアルディスプレイいけるんじゃねぇか、と色々調べた結果、LinuxではXineramaとxrandr、そしてnVidiaの場合にはそれに加えてTwinViewというのがある、とわかりました。
WMはStumpwmからXmonadに乗り換えているので、デュアルディスプレイでも問題は無いだろうと判断しました。

さて、調べていくうちに、基本は「別々の物理スクリーンを、一つの仮想スクリーンとして取り扱う」というような感じでした。色々設定を漁って調べて設定してみたところ、Vaio Zでデュアルディスプレイは現実的な速度が出ないっぽいです。
これがWindowsだと現実的な速度が出るのかどうかわかりませんが(購入と同時にWindowsを起動することなくGentooを入れたので)、とりあえず「でかいモニタで作業できればいい、でも接続していないときはTypeZの液晶で表示するようにしたい」ということで設定を模索してみました。

とりあえず現在のxorg.confは以下の通りです。キモは「TwinViewにしているが、どちらか一方だけを表示するようにしている」という点に尽きます。まぁHDMIが接続されていない場合に動作するかわからないという片手落ちな現状ではありますが。

Section "ServerFlags"
	Option "AllowEmptyInput" "off"
	Option "AutoAddDevices" "false"
	Option "Xinerama" "on"
EndSection

Section "ServerLayout"
	Identifier     "Xinerama"
	Screen      0  "Screen0" 0 0 
	#Screen      1  "Screen1" 0 0 # LeftOf "Screen0"
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
	ModulePath   "/usr/lib/xorg/modules"
	FontPath     "/usr/share/fonts/misc/"
	FontPath     "/usr/share/fonts/TTF/"
	FontPath     "/usr/share/fonts/OTF"
	FontPath     "/usr/share/fonts/Type1/"
	FontPath     "/usr/share/fonts/100dpi/"
	FontPath     "/usr/share/fonts/75dpi/"
	FontPath     "/usr/share/fonts/ipamonafont/"
	FontPath     "/usr/share/fonts/shinonome/"
	FontPath     "/usr/local/stow/pawfont/"
	FontPath     "/usr/share/fonts/ja/TrueType/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	#Load  "xtrap"
	#Load  "dri"
	#Load  "dri2"
	Load  "glx"
	Load  "freetype"
	Load  "nvidia"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option "XkbRules" "xorg"
	Option "XkbModel" "kana"
	Option "XkbLayout" "jp"
	Option "XkbOptions" "ctrl:swapcaps"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/input/mice"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
	Option "DPMS"
EndSection

Section "Monitor"
	Identifier   "Monitor1"
	VendorName   "DELL"
	ModelName    "Monitor Model"
	Option "DPMS"
EndSection

Section "Device"
	Identifier  "Card0"
	Driver      "nvidia"
	VendorName  "nVidia Corporation"
	BoardName   "GeForce 9300M GS"
	Option "UseEDIDDpi" "FALSE"
	Option "AddARGBGLXVisuals" "true"
	Option "DPI" "96x96"
	Option "NoLogo" "true"
	Option "UseEvents" "True"
	Screen 0
EndSection


Section "Device"
	Identifier  "Card2"
	Driver      "nvidia"
	VendorName  "nVidia Corporation"
	BoardName   "GeForce 9300M GS"
	Option "UseEDIDDpi" "FALSE"
	Option "AddARGBGLXVisuals" "true"
	Option "DPI" "96x96"
	Option "NoLogo" "true"
	Option "UseEvents" "True"
	Screen 1
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"            	# [<bool>]
        #Option     "SWcursor"           	# [<bool>]
        #Option     "ColorKey"           	# <i>
        #Option     "CacheLines"         	# <i>
        #Option     "Dac6Bit"            	# [<bool>]
        #Option     "DRI"                	# [<bool>]
        #Option     "NoDDC"              	# [<bool>]
        #Option     "ShowCache"          	# [<bool>]
        #Option     "XvMCSurfaces"       	# <i>
        #Option     "PageFlip"           	# [<bool>]
	Identifier  "Card1"
	Driver      "intel"
	VendorName  "Intel Corporation"
	BoardName   "Mobile 4 Series Chipset Integrated Graphics Controller"
	BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	DefaultDepth  24
	Option "UseEDIDDpi" "FALSE"
	Option "AddARGBGLXVisuals" "true"
	Option "DPI" "96x96"
	Option "TwinView" "true"
	Option "TwinViewXineramaInfoOrder" "DFP-2,DFP-0"
	Option "metamodes" "DFP-2: 1920x1080, DFP-0: NULL; DFP-0: 1600x900 +0+0, DFP-2: NULL "
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
		Modes     "1600x900"
	EndSubSection
EndSection

Section "Screen"
	Identifier "Screen1"
	Device     "Card2"
	Monitor    "Monitor1"
	DefaultDepth 24
	Option "TwinView" "true"
	Option "TwinViewXineramaInfo" "DFP-2"
	Option "metamodes" "DFP-2: 1920x1080+0+0; DFP-0: 1600x900 +0+0, DFP-2: NULL "
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
		Modes     "1920x1200"
	EndSubSection
EndSection

次のバージョンのXorgから、HALを利用しないようになる、と聞いて、HALを利用しないような設定にしています(本当に利用していないのかはよくわかんないです)。

とりあえず部屋にいるときはこれで快適になりそうです。問題はHHKProじゃないとキーボードを叩く気力が無くなるようになってきつつあるという現状の方な気がします。