Clone of mesa.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

llvmpipe.html 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html lang="en">
  3. <head>
  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">
  7. </head>
  8. <body>
  9. <div class="header">
  10. <h1>The Mesa 3D Graphics Library</h1>
  11. </div>
  12. <iframe src="contents.html"></iframe>
  13. <div class="content">
  14. <h1>Introduction</h1>
  15. <p>
  16. The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
  17. do runtime code generation.
  18. Shaders, point/line/triangle rasterization and vertex processing are
  19. implemented with LLVM IR which is translated to x86 or x86-64 machine
  20. code.
  21. Also, the driver is multithreaded to take advantage of multiple CPU cores
  22. (up to 8 at this time).
  23. It's the fastest software rasterizer for Mesa.
  24. </p>
  25. <h1>Requirements</h1>
  26. <ul>
  27. <li>
  28. <p>An x86 or amd64 processor; 64-bit mode recommended.</p>
  29. <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.
  33. </p>
  34. <p>
  35. See /proc/cpuinfo to know what your CPU supports.
  36. </p>
  37. </li>
  38. <li>
  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.
  43. </p>
  44. <p>
  45. For Linux, on a recent Debian based distribution do:
  46. </p>
  47. <pre>
  48. aptitude install llvm-dev
  49. </pre>
  50. <p>
  51. For a RPM-based distribution do:
  52. </p>
  53. <pre>
  54. yum install llvm-devel
  55. </pre>
  56. <p>
  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.
  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.
  64. You can build only the x86 target by passing -DLLVM_TARGETS_TO_BUILD=X86
  65. to cmake.
  66. </p>
  67. </li>
  68. <li>
  69. <p>scons (optional)</p>
  70. </li>
  71. </ul>
  72. <h1>Building</h1>
  73. To build everything on Linux invoke scons as:
  74. <pre>
  75. scons build=debug libgl-xlib
  76. </pre>
  77. Alternatively, you can build it with GNU make, if you prefer, by invoking it as
  78. <pre>
  79. make linux-llvm
  80. </pre>
  81. but the rest of these instructions assume that scons is used.
  82. For Windows the procedure is similar except the target:
  83. <pre>
  84. scons build=debug libgl-gdi
  85. </pre>
  86. <h1>Using</h1>
  87. On Linux, building will create a drop-in alternative for libGL.so into
  88. <pre>
  89. build/foo/gallium/targets/libgl-xlib/libGL.so
  90. </pre>
  91. or
  92. <pre>
  93. lib/gallium/libGL.so
  94. </pre>
  95. To use it set the LD_LIBRARY_PATH environment variable accordingly.
  96. For performance evaluation pass debug=no to scons, and use the corresponding
  97. lib directory without the "-debug" suffix.
  98. On Windows, building will create a drop-in alternative for opengl32.dll. To use
  99. it put it in the same directory as the application. It can also be used by
  100. replacing the native ICD driver, but it's quite an advanced usage, so if you
  101. need to ask, don't even try it.
  102. <h1>Profiling</h1>
  103. <p>
  104. To profile llvmpipe you should build as
  105. </p>
  106. <pre>
  107. scons build=profile &lt;same-as-before&gt;
  108. </pre>
  109. <p>
  110. This will ensure that frame pointers are used both in C and JIT functions, and
  111. that no tail call optimizations are done by gcc.
  112. </p>
  113. <h2>Linux perf integration</h2>
  114. <p>
  115. On Linux, it is possible to have symbol resolution of JIT code with <a href="http://perf.wiki.kernel.org/">Linux perf</a>:
  116. </p>
  117. <pre>
  118. perf record -g /my/application
  119. perf report
  120. </pre>
  121. <p>
  122. When run inside Linux perf, llvmpipe will create a /tmp/perf-XXXXX.map file with
  123. symbol address table. It also dumps assembly code to /tmp/perf-XXXXX.map.asm,
  124. which can be used by the bin/perf-annotate-jit script to produce disassembly of
  125. the generated code annotated with the samples.
  126. </p>
  127. <p>You can obtain a call graph via
  128. <a href="http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#linux_perf">Gprof2Dot</a>.</p>
  129. <h1>Unit testing</h1>
  130. <p>
  131. Building will also create several unit tests in
  132. build/linux-???-debug/gallium/drivers/llvmpipe:
  133. </p>
  134. <ul>
  135. <li> lp_test_blend: blending
  136. <li> lp_test_conv: SIMD vector conversion
  137. <li> lp_test_format: pixel unpacking/packing
  138. </ul>
  139. <p>
  140. Some of this tests can output results and benchmarks to a tab-separated-file
  141. for posterior analysis, e.g.:
  142. </p>
  143. <pre>
  144. build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
  145. </pre>
  146. <h1>Development Notes</h1>
  147. <ul>
  148. <li>
  149. When looking to this code by the first time start in lp_state_fs.c, and
  150. then skim through the lp_bld_* functions called in there, and the comments
  151. at the top of the lp_bld_*.c functions.
  152. </li>
  153. <li>
  154. The driver-independent parts of the LLVM / Gallium code are found in
  155. src/gallium/auxiliary/gallivm/. The filenames and function prefixes
  156. need to be renamed from "lp_bld_" to something else though.
  157. </li>
  158. <li>
  159. We use LLVM-C bindings for now. They are not documented, but follow the C++
  160. interfaces very closely, and appear to be complete enough for code
  161. generation. See
  162. http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
  163. for a stand-alone example. See the llvm-c/Core.h file for reference.
  164. </li>
  165. </ul>
  166. </div>
  167. </body>
  168. </html>