i965/tiled_memcpy: avoid creating bswap32 if it exists as a macro (e.g. on FreeBSD)
[mesa.git] / docs / llvmpipe.html
index e4676920ede131fe943dcef3922b9ebee919dd1c..c7d0dd4652af7de20a60756e67418ceb80af7f81 100644 (file)
@@ -2,25 +2,27 @@
 <html lang="en">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
 <html lang="en">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
-  <title>llvmpipe</title>
+  <title>Gallium LLVMpipe Driver</title>
   <link rel="stylesheet" type="text/css" href="mesa.css">
 </head>
 <body>
 
 <div class="header">
   <link rel="stylesheet" type="text/css" href="mesa.css">
 </head>
 <body>
 
 <div class="header">
-  <h1>The Mesa 3D Graphics Library</h1>
+  The Mesa 3D Graphics Library
 </div>
 
 <iframe src="contents.html"></iframe>
 <div class="content">
 
 </div>
 
 <iframe src="contents.html"></iframe>
 <div class="content">
 
-<h1>Introduction</h1>
+<h1>Gallium LLVMpipe Driver</h1>
+
+<h2>Introduction</h2>
 
 <p>
 The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
 do runtime code generation.
 Shaders, point/line/triangle rasterization and vertex processing are
 
 <p>
 The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
 do runtime code generation.
 Shaders, point/line/triangle rasterization and vertex processing are
-implemented with LLVM IR which is translated to x86 or x86-64 machine
+implemented with LLVM IR which is translated to x86, x86-64, or ppc64le machine
 code.
 Also, the driver is multithreaded to take advantage of multiple CPU cores
 (up to 8 at this time).
 code.
 Also, the driver is multithreaded to take advantage of multiple CPU cores
 (up to 8 at this time).
@@ -28,28 +30,40 @@ It's the fastest software rasterizer for Mesa.
 </p>
 
 
 </p>
 
 
-<h1>Requirements</h1>
+<h2>Requirements</h2>
 
 <ul>
 <li>
 
 <ul>
 <li>
-   <p>An x86 or amd64 processor; 64-bit mode recommended.</p>
    <p>
    <p>
+   For x86 or amd64 processors, 64-bit mode is recommended.
    Support for SSE2 is strongly encouraged.  Support for SSE3 and SSE4.1 will
    yield the most efficient code.  The fewer features the CPU has the more
    Support for SSE2 is strongly encouraged.  Support for SSE3 and SSE4.1 will
    yield the most efficient code.  The fewer features the CPU has the more
-   likely is that you run into underperforming, buggy, or incomplete code.
+   likely it is that you will run into underperforming, buggy, or incomplete code.
+   </p>
+   <p>
+   For ppc64le processors, use of the Altivec feature (the Vector
+   Facility) is recommended if supported; use of the VSX feature (the
+   Vector-Scalar Facility) is recommended if supported AND Mesa is
+   built with LLVM version 4.0 or later.
    </p>
    <p>
    </p>
    <p>
-   See /proc/cpuinfo to know what your CPU supports.
+   See <code>/proc/cpuinfo</code> to know what your CPU supports.
    </p>
 </li>
 <li>
    </p>
 </li>
 <li>
-   <p>LLVM: version 3.4 recommended; 3.3 or later required.</p>
+   <p>Unless otherwise stated, LLVM version 3.4 is recommended; 3.3 or later is required.</p>
    <p>
    For Linux, on a recent Debian based distribution do:
    </p>
 <pre>
      aptitude install llvm-dev
 </pre>
    <p>
    For Linux, on a recent Debian based distribution do:
    </p>
 <pre>
      aptitude install llvm-dev
 </pre>
+   <p>
+   If you want development snapshot builds of LLVM for Debian and derived
+   distributions like Ubuntu, you can use the APT repository at <a
+   href="https://apt.llvm.org/" title="Debian Development packages for LLVM"
+   >apt.llvm.org</a>, which are maintained by Debian's LLVM maintainer.
+   </p>
    <p>
    For a RPM-based distribution do:
    </p>
    <p>
    For a RPM-based distribution do:
    </p>
@@ -59,8 +73,9 @@ It's the fastest software rasterizer for Mesa.
 
    <p>
    For Windows you will need to build LLVM from source with MSVC or MINGW
 
    <p>
    For Windows you will need to build LLVM from source with MSVC or MINGW
-   (either natively or through cross compilers) and CMake, and set the LLVM
-   environment variable to the directory you installed it to.
+   (either natively or through cross compilers) and CMake, and set the
+   <code>LLVM</code> environment variable to the directory you installed
+   it to.
 
    LLVM will be statically linked, so when building on MSVC it needs to be
    built with a matching CRT as Mesa, and you'll need to pass
 
    LLVM will be statically linked, so when building on MSVC it needs to be
    built with a matching CRT as Mesa, and you'll need to pass
@@ -89,8 +104,8 @@ It's the fastest software rasterizer for Mesa.
    </table>
 
    <p>
    </table>
 
    <p>
-   You can build only the x86 target by passing -DLLVM_TARGETS_TO_BUILD=X86
-   to cmake.
+   You can build only the x86 target by passing
+   <code>-DLLVM_TARGETS_TO_BUILD=X86</code> to cmake.
    </p>
 </li>
 
    </p>
 </li>
 
@@ -100,7 +115,7 @@ It's the fastest software rasterizer for Mesa.
 </ul>
 
 
 </ul>
 
 
-<h1>Building</h1>
+<h2>Building</h2>
 
 To build everything on Linux invoke scons as:
 
 
 To build everything on Linux invoke scons as:
 
@@ -108,10 +123,12 @@ To build everything on Linux invoke scons as:
   scons build=debug libgl-xlib
 </pre>
 
   scons build=debug libgl-xlib
 </pre>
 
-Alternatively, you can build it with autoconf/make with:
+Alternatively, you can build it with meson with:
 <pre>
 <pre>
-  ./configure --enable-glx=gallium-xlib --with-gallium-drivers=swrast --disable-dri --disable-gbm --disable-egl
-  make
+  mkdir build
+  cd build
+  meson -D glx=gallium-xlib -D gallium-drivers=swrast
+  ninja
 </pre>
 
 but the rest of these instructions assume that scons is used.
 </pre>
 
 but the rest of these instructions assume that scons is used.
@@ -123,11 +140,12 @@ For Windows the procedure is similar except the target:
 </pre>
 
 
 </pre>
 
 
-<h1>Using</h1>
+<h2>Using</h2>
 
 
-<h2>Linux</h2>
+<h3>Linux</h3>
 
 
-<p>On Linux, building will create a drop-in alternative for libGL.so into</p>
+<p>On Linux, building will create a drop-in alternative for
+<code>libGL.so</code> into</p>
 
 <pre>
   build/foo/gallium/targets/libgl-xlib/libGL.so
 
 <pre>
   build/foo/gallium/targets/libgl-xlib/libGL.so
@@ -137,13 +155,15 @@ or
   lib/gallium/libGL.so
 </pre>
 
   lib/gallium/libGL.so
 </pre>
 
-<p>To use it set the LD_LIBRARY_PATH environment variable accordingly.</p>
+<p>To use it set the <code>LD_LIBRARY_PATH</code> environment variable
+accordingly.</p>
 
 
-<p>For performance evaluation pass build=release to scons, and use the corresponding
-lib directory without the "-debug" suffix.</p>
+<p>For performance evaluation pass <code>build=release</code> to scons,
+and use the corresponding lib directory without the <code>-debug</code>
+suffix.</p>
 
 
 
 
-<h2>Windows</h2>
+<h3>Windows</h3>
 
 <p>
 On Windows, building will create
 
 <p>
 On Windows, building will create
@@ -161,7 +181,9 @@ any OpenGL drivers):
 </p>
 
 <ul>
 </p>
 
 <ul>
-  <li><p>copy build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll to C:\Windows\SysWOW64\mesadrv.dll</p></li>
+  <li><p>copy <code>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll</code>
+         to <code>C:\Windows\SysWOW64\mesadrv.dll</code>
+  </p></li>
   <li><p>load this registry settings:</p>
   <pre>REGEDIT4
 
   <li><p>load this registry settings:</p>
   <pre>REGEDIT4
 
@@ -178,7 +200,7 @@ any OpenGL drivers):
 </ul>
 
 
 </ul>
 
 
-<h1>Profiling</h1>
+<h2>Profiling</h2>
 
 <p>
 To profile llvmpipe you should build as
 
 <p>
 To profile llvmpipe you should build as
@@ -192,7 +214,7 @@ This will ensure that frame pointers are used both in C and JIT functions, and
 that no tail call optimizations are done by gcc.
 </p>
 
 that no tail call optimizations are done by gcc.
 </p>
 
-<h2>Linux perf integration</h2>
+<h3>Linux perf integration</h3>
 
 <p>
 On Linux, it is possible to have symbol resolution of JIT code with <a href="https://perf.wiki.kernel.org/">Linux perf</a>:
 
 <p>
 On Linux, it is possible to have symbol resolution of JIT code with <a href="https://perf.wiki.kernel.org/">Linux perf</a>:
@@ -204,61 +226,64 @@ On Linux, it is possible to have symbol resolution of JIT code with <a href="htt
 </pre>
 
 <p>
 </pre>
 
 <p>
-When run inside Linux perf, llvmpipe will create a /tmp/perf-XXXXX.map file with
-symbol address table.  It also dumps assembly code to /tmp/perf-XXXXX.map.asm,
-which can be used by the bin/perf-annotate-jit.py script to produce disassembly of
-the generated code annotated with the samples.
+When run inside Linux perf, llvmpipe will create a
+<code>/tmp/perf-XXXXX.map</code> file with symbol address table.  It also
+dumps assembly code to <code>/tmp/perf-XXXXX.map.asm</code>, which can be
+used by the <code>bin/perf-annotate-jit.py</code> script to produce
+disassembly of the generated code annotated with the samples.
 </p>
 
 <p>You can obtain a call graph via
 <a href="https://github.com/jrfonseca/gprof2dot#linux-perf">Gprof2Dot</a>.</p>
 
 
 </p>
 
 <p>You can obtain a call graph via
 <a href="https://github.com/jrfonseca/gprof2dot#linux-perf">Gprof2Dot</a>.</p>
 
 
-<h1>Unit testing</h1>
+<h2>Unit testing</h2>
 
 <p>
 Building will also create several unit tests in
 
 <p>
 Building will also create several unit tests in
-build/linux-???-debug/gallium/drivers/llvmpipe:
+<code>build/linux-???-debug/gallium/drivers/llvmpipe</code>:
 </p>
 
 <ul>
 </p>
 
 <ul>
-<li> lp_test_blend: blending
-<li> lp_test_conv: SIMD vector conversion
-<li> lp_test_format: pixel unpacking/packing
+<li> <code>lp_test_blend</code>: blending
+<li> <code>lp_test_conv</code>: SIMD vector conversion
+<li> <code>lp_test_format</code>: pixel unpacking/packing
 </ul>
 
 <p>
 </ul>
 
 <p>
-Some of this tests can output results and benchmarks to a tab-separated-file
-for posterior analysis, e.g.:
+Some of these tests can output results and benchmarks to a tab-separated file
+for later analysis, e.g.:
 </p>
 <pre>
   build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
 </pre>
 
 
 </p>
 <pre>
   build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
 </pre>
 
 
-<h1>Development Notes</h1>
+<h2>Development Notes</h2>
 
 <ul>
 <li>
 
 <ul>
 <li>
-  When looking to this code by the first time start in lp_state_fs.c, and 
-  then skim through the lp_bld_* functions called in there, and the comments
-  at the top of the lp_bld_*.c functions.
+  When looking at this code for the first time, start in lp_state_fs.c, and
+  then skim through the <code>lp_bld_*</code> functions called there, and
+  the comments at the top of the <code>lp_bld_*.c</code> functions.
 </li>
 <li>
   The driver-independent parts of the LLVM / Gallium code are found in
 </li>
 <li>
   The driver-independent parts of the LLVM / Gallium code are found in
-  src/gallium/auxiliary/gallivm/.  The filenames and function prefixes
-  need to be renamed from "lp_bld_" to something else though.
+  <code>src/gallium/auxiliary/gallivm/</code>.  The filenames and function
+  prefixes need to be renamed from <code>lp_bld_</code> to something else
+  though.
 </li>
 <li>
   We use LLVM-C bindings for now. They are not documented, but follow the C++
   interfaces very closely, and appear to be complete enough for code
   generation. See 
   <a href="https://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html">
 </li>
 <li>
   We use LLVM-C bindings for now. They are not documented, but follow the C++
   interfaces very closely, and appear to be complete enough for code
   generation. See 
   <a href="https://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html">
-  this stand-alone example</a>.  See the llvm-c/Core.h file for reference.
+  this stand-alone example</a>.  See the <code>llvm-c/Core.h</code> file for
+  reference.
 </li>
 </ul>
 
 </li>
 </ul>
 
-<h1 id="recommended_reading">Recommended Reading</h1>
+<h2 id="recommended_reading">Recommended Reading</h2>
 
 <ul>
   <li>
 
 <ul>
   <li>
@@ -294,7 +319,7 @@ for posterior analysis, e.g.:
       <li><a href="http://www.drdobbs.com/optimizing-pixomatic-for-modern-x86-proc/184405807">Optimizing Pixomatic For Modern x86 Processors</a></li>
       <li><a href="http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-optimization-manual.html">Intel 64 and IA-32 Architectures Optimization Reference Manual</a></li>
       <li><a href="http://www.agner.org/optimize/">Software optimization resources</a></li>
       <li><a href="http://www.drdobbs.com/optimizing-pixomatic-for-modern-x86-proc/184405807">Optimizing Pixomatic For Modern x86 Processors</a></li>
       <li><a href="http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-optimization-manual.html">Intel 64 and IA-32 Architectures Optimization Reference Manual</a></li>
       <li><a href="http://www.agner.org/optimize/">Software optimization resources</a></li>
-      <li><a href="https://software.intel.com/en-us/articles/intel-intrinsics-guide">Intel Intrinsics Guide</a><li>
+      <li><a href="https://software.intel.com/en-us/articles/intel-intrinsics-guide">Intel Intrinsics Guide</a></li>
     </ul>
   </li>
   <li>
     </ul>
   </li>
   <li>