Linux 桌面環境常遇到螢幕偏移、解析度過低、刷新率不支援等問題。解決路徑主要有二:安裝顯示卡專屬驅動(最佳效能)或使用 gtf 計算 VESA 模式參數手動配置 xorg.conf(通用方案)。
system-config-display# 安裝(Fedora/RHEL/CentOS)
dnf install system-config-display
# 啟動
system-config-display
GUI 介面可自動偵測顯示器 EDID,支援 LCD/CRT 選擇、解析度與刷新率下拉選單。適用於不想手動編輯設定檔的使用者。
| 顯示卡 | 驅動來源 | 安裝方式 |
|---|---|---|
| NVIDIA | 官網 .run 或 RPM Fusion 套件庫 | dnf install akmod-nvidia (Fedora) |
| AMD | 官網 amdgpu-install 或 Mesa 開源驅動 | 核心 5.10+ 內建 amdgpu,通常免安裝 |
| Intel | 核心內建 i915,舊晶片需 855resolution | 現代晶片免設定,舊款參考 855resolution 工具 |
安裝後會提供廠商控制面板(如 nvidia-settings),可視化調整解析度、多螢幕、3D 設定。
gtf 手動產生 Modeline(通用無驅動方案)gtf (Generalized Timing Formula) 為 VESA 標準工具,依解析度與刷新率計算水平/垂直同步參數、像素時脈,產出 Modeline 供 Xorg 使用。
xdpyinfo | grep dimensions 確認最大解析度與刷新率。# 語法:gtf <水平解析度> <垂直解析度> <刷新率> -x
gtf 1920 1080 60 -x
# 輸出範例
# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.11 kHz; pclk: 172.80 MHz
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
/etc/X11/xorg.conf:
Section "Monitor"
Identifier "Monitor0"
VendorName "Generic"
ModelName "LCD Panel"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 75.0
Option "DPMS"
# 將上方 Modeline 整行貼上
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080_60.00" "1280x1024" "1024x768"
EndSubSection
EndSection
systemctl restart display-manager 或重開機。xdpyinfoxdpyinfo | grep -E 'dimensions|resolution'
# dimensions: 1920x1080 pixels (508x286 millimeters)
# resolution: 96x96 dots per inch
確認 dimensions 符合預期,resolution (DPI) 合理即代表設定生效。
| 現象 | 可能原因 | 對策 |
|---|---|---|
| 螢幕黑屏/超出範圍 | Modeline 參數超出螢幕支援範圍 | 降低刷新率或解析度,參考 EDID:get-edid | parse-edid |
| 畫面閃爍 | 刷新率設定錯誤或線材品質不佳 | 嘗試 60Hz、更換 DP/HDMI 線 |
| 雙螢幕解析度不同步 | xorg.conf Screen 區段 Modes 設定衝突 | 為每個 Monitor 定義獨立 Modeline,Screen 區段用 PreferredMode 指定 |
| Wayland 會話無效 | gtf/xorg.conf 僅適用 X11 | 登入時選擇「GNOME on Xorg」或改用 wlr-randr (wlroots) |
現代 Linux 桌面多已自動偵測 EDID 免設定。僅在舊硬體、特殊解析度、或無專屬驅動時需手動 gtf + xorg.conf。優先嘗試廠商驅動與 system-config-display,保留手動模式作為終極備援。