Ubuntu的双屏显示

对我来说,安装完Ubuntu的第一件事情,当然就是恢复在电视上看电影的能力,因为这是LP的需求阿 :D
我的电脑使用的是ATI Radeon 9250 双头显卡,显示器接在VGA接口上,电视机通过VGA转接器接在DVI接口上。

第一步当然就是安装ATI的原生驱动程序,这可以在ati的官方网站上下载到:http://ati.amd.com/support/driver.html,对我而言,自然选择Linux X86->Radeon->Radeon 9250 series。点Go之后,在随后的页面中下载ATI Driver Installer,下载之后是一个ati-driver-installer-8.28.8.run的文件,这实际上是一个可执行文件。在Linux下,一个文件是否可执行,并不由它的后缀名决定,这一点不像Windows,windows下只要后缀不是exe或者com,即使他真的是个可执行文件你也执行不了。在Linux下,文件有一个“可执行属性”,包含可执行属性的文件都会被当做可执行文件处理。所以在这里,我们需要将这个文件的可执行属性设上。这个可以使用命令 sudo chmod a+x ati-driver-installer-8.28.8.run 做到。做完这一步,然后就可以执行这个命令了: sudo ./ati-driver-installer-8.28.8.run,这样在X系统下会弹出一个对话框,跟着对话框一步步走,一般而言驱动就能成功的装好了(我在这边没有碰到什么特殊的麻烦)。
不过如果系统是ubunut edgy (6.10),这里可能会碰到一点麻烦。我的 另一篇blog提到了这个问题。

重启之后应该能进入X,如果不行,那么很不幸,说明驱动的安装出现了问题。我自己曾经碰到过的一个问题是,最初用apt-get install的方式安装了源里的ati fglrx驱动,但是改用ATI原生驱动的时候先前的没有卸载干净,造成驱动无法加载。这时,可以去/etc/X11/xorg.conf把驱动fglrx改回ati,然后重启进入X,打开新立得软件包管理,搜索fglrx,把已经安装的都卸载,然后去/usr/share/fglrx目录,执行sudo ./fglrx-unistall.sh卸载之前的安装,再重新安装一次驱动就可以了。

如果顺利进入了X,并且执行fglrxinfo命令,OpenGL vender string是ATI ...字样,说明驱动已经安装完成了,这样就做完了第一步。接下来就是配置xorg.conf,使它支持双屏显示。

这个配置实在不好找,我找了N多的论坛,尝试了N次才算成功。下面是我的配置文件:

# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
# (Type "man /etc/X11/xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen      0  "aticonfig-Screen[0]" 0 0
    Screen         "aticonfig-Screen[1]" RightOf "aticonfig-Screen[0]"
    InputDevice    "Generic Keyboard"
    InputDevice    "Configured Mouse"
EndSection

Section "Files"

    # path to defoma fonts
    FontPath     "/usr/share/X11/fonts/misc"
    FontPath     "/usr/share/X11/fonts/cyrillic"
    FontPath     "/usr/share/X11/fonts/100dpi/:unscaled"
    FontPath     "/usr/share/X11/fonts/75dpi/:unscaled"
    FontPath     "/usr/share/X11/fonts/Type1"
    FontPath     "/usr/share/X11/fonts/100dpi"
    FontPath     "/usr/share/X11/fonts/75dpi"
    FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

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

Section "InputDevice"
    Identifier  "Generic Keyboard"
    Driver      "kbd"
    Option        "CoreKeyboard"
    Option        "XkbRules" "xorg"
    Option        "XkbModel" "pc104"
    Option        "XkbLayout" "us"
EndSection

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

Section "Monitor"
    Identifier   "aticonfig-Monitor[0]"
    VertRefresh  85.0 - 85.0
    HorizSync    30 - 75
    # 1024x768 @ 85.00 Hz (GTF) hsync: 68.60 kHz; pclk: 94.39 MHz
    Modeline "1024x768_85.00"  94.39  1024 1088 1200 1376  768 769 772 807  -HSync +Vsync
    Option        "VendorName" "ATI Proprietary Driver"
    Option        "ModelName" "Generic Autodetecting Monitor"
    Option        "DPMS" "true"
EndSection

Section "Monitor"
    Identifier   "aticonfig-Monitor[1]"
    VertRefresh  60.0 - 60.0
    HorizSync 10 - 40
    # 800x600 @ 60.00 Hz (GTF) hsync: 37.32 kHz; pclk: 38.22 MHz
    #Modeline "800x600_60.00"  38.22  800 832 912 1024  600 601 604 622  -HSync +Vsync
    Option        "VendorName" "ATI Proprietary Driver"
    Option        "ModelName" "Generic Autodetecting Monitor"
    Option        "DPMS" "true"
EndSection

Section "Device"
    Identifier  "aticonfig-Device[0]"
    Driver      "fglrx"
    Option        "VideoOverlay" "on"
    Option        "OpenGLOverlay" "off"
    BusID       "PCI:1:0:0"
EndSection

Section "Device"
    Identifier  "aticonfig-Device[1]"
    Driver      "fglrx"
    Option        "VideoOverlay" "on"
    Option        "OpenGLOverlay" "off"
    BusID       "PCI:1:0:0"
    Screen      1
EndSection

Section "Screen"
    Identifier "aticonfig-Screen[0]"
    Device     "aticonfig-Device[0]"
    Monitor    "aticonfig-Monitor[0]"
    DefaultDepth     24
    SubSection "Display"
        Viewport  0 0
        Depth     24
        Modes     "1024x768"
    EndSubSection
EndSection

Section "Screen"
    Identifier "aticonfig-Screen[1]"
    Device     "aticonfig-Device[1]"
    Monitor    "aticonfig-Monitor[1]"
    DefaultDepth     24
    SubSection "Display"
        Viewport  0 0
        Depth     24
        Modes     "800x600"
    EndSubSection
EndSection
 
Section "DRI"
    Mode         0666
EndSection

Section "Extensions"
    Option "Composite" "false"
EndSection

Section "ServerFlags"
    Option "AIGLX" "off"
EndSection


这样做完之后,主屏幕以1024x768x24 75Hz的刷新率显示,电视所在的副屏幕以800x600x24 60Hz的刷新率显示(这是我们家电视的最大分辨率和刷新率)
但是现在,两个屏幕是独立的,不像Windows的扩展屏幕,可以把窗口拖到另外一边去(BTW:那种模式也可以通过配置xorg.conf实现,但我试过,效果不好),那怎么再另外一边放电影呢?难道还需要在另外一个屏幕上操作不成?
实际上不需要,现在在X里,主屏幕是DISPLAY :0.0,副屏幕是DISPLAY :0.1,所以,我们就可以使用mplayer的命令行版本,指定显示的display来让电影显示在副屏幕,而控制仍然在主屏幕:
mplayer -fs -font ~/.mplayer/subfont.ttf -subcp cp936 -subfont-autoscale 2  -display :0.1 1.avi
由于参数太多,而且输入文件名不方便,我写了一个脚本来做这件事。这样一来,双屏的问题就算是解决了。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值