source: x/installing/xorg-config.xml@ d769233

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since d769233 was d769233, checked in by Ken Moffat <ken@…>, 8 years ago

Some rewording around the end of Xft Font Protocol: in particular stop recommending the Unicode Font Guide (unmaintained, outdated) and note that noto-fonts are almost complete. Also mention unzip here.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@17643 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 17.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="xorg-config">
9 <?dbhtml filename="xorg-config.html"?>
10
11 <sect1info>
12 <othername>$LastChangedBy$</othername>
13 <date>$Date$</date>
14 </sect1info>
15
16 <title>Xorg-&xorg-version; Testing and Configuration</title>
17
18 <indexterm zone="xorg-config">
19 <primary sortas="g-configuring-xorg">Configuring Xorg</primary>
20 </indexterm>
21
22 <sect2 id='X11-testing' xreflabel="Testing Xorg">
23 <title>Testing Xorg</title>
24
25 <note><para>Before starting Xorg for the first time, is is useful to
26 rebuild the library cache by running <userinput>ldconfig</userinput>
27 as the <systemitem class="username">root</systemitem> user.</para></note>
28
29 <para>To test the <application>Xorg</application> installation, issue
30 <userinput>startx</userinput>. This command brings up a rudimentary window
31 manager called <emphasis>twm</emphasis> with three xterm windows and one
32 xclock window. The xterm window in the upper left is a login terminal and
33 running <emphasis>exit</emphasis> from this terminal will exit the
34 <application>X Window</application> session. The third xterm window may be
35 obscured on your system by the other two xterms.</para>
36
37 <para>Generally, there is no specific configuration required for
38 <application>Xorg</application>, but customization is possible. For details
39 see <xref linkend='xconfig'/> below.</para>
40
41 </sect2>
42
43 <sect2 role="configuration" id="checking-dri" xreflabel="Checking the DRI installation">
44 <title>Checking the Direct Rendering Infrastructure (DRI) Installation</title>
45
46 <para>
47 DRI is a framework for allowing software to access graphics hardware in a safe and
48 efficient manner. It is installed in <application>X</application> by default
49 (using <application>Mesa</application>) if you have a supported video card.
50 </para>
51
52 <para>
53 To check if DRI drivers are installed properly, check the log file
54 <filename>/var/log/Xorg.0.log</filename> for statements such as:
55 </para>
56
57<screen><literal>(II) intel(0): direct rendering: DRI2 Enabled</literal></screen>
58
59 <para>or</para>
60
61<screen><literal>(II) NOUVEAU(0): Loaded DRI module</literal></screen>
62
63 <note>
64 <para>
65 DRI configuration may differ if you are using alternate drivers, such
66 as those from
67 <ulink url="http://www.nvidia.com/page/home.html">NVIDIA</ulink> or
68 <ulink url="http://www.ati.com/">ATI</ulink>.
69 </para>
70 </note>
71
72 <para>
73 Although all users can use software acceleration, any hardware acceleration (DRI2)
74 is only available to <systemitem class="username">root</systemitem> and members
75 of the <systemitem class="groupname">video</systemitem> group.
76 </para>
77<!--
78 <para>
79 To see if hardware acceleration is available for your driver, look in
80 <filename>/var/log/Xorg.0.log</filename> for statements like:
81 </para>
82
83<screen><literal>(II) intel(0): direct rendering: DRI2 Enabled</literal></screen>
84-->
85 <para>
86 If your driver is supported, add any users that might use X to that group:
87 </para>
88
89<screen role="root"><userinput>usermod -a -G video <replaceable>&lt;username&gt;</replaceable></userinput></screen>
90
91 <para>
92 Another way to determine if DRI is working properly is to use one of the
93 two optionally installed OpenGL demo programs in <xref
94 linkend="mesa"/>. From an X terminal, run <command>glxinfo</command>
95 and look for the phrase:
96 </para>
97
98<screen><computeroutput>name of display: :0
99display: :0 screen: 0
100direct rendering: Yes</computeroutput></screen>
101
102 <para>
103 If direct rendering is enabled, you can add verbosity by running
104 <command>LIBGL_DEBUG=verbose glxinfo</command>. This will show the drivers,
105 device nodes and files used by the DRI system.
106 </para>
107
108 <para>
109 To confirm that DRI2 hardware acceleration is working, you can (still in
110 the X terminal) run the command <command>glxinfo | egrep "(OpenGL
111 vendor|OpenGL renderer|OpenGL version)"</command>.
112 If that reports something <emphasis>other than</emphasis>
113 <literal>Software Rasterizer</literal> then you have working
114 acceleration for the user who ran the command.
115 </para>
116
117 <para>
118 If your hardware does not have any DRI2 driver available, it will use a
119 Software Rasterizer for Direct Rendering. In such cases, you can use a new,
120 LLVM-accelerated, Software Rasterizer called LLVMPipe. In order to build
121 LLVMPipe just make sure that <xref linkend="llvm"/> is present at Mesa
122 build time. Note that all decoding is done on the CPU instead of the GPU,
123 so the display will run slower than with hardware acceleration.
124 To check if you are using LLVMpipe,
125 review the output ot the glxinfo command above. An example of the
126 output using the Software Rasterizer is shown below:
127 </para>
128
129<screen><computeroutput>OpenGL vendor string: VMware, Inc.
130OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits)
131OpenGL version string: 3.0 Mesa 10.4.5</computeroutput></screen>
132
133 <para>
134 You can also force LLVMPipe by exporting the <envar>LIBGL_ALWAYS_SOFTWARE=1</envar>
135 environment variable when starting Xorg.
136 </para>
137
138 <para>
139 Again, if you have built the Mesa OpenGL demos, you can also run the test
140 program <command>glxgears</command>. This program brings up a window with
141 three gears turning. The X terminal will display how many frames were
142 drawn every five seconds, so this will give a rough benchmark. The window
143 is scalable, and the frames drawn per second is highly dependent on the
144 size of the window. On some hardware, <command>glxgears</command> will
145 run synchronized with the vertical refresh signal and the frame rate will
146 be approximately the same as the monitor refresh rate.
147 </para>
148
149 </sect2>
150
151 <sect2 role="configuration" id="hybrid-graphics" xreflabel="Hybrid Graphics">
152 <title>Hybrid Graphics</title>
153
154 <para>
155 Hybrid Graphics is still in experimental state for Linux. Xorg Developers have
156 developed a technology called PRIME that can be used for switching between
157 integrated and muxless discrete GPU at will. Automatic switching is not
158 possible at the moment.
159 </para>
160
161 <para>
162 In order to use PRIME for GPU switching, make sure that you are using Linux
163 Kernel 3.4 or later (recommended). You will need latest DRI and DDX drivers
164 for your hardware and <application>Xorg Server</application> 1.13 or later
165 with an optional patch applied.
166 </para>
167
168 <para>
169 <application>Xorg Server</application> should load both GPU drivers automaticaly.
170 In order to run a GLX application on a discrete GPU, you will need to export
171 the <envar>DRI_PRIME=1</envar> environment variable. For example,
172
173<screen><userinput>DRI_PRIME=1 glxinfo | egrep "(OpenGL vendor|OpenGL renderer|OpenGL version)"</userinput></screen>
174
175 will show OpenGL vendor, renderer and version for the discrete GPU.
176 </para>
177
178 <para>
179 If the last command reports same OpenGL renderer with and without
180 <envar>DRI_PRIME=1</envar>, you will need to check your installation.
181 </para>
182
183 </sect2>
184
185 <sect2 role="configuration" id="xft-font-protocol" xreflabel="Xft Font Protocol">
186 <title>Xft Font Protocol</title>
187
188 <indexterm zone="xft-font-protocol" id="fonts">
189 <primary sortas="g-truetype">TrueType Fonts</primary>
190 </indexterm>
191
192 <para>Xft provides antialiased font rendering through
193 <application>Freetype</application>, and fonts are controlled from the
194 client side using <application>Fontconfig</application>. The default
195 search path is <filename class="directory">/usr/share/fonts</filename>
196 and <filename class="directory">~/.fonts</filename>.
197 <application>Fontconfig</application> searches directories in its
198 path recursively and maintains a cache of the font characteristics in
199 <filename>fonts.cache-1</filename> files in each directory. If the cache
200 appears to be out of date, it is ignored, and information is (slowly)
201 fetched from the fonts themselves. This cache
202 can be regenerated using the <command>fc-cache</command> command at any
203 time. You can see the list of fonts known by
204 <application>Fontconfig</application> by running the command
205 <command>fc-list</command>.</para>
206
207 <para>If you've installed <application>Xorg</application> in any prefix
208 other than <filename class="directory">/usr</filename>, the
209 <application>X</application> fonts were not installed in a
210 location known to <application>Fontconfig</application>. This prevents
211 <application>Fontconfig</application> from using the poorly rendered
212 Type 1 fonts or the non-scalable bitmapped fonts. Symlinks were created
213 from the <filename class="directory">OTF</filename> and <filename
214 class="directory">TTF</filename> <application>X</application> font
215 directories to <filename
216 class="directory">/usr/share/fonts/X11-{OTF,TTF}</filename>. This allows
217 <application>Fontconfig</application> to use the OpenType and TrueType
218 fonts provided by <application>X</application> (which are scalable and
219 of higher quality).</para>
220
221 <para><application>Fontconfig</application> uses names such as
222 "Monospace 12" to define fonts. Applications generally use generic font
223 names such as "Monospace", "Sans" and "Serif".
224 <application>Fontconfig</application> resolves these names to a font that
225 has all characters that cover the orthography of the language indicated
226 by the locale settings. Knowledge of these font names is included in
227 <filename>/etc/fonts/fonts.conf</filename>. Fonts that are not listed
228 in this file are still usable by <application>Fontconfig</application>,
229 but they will not be accessible by the generic family names.</para>
230
231 <para>Standard scalable fonts that come with <application>X</application>
232 provide very poor Unicode coverage. You may notice in applications that
233 use <application>Xft</application> that some characters appear as a box
234 with four binary digits inside. In this case, a font set with the
235 available glyphs has not been found. Other times, applications that
236 don't use other font families by default and don't accept substitutions
237 from <application>Fontconfig</application> will display blank lines when
238 the default font doesn't cover the orthography of the user's language.
239 This happens, e.g., with <application>Fluxbox</application> in the
240 ru_RU.KOI8-R locale.</para>
241
242 <para>In order to provide greater Unicode coverage, it is recommended
243 that you install these fonts:</para>
244
245 <itemizedlist>
246 <listitem>
247 <para><ulink url="http://dejavu.sourceforge.net/">DejaVu fonts</ulink>
248 - These fonts are replacements for the Bitstream Vera fonts and
249 provide Latin-based scripts with accents and Cyrillic glyphs.</para>
250 </listitem>
251 <listitem>
252 <para><ulink
253 url="http://download.savannah.nongnu.org/releases/freefont/">FreeFont</ulink>
254 - This set of fonts covers nearly every non-CJK character, but is not
255 visually pleasing. <application>Fontconfig</application> will use it
256 as a last resort to substitute generic font family names.</para>
257 </listitem>
258 <listitem>
259 <para><ulink
260 url="http://corefonts.sourceforge.net/">Microsoft Core fonts</ulink>
261 - These fonts provide slightly worse Unicode coverage than FreeFont,
262 but are better hinted. Be sure to read the license before using
263 them. These fonts are listed in the aliases in the
264 <filename class="directory">/etc/fonts/conf.d</filename> directory
265 by default.</para>
266 </listitem>
267 <listitem>
268 <para><ulink
269 url="http://ftp.osuosl.org/pub/blfs/conglomeration/Xorg//fireflysung-1.3.0.tar.gz">Firefly New Sung font</ulink>
270 - This font ('AR PL New Sung') provides Chinese coverage and is
271 listed in the aliases in the
272 the <filename class="directory">/etc/fonts/conf.d</filename>
273 directory by default.</para>
274 </listitem>
275 <listitem>
276 <para><ulink
277 url="http://packages.debian.org/sid/fonts-arphic-ukai">UKai fonts</ulink>
278 and <ulink
279 url="http://packages.debian.org/sid/fonts-arphic-uming">UMing fonts</ulink>
280 - Newer sets (ttc) of Chinese fonts similarto the Firefly New Sung font,
281 containing variations of Simplified and Traditional. The Ming style is
282 similar to Sung (or Song), Kai is a slightly different style but still
283 looks to people used to the latin alphabets like a Serif font.
284 </para>
285 </listitem>
286 <listitem>
287 <para><ulink
288 url="http://sourceforge.jp/projects/efont/">Kochi fonts</ulink> -
289 These provide Japanese characters, and are listed in the aliases
290 in the <filename class="directory">/etc/fonts/conf.d</filename>
291 directory by default.</para>
292 </listitem>
293 <listitem>
294 <para><ulink
295 url="http://kldp.net/projects/baekmuk/">Baekmuk fonts</ulink>
296 - These fonts provide Korean coverage, and some are listed
297 <!-- Batang, Dotum in 40-nonlatin, 65-nonlatin adds Gulim -->
298 in the aliases in the
299 <filename class="directory">/etc/fonts/conf.d</filename> directory
300 by default.</para>
301 </listitem>
302 <listitem>
303 <para><ulink
304 url="&gnome-download-http;/cantarell-fonts/0.0/">Cantarell fonts</ulink>
305 - The Cantarell typeface family provides a contemporary Humanist sans
306 serif. It is particularly optimised for legibility at small sizes and is
307 the preferred font family for the <application>GNOME-3</application> user
308 interface.</para>
309 </listitem>
310 </itemizedlist>
311
312 <para>The list above will not provide complete Unicode coverage.
313 Unicode is updated every year, and most additions are now for historic
314 writing systems. For almost-complete coverage you can install <xref
315 linkend="noto-fonts"/> (about 180 fonts when last checked) but that
316 number of fonts makes it <emphasis>much</emphasis> less convenient to
317 select a specific font in a document, and most people will regard many
318 of them as a waste of space. We used to recommend the <ulink
319 url="http://unifont.org/fontguide/">Unicode Font Guide</ulink>, but that
320 has not been updated since 2008 and many of its links are dead.</para>
321
322 <para>Rendered examples of most of the above fonts, and many others,
323 can be found at this
324 <ulink url="http://zarniwhoop.uk/ttf-otf-notes.html#examples">
325 font analysis</ulink> page.</para>
326
327 <para>As a font installation example, consider the installation of the
328 DejaVu fonts. From the unpacked source directory, run the following
329 commands as the <systemitem class="username">root</systemitem> user:</para>
330
331<screen role="root"><userinput>install -v -d -m755 /usr/share/fonts/dejavu &amp;&amp;
332install -v -m644 *.ttf /usr/share/fonts/dejavu &amp;&amp;
333fc-cache -v /usr/share/fonts/dejavu</userinput></screen>
334
335 <para>Fonts are often supplied in zip files, requiring <xref linkend="unzip"/>
336 to list and extract them, but even if the current release is a tarball
337 you should still check to see if it will create a directory.</para>
338
339 </sect2>
340
341 <sect2 role="configuration" id='xconfig'>
342 <title>Setting up Xorg Devices</title>
343
344 <para>For most hardware configurations, modern Xorg will automatically
345 get the server configuration correct without any user intervention. There
346 are, however, some cases where auto-configuration will be incorrect.
347 Following are some example manual configuration items that may be of use in
348 these instances.</para>
349
350 <sect3 id="xinput">
351 <title>Setting up X Input Devices</title>
352 <para>For most input devices, no additional configuration will be
353 necessary. This section is provided for informational purposes only.</para>
354
355 <para>A sample default XKB setup could look like the following (executed as
356 the <systemitem class="username">root</systemitem> user):</para>
357
358<screen><userinput role="username">cat &gt; /etc/X11/xorg.conf.d/xkb-defaults.conf &lt;&lt; "EOF"
359Section "InputClass"
360 Identifier "XKB Defaults"
361 MatchIsKeyboard "yes"
362 Option "XkbOptions" "terminate:ctrl_alt_bksp"
363EndSection
364EOF</userinput></screen>
365
366 </sect3>
367
368 <sect3 id="xdisplay">
369 <title>Fine Tuning Display Settings</title>
370
371 <para>Again, with modern Xorg, little or no additional configuration is
372 necessary. If you should need extra options passed to your video driver,
373 for instance, you could use something like the following (again, executed as
374 the <systemitem class="username">root</systemitem> user):</para>
375
376<screen><userinput role="root">cat &gt; /etc/X11/xorg.conf.d/videocard-0.conf &lt;&lt; "EOF"
377Section "Device"
378 Identifier "Videocard0"
379 Driver "radeon"
380 VendorName "Videocard vendor"
381 BoardName "ATI Radeon 7500"
382 Option "NoAccel" "true"
383EndSection
384EOF</userinput></screen>
385
386 <para>Another common setup is having multiple server layouts for use in
387 different environments. Though the server will automatically detect the
388 presence of another monitor, it may get the order incorrect:</para>
389
390<screen><userinput role="root">cat &gt; /etc/X11/xorg.conf.d/server-layout.conf &lt;&lt; "EOF"
391Section "ServerLayout"
392 Identifier "DefaultLayout"
393 Screen 0 "Screen0" 0 0
394 Screen 1 "Screen1" LeftOf "Screen0"
395 Option "Xinerama"
396EndSection
397EOF</userinput></screen>
398
399 </sect3>
400 </sect2>
401</sect1>
Note: See TracBrowser for help on using the repository browser.