Merge branch 'master' into gallium-0.2
[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 <code>gallium-0.2</code> branch
34 of the Mesa git repository.
35 After you've cloned the repository, check out the branch with:
36 </p>
37 <pre>
38 git-checkout -b gallium-0.2 origin/gallium-0.2
39 </pre>
40 <p>
41 To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
42 To use the driver you'll need a Cell system, such as a PS3 running Linux,
43 or the Cell Simulator (untested, though).
44 </p>
45
46 <p>
47 If using Cell SDK 2.1, see the configs/linux-cell file for some
48 special changes.
49 </p>
50
51 <p>
52 To compile the code, run <code>make linux-cell</code>.
53 To build in debug mode, run <code>make linux-cell-debug</code>.
54 </p>
55
56 <p>
57 To use the library, make sure <code>LD_LIBRARY_PATH</code> points the Mesa/lib/
58 directory that contains <code>libGL.so</code>.
59 </p>
60
61 <p>
62 Verify that the Cell driver is being used by running <code>glxinfo</code>
63 and looking for:
64 <pre>
65 OpenGL renderer string: Gallium 0.2, Cell on Xlib
66 </pre>
67
68
69 <H2>Driver Implementation Summary</H2>
70
71 <p>
72 Rasterization is parallelized across the SPUs in a tiled-based manner.
73 Batches of transformed triangles are sent to the SPUs (actually, pulled by from
74 main memory by the SPUs).
75 Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
76 into each tile.
77 Because of the limited SPU memory, framebuffer tiles are paged in/out of
78 SPU local store as needed.
79 Similarly, textures are tiled and brought into local store as needed.
80 </p>
81
82
83 <H2>Status</H2>
84
85 <p>
86 As of September 2008, the driver supports smooth/flat shaded triangle rendering
87 with Z testing and simple texture mapping.
88 Simple demos like gears run successfully.
89 To test texture mapping, try progs/demos/texcyl (press right mouse button for
90 rendering options).
91 </p>
92 <p>
93 Runtime/dynamic code generation is being done for per-fragment
94 operations (Z test, blend, etc) and for fragment programs (though only a
95 few opcodes are implemented now).
96 </p>
97 <p>
98 In general, however, the driver is rather slow because all vertex
99 transformation is being done by an interpreter running on the PPU.
100 Programs with many vertices or complex vertex shaders will run especially
101 slow.
102 This will be addressed in the future.
103 </p>
104
105
106
107 <H2>Debug Options</H2>
108
109 <p>
110 The CELL_DEBUG env var can be set to a comma-separated list of one or
111 more 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 </ul>
118
119 <p>
120 If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
121 intead of the Cell driver.
122 This is useful for comparison/validation.
123 </p>
124
125
126
127 <H2>Contributing</H2>
128
129 <p>
130 If you're interested in contributing to the effort, familiarize yourself
131 with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
132 and describe what you'd like to do.
133 </p>
134
135
136 </BODY>
137 </HTML>