在開始設定 X11 之前,要先瞭解所要裝的機器資料為何:
螢幕規格
顯示卡的晶片規格
顯示卡的記憶體容量
X11 會依螢幕規格來決定解析度以及更新頻率。 這些規格通常可從螢幕所附的文件或廠商網站上取得。 最重要的是要知道水平、垂直更新頻率為何。
而顯示卡晶片則決定 X11 要用哪一種驅動程式模組。 大多數的晶片都可以自動偵測,但最好還是要知道是何種晶片, 以免萬一自動偵測失敗。
Video memory on the graphic adapter determines the resolution and color depth which the system can run at. This is important to know so the user knows the limitations of the system.
Xorg 自 7.3 版起不再需任何設定檔,只要打下列即可:
% startx
若這指令不行或預設設定無法使用,那麼就需要手動設定 X11。 設定 X11 需要幾個步驟,首先是以系統管理者帳號來建立初始設定檔:
# Xorg -configure
這會在 /root 目錄內產生 xorg.conf.new 設定檔(無論是用 su(1) 或直接登入為 root,都會改變 root 預設的 $HOME 環境變數)。 X11 程式接著會偵測系統的顯示卡相關硬體,並將偵測到硬體訊息寫入設定檔, 以便載入正確的驅動程式。
下一步是測試現有的設定檔,以便確認 Xorg 可以與顯示卡、螢幕相關硬體正確運作:
# Xorg -config xorg.conf.new
若看得到一堆黑灰夾雜的網格畫面,以及 X 形的滑鼠游標, 那麼設定檔就是成功的。 要退出測試,只要同時按下 Ctrl+Alt+Backspace 即可。
注: 若滑鼠不正確運作,那麼需要先對其作設定。 請參閱 FreeBSD 安裝一章中的 µÚ 2.10.10 節 說明。
Next, tune the xorg.conf.new configuration file to taste. Open the file in a text editor such as emacs(1) or ee(1). First, add the frequencies for the target system's monitor. These are usually expressed as a horizontal and vertical synchronization rate. These values are added to the xorg.conf.new file under the "Monitor" section:
Section "Monitor" Identifier "Monitor0" VendorName "Monitor Vendor" ModelName "Monitor Model" HorizSync 30-107 VertRefresh 48-120 EndSection
The HorizSync and VertRefresh keywords may be missing in the configuration file. If they are, they need to be added, with the correct horizontal synchronization rate placed after the HorizSync keyword and the vertical synchronization rate after the VertRefresh keyword. In the example above the target monitor's rates were entered.
X allows DPMS (Energy Star) features to be used with capable monitors. The xset(1) program controls the time-outs and can force standby, suspend, or off modes. If you wish to enable DPMS features for your monitor, you must add the following line to the monitor section:
Option "DPMS"
While the xorg.conf.new configuration file is still open in an editor, select the default resolution and color depth desired. This is defined in the "Screen" section:
Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Modes "1024x768" EndSubSection EndSection
The DefaultDepth keyword describes the color depth to run at
by default. This can be overridden with the -depth
command
line switch to Xorg(1). The Modes keyword describes the resolution to run at for the given color
depth. Note that only VESA standard modes are supported as defined by the target system's
graphics hardware. In the example above, the default color depth is twenty-four bits per
pixel. At this color depth, the accepted resolution is 1024 by 768 pixels.
Finally, write the configuration file and test it using the test mode given above.
注: One of the tools available to assist you during troubleshooting process are the X11 log files, which contain information on each device that the X11 server attaches to. Xorg log file names are in the format of /var/log/Xorg.0.log. The exact name of the log can vary from Xorg.0.log to Xorg.8.log and so forth.
If all is well, the configuration file needs to be installed in a common location where Xorg(1) can find it. This is typically /etc/X11/xorg.conf or /usr/local/etc/X11/xorg.conf.
# cp xorg.conf.new /etc/X11/xorg.conf
The X11 configuration process is now complete. Xorg 目前可透過 startx(1) 來啟動之。 The X11 server may also be started with the use of xdm(1).
注: There is also a graphical configuration tool, xorgcfg(1), which comes with the X11 distribution. It allows you to interactively define your configuration by choosing the appropriate drivers and settings. This program can be invoked from the console, by typing the command xorgcfg -textmode. For more details, refer to the xorgcfg(1) manual pages.
Alternatively, there is also a tool called xorgconfig(1). This program is a console utility that is less user friendly, but it may work in situations where the other tools do not.
Configuration with Intel® i810 integrated chipsets requires the agpgart AGP programming interface for X11 to drive the card. 詳情請參閱 agp(4) 說明。
This will allow configuration of the hardware as any other graphics board. Note on systems without the agp(4) driver compiled in the kernel, trying to load the module with kldload(8) will not work. This driver has to be in the kernel at boot time through being compiled in or using /boot/loader.conf.
本節假設各位已經有些微進階設定的功力。 如果試著使用上述設定工具會有問題的話,請多利用相關 log 檔 (會記錄相關訊息)以便找出解法。 找尋解法過程中,可能會需要用到文字編輯器作為輔助。
目前的寬螢幕 (WSXGA, WSXGA+, WUXGA, WXGA, WXGA+ 等) 都有支援 16:10 及 10:9 比例,以及一些可能有問題的比例。 以下是一些常見的 16:10 螢幕解析度:
2560x1600
1920x1200
1680x1050
1440x900
1280x800
某方面而言,要增加這些解析度設定也是相當容易的, 只要在 Section "Screen" 內的 Mode 加上去就好,比如:
Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Modes "1680x1050" EndSubSection EndSection
Xorg 可以透過 I2C/DDC 來得知該寬螢幕所支援的解析度等相關資訊, 因此就能正確偵測出該螢幕所能支援的頻率、解析度。
若驅動程式並未包括 ModeLine 訊息的話, 那麼就要為 Xorg 做些設定才行。 我們可以透過 /var/log/Xorg.0.log 檔來取得 ModeLine 相關設定資料,即可讓螢幕正常顯示。 應該可以看到類似下面的訊息:
(II) MGA(0): Supported additional Video Mode: (II) MGA(0): clock: 146.2 MHz Image Size: 433 x 271 mm (II) MGA(0): h_active: 1680 h_sync: 1784 h_sync_end 1960 h_blank_end 2240 h_border: 0 (II) MGA(0): v_active: 1050 v_sync: 1053 v_sync_end 1059 v_blanking: 1089 v_border: 0 (II) MGA(0): Ranges: V min: 48 V max: 85 Hz, H min: 30 H max: 94 kHz, PixClock max 170 MHz
這些訊息被稱為 EDID 訊息。 可以藉由這些資料, 搭配下列的正確順序來產生 ModeLine 設定:
ModeLine <name> <clock> <4 horiz. timings> <4 vert. timings>
所以這個案例 Section "Monitor" 的 ModeLine 就會是像下面這樣:
Section "Monitor" Identifier "Monitor1" VendorName "Bigname" ModelName "BestModel" ModeLine "1680x1050" 146.2 1680 1784 1960 2240 1050 1053 1059 1089 Option "DPMS" EndSection
這樣子就簡單完成了,X 視窗就可以打造為新的寬螢幕環境囉。
本文及其他文件,可由此下載:ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。
若有 FreeBSD 方面疑問,請先閱讀 FreeBSD 相關文件,如不能解決的話,再洽詢
<questions@FreeBSD.org>。
關於本文件的問題,請洽詢 <doc@FreeBSD.org>。