• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<HTML>
2
3<TITLE>Cell Driver</TITLE>
4
5<link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7<BODY>
8
9<H1>Mesa/Gallium Cell Driver</H1>
10
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://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
16architecture.
17Tungsten Graphics did the original implementation of the Cell driver.
18</p>
19
20
21<H2>Source Code</H2>
22
23<p>
24The latest Cell driver source code is on the master branch of the Mesa
25git repository.
26</p>
27<p>
28To 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>
34If using Cell SDK 2.1, see the configs/linux-cell file for some
35special changes.
36</p>
37
38<p>
39To compile the code, run <code>make linux-cell</code>.
40Or to build in debug mode, run <code>make linux-cell-debug</code>.
41</p>
42
43<p>
44To 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>
49
50<p>
51Verify that the Cell driver is being used by running
52<code>progs/xdemos/glxinfo</code> and looking for:
53<pre>
54  OpenGL renderer string: Gallium 0.3, Cell on Xlib
55</pre>
56
57
58<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
71
72<H2>Status</H2>
73
74<p>
75As of October 2008, the driver runs quite a few OpenGL demos.
76Features that work include:
77</p>
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>
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
126
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>
139