3 <TITLE>llvmpipe
</TITLE>
5 <link rel=
"stylesheet" type=
"text/css" href=
"mesa.css"></head>
12 The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
13 do runtime code generation.
14 Shaders, point/line/triangle rasterization and vertex processing are
15 implemented with LLVM IR which is translated to x86 or x86-
64 machine
17 Also, the driver is multithreaded to take advantage of multiple CPU cores
18 (up to
8 at this time).
19 It's the fastest software rasterizer for Mesa.
27 <p>An x86 or amd64 processor;
64-bit mode recommended.
</p
29 Support for SSE2 is strongly encouraged. Support for SSSE3 and SSE4.1 will
30 yield the most efficient code. The fewer features the CPU has the more
31 likely is that you run into underperforming, buggy, or incomplete code.
34 See /proc/cpuinfo to know what your CPU supports.
38 <p>LLVM: version
2.9 recommended;
2.6 or later required.
</p>
39 <b>NOTE
</b>: LLVM
2.8 and earlier will not work on systems that support the
40 Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will
41 fail when trying to emit AVX instructions. This was fixed in LLVM
2.9.
44 For Linux, on a recent Debian based distribution do:
47 aptitude install llvm-dev
49 For a RPM-based distribution do:
52 yum install llvm-devel
56 For Windows you will need to build LLVM from source with MSVC or MINGW
57 (either natively or through cross compilers) and CMake, and set the LLVM
58 environment variable to the directory you installed it to.
60 LLVM will be statically linked, so when building on MSVC it needs to be
61 built with a matching CRT as Mesa, and you'll need to pass
62 -DLLVM_USE_CRT_RELEASE=MTd for debug and checked builds,
63 -DLLVM_USE_CRT_RELEASE=MTd for profile and release builds.
65 You can build only the x86 target by passing -DLLVM_TARGETS_TO_BUILD=X86
71 <p>scons (optional)
</p>
80 To build everything on Linux invoke scons as:
83 scons build=debug libgl-xlib
86 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
92 but the rest of these instructions assume that scons is used.
94 For Windows the procedure is similar except the target:
97 scons build=debug libgl-gdi
103 On Linux, building will create a drop-in alternative for libGL.so into
106 build/foo/gallium/targets/libgl-xlib/libGL.so
113 To use it set the LD_LIBRARY_PATH environment variable accordingly.
115 For performance evaluation pass debug=no to scons, and use the corresponding
116 lib directory without the
"-debug" suffix.
118 On Windows, building will create a drop-in alternative for opengl32.dll. To use
119 it put it in the same directory as the application. It can also be used by
120 replacing the native ICD driver, but it's quite an advanced usage, so if you
121 need to ask, don't even try it.
126 To profile llvmpipe you should pass the options
129 scons build=profile
<same-as-before>
132 This will ensure that frame pointers are used both in C and JIT functions, and
133 that no tail call optimizations are done by gcc.
135 To better profile JIT code you'll need to build LLVM with oprofile integration.
139 --prefix=$install_dir \
141 --disable-profiling \
142 --enable-targets=host-only \
146 make -C
"$build_dir" install
148 find
"$install_dir/lib" -iname '*.a' -print0 | xargs -
0 strip --strip-debug
151 The you should define
154 export LLVM=/path/to/llvm-
2.6-profile
160 <h1>Unit testing
</h1>
163 Building will also create several unit tests in
164 build/linux-???-debug/gallium/drivers/llvmpipe:
168 <li> lp_test_blend: blending
169 <li> lp_test_conv: SIMD vector conversion
170 <li> lp_test_format: pixel unpacking/packing
174 Some of this tests can output results and benchmarks to a tab-separated-file
175 for posterior analysis, e.g.:
178 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
182 <h1>Development Notes
</h1>
186 When looking to this code by the first time start in lp_state_fs.c, and
187 then skim through the lp_bld_* functions called in there, and the comments
188 at the top of the lp_bld_*.c functions.
191 The driver-independent parts of the LLVM / Gallium code are found in
192 src/gallium/auxiliary/gallivm/. The filenames and function prefixes
193 need to be renamed from
"lp_bld_" to something else though.
196 We use LLVM-C bindings for now. They are not documented, but follow the C++
197 interfaces very closely, and appear to be complete enough for code
199 http://npcontemplation.blogspot.com/
2008/
06/secret-of-llvm-c-bindings.html
200 for a stand-alone example. See the llvm-c/Core.h file for reference.