Commit ccd4d436 authored by Kai Wasserbäch's avatar Kai Wasserbäch Committed by Jose Fonseca

gallium/cell: Remove the driver.

Complicates Gallium3D development and doesn't seem to have active users.
Signed-off-by: Kai Wasserbäch's avatarKai Wasserbäch <kai@dev.carbon-project.org>
Signed-off-by: Jose Fonseca's avatarJosé Fonseca <jfonseca@vmware.com>
parent 09e67706
......@@ -112,8 +112,6 @@ linux \
linux-i965 \
linux-alpha \
linux-alpha-static \
linux-cell \
linux-cell-debug \
linux-debug \
linux-dri \
linux-dri-debug \
......
......@@ -83,7 +83,7 @@ def AddOptions(opts):
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', host_platform,
allowed_values=('linux', 'cell', 'windows', 'darwin', 'cygwin', 'sunos', 'freebsd8')))
allowed_values=('linux', 'windows', 'darwin', 'cygwin', 'sunos', 'freebsd8')))
opts.Add(BoolOption('embedded', 'embedded build', 'no'))
opts.Add('toolchain', 'compiler toolchain', default_toolchain)
opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no'))
......
# linux-cell (non-debug build)
include $(TOP)/configs/linux
CONFIG_NAME = linux-cell
# Omiting other gallium drivers:
GALLIUM_DRIVERS_DIRS = cell softpipe trace rbug identity
# Compiler and flags
CC = ppu32-gcc
CXX = ppu32-g++
HOST_CC = gcc
APP_CC = gcc
APP_CXX = g++
OPT_FLAGS = -O3
# Cell SDK location
## For SDK 2.1: (plus, remove -DSPU_MAIN_PARAM_LONG_LONG below)
#SDK = /opt/ibm/cell-sdk/prototype/sysroot/usr
## For SDK 3.0:
SDK = /opt/cell/sdk/usr
COMMON_C_CPP_FLAGS = $(OPT_FLAGS) -Wall -Winline \
-fPIC -m32 -mabi=altivec -maltivec \
-I. -I$(SDK)/include \
-DGALLIUM_CELL $(DEFINES)
CFLAGS = $(COMMON_C_CPP_FLAGS) -Wmissing-prototypes -std=c99
CXXFLAGS = $(COMMON_C_CPP_FLAGS)
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
gallium gallium/winsys gallium/targets glu
# Build no traditional Mesa drivers:
DRIVER_DIRS =
MKDEP_OPTIONS = -fdepend -Y
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread \
-L$(SDK)/lib -m32 -Wl,-m,elf32ppc -R$(SDK)/lib -lspe2
CELL_SPU_LIB = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a
### SPU stuff
SPU_CC = spu-gcc
SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main \
-I. -I$(SDK)/spu/include -I$(TOP)/src/mesa/ $(INCLUDE_DIRS) \
-DSPU_MAIN_PARAM_LONG_LONG \
-include spu_intrinsics.h
SPU_LFLAGS = -L$(SDK)/spu/lib -Wl,-N -lmisc -lm
SPU_AR = ppu-ar
SPU_AR_FLAGS = -qcs
SPU_EMBED = ppu32-embedspu
SPU_EMBED_FLAGS = -m32
# linux-cell-debug
include $(TOP)/configs/linux-cell
# just override name and OPT_FLAGS here:
CONFIG_NAME = linux-cell-debug
OPT_FLAGS = -g -DDEBUG
<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://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
architecture.
Tungsten Graphics did the original implementation of the Cell driver.
</p>
<H2>Source Code</H2>
<p>
The latest Cell driver source code is on the master branch of the Mesa
git repository.
</p>
<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>.
Or to build in debug mode, run <code>make linux-cell-debug</code>.
</p>
<p>
To use the library, make sure your current directory is the top of the
Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this:
<pre>
export LD_LIBRARY_PATH=$PWD/lib/gallium:$PWD/lib/
</pre>
<p>
Verify that the Cell driver is being used by running
<code>progs/xdemos/glxinfo</code> and looking for:
<pre>
OpenGL renderer string: Gallium 0.3, 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 October 2008, the driver runs quite a few OpenGL demos.
Features that work include:
</p>
<ul>
<li>Point/line/triangle rendering, glDrawPixels
<li>2D, NPOT and cube texture maps with nearest/linear/mipmap filtering
<li>Dynamic SPU code generation for fragment shaders, but not complete
<li>Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete
<li>Dynamic PPU/PPC code generation for vertex shaders, but not complete
</ul>
<p>
Performance has recently improved with the addition of PPC code generation
for vertex shaders, but the code quality isn't too great yet.
</p>
<p>
Another bottleneck is SwapBuffers. It may be the limiting factor for
many simple GL tests.
</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
<li><b>asm</b> - print generated SPU assembly code to stdout
<li><b>fragops</b> - emit fragment ops debug messages
<li><b>fragopfallback</b> - don't use codegen for fragment ops
<li><b>cmd</b> - print SPU commands as their received
<li><b>cache</b> - print texture cache statistics when program exits
</ul>
<p>
Note that some of these options may only work for linux-cell-debug builds.
</p>
<p>
If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
and vertex shaders will be run with the TGSI interpreter.
</p>
<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>
......@@ -78,8 +78,7 @@ a:visited {
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>
<li><a href="sourcedocs.html" target="MainFrame">Source Documentation</a>
<li><a href="subset.html" target="MainFrame">Mesa Subset Driver</a>
<LI><A HREF="dispatch.html" target="MainFrame">GL Dispatch</A>
<li><a href="cell.html" target="MainFrame">Cell Driver</A>
<li><a HREF="dispatch.html" target="MainFrame">GL Dispatch</a>
</ul>
<b>Links</b>
......
......@@ -217,7 +217,7 @@ This is a bug-fix release.
<h2>January 24, 2008</h2>
<p>
Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
Added a new page describing the Mesa Cell driver.
</p>
......
......@@ -74,6 +74,8 @@ tbd
by the gallium drivers for this hardware.</li>
<li>Removed the i965g driver, which was broken and with nobody in sight to fix
the situation</li>
<li>Removed the Gallium cell driver, it was just a burden on Gallium
development and nobody seems to use it.</li>
</ul>
......
......@@ -61,7 +61,7 @@ baa7a1e850b6e39bae58868fd0684004 MesaGLUT-7.5.tar.bz2
<ul>
<li>softpipe - a software/reference driver
<li>i915 - Intel 915/945 driver
<li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
<li>Cell - IBM/Sony/Toshiba Cell processor driver
<li>nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300).
<b>PLEASE NOTE: these drivers are incomplete and still under development.
It's probably NOT worthwhile to report any bugs unless you have patches.
......
......@@ -86,7 +86,6 @@ each directory.
interfaces
<li><b>drivers</b> - Gallium3D device drivers
<ul>
<li><b>cell</b> - Driver for Cell processor.
<li><b>i915</b> - Driver for Intel i915/i945.
<li><b>llvmpipe</b> - Software driver using LLVM for runtime code generation.
<li><b>nv*</b> - Drivers for NVIDIA GPUs.
......
......@@ -34,7 +34,6 @@
- Pipe drivers:
- \ref softpipe
- \ref i915g
- Cell driver (cell_context.h, cell_winsys.h)
- \ref failover
- Winsys drivers:
......
......@@ -63,7 +63,6 @@ C_SOURCES := \
rtasm/rtasm_cpu.c \
rtasm/rtasm_execmem.c \
rtasm/rtasm_ppc.c \
rtasm/rtasm_ppc_spe.c \
rtasm/rtasm_x86sse.c \
tgsi/tgsi_build.c \
tgsi/tgsi_dump.c \
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@
/* Helper function to choose and instantiate one of the software rasterizers:
* cell, llvmpipe, softpipe.
* llvmpipe, softpipe.
*/
#ifdef GALLIUM_SOFTPIPE
......@@ -19,21 +19,12 @@
#include "llvmpipe/lp_public.h"
#endif
#ifdef GALLIUM_CELL
#include "cell/ppu/cell_public.h"
#endif
static INLINE struct pipe_screen *
sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
{
struct pipe_screen *screen = NULL;
#if defined(GALLIUM_CELL)
if (screen == NULL && strcmp(driver, "cell") == 0)
screen = cell_create_screen(winsys);
#endif
#if defined(GALLIUM_LLVMPIPE)
if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
screen = llvmpipe_create_screen(winsys);
......@@ -54,9 +45,7 @@ sw_screen_create(struct sw_winsys *winsys)
const char *default_driver;
const char *driver;
#if defined(GALLIUM_CELL)
default_driver = "cell";
#elif defined(GALLIUM_LLVMPIPE)
#if defined(GALLIUM_LLVMPIPE)
default_driver = "llvmpipe";
#elif defined(GALLIUM_SOFTPIPE)
default_driver = "softpipe";
......
# Cell Gallium driver Makefile
default:
( cd spu ; make )
( cd ppu ; make )
clean:
( cd spu ; make clean )
( cd ppu ; make clean )
This diff is collapsed.
# Gallium3D Cell driver: PPU code
# This makefile builds the libcell.a library which gets pulled into
# the main libGL.so library
TOP = ../../../../..
include $(TOP)/configs/current
# This is the "top-level" cell PPU driver code, will get pulled into libGL.so
# by the winsys Makefile.
CELL_LIB = ../libcell.a
# This is the SPU code. We'd like to be able to put this into the libcell.a
# archive with the PPU code, but nesting .a libs doesn't seem to work.
# So, it's pulled into libGL.so in gallium/winsys/xlib/Makefile
SPU_CODE_MODULE = ../spu/g3d_spu.a
SOURCES = \
cell_batch.c \
cell_clear.c \
cell_context.c \
cell_draw_arrays.c \
cell_fence.c \
cell_flush.c \
cell_gen_fragment.c \
cell_gen_fp.c \
cell_state_derived.c \
cell_state_emit.c \
cell_state_shader.c \
cell_pipe_state.c \
cell_screen.c \
cell_state_vertex.c \
cell_spu.c \
cell_surface.c \
cell_texture.c \
cell_vbuf.c \
cell_vertex_fetch.c \
cell_vertex_shader.c
OBJECTS = $(SOURCES:.c=.o) \
INCLUDE_DIRS = \
-I$(TOP)/src/mesa \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/src/gallium/drivers
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
.c.s:
$(CC) -S $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(CELL_LIB)
$(CELL_LIB): $(OBJECTS) $(SPU_CODE_MODULE)
# ar -ru $(CELL_LIB) $(OBJECTS) $(SPU_CODE_MODULE) # doesn't work
ar -ru $(CELL_LIB) $(OBJECTS)
#$(PROG): $(PPU_OBJECTS)
# $(CC) -o $(PROG) $(PPU_OBJECTS) $(SPU_CODE_MODULE) $(PPU_LFLAGS)
clean:
rm -f *.o *~ $(CELL_LIB)
depend: $(SOURCES)
rm -f depend
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDE_DIRS) $(SOURCES) 2> /dev/null
include depend
/**************************************************************************
*
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "cell_context.h"
#include "cell_batch.h"
#include "cell_fence.h"
#include "cell_spu.h"
/**
* Search the buffer pool for an empty/free buffer and return its index.
* Buffers are used for storing vertex data, state and commands which
* will be sent to the SPUs.
* If no empty buffers are available, wait for one.
* \return buffer index in [0, CELL_NUM_BUFFERS-1]
*/
uint
cell_get_empty_buffer(struct cell_context *cell)
{
static uint prev_buffer = 0;
uint buf = (prev_buffer + 1) % CELL_NUM_BUFFERS;
uint tries = 0;
/* Find a buffer that's marked as free by all SPUs */
while (1) {
uint spu, num_free = 0;
for (spu = 0; spu < cell->num_spus; spu++) {
if (cell->buffer_status[spu][buf][0] == CELL_BUFFER_STATUS_FREE) {
num_free++;
if (num_free == cell->num_spus) {
/* found a free buffer, now mark status as used */
for (spu = 0; spu < cell->num_spus; spu++) {
cell->buffer_status[spu][buf][0] = CELL_BUFFER_STATUS_USED;
}
/*
printf("PPU: ALLOC BUFFER %u, %u tries\n", buf, tries);
*/
prev_buffer = buf;
/* release tex buffer associated w/ prev use of this batch buf */
cell_free_fenced_buffers(cell, &cell->fenced_buffers[buf]);
return buf;
}
}
else {
break;
}
}
/* try next buf */
buf = (buf + 1) % CELL_NUM_BUFFERS;
tries++;
if (tries == 100) {
/*
printf("PPU WAITING for buffer...\n");
*/
}
}
}
/**
* Append a fence command to the current batch buffer.
* Note that we're sure there's always room for this because of the
* adjusted size check in cell_batch_free_space().
*/
static void
emit_fence(struct cell_context *cell)
{
const uint batch = cell->cur_batch;
const uint size = cell->buffer_size[batch];
struct cell_command_fence *fence_cmd;
struct cell_fence *fence = &cell->fenced_buffers[batch].fence;
uint i;
/* set fence status to emitted, not yet signalled */
for (i = 0; i < cell->num_spus; i++) {
fence->status[i][0] = CELL_FENCE_EMITTED;
}
STATIC_ASSERT(sizeof(struct cell_command_fence) % 16 == 0);
ASSERT(size % 16 == 0);
ASSERT(size + sizeof(struct cell_command_fence) <= CELL_BUFFER_SIZE);
fence_cmd = (struct cell_command_fence *) (cell->buffer[batch] + size);
fence_cmd->opcode[0] = CELL_CMD_FENCE;
fence_cmd->fence = fence;
/* update batch buffer size */
cell->buffer_size[batch] = size + sizeof(struct cell_command_fence);
}
/**
* Flush the current batch buffer to the SPUs.
* An empty buffer will be found and set as the new current batch buffer
* for subsequent commands/data.
*/
void
cell_batch_flush(struct cell_context *cell)
{
static boolean flushing = FALSE;
uint batch = cell->cur_batch;
uint size = cell->buffer_size[batch];
uint spu, cmd_word;
assert(!flushing);
if (size == 0)
return;
/* Before we use this batch buffer, make sure any fenced texture buffers
* are released.
*/
if (cell->fenced_buffers[batch].head) {
emit_fence(cell);
size = cell->buffer_size[batch];
}
flushing = TRUE;
assert(batch < CELL_NUM_BUFFERS);
/*
printf("cell_batch_dispatch: buf %u at %p, size %u\n",
batch, &cell->buffer[batch][0], size);
*/
/*
* Build "BATCH" command and send to all SPUs.
*/
cmd_word = CELL_CMD_BATCH | (batch << 8) | (size << 16);
for (spu = 0; spu < cell->num_spus; spu++) {
assert(cell->buffer_status[spu][batch][0] == CELL_BUFFER_STATUS_USED);
send_mbox_message(cell_global.spe_contexts[spu], cmd_word);
}
/* When the SPUs are done copying the buffer into their locals stores
* they'll write a BUFFER_STATUS_FREE message into the buffer_status[]
* array indicating that the PPU can re-use the buffer.
*/
batch = cell_get_empty_buffer(cell);
cell->buffer_size[batch] = 0; /* empty */
cell->cur_batch = batch;
flushing = FALSE;
}
/**
* Return the number of bytes free in the current batch buffer.
*/
uint
cell_batch_free_space(const struct cell_context *cell)
{
uint free = CELL_BUFFER_SIZE - cell->buffer_size[cell->cur_batch];
free -= sizeof(struct cell_command_fence);
return free;
}
/**
* Allocate space in the current batch buffer for 'bytes' space.
* Bytes must be a multiple of 16 bytes. Allocation will be 16 byte aligned.
* \return address in batch buffer to put data
*/
void *
cell_batch_alloc16(struct cell_context *cell, uint bytes)
{
void *pos;
uint size;
ASSERT(bytes % 16 == 0);
ASSERT(bytes <= CELL_BUFFER_SIZE);
ASSERT(cell->cur_batch >= 0);
#ifdef ASSERT
{
uint spu;
for (spu = 0; spu < cell->num_spus; spu++) {
ASSERT(cell->buffer_status[spu][cell->cur_batch][0]
== CELL_BUFFER_STATUS_USED);
}
}
#endif
size = cell->buffer_size[cell->cur_batch];
if (bytes > cell_batch_free_space(cell)) {
cell_batch_flush(cell);
size = 0;
}
ASSERT(size % 16 == 0);
ASSERT(size + bytes <= CELL_BUFFER_SIZE);
pos = (void *) (cell->buffer[cell->cur_batch] + size);
cell->buffer_size[cell->cur_batch] = size + bytes;
return pos;
}
/**
* One-time init of batch buffers.
*/
void
cell_init_batch_buffers(struct cell_context *cell)
{
uint spu, buf;
/* init command, vertex/index buffer info */
for (buf = 0; buf < CELL_NUM_BUFFERS; buf++) {
cell->buffer_size[buf] = 0;
/* init batch buffer status values,
* mark 0th buffer as used, rest as free.
*/
for (spu = 0; spu < cell->num_spus; spu++) {
if (buf == 0)
cell->buffer_status[spu][buf][0] = CELL_BUFFER_STATUS_USED;
else
cell->buffer_status[spu][buf][0] = CELL_BUFFER_STATUS_FREE;
}
}