blob: d7feb468adb6c8ca5aafea99c6a4783f60c1da10 [file] [log] [blame]
Brianb87c1ab2008-01-24 09:15:31 -07001<HTML>
2
3<TITLE>Cell Driver</TITLE>
4
5<link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7<BODY>
8
Brian Paul2c0ce922009-01-08 16:15:31 -07009<H1>Mesa/Gallium Cell Driver</H1>
Brianb87c1ab2008-01-24 09:15:31 -070010
11<p>
12The Mesa
13<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
14driver is part of the
15<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
16architecture.
17</p>
18
19<p>
20<a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
21is leading the project.
22Two phases are planned.
23First, to implement the framework for parallel rasterization using the Cell
24SPEs, including texture mapping.
25Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
Brian Paul2c0ce922009-01-08 16:15:31 -070026The second phase is now underway.
Brianb87c1ab2008-01-24 09:15:31 -070027</p>
28
29
30<H2>Source Code</H2>
31
32<p>
Brian Paul9c101c42009-02-10 16:56:58 -070033The latest Cell driver source code is on the master branch of the Mesa
34git repository.
Brian99a12602008-02-28 09:48:26 -070035</p>
Brian99a12602008-02-28 09:48:26 -070036<p>
Brianb87c1ab2008-01-24 09:15:31 -070037To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
38To use the driver you'll need a Cell system, such as a PS3 running Linux,
39or the Cell Simulator (untested, though).
40</p>
41
42<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070043If using Cell SDK 2.1, see the configs/linux-cell file for some
44special changes.
Briancabcee92008-02-27 18:01:37 -070045</p>
46
47<p>
Brianb87c1ab2008-01-24 09:15:31 -070048To compile the code, run <code>make linux-cell</code>.
Brian Paul2c0ce922009-01-08 16:15:31 -070049To build in debug mode, run <code>make linux-cell-debug</code>.
Brianb87c1ab2008-01-24 09:15:31 -070050</p>
51
52<p>
53To use the library, make sure <code>LD_LIBRARY_PATH</code> points the Mesa/lib/
54directory that contains <code>libGL.so</code>.
55</p>
56
57<p>
58Verify that the Cell driver is being used by running <code>glxinfo</code>
59and looking for:
60<pre>
Brian Paul2c0ce922009-01-08 16:15:31 -070061 OpenGL renderer string: Gallium 0.2, Cell on Xlib
Brianb87c1ab2008-01-24 09:15:31 -070062</pre>
63
64
Briancef71f52008-02-27 18:13:21 -070065<H2>Driver Implementation Summary</H2>
66
67<p>
68Rasterization is parallelized across the SPUs in a tiled-based manner.
69Batches of transformed triangles are sent to the SPUs (actually, pulled by from
70main memory by the SPUs).
71Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
72into each tile.
73Because of the limited SPU memory, framebuffer tiles are paged in/out of
74SPU local store as needed.
75Similarly, textures are tiled and brought into local store as needed.
76</p>
77
Briancef71f52008-02-27 18:13:21 -070078
Brianb87c1ab2008-01-24 09:15:31 -070079<H2>Status</H2>
80
81<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070082As of October 2008, the driver runs quite a few OpenGL demos.
83Features that work include:
Brianb87c1ab2008-01-24 09:15:31 -070084</p>
Brian Paul2c0ce922009-01-08 16:15:31 -070085<ul>
86<li>Point/line/triangle rendering, glDrawPixels
87<li>2D, NPOT and cube texture maps with nearest/linear/mipmap filtering
88<li>Dynamic SPU code generation for fragment shaders, but not complete
89<li>Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete
90<li>Dynamic PPU/PPC code generation for vertex shaders, but not complete
91</ul>
92<p>
93Performance has recently improved with the addition of PPC code generation
94for vertex shaders, but the code quality isn't too great yet.
95</p>
96<p>
97Another bottleneck is SwapBuffers. It may be the limiting factor for
98many simple GL tests.
99</p>
100
101
102
103<H2>Debug Options</H2>
104
105<p>
106The CELL_DEBUG env var can be set to a comma-separated list of one or
107more of the following debug options:
108</p>
109<ul>
110<li><b>checker</b> - use a different background clear color for each SPU.
111 This lets you see which SPU is rendering which screen tiles.
112<li><b>sync</b> - wait/synchronize after each DMA transfer
113<li><b>asm</b> - print generated SPU assembly code to stdout
114<li><b>fragops</b> - emit fragment ops debug messages
115<li><b>fragopfallback</b> - don't use codegen for fragment ops
116<li><b>cmd</b> - print SPU commands as their received
117<li><b>cache</b> - print texture cache statistics when program exits
118</ul>
119<p>
120Note that some of these options may only work for linux-cell-debug builds.
121</p>
122
123<p>
124If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
125and vertex shaders will be run with the TGSI interpreter.
126</p>
127<p>
128If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
129intead of the Cell driver.
130This is useful for comparison/validation.
131</p>
132
Brianb87c1ab2008-01-24 09:15:31 -0700133
134
135<H2>Contributing</H2>
136
137<p>
138If you're interested in contributing to the effort, familiarize yourself
139with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
140and describe what you'd like to do.
141</p>
142
143
144</BODY>
145</HTML>