xorg.conf配置

X配置文件xorg.conf分析

轉載於:http://blog.csdn.net/comcat/archive/2007/04/02/1549658.aspx

作者:壯志凌雲的csdn博客


X的配置,實際上就是生成 /etc/X11/xorg.conf 這個文件。


通常的配置主要對以下的Section作操作:

a. 顯示器的信息寫在該節

    Section “Monitor”

        Identifier     “monitor0”
        VendorName     “VSC”
        ModelName     “VSC1609 ”
        HorizSync     30 – 70
        VertRefresh     50 - 160
        ModeLine     “...”     --------->指定顯示器的顯示模式,很重要。
        ...
        ModeLine     “...”

    Endsection
       
  ModeLine 可以用ddcxinfo-knoppix直接生成。(通過檢測你的顯卡和顯示器)
  或者通過gtf 直接計算標準的VESA mode lines。如:
       
        gtf 1024 768 85

  則生成:

  # 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

  要成爲高手,能手工微調的話參考:
  http://www.tldp.org/HOWTO/XFree86-Video-Timings-HOWTO/
  中文版: http://man.chinaunix.net/linux/how/XFree86-Video-Timings-HOWTO.html
  作者Eric S. Raymond,勿須多言了。


b. 顯卡信息寫在該節

    Section “Device”

        Identifier “card0”
        VendorName “Intel”
        BoardName “Intel Corporation 82845G/GL/GE Chipset Integrated Graphics Device”
        Driver     “i810”
        BusID     “PCI:0:2:0”

    Endseciton

    PS: 一個PCI外設由BusID(8bit):DeviceID(5bit):FunctionID(3bit)來描述。在xorg.conf 中需用十進制表示。
    一般PCI接口的顯卡的總線編號爲0,AGP接口的顯卡的總線編號爲1。
    單顯卡的情況下可以沒有BusID這一行。

    X所用之所有驅動都安裝在/usr/X11R6/lib/modules/drivers/ ,官方驅動亦是。
    (注: 最新版本的Xorg,其驅動位於 /usr/lib/xorg/modules/drivers/ )
    比如安裝了官方的nvidia驅動後,會在上述目錄中放置nvidia_drv.o文件,則在上節中指定:

        Driver “nvidia” (X自帶的驅動爲nv,相應的文件爲nv_drv.so)


c. 一個顯卡和一個顯示器則組成一個screen,用Section “Screen” 描述。


    Section “Screen”

        Identifier     “screen0”
        Device         “card0”
        Monitor     “monitor0”
        DefaultDepth     24

        SubSection     “Display”
              Depth     24
              Modes     “1024x768” “800x600” “640x480”
        EndSubSection
        ...

    EndSection

    若還有一塊顯卡,其上也接一顯示器則再加一Section “Screen”描述。

    Section “Screen”

        Identifier     “screen1”
        Device         “card1”
        Monitor     “monitor1”
        DefaultDepth     24

        SubSection     “Display”
              Depth     24
              Modes     “1024x768” “800x600” “640x480”
        EndSubSection
        ...

    EndSection


d. 若有兩套獨立的顯卡顯示器,則需在Section “ServerLayout”中對多個screen進行組織。

    Section “ServerLayout”

        Identifier “multihead layout”
        Screen     0 “screen0” 0 768
        Screen     1 “screen1” 0 0
        ...
        Option     “Xinerama” “on”   ------------------->擴展桌面,off則爲個體桌面

    EndSection

    PS: 其他常用的Option :

        Option "DontZap" 屏蔽 <Ctrl>+<Alt>+<Backspace>
        Option "DontVTSwitch" 屏蔽<Ctrl>+<Alt>+<Fn> 的控制檯的切換
   
    更多選項參閱xorg.conf 的man手冊

XF86Config說明
文件的每節都是由下述的部分組成:

Section "SectionName"
SectionEntry

EndSection

SectionName包括:

Files      文件路徑名
ServerFlags    服務器標誌
Module      動態模塊加載
InputDevice    輸入設備描述
Device      圖形設備描述
VideoAdaptor    Xv視頻卡描述
Monitor      監視器描述
Modes       視頻模式描述
Screen      屏幕配置
ServerLayout    全面的層疊
DRI      DRI特定的配置
Vendor      供應商特定的配置


出於向下兼容的目的,下列項雖已廢除但是配置文件仍能識別。在新的配置文件中,應使用新的InputDevice項。
Keyboard 鍵盤配置
Pointer 指針/鼠標配置
老的XInput節已經被廢除。

ServerLayout在最高層。它們綁定的輸入輸出設備會在這一節裏使用。輸入設備由InputDevice描述,
輸出設備通常有多個獨立的組件組成。多個組件組成Screen節。每個Screen節將圖形板和監視器綁定在一起。
顯示卡由Device節描述,監視器由Monitor節描述。
RGBPath "path"
rgb顏色數據庫的路徑,缺省值爲:/usr/X11R6/lib/X11/rgb。


Option "AllowMouseOpenFail" "boolean"
即使鼠標設備不能被打開/初始化也允許X服務器啓動




1)Layout主節點包括Mouse/Keyboard和Screen

Section "ServerLayout"

Identifier "Layout0"
Screen "Screen0"
#Screen "Screen1" Below "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"

EndSection


2)擴展支持

Section "ServerFlags"

option "Xinerama" "on"和dri有衝突

EndSection

3)定義mouse

主設備號可以在/proc/devices找到。每一個物理設備由設備驅動程序控
制且被分配一個次設備號

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol"  "ImPS/2"    (鍵位說明)
Option "ZAxisMapping"  "4 5"
Option "Device"   "/dev/input/mice" (如果是ps/2的接口)
EndSection
Emulate3Buttons是否模擬3鍵鼠標

4)定義字體

ection "Files"

RgbPath  "/usr/X11R6/lib/X11/rgb"
FontPath  "/usr/X11R6/lib/X11/fonts/local/"
FontPath  "/usr/X11R6/lib/X11/fonts/misc/"
FontPath  "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath  "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath  "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath  "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath  "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath  "/usr/X11R6/lib/X11/fonts/100dpi/"

#FontPath   "unix/:7100"
EndSection

5)定義顯卡
Section "Device"
Identifier "Videocard0"
Option "DesktopSetup"    "0x00000000"
Driver  "fglrx"(說明驅動/usr/X11R6/lib/modules/drivers)
VendorName "ATI"
BoardName  "ATI Radeon 7000"
BusID  "PCI:1:0:0" (lspci和scanpci -v得到)
Screen0
EndSection

6)定義ddcprobe(顯示器)
Section "Monitor"

Identifier  "Monitor0"
VendorName  "Sony"
ModelName  "Sony CPD-G520"
HorizSync  30.0 - 121.0 改刷新率 (橫顯示器 )
VertRefresh 48.0 - 160.0 改刷新率 (縱顯示器-分辨率 )
Option  "dpms"
EndSection

7)附加的模塊

Section "Module"
Load "dbe" 
Load "extmod"
Load "fbdevhw"
Load "glx"
Load "record"
Load "freetype"
Load "type1"
#Load "dri"

EndSection

說明對DRI的使用者

#Section "DRI"
#Group  10
#Mode  0666
#EndSection

定義關聯

Section "Screen"
Identifier "Screen1" 
Device   "Videocard0" 定義顯卡
Monitor  "Monitor1"  顯示器
DefaultDepth   24  色深
SubSection "Display"  
Viewport  0 0    虛擬屏
Depth   24
Modes  "1024x768"  屏幕分辨率
EndSubSection
EndSection

VideoRam mem
此選項指定圖形卡的RAM數量,以KB爲單位。X服務程序會自動探測顯示卡,所以此字段一定不要指定。'

我用的是cent   OS的linux ,主板上的顯示芯片是intel的852GM,我在xp下設置雙顯沒有問題,可是在linux下修改完/etc/X11/xorg.conf的內容後tv上沒有信號輸出,crt可以正常顯示。
經過本人研究終於解決了問題,現在供大家參考

在圖形界面下以root身份登陸,修改/etc/X11/xorg.conf文件,下面是修改後的內容。
  

   Section "ServerLayout"

Identifier     "Multihead layout"

Screen    0   "Screen0" LeftOf "Screen1"

Screen    1   "Screen1" 0 0

InputDevice "Mouse0" "CorePointer"

InputDevice "Keyboard0" "CoreKeyboard"

Option    "Xinerama" "on"
      
Option       "MonitorLayout"   "anystr"

Option           "Clone" "off"

   EndSection




   Section "Files"



RgbPath        "/usr/X11R6/lib/X11/rgb"

FontPath    "unix/:7100"

   EndSection





   Section "Module"

Load   "dbe"

Load   "extmod"

Load   "fbdevhw"

Load   "glx"

Load   "record"

Load   "freetype"

Load   "type1"

Load   "dri"

   EndSection





   Section    "InputDevice"

Identifier   "Keyboard0"

Driver    "kbd"

Option "XkbModel" "pc105"

Option "XkbLayout" "us"

   EndSection





   Section           "InputDevice"

Identifier    "Mouse0"

Driver       "mouse"

Option        "Protocol" "IMPS/2"

Option        "Device" "/dev/input/mice"

Option        "ZAxisMapping" "4 5"

Option        "Emulate3Buttons" "yes"

   EndSection





   Section           "Monitor"

Identifier    "Monitor0"

VendorName    "Monitor Vendor"

ModelName    "SyncMaster"

DisplaySize    320 240

HorizSync        30.0 - 71.0

VertRefresh    50.0 - 160.0

Option        "dpms"
      
Option       "MonitorLayout" "CRT,TV"

   EndSection




   Section        "Monitor"

Identifier "Monitor1"

VendorName "Monitor Vendor"

ModelName "LCD Panel 800x600"

HorizSync 31.5 - 37.9

VertRefresh   40.0 - 70.0
  
Option    "MetaModes" "800x600"
      
Option    "TVOutFormat" "COMPOSITE"
      
OPtion    "TVStandard" "NTSC-M"
      
Option    "ConnectedMonitor" "TV"

Option    "dpms"
      
Option    "MonitorLayout" "CRT,TV"

   EndSection





   Section    "Device"

Identifier   "Videocard0"

Driver    "i810"

VendorName   "Videocard vendor"

BoardName "Intel 852"

   EndSection





   Section    "Device"

Identifier   "Videocard1"

Driver    "i810"

VendorName   "Videocard Vendor"

BoardName "Intel 852"

BusID    "PCI:0:2:0"

Screen    1

   EndSection





   Section "Screen"

Identifier "Screen0"

Device     "Videocard0"

Monitor "Monitor0"

DefaultDepth     24


SubSection "Display"

   Viewport 0 0

   Depth     16

   Modes "800x600" "640x480"

EndSubSection


SubSection "Display"

   Viewport 0 0

   Depth     24

   Modes "800x600" "640x480"

EndSubSection

   EndSection




   Section "Screen"

Identifier "Screen1"

Device     "Videocard1"

Monitor "Monitor1"

DefaultDepth     24


SubSection "Display"

   Viewport 0 0

   Depth     24

   Modes "800x600"

EndSubSection

   EndSection





   Section "DRI"

Group        0

Mode       0666

   EndSection
 
雙屏配置
2007-11-17 20:11

一直不知道i915的顯卡還能使用MergedFB,原來在試驗雙顯示器的時候,只用過Xinerama,但Xinerama使用後會禁止DRI,導致不能使用硬件加速以及AIGLX和XGL等三維效果。

主要的配置都在/etc/X11/xorg.conf的文件裏。
關鍵的部分,一個是在Device節裏:

Option "MergedFB" "true"

另外一個部分是在Screen節裏:

SubSection "Display"
Depth 24
Virtual 1560 1024
EndSubSection

SubSection "Display"
Depth 24
Modes "1400x1050 1280x1024 1024x768"
EndSubSection

要添加一個Virtual的桌面大小定義。通常這個Virtual的桌面就是兩個顯示器的分辨率之和。
我的xorg.conf配置:

Section "Files"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
# path to defoma fonts
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 "vbe"
EndSection

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

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

Section "InputDevice"
Driver "wacom"
Identifier "stylus"
Option "Device" "/dev/input/wacom"
Option "Type" "stylus"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "eraser"
Option "Device" "/dev/input/wacom"
Option "Type" "eraser"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "cursor"
Option "Device" "/dev/input/wacom"
Option "Type" "cursor"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

Section "Device"
Identifier "Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller"
Driver "i810"
BusID "PCI:0:2:0"
VideoRam 131072
# Screen 0
Option "No2048Limit" "true"
Option "DRI" "true"
Option "MergedFB" "true"
Option "DDCMode" "true"
Option "MonitorLayout" "CRT,LFP"
Option "SecondPosition" "LeftOf"
Option "MetaModes" "1024x768-1280x1024 1024x768"
Option "MergedNonRectangular" "ture"
Option "XAANoOffscreenPixmaps" "true"
Option "MergedXinerama" "true"
Option "crt2hsync" "30-82"
Option "crt2vrefresh" "50-85"
EndSection

Section "Monitor"
Identifier "Generic Monitor"
Option "DPMS"
HorizSync 28-51
VertRefresh 43-60
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Virtual 2048 1024
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "MergedFB"
Screen 0 "Default Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "stylus" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
EndSection

Section "DRI"
Mode 0666
EndSection

鬱悶的是,No2048Limit參數不起作用,不知道什麼原因,導致我最大隻能使用2048的寬度,在兩個屏幕中間會有重合的部分,不爽。
還有,我一開始看庫裏還有一個xserver-xorg-video-intel的包,這個的版本更新一些,就稀裏糊塗地裝上,導致後面很長時間都沒搞定,還是最後恢復成xserver-xorg-video-i810才搞定,還沒搞清楚這兩個包有什麼關係。

參考:
1 http://dri.freedesktop.org/wiki/MergedFB
2 http://ubuntuforums.org/showthread.php?t=221174

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章