[d28b5ef] | 1 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 2 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 |
|
---|
[7c472863] | 7 | <sect1 id="xorg-config">
|
---|
| 8 | <?dbhtml filename="xorg-config.html"?>
|
---|
[d28b5ef] | 9 |
|
---|
| 10 |
|
---|
[5287b7c] | 11 | <title>Xorg-&xorg-version; Testing and Configuration</title>
|
---|
[d28b5ef] | 12 |
|
---|
[b960e3ec] | 13 | <indexterm zone="xorg-config">
|
---|
| 14 | <primary sortas="g-configuring-xorg">Configuring Xorg</primary>
|
---|
| 15 | </indexterm>
|
---|
| 16 |
|
---|
[da4b5e0] | 17 | <sect2 id='X11-testing' xreflabel="Testing Xorg">
|
---|
[5930509] | 18 | <title>Testing Xorg</title>
|
---|
[0d7900a] | 19 |
|
---|
[da4b5e0] | 20 | <note>
|
---|
| 21 | <para>
|
---|
| 22 | Before starting Xorg for the first time, is is useful to
|
---|
| 23 | rebuild the library cache by running <userinput>ldconfig</userinput>
|
---|
| 24 | as the <systemitem class="username">root</systemitem> user.
|
---|
| 25 | </para>
|
---|
| 26 | </note>
|
---|
| 27 |
|
---|
[d43c7a12] | 28 | <note>
|
---|
| 29 | <para>
|
---|
| 30 | Before starting Xorg for the first time, is is often needed to
|
---|
| 31 | reboot the system to ensure all appropriate daemons are started
|
---|
[b9c353b] | 32 | and appropriate security issues are properly set.
|
---|
[d43c7a12] | 33 | As an alternative, logging out and logging back in may work, but as
|
---|
| 34 | of this writing has not been tested.
|
---|
| 35 | </para>
|
---|
| 36 | </note>
|
---|
| 37 |
|
---|
[df5c5e0] | 38 | <warning>
|
---|
| 39 | <para>
|
---|
| 40 | If Xorg hangs for some reason (for example, lacking a proper
|
---|
[2c87187] | 41 | input driver), the system may stop responding to any user input.
|
---|
[df5c5e0] | 42 | As a precaution, you can enable a magic <keycap>SysRq</keycap> key
|
---|
| 43 | before testing Xorg. As the
|
---|
| 44 | <systemitem class="username">root</systemitem> user, issue:
|
---|
| 45 | </para>
|
---|
| 46 |
|
---|
| 47 | <screen><userinput>echo 4 > /proc/sys/kernel/sysrq</userinput></screen>
|
---|
| 48 |
|
---|
| 49 | <para>
|
---|
| 50 | Then if Xorg hangs, it's possible to use
|
---|
| 51 | <keycombo>
|
---|
| 52 | <keycap>Alt</keycap>
|
---|
| 53 | <keycap>SysRq</keycap>
|
---|
| 54 | <keycap>R</keycap>
|
---|
| 55 | </keycombo>
|
---|
| 56 | to reset the keyboard mode. Now it should be able to use
|
---|
| 57 | <keycombo>
|
---|
| 58 | <keycap>Ctrl</keycap>
|
---|
| 59 | <keycap>Alt</keycap>
|
---|
| 60 | <keycap>Fx</keycap>
|
---|
| 61 | </keycombo>
|
---|
| 62 | (replace x with a VT number) to switch to another VT.
|
---|
[4e207bb] | 63 | If it works, login and kill Xorg using command line in the new VT.
|
---|
[df5c5e0] | 64 | </para>
|
---|
| 65 | </warning>
|
---|
| 66 |
|
---|
[da4b5e0] | 67 | <para>
|
---|
| 68 | To test the <application>Xorg</application> installation, issue
|
---|
| 69 | <command>startx</command>. This command brings up a rudimentary window
|
---|
| 70 | manager called <emphasis>twm</emphasis> with three xterm windows and one
|
---|
| 71 | xclock window. The xterm window in the upper left is a login terminal and
|
---|
| 72 | running <emphasis>exit</emphasis> from this terminal will exit the
|
---|
| 73 | <application>X Window</application> session. The third xterm window may
|
---|
| 74 | be obscured on your system by the other two xterms.
|
---|
| 75 | </para>
|
---|
| 76 |
|
---|
| 77 | <note>
|
---|
| 78 | <para>
|
---|
| 79 | When testing <application>Xorg</application> with the
|
---|
| 80 | <application>twm</application> window manager, there will be several
|
---|
[82bdecf] | 81 | warnings in the Xorg log file, <!--<filename revision="sysv">
|
---|
| 82 | /var/log/Xorg.0.log</filename><filename revision="systemd">-->
|
---|
| 83 | $HOME/.local/share/xorg/Xorg.0.log<!--</filename>-->, about missing font
|
---|
[da4b5e0] | 84 | files. In addition, there will be several warnings on the text mode
|
---|
| 85 | terminal (usually tty1) about missing fonts. These warnings do not
|
---|
| 86 | affect functionality, but can be removed if desired by installing
|
---|
| 87 | the <xref linkend="xorg7-legacy"/>.
|
---|
| 88 | </para>
|
---|
| 89 | </note>
|
---|
| 90 |
|
---|
| 91 | <para>
|
---|
| 92 | Generally, there is no specific configuration required for
|
---|
| 93 | <application>Xorg</application>, but customization is possible. For
|
---|
| 94 | details, see <xref linkend='xconfig'/> below.
|
---|
| 95 | </para>
|
---|
| 96 |
|
---|
| 97 | </sect2>
|
---|
| 98 |
|
---|
| 99 | <sect2 role="configuration" id="checking-dri" xreflabel="Checking the DRI
|
---|
| 100 | installation">
|
---|
[7612749] | 101 | <title>Checking the Direct Rendering Infrastructure (DRI)
|
---|
| 102 | Installation</title>
|
---|
[2001b3e] | 103 |
|
---|
[f38727d] | 104 | <para>
|
---|
[7612749] | 105 | DRI is a framework for allowing software to access graphics hardware in
|
---|
| 106 | a safe and efficient manner. It is installed in
|
---|
| 107 | <application>X</application> by default (using
|
---|
| 108 | <application>Mesa</application>) if you have a supported video card.
|
---|
[f38727d] | 109 | </para>
|
---|
| 110 |
|
---|
| 111 | <para>
|
---|
| 112 | To check if DRI drivers are installed properly, check the log file
|
---|
[97ee53d] | 113 | <filename>$HOME/.local/share/xorg/Xorg.0.log</filename> (or
|
---|
| 114 | <filename>/var/log/Xorg.0.log</filename> if you have
|
---|
| 115 | built <xref linkend="xorg-server"/> with the suid bit) for
|
---|
[7612749] | 116 | statements such as:
|
---|
[f38727d] | 117 | </para>
|
---|
| 118 |
|
---|
[9871a7a6] | 119 | <screen><literal>(II) modeset(0): [DRI2] Setup complete
|
---|
| 120 | (II) modeset(0): [DRI2] DRI driver: crocus
|
---|
| 121 | (II) modeset(0): [DRI2] VDPAU driver: va_gl</literal></screen>
|
---|
[c96921c] | 122 |
|
---|
[f38727d] | 123 | <note>
|
---|
| 124 | <para>
|
---|
| 125 | DRI configuration may differ if you are using alternate drivers, such
|
---|
[9871a7a6] | 126 | as traditional DDX drivers, or the proprietary drivers from
|
---|
[87fc185] | 127 | <ulink url="https://www.nvidia.com/page/home.html">NVIDIA</ulink> or
|
---|
| 128 | <ulink url="https://www.amd.com/">AMD</ulink>.
|
---|
[f38727d] | 129 | </para>
|
---|
[2001b3e] | 130 | </note>
|
---|
| 131 |
|
---|
[cc405844] | 132 | <!-- With elogind, this is not needed anymore
|
---|
[f38727d] | 133 | <para>
|
---|
[7612749] | 134 | Although all users can use software acceleration, any hardware
|
---|
| 135 | acceleration (DRI2) is only available to <systemitem
|
---|
| 136 | class="username">root</systemitem> and members of the <systemitem
|
---|
| 137 | class="groupname">video</systemitem> group, but
|
---|
| 138 | <phrase revision="sysv"><emphasis>ConsoleKit2</emphasis></phrase>
|
---|
| 139 | <phrase revision="systemd"><emphasis>systemd-logind</emphasis></phrase>
|
---|
| 140 | takes care of adding any logged in user to the user ACL's of
|
---|
| 141 | <filename>/dev/dri/card*</filename>, the special file(s) allowing access
|
---|
| 142 | to hardware acceleration.<phrase revision="systemd"> So, no further
|
---|
| 143 | configuration is needed.</phrase>
|
---|
[f38727d] | 144 | </para>
|
---|
[2001b3e] | 145 |
|
---|
[7612749] | 146 | <para revision="sysv">
|
---|
| 147 | If your driver is supported and <emphasis>ConsoleKit2</emphasis> is not
|
---|
| 148 | installed, add any users that might use X to the <systemitem
|
---|
| 149 | class="groupname">video</systemitem> group:
|
---|
[f38727d] | 150 | </para>
|
---|
[2001b3e] | 151 |
|
---|
[7612749] | 152 | <screen role="root" revision="sysv"><userinput>usermod -a -G video <replaceable><username></replaceable></userinput></screen>
|
---|
[cc405844] | 153 | -->
|
---|
[f38727d] | 154 | <para>
|
---|
[c96921c] | 155 | Another way to determine if DRI is working properly is to use one of the
|
---|
| 156 | two optionally installed OpenGL demo programs in <xref
|
---|
[7a395d1] | 157 | linkend="mesa"/>. From an X terminal, run <command>glxinfo</command>
|
---|
[f38727d] | 158 | and look for the phrase:
|
---|
| 159 | </para>
|
---|
| 160 |
|
---|
| 161 | <screen><computeroutput>name of display: :0
|
---|
| 162 | display: :0 screen: 0
|
---|
| 163 | direct rendering: Yes</computeroutput></screen>
|
---|
| 164 |
|
---|
| 165 | <para>
|
---|
| 166 | If direct rendering is enabled, you can add verbosity by running
|
---|
[7612749] | 167 | <command>LIBGL_DEBUG=verbose glxinfo</command>. This will show the
|
---|
| 168 | drivers, device nodes and files used by the DRI system.
|
---|
[f38727d] | 169 | </para>
|
---|
| 170 |
|
---|
| 171 | <para>
|
---|
[c96921c] | 172 | To confirm that DRI2 hardware acceleration is working, you can (still in
|
---|
[d6b45f7] | 173 | the X terminal) run the command <command>glxinfo | grep -E "(OpenGL
|
---|
[c96921c] | 174 | vendor|OpenGL renderer|OpenGL version)"</command>.
|
---|
| 175 | If that reports something <emphasis>other than</emphasis>
|
---|
| 176 | <literal>Software Rasterizer</literal> then you have working
|
---|
| 177 | acceleration for the user who ran the command.
|
---|
[f38727d] | 178 | </para>
|
---|
| 179 |
|
---|
| 180 | <para>
|
---|
[c96921c] | 181 | If your hardware does not have any DRI2 driver available, it will use a
|
---|
[7612749] | 182 | Software Rasterizer for Direct Rendering. In such cases, you can use a
|
---|
| 183 | new, LLVM-accelerated, Software Rasterizer called LLVMPipe. In order to
|
---|
| 184 | build LLVMPipe just make sure that <xref linkend="llvm"/> is present at
|
---|
| 185 | Mesa build time. Note that all decoding is done on the CPU instead of
|
---|
| 186 | the GPU, so the display will run slower than with hardware acceleration.
|
---|
| 187 | To check if you are using LLVMpipe, review the output of the glxinfo
|
---|
| 188 | command above. An example of the output using the Software Rasterizer
|
---|
| 189 | is shown below:
|
---|
[f38727d] | 190 | </para>
|
---|
| 191 |
|
---|
[c8a70a5] | 192 | <screen><computeroutput>OpenGL vendor string: VMware, Inc.
|
---|
| 193 | OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits)
|
---|
[9b175e27] | 194 | OpenGL version string: 3.0 Mesa 10.4.5</computeroutput></screen>
|
---|
[f38727d] | 195 |
|
---|
| 196 | <para>
|
---|
[7612749] | 197 | You can also force LLVMPipe by exporting the
|
---|
| 198 | <envar>LIBGL_ALWAYS_SOFTWARE=1</envar> environment variable when
|
---|
| 199 | starting Xorg.
|
---|
[f38727d] | 200 | </para>
|
---|
| 201 |
|
---|
| 202 | <para>
|
---|
[c96921c] | 203 | Again, if you have built the Mesa OpenGL demos, you can also run the test
|
---|
| 204 | program <command>glxgears</command>. This program brings up a window with
|
---|
| 205 | three gears turning. The X terminal will display how many frames were
|
---|
| 206 | drawn every five seconds, so this will give a rough benchmark. The window
|
---|
| 207 | is scalable, and the frames drawn per second is highly dependent on the
|
---|
| 208 | size of the window. On some hardware, <command>glxgears</command> will
|
---|
| 209 | run synchronized with the vertical refresh signal and the frame rate will
|
---|
| 210 | be approximately the same as the monitor refresh rate.
|
---|
[f38727d] | 211 | </para>
|
---|
[2001b3e] | 212 |
|
---|
[da4b5e0] | 213 | </sect2>
|
---|
[2001b3e] | 214 |
|
---|
[147b566] | 215 | <sect2 role="configuration" id="xorg-debug" xreflabel="Debugging Xorg">
|
---|
| 216 | <title>Debugging Xorg</title>
|
---|
| 217 |
|
---|
| 218 | <para>
|
---|
| 219 | When starting xorg, there are a couple of ways to check what any
|
---|
| 220 | issues you may have. If the system comes up, you can see what driver
|
---|
| 221 | is being used by running <command>xdriinfo</command>. If there are
|
---|
| 222 | issues or you just want to check, look at <filename>Xorg.0.log</filename>.
|
---|
| 223 | </para>
|
---|
| 224 |
|
---|
| 225 | <para>
|
---|
| 226 | The location of <filename>Xorg.0.log</filename> depends on how Xorg is
|
---|
[1fe05eb] | 227 | installed. If the instructions in the book are followed closely and
|
---|
| 228 | Xorg is started from the command line, it will be located in the
|
---|
[147b566] | 229 | <filename class="directory">$HOME/.local/share/xorg/</filename> directory.
|
---|
| 230 | If Xorg is started by a display manager (e.g. <xref linkend='lightdm'/>,
|
---|
[1fe05eb] | 231 | <xref linkend='lxdm'/>, or <xref linkend='gdm'/>) or if
|
---|
[f4d1297] | 232 | <filename>$XORG_PREFIX/bin/Xorg</filename> has the suid bit set,
|
---|
[147b566] | 233 | it will be located in the <filename class="directory">/var/log/</filename>
|
---|
| 234 | directory.
|
---|
| 235 | </para>
|
---|
| 236 |
|
---|
| 237 | <bridgehead renderas="sect3">Xorg.0.log Issues</bridgehead>
|
---|
| 238 |
|
---|
| 239 | <para>
|
---|
| 240 | When you look at Xorg.0.log, check for entries like (EE) or (WW).
|
---|
| 241 | Below are some common entries:
|
---|
| 242 | </para>
|
---|
| 243 |
|
---|
| 244 | <bridgehead renderas="sect5">(WW) Open ACPI failed (/var/run/acpid.socket)</bridgehead>
|
---|
| 245 |
|
---|
| 246 | <para>
|
---|
[5f729f8] | 247 | This warning is because <xref linkend='acpid'/> is not installed. If you
|
---|
| 248 | are not on a laptop, it can be safely ignored. On a laptop, install
|
---|
[147b566] | 249 | <xref linkend='acpid'/> to enable actions like recognizing when the lid is
|
---|
| 250 | closed.
|
---|
| 251 | </para>
|
---|
| 252 |
|
---|
| 253 | <bridgehead renderas="sect5">(WW) VGA arbiter: cannot open kernel arbiter, no multi-card support</bridgehead>
|
---|
| 254 |
|
---|
| 255 | <para>
|
---|
| 256 | This warning is displayed when a regular user starts Xorg. The library
|
---|
| 257 | <filename>libpciaccess.so</filename> issues this warning when it
|
---|
[7affde51] | 258 | tries to open <filename>/dev/vga_arbiter</filename>. If there is no
|
---|
| 259 | more than one legacy PCI (not PCIe) graphic cards on the system, it
|
---|
| 260 | can safely be ignored. If really necessary, the
|
---|
[1fe05eb] | 261 | permissions of this device can be changed by adding a udev rule and
|
---|
[147b566] | 262 | adding the local user to the video group. As the &root; user:
|
---|
| 263 | </para>
|
---|
| 264 |
|
---|
| 265 | <screen role="root"><userinput>cat > /etc/udev/rules.d/99-vga-arbiter.rules << EOF
|
---|
| 266 | # /etc/udev/rules.d/99-vga-arbiter.rules: Set vga_arbiter group/mode
|
---|
| 267 |
|
---|
| 268 | ACTION=="add", KERNEL=="vga_arbiter", GROUP="video" MODE="0660"
|
---|
| 269 | EOF
|
---|
| 270 |
|
---|
[9f4aee8] | 271 | usermod -a -G video <user running xorg></userinput></screen>
|
---|
[147b566] | 272 |
|
---|
| 273 | </sect2>
|
---|
| 274 |
|
---|
[da4b5e0] | 275 | <sect2 role="configuration" id="hybrid-graphics" xreflabel="Hybrid Graphics">
|
---|
[f38727d] | 276 | <title>Hybrid Graphics</title>
|
---|
| 277 |
|
---|
| 278 | <para>
|
---|
[7612749] | 279 | Hybrid Graphics is still in experimental state for Linux. Xorg Developers
|
---|
| 280 | have developed a technology called PRIME that can be used for switching
|
---|
| 281 | between integrated and muxless discrete GPU at will. Automatic switching
|
---|
| 282 | is not possible at the moment.
|
---|
[f38727d] | 283 | </para>
|
---|
| 284 |
|
---|
| 285 | <para>
|
---|
[7612749] | 286 | In order to use PRIME for GPU switching, make sure that you are using
|
---|
| 287 | Linux Kernel 3.4 or later (recommended). You will need latest DRI and
|
---|
| 288 | DDX drivers for your hardware and <application>Xorg Server</application>
|
---|
[6039a39] | 289 | 1.13 or later.
|
---|
[f38727d] | 290 | </para>
|
---|
| 291 |
|
---|
| 292 | <para>
|
---|
[7612749] | 293 | <application>Xorg Server</application> should load both GPU drivers
|
---|
[5f729f8] | 294 | automatically. You can check that by running:
|
---|
[6039a39] | 295 | </para>
|
---|
| 296 |
|
---|
| 297 | <screen><userinput>xrandr --listproviders</userinput></screen>
|
---|
| 298 |
|
---|
| 299 | <para>
|
---|
| 300 | There should be two (or more) providers listed, for example:
|
---|
| 301 | </para>
|
---|
| 302 |
|
---|
| 303 | <screen><computeroutput>Providers: number : 2
|
---|
[1473268a] | 304 | Provider 0: id: 0x7d cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 4 associated providers: 1 name:modesetting
|
---|
| 305 | Provider 1: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 1 associated providers: 1 name:modesetting</computeroutput></screen>
|
---|
[6039a39] | 306 |
|
---|
[1473268a] | 307 | <!-- Well, both "id" and "name" are supposed to work here but after
|
---|
| 308 | the xf86-video-* removal all the names will be modesetting unless
|
---|
| 309 | a proprietary driver used... -->
|
---|
[6039a39] | 310 | <para>
|
---|
| 311 | In order to be able to run a GLX application on a discrete GPU, you will
|
---|
[1473268a] | 312 | need to run the following command, where <provider> is the id of
|
---|
| 313 | the more powerful discrete card, and <sink> is the id of card
|
---|
| 314 | which has a display connected:
|
---|
[6039a39] | 315 | </para>
|
---|
| 316 |
|
---|
| 317 | <screen><userinput>xrandr --setprovideroffloadsink <replaceable><provider> <sink></replaceable></userinput></screen>
|
---|
| 318 |
|
---|
| 319 | <note>
|
---|
| 320 | <para>
|
---|
[1473268a] | 321 | With the <application>Xorg</application> modesetting driver,
|
---|
| 322 | which is DRI3 capable, the above command is no longer
|
---|
[6039a39] | 323 | necessary. It does no harm however.
|
---|
| 324 | </para>
|
---|
| 325 | </note>
|
---|
| 326 |
|
---|
| 327 | <para>
|
---|
| 328 | Then, you will need to export the <envar>DRI_PRIME=1</envar> environment
|
---|
| 329 | variable each time you want the powerful GPU to be used. For example,
|
---|
[0d7900a] | 330 |
|
---|
[d6b45f7] | 331 | <screen><userinput>DRI_PRIME=1 glxinfo | grep -E "(OpenGL vendor|OpenGL renderer|OpenGL version)"</userinput></screen>
|
---|
[f38727d] | 332 |
|
---|
| 333 | will show OpenGL vendor, renderer and version for the discrete GPU.
|
---|
| 334 | </para>
|
---|
| 335 |
|
---|
| 336 | <para>
|
---|
[c96921c] | 337 | If the last command reports same OpenGL renderer with and without
|
---|
| 338 | <envar>DRI_PRIME=1</envar>, you will need to check your installation.
|
---|
[f38727d] | 339 | </para>
|
---|
[2001b3e] | 340 |
|
---|
[da4b5e0] | 341 | </sect2>
|
---|
[2001b3e] | 342 |
|
---|
[d28b5ef] | 343 | <sect2 role="configuration" id='xconfig'>
|
---|
| 344 | <title>Setting up Xorg Devices</title>
|
---|
[c96921c] | 345 |
|
---|
[da4b5e0] | 346 | <para>
|
---|
| 347 | For most hardware configurations, modern Xorg will automatically
|
---|
| 348 | get the server configuration correct without any user intervention. There
|
---|
| 349 | are, however, some cases where auto-configuration will be incorrect.
|
---|
| 350 | Following are some example manual configuration items that may be of use
|
---|
| 351 | in these instances.
|
---|
| 352 | </para>
|
---|
[d28b5ef] | 353 |
|
---|
| 354 | <sect3 id="xinput">
|
---|
[da4b5e0] | 355 | <title>Setting up X Input Devices</title>
|
---|
| 356 | <para>
|
---|
| 357 | For most input devices, no additional configuration will be
|
---|
| 358 | necessary. This section is provided for informational purposes only.
|
---|
| 359 | </para>
|
---|
[0d7900a] | 360 |
|
---|
[da4b5e0] | 361 | <para>
|
---|
| 362 | A sample default XKB setup could look like the following (executed as
|
---|
| 363 | the <systemitem class="username">root</systemitem> user):
|
---|
| 364 | </para>
|
---|
[c96921c] | 365 |
|
---|
[7612749] | 366 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/xkb-defaults.conf << "EOF"
|
---|
[51dfb3e] | 367 | <literal>Section "InputClass"
|
---|
[d28b5ef] | 368 | Identifier "XKB Defaults"
|
---|
| 369 | MatchIsKeyboard "yes"
|
---|
[7612749] | 370 | Option "XkbLayout" "fr"
|
---|
[d28b5ef] | 371 | Option "XkbOptions" "terminate:ctrl_alt_bksp"
|
---|
[51dfb3e] | 372 | EndSection</literal>
|
---|
[d28b5ef] | 373 | EOF</userinput></screen>
|
---|
| 374 |
|
---|
[da4b5e0] | 375 | <para>
|
---|
| 376 | The <quote>XkbLayout</quote> line is an example for a French (AZERTY)
|
---|
| 377 | keyboard. Change it to your keyboard model. That line is not needed for
|
---|
| 378 | a QWERTY (US) keyboard.
|
---|
| 379 | </para>
|
---|
| 380 | </sect3>
|
---|
[d28b5ef] | 381 |
|
---|
[da4b5e0] | 382 | <sect3 id="xdisplay">
|
---|
| 383 | <title>Fine Tuning Display Settings</title>
|
---|
[f3429309] | 384 |
|
---|
[da4b5e0] | 385 | <para>
|
---|
[5c7ad04] | 386 | If you want to set the monitor resolution for Xorg, first run
|
---|
| 387 | <command>xrandr</command> in a X terminal to list the supported
|
---|
| 388 | resolutions and the corresponding refresh rates. For example, it
|
---|
| 389 | outputs the following for one monitor:
|
---|
[da4b5e0] | 390 | </para>
|
---|
[d28b5ef] | 391 |
|
---|
[5c7ad04] | 392 | <screen><computeroutput>Screen 0: minimum 16 x 16, current 5760 x 2160, maximum 32767 x 32767
|
---|
| 393 | DP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
|
---|
| 394 | 3840x2160 59.98*+
|
---|
| 395 | 2048x1536 59.95
|
---|
| 396 | 1920x1440 59.90
|
---|
| 397 | 1600x1200 59.87
|
---|
| 398 | 1440x1080 59.99
|
---|
| 399 | 1400x1050 59.98
|
---|
| 400 | 1280x1024 59.89
|
---|
| 401 | 1280x960 59.94
|
---|
| 402 | 1152x864 59.96
|
---|
| 403 | 1024x768 59.92
|
---|
| 404 | 800x600 59.86
|
---|
| 405 | 640x480 59.38 </computeroutput></screen>
|
---|
| 406 |
|
---|
| 407 | <para>
|
---|
| 408 | From the output we can see the monitor is identified
|
---|
| 409 | <literal>DP-1</literal>. Select a suitable resolution from the
|
---|
[0c76f3cf] | 410 | output list, for example <literal>1920x1440</literal>. Then
|
---|
[5c7ad04] | 411 | as the &root; user, create a configuration file for the Xorg server:
|
---|
| 412 | </para>
|
---|
| 413 |
|
---|
| 414 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/monitor-DP-1.conf << "EOF"
|
---|
| 415 | <literal>Section "Monitor"
|
---|
| 416 | Identifier "DP-1"
|
---|
| 417 | Option "PerferredMode" "1920x1440"
|
---|
| 418 | EndSection</literal>
|
---|
| 419 | EOF</userinput></screen>
|
---|
| 420 |
|
---|
| 421 | <para>
|
---|
| 422 | Sometimes <command>xrandr</command> may fail to detect some
|
---|
| 423 | resolution settings supported by the monitor. It usually happens
|
---|
| 424 | with virtual monitors of virtual machine managers like
|
---|
| 425 | <xref linkend='qemu'/> or VMWare: a virtual monitor actually
|
---|
| 426 | supports all pairs of integers in a range as the resolution, but
|
---|
| 427 | <command>xrandr</command> will only list a few. To use a
|
---|
| 428 | resolution not listed by <command>xrandr</command>, first run
|
---|
| 429 | <command>cvt</command> to get the mode line for the resolution.
|
---|
| 430 | For example:
|
---|
| 431 | </para>
|
---|
| 432 |
|
---|
| 433 | <screen><userinput>cvt 1600 900</userinput>
|
---|
| 434 | <computeroutput><literal># 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
|
---|
| 435 | Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync</literal></computeroutput></screen>
|
---|
| 436 |
|
---|
| 437 | <para>
|
---|
| 438 | As the &root; user, create a Xorg server configuration file
|
---|
| 439 | containing this mode line, and specify the mode as preferred mode:
|
---|
| 440 | </para>
|
---|
| 441 |
|
---|
| 442 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/monitor-DP-1.conf << "EOF"
|
---|
| 443 | <literal>Section "Monitor"
|
---|
| 444 | Identifier "DP-1"
|
---|
| 445 | Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
|
---|
| 446 | Option "PerferredMode" "1600x900_60.00"
|
---|
[51dfb3e] | 447 | EndSection</literal>
|
---|
[d28b5ef] | 448 | EOF</userinput></screen>
|
---|
| 449 |
|
---|
[5c7ad04] | 450 | <para>
|
---|
| 451 | Some high-end LCD monitors support a refresh rate higher than 100 Hz
|
---|
| 452 | but <command>xrandr</command> may fail to recognize the supported
|
---|
| 453 | refresh rate and use 60 Hz instead. This issue would prevent you
|
---|
| 454 | from utilizing the full capability of the monitor, and may cause
|
---|
| 455 | the screen to flicker or show <quote>artifacts</quote> like meshes
|
---|
| 456 | or grids. To resolve the issue, again use <command>cvt</command>
|
---|
| 457 | to get the mode line with a custom refresh rate:
|
---|
| 458 | </para>
|
---|
| 459 |
|
---|
| 460 | <screen><userinput>cvt 3840 2160 144</userinput>
|
---|
| 461 | <computeroutput><literal># 3840x2160 143.94 Hz (CVT) hsync: 338.25 kHz; pclk: 1829.25 MHz
|
---|
| 462 | Modeline "3840x2160_144.00" 1829.25 3840 4200 4624 5408 2160 2163 2168 2350 -hsync +vsync</literal></computeroutput></screen>
|
---|
| 463 |
|
---|
| 464 | <para>
|
---|
| 465 | Then paste it into the Xorg server configuration file and set it
|
---|
| 466 | as the preferred mode.
|
---|
| 467 | </para>
|
---|
| 468 |
|
---|
[da4b5e0] | 469 | <para>
|
---|
| 470 | Another common setup is having multiple server layouts for use in
|
---|
| 471 | different environments. Though the server will automatically detect the
|
---|
| 472 | presence of another monitor, it may get the order incorrect:
|
---|
| 473 | </para>
|
---|
[d28b5ef] | 474 |
|
---|
[da4b5e0] | 475 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/server-layout.conf << "EOF"
|
---|
[51dfb3e] | 476 | <literal>Section "ServerLayout"
|
---|
[d28b5ef] | 477 | Identifier "DefaultLayout"
|
---|
| 478 | Screen 0 "Screen0" 0 0
|
---|
| 479 | Screen 1 "Screen1" LeftOf "Screen0"
|
---|
| 480 | Option "Xinerama"
|
---|
[51dfb3e] | 481 | EndSection</literal>
|
---|
[5c7ad04] | 482 | EOF</userinput></screen>
|
---|
| 483 |
|
---|
| 484 | <para>
|
---|
[4ada352] | 485 | When you drag a window in twm (or any non-compositing window
|
---|
| 486 | manager) horizontally, you may observe that the vertical borders
|
---|
| 487 | of the window are broken into multiple segments. This is an example
|
---|
| 488 | of the visual artifacts called <emphasis>screen tearing</emphasis>.
|
---|
| 489 | To resolve the screen tearing problems, create a configuration file
|
---|
| 490 | that enables the TearFree option. Note that you must have the
|
---|
| 491 | Tearfree patch applied from <xref role="nodep"
|
---|
| 492 | linkend="xorg-server"/> for this to function properly, and it may
|
---|
| 493 | increase memory allocation and reduce performance.
|
---|
[810935e] | 494 | </para>
|
---|
| 495 |
|
---|
[4ada352] | 496 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/20-tearfree.conf << "EOF"
|
---|
[810935e] | 497 | <literal>Section "Device"
|
---|
| 498 | Identifier "Graphics Adapter"
|
---|
| 499 | Driver "modesetting"
|
---|
| 500 | Option "TearFree" "true"
|
---|
| 501 | EndSection</literal>
|
---|
[d28b5ef] | 502 | EOF</userinput></screen>
|
---|
| 503 |
|
---|
[4ada352] | 504 | <para>
|
---|
| 505 | With modern Xorg, little or no additional graphic card configuration
|
---|
| 506 | is necessary. If you should need extra options passed to your video
|
---|
| 507 | driver, add them into the <literal>Device</literal> section as well.
|
---|
| 508 | The options supported by the modesetting driver are documented in
|
---|
| 509 | the man page <filename>modesetting(4)</filename>.
|
---|
| 510 | </para>
|
---|
| 511 |
|
---|
[da4b5e0] | 512 | </sect3>
|
---|
[d28b5ef] | 513 | </sect2>
|
---|
| 514 | </sect1>
|
---|