1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8">
5 <title>llvmpipe
</title>
6 <link rel=
"stylesheet" type=
"text/css" href=
"mesa.css">
13 The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
14 do runtime code generation.
15 Shaders, point/line/triangle rasterization and vertex processing are
16 implemented with LLVM IR which is translated to x86 or x86-
64 machine
18 Also, the driver is multithreaded to take advantage of multiple CPU cores
19 (up to
8 at this time).
20 It's the fastest software rasterizer for Mesa.
28 <p>An x86 or amd64 processor;
64-bit mode recommended.
</p
30 Support for SSE2 is strongly encouraged. Support for SSSE3 and SSE4.1 will
31 yield the most efficient code. The fewer features the CPU has the more
32 likely is that you run into underperforming, buggy, or incomplete code.
35 See /proc/cpuinfo to know what your CPU supports.
39 <p>LLVM: version
2.9 recommended;
2.6 or later required.
</p>
40 <p><b>NOTE
</b>: LLVM
2.8 and earlier will not work on systems that support the
41 Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will
42 fail when trying to emit AVX instructions. This was fixed in LLVM
2.9.
45 For Linux, on a recent Debian based distribution do:
48 aptitude install llvm-dev
51 For a RPM-based distribution do:
54 yum install llvm-devel
58 For Windows you will need to build LLVM from source with MSVC or MINGW
59 (either natively or through cross compilers) and CMake, and set the LLVM
60 environment variable to the directory you installed it to.
62 LLVM will be statically linked, so when building on MSVC it needs to be
63 built with a matching CRT as Mesa, and you'll need to pass
64 -DLLVM_USE_CRT_RELEASE=MTd for debug and checked builds,
65 -DLLVM_USE_CRT_RELEASE=MTd for profile and release builds.
67 You can build only the x86 target by passing -DLLVM_TARGETS_TO_BUILD=X86
73 <p>scons (optional)
</p>
82 To build everything on Linux invoke scons as:
85 scons build=debug libgl-xlib
88 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
94 but the rest of these instructions assume that scons is used.
96 For Windows the procedure is similar except the target:
99 scons build=debug libgl-gdi
105 On Linux, building will create a drop-in alternative for libGL.so into
108 build/foo/gallium/targets/libgl-xlib/libGL.so
115 To use it set the LD_LIBRARY_PATH environment variable accordingly.
117 For performance evaluation pass debug=no to scons, and use the corresponding
118 lib directory without the
"-debug" suffix.
120 On Windows, building will create a drop-in alternative for opengl32.dll. To use
121 it put it in the same directory as the application. It can also be used by
122 replacing the native ICD driver, but it's quite an advanced usage, so if you
123 need to ask, don't even try it.
128 To profile llvmpipe you should pass the options
131 scons build=profile
<same-as-before
>
134 This will ensure that frame pointers are used both in C and JIT functions, and
135 that no tail call optimizations are done by gcc.
137 To better profile JIT code you'll need to build LLVM with oprofile integration.
141 --prefix=$install_dir \
143 --disable-profiling \
144 --enable-targets=host-only \
148 make -C
"$build_dir" install
150 find
"$install_dir/lib" -iname '*.a' -print0 | xargs -
0 strip --strip-debug
153 The you should define
156 export LLVM=/path/to/llvm-
2.6-profile
162 <h1>Unit testing
</h1>
165 Building will also create several unit tests in
166 build/linux-???-debug/gallium/drivers/llvmpipe:
170 <li> lp_test_blend: blending
171 <li> lp_test_conv: SIMD vector conversion
172 <li> lp_test_format: pixel unpacking/packing
176 Some of this tests can output results and benchmarks to a tab-separated-file
177 for posterior analysis, e.g.:
180 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
184 <h1>Development Notes
</h1>
188 When looking to this code by the first time start in lp_state_fs.c, and
189 then skim through the lp_bld_* functions called in there, and the comments
190 at the top of the lp_bld_*.c functions.
193 The driver-independent parts of the LLVM / Gallium code are found in
194 src/gallium/auxiliary/gallivm/. The filenames and function prefixes
195 need to be renamed from
"lp_bld_" to something else though.
198 We use LLVM-C bindings for now. They are not documented, but follow the C++
199 interfaces very closely, and appear to be complete enough for code
201 http://npcontemplation.blogspot.com/
2008/
06/secret-of-llvm-c-bindings.html
202 for a stand-alone example. See the llvm-c/Core.h file for reference.