Merge branch 'master' into gallium-texture-transfer
[mesa.git] / docs / cell.html
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>
12 The Mesa
13 <a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
14 driver is part of the
15 <a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
16 architecture.
17 </p>
18
19 <p>
20 <a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
21 is leading the project.
22 Two phases are planned.
23 First, to implement the framework for parallel rasterization using the Cell
24 SPEs, including texture mapping.
25 Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
26 The second phase is now underway.
27 </p>
28
29
30 <H2>Source Code</H2>
31
32 <p>
33 The latest Cell driver source code is on the master branch of the Mesa
34 git repository.
35 </p>
36 <p>
37 To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
38 To use the driver you'll need a Cell system, such as a PS3 running Linux,
39 or the Cell Simulator (untested, though).
40 </p>
41
42 <p>
43 If using Cell SDK 2.1, see the configs/linux-cell file for some
44 special changes.
45 </p>
46
47 <p>
48 To compile the code, run <code>make linux-cell</code>.
49 Or to build in debug mode, run <code>make linux-cell-debug</code>.
50 </p>
51
52 <p>
53 To use the library, make sure your current directory is the top of the
54 Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this:
55 <pre>
56 export LD_LIBRARY_PATH=$PWD/lib/gallium:$PWD/lib/
57 </pre>
58
59 <p>
60 Verify that the Cell driver is being used by running
61 <code>progs/xdemos/glxinfo</code> and looking for:
62 <pre>
63 OpenGL renderer string: Gallium 0.2, Cell on Xlib
64 </pre>
65
66
67 <H2>Driver Implementation Summary</H2>
68
69 <p>
70 Rasterization is parallelized across the SPUs in a tiled-based manner.
71 Batches of transformed triangles are sent to the SPUs (actually, pulled by from
72 main memory by the SPUs).
73 Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
74 into each tile.
75 Because of the limited SPU memory, framebuffer tiles are paged in/out of
76 SPU local store as needed.
77 Similarly, textures are tiled and brought into local store as needed.
78 </p>
79
80
81 <H2>Status</H2>
82
83 <p>
84 As of October 2008, the driver runs quite a few OpenGL demos.
85 Features that work include:
86 </p>
87 <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>
95 Performance has recently improved with the addition of PPC code generation
96 for vertex shaders, but the code quality isn't too great yet.
97 </p>
98 <p>
99 Another bottleneck is SwapBuffers. It may be the limiting factor for
100 many simple GL tests.
101 </p>
102
103
104
105 <H2>Debug Options</H2>
106
107 <p>
108 The CELL_DEBUG env var can be set to a comma-separated list of one or
109 more 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>
122 Note that some of these options may only work for linux-cell-debug builds.
123 </p>
124
125 <p>
126 If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
127 and vertex shaders will be run with the TGSI interpreter.
128 </p>
129 <p>
130 If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
131 intead of the Cell driver.
132 This is useful for comparison/validation.
133 </p>
134
135
136
137 <H2>Contributing</H2>
138
139 <p>
140 If you're interested in contributing to the effort, familiarize yourself
141 with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
142 and describe what you'd like to do.
143 </p>
144
145
146 </BODY>
147 </HTML>