Xrandr linux что это

XRandR: настройка режимов работы с дисплеями (мониторами) в GNU/Linux

Оригинал здесь

XRandR — расширение X сервера, позволяющее производить настройки режимов работы мониторов. Например, можно изменить разрешение, вывести изображение на внешний монитор, повернуть изображение и тому подобное. Утилита часто полезна для настройки корректного разрешения при подключении к внешнему монитору или телевизору.

Вывод доступных мониторов и режимов
Введя в терминале
xrandr
, мы увидим список интерфейсов по которым могут быть подключены мониторы и доступные режимы работы монитора (разрешение и частота смена кадров в герцах).
Пример вывода:
Screen 0: minimum 320 x 200, current 1024 x 600, maximum 4096 x 4096
LVDS1 connected 1024×600+0+0 (normal left inverted right x axis y axis) 223mm x 125mm
1024×600 60.0*+
800×600 60.3 56.2
640×480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)

Возможные названия интерфейсов:

LVDS1 — экран ноутбука;
VGA1 — экран, подключаемый через VGA;
DVI1 — экран, подключаемый через DVI;

Названия интерфейсов могут отличаться в зависимости от используемой видеокарты. Для последующей работы с конкретным интерфейсом, необходимо запомнить его название (например, VGA1 если мы работам на видео от Intel и подключаем монитор по VGA, который и хотим настроить через XRandR).

Изменение разрешения
Лучше всего рассмотреть пример:
xrandr —output LVDS1 —mode 800×600

Опция —output предназначена для указания на нужный интерфейс, а —mode собственно на выбираемый режим работы. Обратите внимание, что выбираемый режим должен быть указан в выводе команды
xrandr
(смотреть предыдущий раздел статьи).
Если нужный вам режим не прописан, то необходимо добавить его вручную. Это позволяет настроить монитор на правильное разрешение, при ситуации, когда в списке оно отсутствует (например, если при подключении 1080p монитора в программах настройки экрана доступно лишь намного меньшее разрешение). Данная проблема связана с тем, что некоторые мониторы и множество телевизоров почему-то не считают нужным передавать информацию о своём разрешении при подключении через VGA.
Создание нового режима
Если режим уже существует (смотреть перввую часть статьи), но не связан с нужным интерфейсом, то можно добавить режим таким образом:
xrandr —addmode VGA1 1024×600
— добавляем режим с разрешением 1024×600 и 60 Гц частотой для монитора, подключённого по VGA1.
Если режима ещё не существует, то сначала вызываем утилиту CVT (Coordinated Video Timing) с необходимым разрешением и частотой кадров в качестве параметров (в качестве примера добавим режим 1600×900 при 60Гц):
cvt 1600 900 60

Вывод утилиты cvt с нашими параметрами таков:
# 1600×900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
Modeline «1600x900_60.00» 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync

Далее мы скопируем всё, что после Modeline при вызове xrandr с ключём создания нового режима:
xrandr —newmode «1600x900_60.00» 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync

Теперь осталось «привязать» созданный режим к нужному интерфейсу (в нашем примере к VGA1):
xrandr —addmode VGA1 1600x900_60.00

Наконец, мы можем выбрать нужное нам разрешение для монитора:
xrandr —output VGA1 —mode 1600x900_60.00

Режимы работы с несколькими мониторами
Отключение дисплея
Отключить не нужный в данный момент дисплей можно с помощью опции —off:
xrandr —output LVDS1 —off
— отключаем монитор ноутбука.
Расположение мониторов относительно друг-друга
xrandr —output VGA1 —right-of LVDS1
— монитор, подключённый по VGA1 будет располагаться «справа» от монитора ноутбука (переходить на внешний монитор необходимо будет через правый угол монитора ноутбука).
Аналогично используется опция —left-of
xrandr —output LVDS1 —primary
— монитор ноутбука становится основным.
Чтобы сделать виртуальный экран большего разрешения, чем физический (в таком режиме, чтобы увидеть всё изображение необходимо будет передвигать курсор за границы) применяем команду:
xrandr —output LVDS1 —mode 1024×600 —fb 1280×720 —panning 1280×720

Читайте также:  Lpcvcom для windows 10

После этого у вас будет виртуальное разрешение 1280×720 при 1024×600 физическом.

Поворот
Используйте следующие опции применительно к нужному интерфейсу:

  • —rotate normal
  • —rotate left
  • —rotate right
  • —rotate inverted (поворот на Пи радиан)

Сохранение настроек
Для активации необходимых настроек при старте, создайте файл

/ указывает на расположение в домашней директории) и внесите в него необходимые строки команд xrandr.

Статья частично основана по материалам англоязычной документации.

Источник

xrandr

xrandr is an official configuration utility to the RandR (Resize and Rotate) X Window System extension. It can be used to set the size, orientation or reflection of the outputs for a screen. For configuring multiple monitors see the Multihead page.

Contents

Installation

Graphical front-ends

  • ARandR — Simple visual front end for XRandR. Relative monitor positions are shown graphically and can be changed in a drag-and-drop way.

https://christian.amsuess.com/tools/arandr/ || arandr

  • LXRandR — Screen resolution and monitor position tool for LXDE. Also works in Openbox.

https://wiki.lxde.org/en/LXRandR || GTK 2: lxrandr , GTK 3: lxrandr-gtk3

CLI front-ends

  • autorandr — Automatically select a display configuration based on connected devices.

https://github.com/phillipberndt/autorandr || autorandr

  • xlayoutdisplay — Detects and arranges displays. Handles: laptop lid state, highest available refresh rates, calculating and applying the actual DPI. Best used in .xinitrc, then can be invoked when plugging/unplugging monitors or closing laptop lid.

https://github.com/alex-courtis/xlayoutdisplay || xlayoutdisplayAUR

Testing configuration

When run without any option, xrandr shows the names of different outputs available on the system ( VGA-1 , HDMI-1 , etc.) and resolutions available on each, with a * after the current one and a + after the preferred one :

You can use xrandr to set different resolution (must be present in the above list) on some output:

When multiple refresh rates are present in the list, it may be changed by the —rate option, either at the same time or independently. For example:

The —auto option will turn the specified output on if it is off and set the preferred (maximum) resolution:

It is possible to specify multiple outputs in one command, e.g. to turn off HDMI-1 and turn on HDMI-2 with preferred resolution:

Configuration

xrandr is just a simple interface to the RandR extension and has no configuration file. However, there are multiple ways of achieving persistent configuration:

  1. The RandR extension can be configured via X configuration files, see Multihead#RandR for details. This method provides only static configuration.
  2. If you need dynamic configuration, you need to execute xrandr commands each time X server starts. See Autostarting#On Xorg startup for details. This method has the disadvantage of occurring fairly late in the startup process, thus it will not alter the resolution of the display manager if you use one.
  3. Custom scripts calling xrandr can be bound to events (for example when external monitor is plugged in), see udev or acpid for details. The #Scripts section provides you with some example scripts that might be useful for this purpose.

Scripts

Toggle external monitor

This script toggles between an external monitor (specified by $extern ) and a default monitor (specified by $intern ), so that only one monitor is active at a time.

The default monitor should be connected when running the script, which is always true for a laptop.

Manage 2-monitors

mons AUR is a POSIX-compliant shell script to quickly manage 2-monitors display.

It provides well-known modes like computer, duplicate, extend and projector mode as well as selecting and positioning one or two monitors among those plugged in (for more details, see mons).

Читайте также:  Linux echo to file new line

Example 3

The factual accuracy of this article or section is disputed.

This script iterates through connected monitors, selects currently active monitor, turns next one on and the others off:

Avoid X crash with xrasengan

Use this workaround to turn on connected outputs that may be in suspend mode and hence shown as disconnected, as is often the case of DisplayPort monitors:

xrasengan AUR is an xrandr wrapper with this workaround built in.

With the —force option, xrasengan will update status of all outputs before HDMI-0 is turned off, avoiding an X crash if they were the only connected/active outputs.

To force reload current settings, xrasengan provides a —try-reload-active-layout option, which uses —force and unxrandr from the arandr package to assemble the command line:

This can be used in systemd unit or in a keyboard binding to avoid blank screen when resuming DisplayPort monitors from suspend.

Configuration using arandr

arandr can graphically arrange your monitors, change resolutions, and save a script to duplicate your setup. By default, if you «Save As» it will be saved in

/.screenlayout/ . These files can then be added to your

/.profile . Sometimes problems arise from running the arandr script too soon after login.

The factual accuracy of this article or section is disputed.

Troubleshooting

Screen Blinking

For some LCD screens (e.g. Samsung 2343NW, Acer XB280HK, iiyama ProLite XUB3490WQSU-B1. ), the command cvt -r (i.e. with reduced blanking) is to be used. E.g with ProLite XUB3490WQSU-B1 and Thunderbolt HDMI 2.0 adapter on Dell XPS 13, with 60hz (59,94 selected) this screen is blinking (and the adapter+LCD screen works perfectly on Windows), you have to do :

cvt -r 3440 1440

Wich giving you :

# 3440×1440 59.97 Hz (CVT) hsync: 88.82 kHz; pclk: 319.75 MHz Modeline «3440x1440R» 319.75 3440 3488 3520 3600 1440 1443 1453 1481 +hsync -vsync

Then you have to do :

xrandr —newmode «3440x1440R» 319.75 3440 3488 3520 3600 1440 1443 1453 1481 +hsync -vsync

xrandr —addmode DP1 3440x1440R

Now you can select 59.97hz mode with the best screen resolution, wich not blinking anymore.

Adding undetected resolutions

Due to buggy hardware or drivers, your monitor’s correct resolutions may not always be detected by xrandr. For example, the EDID data block queried from the monitor may be incorrect. However, we can add the desired resolutions to xrandr. Also, this same procedure can be used to add refresh rates you know are supported, but not enabled by your driver.

First we run gtf or cvt to get the Modeline for the resolution we want:

You may also find similar lines for the modesetting driver.

Then we create a new xrandr mode. Note that the Modeline keyword needs to be omitted.

After creating it we need an extra step to add this new mode to our current output (VGA1). We use just the name of the mode, since the parameters have been set previously.

Now we change the resolution of the screen to the one we just added:

Note that these settings only take effect during this session.

If you are not sure about the resolution you will test, you may add a sleep 5 and a safe resolution command line following, like this:

Also, change VGA1 to correct output name.

EDID checksum is invalid

If the previous method results in an *ERROR* EDID checksum is invalid error during boot, see KMS#Forcing modes and EDID and [2].

Or xrandr —addmode might give you the error X Error of failed request: BadMatch . NVIDIA users should read NVIDIA/Troubleshooting#xrandr BadMatch. BadMatch could indicate an invalid EDID checksum. To verify that this is the case, run X in verbose mode (e.g. startx — -logverbose 6 ) and check your Xorg log for messages about a bad EDID.

Читайте также:  Windows 10 std dla oem разница

If you use GNOME and your monitor does not have an EDID, above #Adding undetected resolutions might not work, with your screen just blinking once, after xrandr —output .

Poke around with

/.config/monitors.xml , or delete the file completely, and then reboot.

It is better explained in this article.

Permanently adding undetected resolutions

Once a suitable resolution is found using xrandr , the mode can be permanently added by creating an entry in /etc/X11/xorg.conf.d/ :

Replace intel with the right driver, e.g. nvidia . When the X server is restarted, you should be able to set the new resolution.

If this does not work for you, try removing the Screen and Device sections and just leaving the Monitor section. [3]

Resolution lower than expected

If your video card is recognized but the resolution is lower than you expect, you may try this.

Background: ATI X1550 based video card and two LCD monitors DELL 2408(up to 1920×1200) and Samsung 206BW(up to 1680×1050). Upon first login after installation, the resolution default to 1152×864. xrandr does not list any resolution higher than 1152×864. You may want to try editing /etc/X11/xorg.conf, add a section about virtual screen, logout, login and see if this helps. If not then read on.

About the numbers: DELL on the left and Samsung on the right. So the virtual width is of sum of both LCD width 3600=1920+1680; Height then is figured as the max of them, which is max(1200,1050)=1200. If you put one LCD above the other, use this calculation instead: (max(width1, width2), height1+height2).

Correction of overscan tv resolutions via the underscan property

With a flat panel TV, w:overscan looks like the picture is «zoomed in» so the edges are cut off.

Check your TV if there is a parameter to change. If not check if the output has support for the underscan property (xrandr —prop), if so apply an underscan and change border values. The required underscan vborder and underscan hborder values can be different for you, just check it and change it by more or less.

Correction of overscan tv resolutions via —transform

If underscan is not available another solution is using xrandr —transform a,b,c,d,e,f,g,h,i , which applies a transformation matrix on the output. See the xrandr(1) § RandR_version_1.3_options manual page for the explanation of the transformation.

For example, the transformation scaling horizontal coordinates by 0.8 , vertical coordinates by 1.04 and moving the screen by 35 pixels right and 19 pixels down, is:

Full RGB in HDMI

It may occur that the Intel driver will not configure correctly the output of the HDMI monitor. It will set a limited color range (16-235) using the Broadcast RGB property, and the black will not look black, it will be grey.

Disabling phantom monitor

In some cases, a non-existent monitor may be detected by the system. To disable it, find the name of the phantom output, e.g. VGA1, and turn it off with

To make this permanent, add the following to an entry in /etc/X11/xorg.conf.d/ :

Dynamic interlace pattern artifacts with AOC G2590PX

If you are seeing very prominent interlace pattern artifacts (mesh or grid) when you see movement on the screen with this monitor, it might be happening because of a low refresh rate. Switching to a higher refresh rate (from 60 Hz to 119.98 Hz and perhaps even higher) might help reduce the effect.

Sample xrandr output for this monitor over HDMI:

As can be seen in the output above, the preferred refresh rate reported by xrandr is 60.00, but the artifacts are very visible with this refresh rate. Switching to 119.98 should help reduce the effect considerably.

Источник

Оцените статью