/usr/share/doc/xorg/howto/build-mesa.html is in xserver-xorg 1:7.7+7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<title>How to build mesa</title>
<link rel="stylesheet" href="../xsf.css" type="text/css" />
<script type="text/javascript" src="../asciidoc-xhtml11.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install(2);
/*]]>*/
</script>
</head>
<body class="article">
<div id="header">
<h1><a href="../index.html">XSF</a> / How to build mesa</h1>
<span id="author">Cyril Brulebois</span><br />
<span id="email"><code><<a href="mailto:kibi@debian.org">kibi@debian.org</a>></code></span><br />
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="_foreword">Foreword</h2>
<div class="sectionbody">
<div class="paragraph"><p>Mesa is a special package since many flavours are built, which means
it takes quite some time to get all packages ready, as well as some
disc space (over 2GB for the <code>build/</code> directory alone).</p></div>
<div class="paragraph"><p>Also, trying to figure out whether latest <code>master</code> is also affected,
or backporting some bug fixes might lead to some painful I/O while
generating the <code>.deb</code> files, and then installing/unpacking them. This
is why this document was written: Helping users test other mesa
releases, branches, bug fixes without having to build full packages,
and without having to mess with their systems (<em>i.e.</em> no root access
is needed once the build dependencies are installed).</p></div>
<div class="paragraph"><p>We’ll focus on the DRI (Direct Rendering Infrastructure) flavour
(<code>libgl1-mesa-dri</code>), which is the most common.</p></div>
<div class="paragraph"><p>It might be possible to adapt the following steps to another flavour,
in which case the appropriate options to be passed to <code>./configure</code>
should be looked up in the <code>debian/rules</code> file of the Debian source
package.</p></div>
<div class="sidebarblock">
<div class="content">
<div class="paragraph"><div class="title">Note</div><p>Before reading further, be aware that <code>nouveau</code> is a bit special:</p></div>
<div class="ulist"><ul>
<li>
<p>
It’s considered experimental, and shipped in the
<code>libgl1-mesa-dri-experimental</code> package accordingly.
</p>
</li>
<li>
<p>
It may fail to build (both API and ABI are still changing).
</p>
</li>
</ul></div>
</div></div>
<div style="page-break-after:always"></div>
</div>
</div>
<div class="sect1">
<h2 id="_gathering_information">Gathering information</h2>
<div class="sectionbody">
<div class="paragraph"><p>Get started by installing <code>mesa-utils</code>, which contains <code>glxinfo</code>.</p></div>
<div class="ulist"><ul>
<li>
<p>
<em>Is direct rendering enabled?</em>
</p>
<div class="literalblock">
<div class="content">
<pre><code>$ glxinfo | grep ^direct
direct rendering: Yes</code></pre>
</div></div>
<div class="paragraph"><p>↪ Yes.</p></div>
</li>
<li>
<p>
<em>Is this the classic or <a href="http://en.wikipedia.org/wiki/Gallium3D">Gallium</a> driver?</em>
</p>
<div class="literalblock">
<div class="content">
<pre><code>$ glxinfo | grep 'renderer string'
OpenGL renderer string: Mesa DRI Intel(R) 945GM GEM 20100330 DEVELOPMENT</code></pre>
</div></div>
<div class="paragraph"><p>↪ No “Gallium” here, therefore: “classic”.</p></div>
</li>
<li>
<p>
<em>Which driver is this, and where is it located?</em>
</p>
<div class="literalblock">
<div class="content">
<pre><code>$ LIBGL_DEBUG=verbose glxinfo 2>&1 >/dev/null | grep so$
libGL: OpenDriver: trying /usr/lib/dri/tls/i915_dri.so
libGL: OpenDriver: trying /usr/lib/dri/i915_dri.so</code></pre>
</div></div>
<div class="paragraph"><p>↪ <code>i915</code>, from the system directory: <code>/usr/lib/dri</code> (likely installed through a Debian package).</p></div>
</li>
<li>
<p>
<em>How can I get more debugging information?</em>
</p>
<div class="literalblock">
<div class="content">
<pre><code>export LIBGL_DEBUG=verbose
export MESA_DEBUG=1
export EGL_LOG_LEVEL=debug</code></pre>
</div></div>
</li>
</ul></div>
<div style="page-break-after:always"></div>
</div>
</div>
<div class="sect1">
<h2 id="_preparing_mesa_sources">Preparing mesa sources</h2>
<div class="sectionbody">
<div class="paragraph"><p>To get started, installing all build dependencies of the <code>mesa</code> source
package should be sufficient, along with the essential build tools,
and <code>git</code>:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>$ sudo apt-get install build-essential git
$ sudo apt-get build-dep mesa</code></pre>
</div></div>
<div class="paragraph"><p>If you’re on <code>squeeze</code> you may need to install a few more packages:
newer <code>libdrm-dev</code> (it is available in <code>squeeze-backports</code>),
as well as <code>libxmu-dev</code>, <code>libxi-dev</code>.</p></div>
<div class="paragraph"><p>Make sure you have some disc space available, since the git repository
is over 120MB, and since the mesa directory is over 500MB after a
build. Once you’re ready, grab the upstream mesa sources:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>$ git clone git://anongit.freedesktop.org/mesa/mesa mesa.git
$ cd mesa.git
$ autoreconf -vfi</code></pre>
</div></div>
<div class="paragraph"><p>Here’s what the <code>./configure</code> call will look like:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>$ ./configure --prefix=/usr \
--enable-driglx-direct \
--enable-gallium \
--enable-gles-overlay \
--enable-gles1 \
--enable-gles2 \
--enable-glx-tls \
--with-driver=dri \
--with-dri-driverdir=/usr/lib/dri \
--with-egl-platforms='drm x11' \
--with-state-trackers=egl,glx,dri,vega \
…</code></pre>
</div></div>
<div class="paragraph"><p>Now, what are the parameters to replace “<code>…</code>” with? Basically, if
you determined an Intel driver (<code>i915</code> or <code>i965</code>), you want to use the
classic drivers and to disable the Gallium drivers. If you saw a
Radeon driver (<code>r300</code> or <code>r600</code>), you should prefer the Gallium
drivers. If you’re using <code>nouveau</code>, make sure you read the note in the
<em>Foreword</em>. The following assumes you’re using <code>nouveau_dri.so</code>.</p></div>
<div class="paragraph"><p>Examples for common drivers:</p></div>
<div class="ulist"><ul>
<li>
<p>
For <code>i915</code>, you need:
</p>
<div class="literalblock">
<div class="content">
<pre><code>--with-dri-drivers=i915</code></pre>
</div></div>
</li>
<li>
<p>
For <code>i965</code>, you need:
</p>
<div class="literalblock">
<div class="content">
<pre><code>--with-dri-drivers=i965</code></pre>
</div></div>
</li>
<li>
<p>
For <code>nouveau</code>, you may want to try:
</p>
<div class="literalblock">
<div class="content">
<pre><code>--with-dri-drivers=nouveau --enable-gallium-nouveau</code></pre>
</div></div>
</li>
<li>
<p>
For <code>r300</code> (the options are named <code>radeon</code>), you need:
</p>
<div class="literalblock">
<div class="content">
<pre><code>--with-dri-drivers=radeon --enable-gallium-radeon</code></pre>
</div></div>
</li>
<li>
<p>
For <code>r600</code>, you need:
</p>
<div class="literalblock">
<div class="content">
<pre><code>--with-dri-drivers=r600 --enable-gallium-r600</code></pre>
</div></div>
</li>
</ul></div>
<div class="paragraph"><p>Now, once you’ve run <code>./configure</code>, time for your favorite beverage:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>$ make</code></pre>
</div></div>
<div style="page-break-after:always"></div>
</div>
</div>
<div class="sect1">
<h2 id="_running_the_newly_built_mesa_libraries">Running the newly-built mesa libraries</h2>
<div class="sectionbody">
<div class="paragraph"><p>Shared libraries end up in the <code>lib/</code> directory. It contains the
classic drivers, while Gallium drivers end up under <code>lib/gallium</code>. If
you’re not an Intel user, overwrite the classic drivers with the
Gallium ones:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>$ mv lib/gallium/* lib/</code></pre>
</div></div>
<div class="paragraph"><p>Now, 3 variables need to be set, so that the locally-built libraries
are used.</p></div>
<div class="ulist"><ul>
<li>
<p>
To begin with, libGL itself and its drivers:
</p>
<div class="literalblock">
<div class="content">
<pre><code>$ export LIBGL_DRIVERS_PATH=lib</code></pre>
</div></div>
<div class="paragraph"><p><em>Did this work?</em></p></div>
<div class="literalblock">
<div class="content">
<pre><code>$ LIBGL_DEBUG=verbose glxinfo 2>&1 >/dev/null | grep so$
libGL: OpenDriver: trying lib/tls/i915_dri.so
libGL: OpenDriver: trying lib/i915_dri.so</code></pre>
</div></div>
<div class="paragraph"><p>↪ Yes: No system directory, paths are relative to <code>lib/</code>.</p></div>
</li>
<li>
<p>
Set <code>LD_LIBRARY_PATH</code> to make sure the locally-built libraries
(including those pulled through library dependencies) are used,
instead of system ones:
</p>
<div class="literalblock">
<div class="content">
<pre><code>$ export LD_LIBRARY_PATH=lib</code></pre>
</div></div>
<div class="paragraph"><p><em>Did this work?</em></p></div>
<div class="literalblock">
<div class="content">
<pre><code>$ ldd lib/libGLESv2.so | grep glapi
libglapi.so.0 => lib/libglapi.so.0 (0x00007fee3192e000)</code></pre>
</div></div>
<div class="paragraph"><p>↪ Yes: Path is relative to <code>lib</code>.</p></div>
</li>
<li>
<p>
Set the EGL search path:
</p>
<div class="literalblock">
<div class="content">
<pre><code>$ export EGL_DRIVERS_PATH=lib/egl</code></pre>
</div></div>
<div class="paragraph"><p><em>Did this work?</em></p></div>
<div class="paragraph"><p><strong>FIXME: We should be shipping EGL-aware applications through <code>mesa-utils</code>.</strong></p></div>
<div class="literalblock">
<div class="content">
<pre><code>$ EGL_LOG_LEVEL=debug test_application 2>&1 >/dev/null | grep '\.so'
libEGL debug: added lib/egl/egl_gallium.so to module array
libEGL debug: dlopen(lib/egl/egl_gallium.so)
libEGL debug: DRI2: dlopen(lib/i915_dri.so)</code></pre>
</div></div>
<div class="paragraph"><p>↪ Yes: No system directory, paths are relative to <code>lib/</code>.</p></div>
</li>
</ul></div>
<h3 id="_the_end" class="float">The end.</h3>
<div class="paragraph"><p>Now you should be ready to test upstream’s suggestions!</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2013-09-25 23:24:29 UTC
</div>
</div>
</body>
</html>
|