aboutsummaryrefslogtreecommitdiffstats
path: root/docs/cell.html
blob: 34d9a92723154d0346430725928814839dca1fd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<HTML>

<TITLE>Cell Driver</TITLE>

<link rel="stylesheet" type="text/css" href="mesa.css"></head>

<BODY>

<H1>Mesa/Gallium Cell Driver</H1>

<p>
The Mesa
<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
driver is part of the 
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
architecture.
</p>

<p>
<a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
is leading the project.
Two phases are planned.
First, to implement the framework for parallel rasterization using the Cell
SPEs, including texture mapping.
Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
The second phase is now underway.
</p>


<H2>Source Code</H2>

<p>
The latest Cell driver source code is on the <code>gallium-0.2</code> branch
of the Mesa git repository.
After you've cloned the repository, check out the branch with:
</p>
<pre>
   git-checkout -b gallium-0.2 origin/gallium-0.2
</pre>
<p>
To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
To use the driver you'll need a Cell system, such as a PS3 running Linux,
or the Cell Simulator (untested, though).
</p>

<p>
If using Cell SDK 2.1, see the configs/linux-cell file for some
special changes.
</p>

<p>
To compile the code, run <code>make linux-cell</code>.
To build in debug mode, run <code>make linux-cell-debug</code>.
</p>

<p>
To use the library, make sure <code>LD_LIBRARY_PATH</code> points the Mesa/lib/
directory that contains <code>libGL.so</code>.
</p>

<p>
Verify that the Cell driver is being used by running <code>glxinfo</code>
and looking for:
<pre>
  OpenGL renderer string: Gallium 0.2, Cell on Xlib
</pre>


<H2>Driver Implementation Summary</H2>

<p>
Rasterization is parallelized across the SPUs in a tiled-based manner.
Batches of transformed triangles are sent to the SPUs (actually, pulled by from
main memory by the SPUs).
Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
into each tile.
Because of the limited SPU memory, framebuffer tiles are paged in/out of
SPU local store as needed.
Similarly, textures are tiled and brought into local store as needed.
</p>


<H2>Status</H2>

<p>
As of September 2008, the driver supports smooth/flat shaded triangle rendering
with Z testing and simple texture mapping.
Simple demos like gears run successfully.
To test texture mapping, try progs/demos/texcyl (press right mouse button for
rendering options).
</p>
<p>
Runtime/dynamic code generation is being done for per-fragment
operations (Z test, blend, etc) and for fragment programs (though only a
few opcodes are implemented now).
</p>
<p>
In general, however, the driver is rather slow because all vertex
transformation is being done by an interpreter running on the PPU.
Programs with many vertices or complex vertex shaders will run especially
slow.
This will be addressed in the future.
</p>



<H2>Debug Options</H2>

<p>
The CELL_DEBUG env var can be set to a comma-separated list of one or
more of the following debug options:
</p>
<ul>
<li><b>checker</b> - use a different background clear color for each SPU.
   This lets you see which SPU is rendering which screen tiles.
<li><b>sync</b> - wait/synchronize after each DMA transfer
</ul>

<p>
If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
intead of the Cell driver.
This is useful for comparison/validation.
</p>



<H2>Contributing</H2>

<p>
If you're interested in contributing to the effort, familiarize yourself
with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
and describe what you'd like to do.
</p>


</BODY>
</HTML>