mesa/src/gallium/drivers/llvmpipe
Brian Paul 06613b7b3a llvmpipe: document issue with LLVM 2.8 and earlier with AVX 2011-04-07 13:43:00 -06:00
..
.gitignore
Makefile mesa: consolidate some compiler -D flags 2010-12-03 13:52:59 -07:00
README llvmpipe: document issue with LLVM 2.8 and earlier with AVX 2011-04-07 13:43:00 -06:00
SConscript scons: Add aliases for the llvmpipe unit tests. 2011-02-19 10:56:05 +00:00
lp_bld_alpha.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_bld_alpha.h llvmpipe: Include p_compiler.h in lp_bld_alpha.h. 2011-01-04 00:50:48 -08:00
lp_bld_blend.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_bld_blend_aos.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_bld_blend_logicop.c
lp_bld_blend_soa.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_bld_depth.c llvmpipe: fix broken stencil writemask 2010-12-03 09:44:30 -07:00
lp_bld_depth.h llvmpipe: Include missing headers in lp_bld_depth.h 2011-01-04 00:54:14 -08:00
lp_bld_interp.c gallivm/llvmpipe: remove lp_build_context::builder 2010-12-02 18:11:16 -07:00
lp_bld_interp.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_clear.c llvmpipe: add LP_PERF flag to disable various aspects of rasterization 2010-09-16 17:34:19 +01:00
lp_clear.h
lp_context.c gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_context.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_debug.h llvmpipe: add DEBUG_FS to dump variant information 2010-09-16 17:34:58 +01:00
lp_draw_arrays.c gallium: Use draw_set_index_buffer and others. 2010-08-25 16:06:45 +08:00
lp_fence.c Check for out of memory when creating fence 2011-02-26 10:30:19 +00:00
lp_fence.h llvmpipe: move some fence functions into lp_screen.c 2010-08-25 10:29:27 +01:00
lp_flush.c gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_flush.h gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_jit.c llvmpipe: Remove unnecessary headers. 2010-12-22 00:55:41 -08:00
lp_jit.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_limits.h llvmpipe: use llvm for attribute interpolant calculation 2010-09-18 08:40:17 +01:00
lp_memory.c
lp_memory.h
lp_perf.c llvmpipe: more rasterization counters 2010-08-25 10:29:27 +01:00
lp_perf.h llvmpipe: Include p_compiler.h in lp_perf.h. 2011-01-04 01:01:18 -08:00
lp_public.h
lp_query.c gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_query.h llvmpipe: rework fences and queries 2010-09-07 13:22:55 +01:00
lp_rast.c gallium: support for array textures and related changes 2010-12-02 04:33:43 +01:00
lp_rast.h llvmpipe: don't store plane.ei value in binned data 2010-10-15 13:27:47 +01:00
lp_rast_debug.c llvmpipe: Initialize variable. 2010-10-19 10:14:11 -07:00
lp_rast_priv.h gallium: support for array textures and related changes 2010-12-02 04:33:43 +01:00
lp_rast_tri.c llvmpipe: use aligned loads/stores for plane values 2010-10-15 13:52:00 +01:00
lp_rast_tri_tmp.h llvmpipe: don't store plane.ei value in binned data 2010-10-15 13:27:47 +01:00
lp_scene.c llvmpipe: Plug fence leaks. 2010-12-09 16:48:26 +00:00
lp_scene.h llvmpipe: reintroduce SET_STATE binner command 2010-10-15 13:27:47 +01:00
lp_scene_queue.c
lp_scene_queue.h llvmpipe: Include p_compiler.h in lp_scene_queue.h. 2011-01-04 01:08:47 -08:00
lp_screen.c gallium: set PIPE_CAP_MIXED_COLORBUFFER_FORMATS in some drivers 2011-04-01 13:48:01 +02:00
lp_screen.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_setup.c gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_setup.h gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_setup_context.h Merge remote branch 'origin/master' into lp-setup-llvm 2010-10-17 19:09:42 -07:00
lp_setup_line.c llvmpipe: avoid generating tri_16 for tris which extend past tile bounds 2010-11-02 16:48:10 +00:00
lp_setup_point.c Merge remote branch 'origin/master' into lp-setup-llvm 2010-10-17 19:09:42 -07:00
lp_setup_tri.c llvmpipe: added some debug assertions, but disabled 2010-11-04 18:21:45 -06:00
lp_setup_vbuf.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_state.h llvmpipe: use llvm for attribute interpolant calculation 2010-09-18 08:40:17 +01:00
lp_state_blend.c llvmpipe: add LP_PERF flag to disable various aspects of rasterization 2010-09-16 17:34:19 +01:00
lp_state_clip.c
lp_state_derived.c llvmpipe: twoside for specular color also 2010-11-19 16:17:36 +00:00
lp_state_fs.c llvmpipe: implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS 2011-01-19 18:46:59 -07:00
lp_state_fs.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_state_gs.c
lp_state_rasterizer.c llvmpipe: turn off draw offset/twoside when we can handle it 2010-10-22 18:58:36 +01:00
lp_state_sampler.c draw/llvmpipe: replace DRAW_MAX_TEXTURE_LEVELS with PIPE_MAX_TEXTURE_LEVELS 2010-10-12 19:04:05 -06:00
lp_state_setup.c llvmpipe: fix warning: ‘t0’ may be used uninitialized in this function 2011-03-12 08:48:43 +01:00
lp_state_setup.h llvmpipe: twoside for specular color also 2010-11-19 16:17:36 +00:00
lp_state_so.c
lp_state_surface.c llvmpipe: added llvm offset setup code 2010-11-04 12:57:30 +00:00
lp_state_vertex.c gallium: notify drivers about possible changes in user buffer contents 2011-02-14 21:50:08 +01:00
lp_state_vs.c
lp_surface.c gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_surface.h
lp_test.h gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_test_blend.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_test_conv.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_test_format.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_test_main.c llvmpipe: Use u_math's round. 2011-02-11 11:24:54 +00:00
lp_test_printf.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_test_round.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_test_sincos.c llvmpipe: Fix build errors on x86. 2010-12-01 11:23:48 +08:00
lp_tex_sample.c gallivm/llvmpipe: squash merge of the llvm-context branch 2010-11-30 16:35:12 -07:00
lp_tex_sample.h
lp_texture.c gallium: remove flags from the flush function 2011-03-11 21:39:31 +01:00
lp_texture.h gallium: kill is_resource_referenced 2011-03-11 21:39:30 +01:00
lp_tile_image.c
lp_tile_image.h
lp_tile_shuffle_mask.py
lp_tile_soa.h
lp_tile_soa.py gallium: Avoid using __doc__ in python scripts. 2010-10-28 17:38:18 +01:00
sse_mathfun.h llvmpipe: Remove some broken MinGW hacks in the sin/cos reference code. 2010-09-05 10:40:38 +01:00

README

LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.


Requirements
============

 - A x86 or amd64 processor.  64bit mode is preferred.
 
   Support for sse2 is strongly encouraged.  Support for ssse3, and sse4.1 will
   yield the most efficient code.  The less features the CPU has the more
   likely is that you ran into underperforming, buggy, or incomplete code.  
   
   See /proc/cpuinfo to know what your CPU supports.
 
 - LLVM. Version 2.8 recommended. 2.6 or later required.

   NOTE: LLVM 2.8 and earlier will not work on systems that support the
   Intel AVX extensions (e.g. Sandybridge).  LLVM's code generator will
   fail when trying to emit AVX instructions.  This was fixed in LLVM 2.9.
 
   For Linux, on a recent Debian based distribution do:
 
     aptitude install llvm-dev

   For Windows download pre-built MSVC 9.0 or MinGW binaries from
   http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
   variable to the extracted path.

   For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
   llvm-x.x-msvc32mtd.7z .

   You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
   debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
   debug=no. This is necessary as LLVM builds as static library so the chosen
   MS CRT must match.

 - scons (optional)


Building
========

To build everything on Linux invoke scons as:

  scons build=debug libgl-xlib

Alternatively, you can build it with GNU make, if you prefer, by invoking it as

  make linux-llvm

but the rest of these instructions assume that scons is used.

For windows is everything the except except the winsys:

  scons build=debug libgl-gdi

Using
=====

On Linux, building will create a drop-in alternative for libGL.so into

  build/foo/gallium/targets/libgl-xlib/libGL.so

To use it set the LD_LIBRARY_PATH environment variable accordingly.

For performance evaluation pass debug=no to scons, and use the corresponding
lib directory without the "-debug" suffix.

On Windows, building will create a drop-in alternative for opengl32.dll. To use
it put it in the same directory as the application. It can also be used by
replacing the native ICD driver, but it's quite an advanced usage, so if you
need to ask, don't even try it.


Profiling
=========

To profile llvmpipe you should pass the options

  scons build=profile <same-as-before>

This will ensure that frame pointers are used both in C and JIT functions, and
that no tail call optimizations are done by gcc.


To better profile JIT code you'll need to build LLVM with oprofile integration.

  ./configure \
      --prefix=$install_dir \
      --enable-optimized \
      --disable-profiling \
      --enable-targets=host-only \
      --with-oprofile

  make -C "$build_dir"
  make -C "$build_dir" install

  find "$install_dir/lib" -iname '*.a' -print0 | xargs -0 strip --strip-debug

The you should define

  export LLVM=/path/to/llvm-2.6-profile

and rebuild.


Unit testing
============

Building will also create several unit tests in
build/linux-???-debug/gallium/drivers/llvmpipe:

 - lp_test_blend: blending
 - lp_test_conv: SIMD vector conversion
 - lp_test_format: pixel unpacking/packing

Some of this tests can output results and benchmarks to a tab-separated-file
for posterior analysis, e.g.:

  build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv


Development Notes
=================

- 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.  

- 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.

- 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 
  http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
  for a stand-alone example.  See the llvm-c/Core.h file for reference.