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 <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
50 For a RPM-based distribution do:
53 yum install llvm-devel
57 For Windows you will need to build LLVM from source with MSVC or MINGW
58 (either natively or through cross compilers) and CMake, and set the LLVM
59 environment variable to the directory you installed it to.
61 LLVM will be statically linked, so when building on MSVC it needs to be
62 built with a matching CRT as Mesa, and you'll need to pass
63 -DLLVM_USE_CRT_RELEASE=MTd for debug and checked builds,
64 -DLLVM_USE_CRT_RELEASE=MTd for profile and release builds.
66 You can build only the x86 target by passing -DLLVM_TARGETS_TO_BUILD=X86
72 <p>scons (optional)
</p>
81 To build everything on Linux invoke scons as:
84 scons build=debug libgl-xlib
87 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
93 but the rest of these instructions assume that scons is used.
95 For Windows the procedure is similar except the target:
98 scons build=debug libgl-gdi
104 On Linux, building will create a drop-in alternative for libGL.so into
107 build/foo/gallium/targets/libgl-xlib/libGL.so
114 To use it set the LD_LIBRARY_PATH environment variable accordingly.
116 For performance evaluation pass debug=no to scons, and use the corresponding
117 lib directory without the
"-debug" suffix.
119 On Windows, building will create a drop-in alternative for opengl32.dll. To use
120 it put it in the same directory as the application. It can also be used by
121 replacing the native ICD driver, but it's quite an advanced usage, so if you
122 need to ask, don't even try it.
127 To profile llvmpipe you should pass the options
130 scons build=profile
<same-as-before>
133 This will ensure that frame pointers are used both in C and JIT functions, and
134 that no tail call optimizations are done by gcc.
136 To better profile JIT code you'll need to build LLVM with oprofile integration.
140 --prefix=$install_dir \
142 --disable-profiling \
143 --enable-targets=host-only \
147 make -C
"$build_dir" install
149 find
"$install_dir/lib" -iname '*.a' -print0 | xargs -
0 strip --strip-debug
152 The you should define
155 export LLVM=/path/to/llvm-
2.6-profile
161 <h1>Unit testing
</h1>
164 Building will also create several unit tests in
165 build/linux-???-debug/gallium/drivers/llvmpipe:
169 <li> lp_test_blend: blending
170 <li> lp_test_conv: SIMD vector conversion
171 <li> lp_test_format: pixel unpacking/packing
175 Some of this tests can output results and benchmarks to a tab-separated-file
176 for posterior analysis, e.g.:
179 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
183 <h1>Development Notes
</h1>
187 When looking to this code by the first time start in lp_state_fs.c, and
188 then skim through the lp_bld_* functions called in there, and the comments
189 at the top of the lp_bld_*.c functions.
192 The driver-independent parts of the LLVM / Gallium code are found in
193 src/gallium/auxiliary/gallivm/. The filenames and function prefixes
194 need to be renamed from
"lp_bld_" to something else though.
197 We use LLVM-C bindings for now. They are not documented, but follow the C++
198 interfaces very closely, and appear to be complete enough for code
200 http://npcontemplation.blogspot.com/
2008/
06/secret-of-llvm-c-bindings.html
201 for a stand-alone example. See the llvm-c/Core.h file for reference.