blob: 7fbbba7c7e0a691c591336c3efc5c438344056a9 [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 Paul2c0ce922009-01-08 16:15:31 -070033The latest Cell driver source code is on the <code>gallium-0.2</code> branch
34of the Mesa git repository.
Brian99a12602008-02-28 09:48:26 -070035After you've cloned the repository, check out the branch with:
36</p>
37<pre>
Brian Paul2c0ce922009-01-08 16:15:31 -070038 git-checkout -b gallium-0.2 origin/gallium-0.2
Brian99a12602008-02-28 09:48:26 -070039</pre>
40<p>
Brianb87c1ab2008-01-24 09:15:31 -070041To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
42To use the driver you'll need a Cell system, such as a PS3 running Linux,
43or the Cell Simulator (untested, though).
44</p>
45
46<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070047If using Cell SDK 2.1, see the configs/linux-cell file for some
48special changes.
Briancabcee92008-02-27 18:01:37 -070049</p>
50
51<p>
Brianb87c1ab2008-01-24 09:15:31 -070052To compile the code, run <code>make linux-cell</code>.
Brian Paul2c0ce922009-01-08 16:15:31 -070053To build in debug mode, run <code>make linux-cell-debug</code>.
Brianb87c1ab2008-01-24 09:15:31 -070054</p>
55
56<p>
57To use the library, make sure <code>LD_LIBRARY_PATH</code> points the Mesa/lib/
58directory that contains <code>libGL.so</code>.
59</p>
60
61<p>
62Verify that the Cell driver is being used by running <code>glxinfo</code>
63and looking for:
64<pre>
Brian Paul2c0ce922009-01-08 16:15:31 -070065 OpenGL renderer string: Gallium 0.2, Cell on Xlib
Brianb87c1ab2008-01-24 09:15:31 -070066</pre>
67
68
Briancef71f52008-02-27 18:13:21 -070069<H2>Driver Implementation Summary</H2>
70
71<p>
72Rasterization is parallelized across the SPUs in a tiled-based manner.
73Batches of transformed triangles are sent to the SPUs (actually, pulled by from
74main memory by the SPUs).
75Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
76into each tile.
77Because of the limited SPU memory, framebuffer tiles are paged in/out of
78SPU local store as needed.
79Similarly, textures are tiled and brought into local store as needed.
80</p>
81
Briancef71f52008-02-27 18:13:21 -070082
Brianb87c1ab2008-01-24 09:15:31 -070083<H2>Status</H2>
84
85<p>
Brian Paul2c0ce922009-01-08 16:15:31 -070086As of October 2008, the driver runs quite a few OpenGL demos.
87Features that work include:
Brianb87c1ab2008-01-24 09:15:31 -070088</p>
Brian Paul2c0ce922009-01-08 16:15:31 -070089<ul>
90<li>Point/line/triangle rendering, glDrawPixels
91<li>2D, NPOT and cube texture maps with nearest/linear/mipmap filtering
92<li>Dynamic SPU code generation for fragment shaders, but not complete
93<li>Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete
94<li>Dynamic PPU/PPC code generation for vertex shaders, but not complete
95</ul>
96<p>
97Performance has recently improved with the addition of PPC code generation
98for vertex shaders, but the code quality isn't too great yet.
99</p>
100<p>
101Another bottleneck is SwapBuffers. It may be the limiting factor for
102many simple GL tests.
103</p>
104
105
106
107<H2>Debug Options</H2>
108
109<p>
110The CELL_DEBUG env var can be set to a comma-separated list of one or
111more of the following debug options:
112</p>
113<ul>
114<li><b>checker</b> - use a different background clear color for each SPU.
115 This lets you see which SPU is rendering which screen tiles.
116<li><b>sync</b> - wait/synchronize after each DMA transfer
117<li><b>asm</b> - print generated SPU assembly code to stdout
118<li><b>fragops</b> - emit fragment ops debug messages
119<li><b>fragopfallback</b> - don't use codegen for fragment ops
120<li><b>cmd</b> - print SPU commands as their received
121<li><b>cache</b> - print texture cache statistics when program exits
122</ul>
123<p>
124Note that some of these options may only work for linux-cell-debug builds.
125</p>
126
127<p>
128If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
129and vertex shaders will be run with the TGSI interpreter.
130</p>
131<p>
132If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
133intead of the Cell driver.
134This is useful for comparison/validation.
135</p>
136
Brianb87c1ab2008-01-24 09:15:31 -0700137
138
139<H2>Contributing</H2>
140
141<p>
142If you're interested in contributing to the effort, familiarize yourself
143with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
144and describe what you'd like to do.
145</p>
146
147
148</BODY>
149</HTML>