我的一台11寸迷你筆記型電腦,裝的ubuntu。最近外接了一個19寸顯示器。解析度最多隻能是1024x768。顯示器設定裡顯示“未知”顯示器。
用下面的命令可以看到顯卡的資訊:
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GME Express Integrated Graphics Controller (rev 03)
我一直以為是顯卡驅動沒裝好,於是下載了intel顯卡linux驅動的源碼,並花了幾天時間來編譯(期間安裝了N多它所依賴的包),最終還是沒能裝成功,還把Xorg搞掛了。無奈還重裝了系統。其實intel整合顯卡的驅動已經裝好了,而且用命令sudo apt-get install xserver-xorg-video-intel也可以安裝。
之後還在網上看到修改/etc/X11/xorg.conf之類的解決方案。我直接頭大了。
最後還是找到瞭解決方案:xrandr命令。
首先,直接運行xrandr查看下解析度的情況:
$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 4096 x 4096
LVDS1 connected (normal left inverted right x axis y axis)
1024x600 60.0 +
800x600 60.3 56.2
640x480 59.9
VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.0 *
800x600 60.3 56.2
848x480 60.0
640x480 59.9
標星號的那行就是我正在使用的解析度。
下面用cvt命令產生一個modeline,為後續添加解析度作準備:
$ cvt 1440 900
# 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
再運行xrandr --newmode來建立一個解析度模式,使用“Modeline”後的內容(--rmmode刪除這個模式):
$ xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
接著用xrandr --addmode把這個模式添加到顯示器上(--delmode把這個模式從該顯示器上移除):
$ xrandr --addmode VGA1 "1440x900_60.00"
最後是應用這個模式:
$ xrandr --output VGA1 --mode "1440x900_60.00"
到此,我的螢幕看上去就清爽多了。
用xrandr查看一下:
$ xrandr
Screen 0: minimum 320 x 200, current 1440 x 900, maximum 4096 x 4096
LVDS1 connected (normal left inverted right x axis y axis)
1024x600 60.0 +
800x600 60.3 56.2
640x480 59.9
VGA1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.0
800x600 60.3 56.2
848x480 60.0
640x480 59.9
1440x900_60.00 59.9*
設定完後我的螢幕向左偏出了約5個像素,直接在顯示器(硬體)上調就可以了。
參考:https://wiki.ubuntu.com/X/Config/Resolution