From e53303ba3b69c2c82cefd58e90d06132c2af2bb7 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 10 Dec 2007 14:25:30 -0700 Subject: Cell driver state-setter functions, basic tile get/put, glClear. The state setting code was mostly just copied from the softpipe driver. The SPUs can now get/put framebuffer tiles from/to main memory and clear them to a given color. Lots of debug code in effect. Tiled framebuffer is displayed in X window via the xmwinsys layer. To enable Cell driver, export GALLIUM_CELL=1 --- src/mesa/pipe/cell/ppu/cell_state_surface.c | 99 +++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/mesa/pipe/cell/ppu/cell_state_surface.c (limited to 'src/mesa/pipe/cell/ppu/cell_state_surface.c') diff --git a/src/mesa/pipe/cell/ppu/cell_state_surface.c b/src/mesa/pipe/cell/ppu/cell_state_surface.c new file mode 100644 index 0000000000..f7330caf5e --- /dev/null +++ b/src/mesa/pipe/cell/ppu/cell_state_surface.c @@ -0,0 +1,99 @@ + + +#include "cell_context.h" +#include "cell_state.h" + +void +cell_set_framebuffer_state(struct pipe_context *pipe, + const struct pipe_framebuffer_state *fb) +{ + struct cell_context *cell = cell_context(pipe); + + cell->framebuffer = *fb; + + cell->dirty |= CELL_NEW_FRAMEBUFFER; + +#if 0 + struct pipe_surface *ps; + uint i; + + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + /* check if changing cbuf */ + if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) { + /* flush old */ + sp_flush_tile_cache(sp, sp->cbuf_cache[i]); + /* unmap old */ + ps = sp->framebuffer.cbufs[i]; + if (ps && ps->map) + pipe_surface_unmap(ps); + /* map new */ + ps = fb->cbufs[i]; + if (ps) + pipe_surface_map(ps); + /* assign new */ + sp->framebuffer.cbufs[i] = fb->cbufs[i]; + + /* update cache */ + sp_tile_cache_set_surface(sp, sp->cbuf_cache[i], ps); + } + } + + sp->framebuffer.num_cbufs = fb->num_cbufs; + + /* zbuf changing? */ + if (sp->framebuffer.zbuf != fb->zbuf) { + /* flush old */ + sp_flush_tile_cache(sp, sp->zbuf_cache); + /* unmap old */ + ps = sp->framebuffer.zbuf; + if (ps && ps->map) + pipe_surface_unmap(ps); + if (sp->framebuffer.sbuf == sp->framebuffer.zbuf) { + /* combined z/stencil */ + sp->framebuffer.sbuf = NULL; + } + /* map new */ + ps = fb->zbuf; + if (ps) + pipe_surface_map(ps); + /* assign new */ + sp->framebuffer.zbuf = fb->zbuf; + + /* update cache */ + sp_tile_cache_set_surface(sp, sp->zbuf_cache, ps); + } + + /* XXX combined depth/stencil here */ + + /* sbuf changing? */ + if (sp->framebuffer.sbuf != fb->sbuf) { + /* flush old */ + sp_flush_tile_cache(sp, sp->sbuf_cache_sep); + /* unmap old */ + ps = sp->framebuffer.sbuf; + if (ps && ps->map) + pipe_surface_unmap(ps); + /* map new */ + ps = fb->sbuf; + if (ps && fb->sbuf != fb->zbuf) + pipe_surface_map(ps); + /* assign new */ + sp->framebuffer.sbuf = fb->sbuf; + + /* update cache */ + if (fb->sbuf != fb->zbuf) { + /* separate stencil buf */ + sp->sbuf_cache = sp->sbuf_cache_sep; + sp_tile_cache_set_surface(sp, sp->sbuf_cache, ps); + } + else { + /* combined depth/stencil */ + sp->sbuf_cache = sp->zbuf_cache; + sp_tile_cache_set_surface(sp, sp->sbuf_cache, ps); + } + } + + sp->dirty |= SP_NEW_FRAMEBUFFER; +#endif +} + -- cgit v1.2.3