Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 1 | <HTML> |
| 2 | |
| 3 | <TITLE>Cell Driver</TITLE> |
| 4 | |
| 5 | <link rel="stylesheet" type="text/css" href="mesa.css"></head> |
| 6 | |
| 7 | <BODY> |
| 8 | |
Brian Paul | 2c0ce92 | 2009-01-08 16:15:31 -0700 | [diff] [blame] | 9 | <H1>Mesa/Gallium Cell Driver</H1> |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 10 | |
| 11 | <p> |
| 12 | The Mesa |
| 13 | <a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a> |
| 14 | driver is part of the |
Brian Paul | 8c6e81f | 2009-07-17 09:40:28 -0600 | [diff] [blame] | 15 | <a href="http://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a> |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 16 | architecture. |
Brian Paul | f6b71d0 | 2009-04-07 18:26:08 -0600 | [diff] [blame] | 17 | Tungsten Graphics did the original implementation of the Cell driver. |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 18 | </p> |
| 19 | |
| 20 | |
| 21 | <H2>Source Code</H2> |
| 22 | |
| 23 | <p> |
Brian Paul | 9c101c4 | 2009-02-10 16:56:58 -0700 | [diff] [blame] | 24 | The latest Cell driver source code is on the master branch of the Mesa |
| 25 | git repository. |
Brian | 99a1260 | 2008-02-28 09:48:26 -0700 | [diff] [blame] | 26 | </p> |
Brian | 99a1260 | 2008-02-28 09:48:26 -0700 | [diff] [blame] | 27 | <p> |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 28 | To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0). |
| 29 | To use the driver you'll need a Cell system, such as a PS3 running Linux, |
| 30 | or the Cell Simulator (untested, though). |
| 31 | </p> |
| 32 | |
| 33 | <p> |
Brian Paul | 2c0ce92 | 2009-01-08 16:15:31 -0700 | [diff] [blame] | 34 | If using Cell SDK 2.1, see the configs/linux-cell file for some |
| 35 | special changes. |
Brian | cabcee9 | 2008-02-27 18:01:37 -0700 | [diff] [blame] | 36 | </p> |
| 37 | |
| 38 | <p> |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 39 | To compile the code, run <code>make linux-cell</code>. |
Brian Paul | 36c1e75 | 2009-02-10 19:36:52 -0700 | [diff] [blame] | 40 | Or to build in debug mode, run <code>make linux-cell-debug</code>. |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 41 | </p> |
| 42 | |
| 43 | <p> |
Brian Paul | 36c1e75 | 2009-02-10 19:36:52 -0700 | [diff] [blame] | 44 | To use the library, make sure your current directory is the top of the |
| 45 | Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this: |
| 46 | <pre> |
| 47 | export LD_LIBRARY_PATH=$PWD/lib/gallium:$PWD/lib/ |
| 48 | </pre> |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 49 | |
| 50 | <p> |
Brian Paul | 36c1e75 | 2009-02-10 19:36:52 -0700 | [diff] [blame] | 51 | Verify that the Cell driver is being used by running |
| 52 | <code>progs/xdemos/glxinfo</code> and looking for: |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 53 | <pre> |
Brian Paul | 9f78464 | 2009-04-07 18:26:45 -0600 | [diff] [blame] | 54 | OpenGL renderer string: Gallium 0.3, Cell on Xlib |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 55 | </pre> |
| 56 | |
| 57 | |
Brian | cef71f5 | 2008-02-27 18:13:21 -0700 | [diff] [blame] | 58 | <H2>Driver Implementation Summary</H2> |
| 59 | |
| 60 | <p> |
| 61 | Rasterization is parallelized across the SPUs in a tiled-based manner. |
| 62 | Batches of transformed triangles are sent to the SPUs (actually, pulled by from |
| 63 | main memory by the SPUs). |
| 64 | Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles |
| 65 | into each tile. |
| 66 | Because of the limited SPU memory, framebuffer tiles are paged in/out of |
| 67 | SPU local store as needed. |
| 68 | Similarly, textures are tiled and brought into local store as needed. |
| 69 | </p> |
| 70 | |
Brian | cef71f5 | 2008-02-27 18:13:21 -0700 | [diff] [blame] | 71 | |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 72 | <H2>Status</H2> |
| 73 | |
| 74 | <p> |
Brian Paul | 2c0ce92 | 2009-01-08 16:15:31 -0700 | [diff] [blame] | 75 | As of October 2008, the driver runs quite a few OpenGL demos. |
| 76 | Features that work include: |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 77 | </p> |
Brian Paul | 2c0ce92 | 2009-01-08 16:15:31 -0700 | [diff] [blame] | 78 | <ul> |
| 79 | <li>Point/line/triangle rendering, glDrawPixels |
| 80 | <li>2D, NPOT and cube texture maps with nearest/linear/mipmap filtering |
| 81 | <li>Dynamic SPU code generation for fragment shaders, but not complete |
| 82 | <li>Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete |
| 83 | <li>Dynamic PPU/PPC code generation for vertex shaders, but not complete |
| 84 | </ul> |
| 85 | <p> |
| 86 | Performance has recently improved with the addition of PPC code generation |
| 87 | for vertex shaders, but the code quality isn't too great yet. |
| 88 | </p> |
| 89 | <p> |
| 90 | Another bottleneck is SwapBuffers. It may be the limiting factor for |
| 91 | many simple GL tests. |
| 92 | </p> |
| 93 | |
| 94 | |
| 95 | |
| 96 | <H2>Debug Options</H2> |
| 97 | |
| 98 | <p> |
| 99 | The CELL_DEBUG env var can be set to a comma-separated list of one or |
| 100 | more of the following debug options: |
| 101 | </p> |
| 102 | <ul> |
| 103 | <li><b>checker</b> - use a different background clear color for each SPU. |
| 104 | This lets you see which SPU is rendering which screen tiles. |
| 105 | <li><b>sync</b> - wait/synchronize after each DMA transfer |
| 106 | <li><b>asm</b> - print generated SPU assembly code to stdout |
| 107 | <li><b>fragops</b> - emit fragment ops debug messages |
| 108 | <li><b>fragopfallback</b> - don't use codegen for fragment ops |
| 109 | <li><b>cmd</b> - print SPU commands as their received |
| 110 | <li><b>cache</b> - print texture cache statistics when program exits |
| 111 | </ul> |
| 112 | <p> |
| 113 | Note that some of these options may only work for linux-cell-debug builds. |
| 114 | </p> |
| 115 | |
| 116 | <p> |
| 117 | If the GALLIUM_NOPPC env var is set, PPC code generation will not be used |
| 118 | and vertex shaders will be run with the TGSI interpreter. |
| 119 | </p> |
| 120 | <p> |
| 121 | If the GALLIUM_NOCELL env var is set, the softpipe driver will be used |
| 122 | intead of the Cell driver. |
| 123 | This is useful for comparison/validation. |
| 124 | </p> |
| 125 | |
Brian | b87c1ab | 2008-01-24 09:15:31 -0700 | [diff] [blame] | 126 | |
| 127 | |
| 128 | <H2>Contributing</H2> |
| 129 | |
| 130 | <p> |
| 131 | If you're interested in contributing to the effort, familiarize yourself |
| 132 | with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>, |
| 133 | and describe what you'd like to do. |
| 134 | </p> |
| 135 | |
| 136 | |
| 137 | </BODY> |
| 138 | </HTML> |