%PDF- %PDF-
Direktori : /usr/share/doc/xorg/howto/ |
Current File : //usr/share/doc/xorg/howto/build-mesa.html |
<?xml version="1.0" encoding="UTF-8"?> <!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 10.2.0" /> <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 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="https://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>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-gles1 \ --enable-gles2 \ --enable-glx-tls \ --with-dri-driverdir=/usr/lib/dri \ --with-egl-platforms='drm x11' \ …</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. Other drivers are only available on Gallium (<code>r300</code>, <code>r600</code>, <code>radeonsi</code> and more). Running <code>./configure --help</code> might be useful.</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 --with-gallium-drivers=nouveau</code></pre> </div></div> </li> <li> <p> For <code>r300</code>, you need: </p> <div class="literalblock"> <div class="content"> <pre><code>--with-gallium-drivers=r300</code></pre> </div></div> </li> <li> <p> For <code>r600</code>, you need: </p> <div class="literalblock"> <div class="content"> <pre><code>--with-gallium-drivers=r600</code></pre> </div></div> </li> <li> <p> For <code>radeonsi</code>, you need: </p> <div class="literalblock"> <div class="content"> <pre><code>--with-gallium-drivers=radeonsi</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="literalblock"> <div class="content"> <pre><code>$ EGL_LOG_LEVEL=debug es2_info 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 2020-10-09 09:18:55 UTC </div> </div> </body> </html>