2012年3月21日 星期三

[Linux] 強制設定x window解析度

OS: ubuntu 11.04版
HW: disktop VIA VX900 內建顯卡
在x window裡因為讀不到顯示器的EDID,所以需要強制設定輸出解析度
How change display resolution settings using xrandr
1.查詢預設定解析度的內容
nash@ubuntu:/$ cvt 1920 1080 57
# 1920x768 56.9 Hz (CVT) hsync: 63.67 kHz; pclk: 163.0 MHz
Modeline "1920x1080_57.00" 163.00 1920 2042 2240 2560 1080 1083 1088 1119 -hsync +vsync
2.加入新的解析度到linux中
nash@ubuntu:/$ xrandr --newmode "1920x1080_57.00" 163.00 1920 2042 2240 2560 1080 1083 1088 1119 -hsync +vsync
3.查詢顯示器名稱
nash@ubuntu:/$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maxumum 4096 x 4096
VGA-1 connected 1920x1080+0+0(normal left inverted right x axis y axis)0mm x 0mm
1360x768 59.8
1024x768 60 * #表示目前使用中的解析度
800x600  60.3    56.2
848x480  60
640x480  59.6    59.9
4.加入預設定解析度到linux中
nash@ubuntu:/$ xrandr --addmode VGA-1 1920x1080_57.00
5.查詢解析度是否加入
nash@ubuntu:/$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maxumum 4096 x 4096
VGA-1 connected 1920x1080+0+0(normal left inverted right x axis y axis)0mm x 0mm
1360x768 59.8
1024x768 60 * #表示目前使用中的解析度
800x600  60.3    56.2
848x480  60
640x480  59.6    59.9
1920x1080_57.00  57.0 #新增的解析度
6.輸出
建議用x window裡面system->Preferences->Monitors去設定新增的解析度,因為如果新增解析度不支援他在30秒後會回復到原本的設定解析度,不會一直卡在黑畫面,然後要重開機進到single去修改
如果有支援可用command line設定輸出

nash@ubuntu:/$ xrandr --output VGA-1 --mode 1920x1080_57.00 #此時畫面解析度就會變化了
7.以上設定均為暫時性所以需要寫到開機時執行以求每次開機都會設定此解析度
nash@ubuntu:/$ gksudo gedit /etc/gdm/Init/Default
..........
..........
PATH=/usr/bin:$PAT  #找到此兩行把指令加入到他下面即可
OLD_IFS=$IFS
xrandr --newmode "1920x1080_57.00" 163.00 1920 2042 2240 2560 1080 1083 1088 1119 -hsync +vsync
xrandr --addmode VGA-1 1920x1080_57.00
xrandr --output VGA-1 --mode 1920x1080_57.00
8.重新開機檢查是否成功

參考資料:
http://www.ubuntugeek.com/how-change-display-resolution-settings-using-xrandr.html
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=34432&forum=3&post_id=159036#forumpost159036
https://wiki.ubuntu.com/X/Config/Resolution
http://shanereustle.com/blog/force-screen-resolutions-on-ubuntu.html


2 則留言:

  1. 你好:
    關於第七點的gksudo gedit /etc/gdm/Init/Default 應為 $gksudo gedit /etc/gdm/Init/Default 才可開啟檔案
    提供你參考,謝謝你。
    (參閱http://www.ubuntugeek.com/how-change-display-resolution-settings-using-xrandr.html)

    回覆刪除