linux 视频输出xrandr设置命令

linux 视频输出xrandr设置命令

沈祥佑
0.4392019.03.28 17:44:09字数 397阅读 3,264

xrandr

不带参数的xrandr 命令会列出系统支持的视频接口名称和设备连接情况,还可以从输出信息里看到当前分辨率current,以及支持的最大分辨率。
带*的表示当前分辨率。

$xrandr
Screen 0: minimum 8 x 8, current 1080 x 1920, maximum 32767 x 32767
DSI1 connected (normal left inverted right x axis y axis)
   1024x600      60.00 +
   1024x576      59.90    59.82
   960x540       59.63    59.82
   800x600       60.32    56.25
   864x486       59.92    59.57
   640x480       59.94
   720x405       59.51    58.99
   640x360       59.84    59.32
   512x300       60.00
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected primary 1080x1920+0+0 right (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+
   1600x1200     60.00
   1680x1050     59.88
   1400x1050     59.95
   1280x1024     75.02    60.02
   1440x900      59.90
   1280x960      60.00
   1152x864      75.00
   1024x768      75.03    70.07    60.00
   832x624       74.55
   800x600       72.19    75.00    60.32    56.25
   640x480       75.00    72.81    66.67    59.94
   720x400       70.08
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

1. 将视频输出发送到某个接口设备:

$ xrandr --output DFP1 --auto

2. 设置分辨率时需要指定设置的output及mode,如将LVDS-1的分辨率改为1920×1080,命令就是:

 xrandr --output eDP1 --mode 1920x1080 
 --output:指定显示器。 
 --mode:指定一种有效的分辨率。 
 --rate:指定刷新率。

3. 添加有效分辨率

如果xrandr查询结果中没有合适的分辨率,则可以通过newmode来

添加,下面将给出eDP1添加1280x1024x60的分辨率方法。

3.1 使用cvt生成一个modeline,命令如下:

$cvt 1280  1024  60
 #1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz
 Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync

3.2 使用newmode创建一个mode,参数就是上面的modeline后的内容:

$xrandr --newmode "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync

3.3 新建模式,将新模式添加至当前输出设备,如果出错,则说明不支持此模式

$xrandr --addmode eDP1 1280x1024_60.00

3.4 设置newmode为当前分辨率

$xrandr --output eDP1 --mode 1280x1024_60.00

4 . 关闭某个接口设备的视频输出。

 $ xrandr --output LVDS --off

5.设置双屏幕显示:

(1)打开外接显示器,双屏幕显示相同的内容--克隆,(auto为最高分辨率)

xrandr --output VGA-0 --same-as DVI-D-0 --auto

(2)若要指定外接显示器的分辨率可以使用下面的命令(1280*1024):

 xrandr --output VGA-0 --same-as DVI-D-0 --mode 1280x1024

(3)打开外接显示器,设置为右侧扩展

 xrandr --output VGA-0 --right-of DVI-D-0 --auto

(4)关闭显示器

 xrandr --output VGA-0 --off

(5)打开VGA-0接口显示器,关闭DVI-D-0接口显示器

 xrandr --output VGA-0 --auto --output DVI-D-0 --off

(6设置HDMI2为主屏幕

$ xrandr --output HDMI2 --auto --primary

(7) 设置eDp1在HDMI2的右面

$ xrandr --output eDP1 --right-of HDMI2 --auto
 
原文地址:https://www.cnblogs.com/xuanbjut/p/12786309.html