Ubuntu modify resolution

Under normal circumstances, the distribution of linux with a graphical interface can directly set the resolution of multiple screens in Setting->Device->Display . But pits are always ubiquitous, and sometimes the resolution that is clearly used is faulty, and it cannot be set on the interface. At this point, you can directly set the resolution through the xrandr command.

normal method

1. Check the display mode parameters:

#1440 900就是要修改的分辨率,根据需要可以使用1920 1080、1720 900等
$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

The content after Modeline is the parameters we will use to add the display mode later.

2. Add a reality mode through the addMode command:

#将Modeline的阿才能书复制到 --newmode之后即可
#后面的参数可以根据需要调整,请查阅cvt相关的说明
$xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync

3. Add to the corresponding display.

First use the xrandr command to query the corresponding display:

$xrandr
#输出类似以下的内容
WAYLAND0 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 173mm
   1366x768      60.00*+
   1360x768      59.80    59.96  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05
WAYLAND1 connected 1024x768+1366+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00* 
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  

Remember the name of WAYLAND0\WAYLAND1, which is the proxy name for our display. Usually, WAYLAND0 is the monitor of the corresponding laptop computer, and the rest are augmented screens.

Then add a mode to the corresponding display:

$xrandr --addmode WAYLAND1 "1440x900_60.00"

Then it's ok......

problems encountered

But the world would be perfect if the world was so easy.

Question 1, the xrand command pointer is for the current user

Remember to use the xrand command for the current user. For example, I created an administrator user, and then disabled the root account. Habitually add sudo when executing the command, and finally output something like "MIT-MAGIC-COOKIE-1 keyCan't open display :0.0" .

Question 2, the last step outputs xrandr: Configure crtc 0 failed

After the last line  $xrandr --addmode WAYLAND1 "1440x900_60.00" command, the modification was not successful, but output xrandr: Configure crtc 0 failed  or  xrandr: Configure crtc 1 failed . Check out the information. Find instructions at askubuntu. It is said that after upgrading to Ubuntu 17.10, AMD/ATI graphics cards are prone to encounter this pit, and wayland cannot recognize the display. At this time, the Displays panel of Setting is opened, and the Unknown Display is displayed. The highest resolution can only reach 1024*768. The least laborious method can be solved by installing a new driver source (but I installed it once and it still does not work).

In fact, as long as both the graphics card and the monitor support a certain resolution, just tell the graphics card to output images according to this resolution, and you don't need wayland to identify the monitor.

First turn off the wayland service. Wayland is a new display service after 17.10 (it is said that you can select and switch between X.org in the login interface, but mine does not). Close method:

1. Open the configuration file:

#打开custom.conf文件,不同发行版文件位置可能有差异
vim /etc/gdm3/custom.conf

2. Modify the file, find the line #WaylandEnable=false , and then remove the comment.

# Uncoment the line below to force the login screen to use Xorg
WaylandEnable=false
#......

3. Finally reboot to restart the computer.

4. After the startup is complete, enter the xrandr command and find that the previous WAYLAND0 and WAYLAND1 have become the names of the output ports:

$xrandr
#输出
Screen 0: minimum 320 x 200, current 2806 x 900, maximum 8192 x 8192
eDP-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 173mm
   1366x768      60.00*+
   1360x768      59.80    59.96  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 connected 1440x900+1366+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00  
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
HDMI-2 disconnected (normal left inverted right x axis y axis)

The DP-1 here is the external monitor I use, but now it can only display 1024*768. Then execute $cvt 1440 900 , $xrandr newmode , $xrandr addmode DP-1 "1440x900_60.00" in sequence according to the method described above , only the parameters of the last addmode are slightly different.

After modification, you can see the latest resolution in Displays.

permanent problem

Finally, the biggest problem with this method is that it cannot be saved. After each restart, the resolution of the display still cannot be recognized, and it returns to the state before the modification.

Some places say that the /etc/X11/xorg.conf file can be added or modified like this:

Section "Monitor"
Identifier "Configured Monitor"
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
Option "PreferredMode" "1920x1080_60.00"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
Section "Device"
Identifier "Configured Video Device"
EndSection

But nothing works after I modify it. And there is an extra /etc/X11/xorg.conf.failsafe file. I don't know if it's a specific reason for 17.0.4. After all, I also had a problem with the resolution after I upgraded the system to 17.0.4.

Since the xorg.conf configuration cannot take effect, I directly create the command as a shell, and then start it and run it:

#view-port-init.sh
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode DP-1 "1920x1080_60.00"
#DP-1这里请根据自己的参数修改。

参考:xrandr-configure-crtc-0-failed-when-trying-to-change-resolution

Original address: http://www.chkui.com/article/linux/ubuntu_modify_view_port_by_xrandr

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325121158&siteId=291194637