blob: 49b62cac7b0ef11c8e0952636365393cb3eb5d5a [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 Paul36c1e752009-02-10 19:36:52 -070049Or to build in debug mode, run <code>make linux-cell-debug</code>.
Brianb87c1ab2008-01-24 09:15:31 -070050</p>
51
52<p>
Brian Paul36c1e752009-02-10 19:36:52 -070053To use the library, make sure your current directory is the top of the
54Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this:
55<pre>
56 export LD_LIBRARY_PATH=$PWD/lib/gallium:$PWD/lib/
57</pre>
Brianb87c1ab2008-01-24 09:15:31 -070058
59<p>
Brian Paul36c1e752009-02-10 19:36:52 -070060Verify that the Cell driver is being used by running
61<code>progs/xdemos/glxinfo</code> and looking for:
Brianb87c1ab2008-01-24 09:15:31 -070062<pre>
Brian Paul2c0ce922009-01-08 16:15:31 -070063 OpenGL renderer string: Gallium 0.2, Cell on Xlib
Brianb87c1ab2008-01-24 09:15:31 -070064</pre>
65
66
Briancef71f52008-02-27 18:13:21 -070067<H2>Driver Implementation Summary</H2>
68
69<p>
70Rasterization is parallelized across the SPUs in a tiled-based manner.
71Batches of transformed triangles are sent to the SPUs (actually, pulled by from
72main memory by the SPUs).
73Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
74into each tile.
75Because of the limited SPU memory, framebuffer tiles are paged in/out of
76SPU local store as needed.
77Similarly, textures are tiled and brought into local store as needed.
78</p>
79
Briancef71f52008-02-27 18:13:21 -070080
Brianb87c1ab2008-01-24 09:15:31 -070081<H2>Status</H2>
82
83<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070084As of October 2008, the driver runs quite a few OpenGL demos.
85Features that work include:
Brianb87c1ab2008-01-24 09:15:31 -070086</p>
Brian Paul2c0ce922009-01-08 16:15:31 -070087<ul>
88<li>Point/line/triangle rendering, glDrawPixels
89<li>2D, NPOT and cube texture maps with nearest/linear/mipmap filtering
90<li>Dynamic SPU code generation for fragment shaders, but not complete
91<li>Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete
92<li>Dynamic PPU/PPC code generation for vertex shaders, but not complete
93</ul>
94<p>
95Performance has recently improved with the addition of PPC code generation
96for vertex shaders, but the code quality isn't too great yet.
97</p>
98<p>
99Another bottleneck is SwapBuffers. It may be the limiting factor for
100many simple GL tests.
101</p>
102
103
104
105<H2>Debug Options</H2>
106
107<p>
108The CELL_DEBUG env var can be set to a comma-separated list of one or
109more of the following debug options:
110</p>
111<ul>
112<li><b>checker</b> - use a different background clear color for each SPU.
113 This lets you see which SPU is rendering which screen tiles.
114<li><b>sync</b> - wait/synchronize after each DMA transfer
115<li><b>asm</b> - print generated SPU assembly code to stdout
116<li><b>fragops</b> - emit fragment ops debug messages
117<li><b>fragopfallback</b> - don't use codegen for fragment ops
118<li><b>cmd</b> - print SPU commands as their received
119<li><b>cache</b> - print texture cache statistics when program exits
120</ul>
121<p>
122Note that some of these options may only work for linux-cell-debug builds.
123</p>
124
125<p>
126If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
127and vertex shaders will be run with the TGSI interpreter.
128</p>
129<p>
130If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
131intead of the Cell driver.
132This is useful for comparison/validation.
133</p>
134
Brianb87c1ab2008-01-24 09:15:31 -0700135
136
137<H2>Contributing</H2>
138
139<p>
140If you're interested in contributing to the effort, familiarize yourself
141with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
142and describe what you'd like to do.
143</p>
144
145
146</BODY>
147</HTML>