blob: 30626b60b42be283e4985537eadfa9de484aa5a1 [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
Brian Paul8c6e81f2009-07-17 09:40:28 -060015<a href="http://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
Brianb87c1ab2008-01-24 09:15:31 -070016architecture.
Brian Paulf6b71d02009-04-07 18:26:08 -060017Tungsten Graphics did the original implementation of the Cell driver.
Brianb87c1ab2008-01-24 09:15:31 -070018</p>
19
20
21<H2>Source Code</H2>
22
23<p>
Brian Paul9c101c42009-02-10 16:56:58 -070024The latest Cell driver source code is on the master branch of the Mesa
25git repository.
Brian99a12602008-02-28 09:48:26 -070026</p>
Brian99a12602008-02-28 09:48:26 -070027<p>
Brianb87c1ab2008-01-24 09:15:31 -070028To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
29To use the driver you'll need a Cell system, such as a PS3 running Linux,
30or the Cell Simulator (untested, though).
31</p>
32
33<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070034If using Cell SDK 2.1, see the configs/linux-cell file for some
35special changes.
Briancabcee92008-02-27 18:01:37 -070036</p>
37
38<p>
Brianb87c1ab2008-01-24 09:15:31 -070039To compile the code, run <code>make linux-cell</code>.
Brian Paul36c1e752009-02-10 19:36:52 -070040Or to build in debug mode, run <code>make linux-cell-debug</code>.
Brianb87c1ab2008-01-24 09:15:31 -070041</p>
42
43<p>
Brian Paul36c1e752009-02-10 19:36:52 -070044To use the library, make sure your current directory is the top of the
45Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this:
46<pre>
47 export LD_LIBRARY_PATH=$PWD/lib/gallium:$PWD/lib/
48</pre>
Brianb87c1ab2008-01-24 09:15:31 -070049
50<p>
Brian Paul36c1e752009-02-10 19:36:52 -070051Verify that the Cell driver is being used by running
52<code>progs/xdemos/glxinfo</code> and looking for:
Brianb87c1ab2008-01-24 09:15:31 -070053<pre>
Brian Paul9f784642009-04-07 18:26:45 -060054 OpenGL renderer string: Gallium 0.3, Cell on Xlib
Brianb87c1ab2008-01-24 09:15:31 -070055</pre>
56
57
Briancef71f52008-02-27 18:13:21 -070058<H2>Driver Implementation Summary</H2>
59
60<p>
61Rasterization is parallelized across the SPUs in a tiled-based manner.
62Batches of transformed triangles are sent to the SPUs (actually, pulled by from
63main memory by the SPUs).
64Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
65into each tile.
66Because of the limited SPU memory, framebuffer tiles are paged in/out of
67SPU local store as needed.
68Similarly, textures are tiled and brought into local store as needed.
69</p>
70
Briancef71f52008-02-27 18:13:21 -070071
Brianb87c1ab2008-01-24 09:15:31 -070072<H2>Status</H2>
73
74<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070075As of October 2008, the driver runs quite a few OpenGL demos.
76Features that work include:
Brianb87c1ab2008-01-24 09:15:31 -070077</p>
Brian Paul2c0ce922009-01-08 16:15:31 -070078<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>
86Performance has recently improved with the addition of PPC code generation
87for vertex shaders, but the code quality isn't too great yet.
88</p>
89<p>
90Another bottleneck is SwapBuffers. It may be the limiting factor for
91many simple GL tests.
92</p>
93
94
95
96<H2>Debug Options</H2>
97
98<p>
99The CELL_DEBUG env var can be set to a comma-separated list of one or
100more 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>
113Note that some of these options may only work for linux-cell-debug builds.
114</p>
115
116<p>
117If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
118and vertex shaders will be run with the TGSI interpreter.
119</p>
120<p>
121If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
122intead of the Cell driver.
123This is useful for comparison/validation.
124</p>
125
Brianb87c1ab2008-01-24 09:15:31 -0700126
127
128<H2>Contributing</H2>
129
130<p>
131If you're interested in contributing to the effort, familiarize yourself
132with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
133and describe what you'd like to do.
134</p>
135
136
137</BODY>
138</HTML>