diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-25 09:01:36 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-25 17:25:56 -0700 |
commit | 4d534124e77109a0405bf68dc3fa1a370f5ea014 (patch) | |
tree | 808777435cd82a0cc088892a63f440ec80173532 /src/mesa/pipe/cell/ppu | |
parent | 42d38ac02fff63406cd59914a3eb1e5ad27134d0 (diff) |
Cell: emit framebuffer state like other state
Plus misc clean-up. Window resize sometimes works now.
Diffstat (limited to 'src/mesa/pipe/cell/ppu')
-rw-r--r-- | src/mesa/pipe/cell/ppu/cell_state_emit.c | 14 | ||||
-rw-r--r-- | src/mesa/pipe/cell/ppu/cell_state_surface.c | 118 |
2 files changed, 15 insertions, 117 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.c b/src/mesa/pipe/cell/ppu/cell_state_emit.c index e5b7c92514..dbca900c35 100644 --- a/src/mesa/pipe/cell/ppu/cell_state_emit.c +++ b/src/mesa/pipe/cell/ppu/cell_state_emit.c @@ -36,6 +36,20 @@ void cell_emit_state(struct cell_context *cell) { + if (cell->dirty & CELL_NEW_FRAMEBUFFER) { + struct pipe_surface *cbuf = cell->framebuffer.cbufs[0]; + struct pipe_surface *zbuf = cell->framebuffer.zsbuf; + struct cell_command_framebuffer *fb + = cell_batch_alloc(cell, sizeof(*fb)); + fb->opcode = CELL_CMD_STATE_FRAMEBUFFER; + fb->color_start = cell->cbuf_map[0]; + fb->color_format = cbuf->format; + fb->depth_start = cell->zsbuf_map; + fb->depth_format = zbuf ? zbuf->format : PIPE_FORMAT_NONE; + fb->width = cell->framebuffer.cbufs[0]->width; + fb->height = cell->framebuffer.cbufs[0]->height; + } + if (cell->dirty & CELL_NEW_DEPTH_STENCIL) { uint cmd = CELL_CMD_STATE_DEPTH_STENCIL; cell_batch_append(cell, &cmd, 4); diff --git a/src/mesa/pipe/cell/ppu/cell_state_surface.c b/src/mesa/pipe/cell/ppu/cell_state_surface.c index 1f7faca080..287610b76b 100644 --- a/src/mesa/pipe/cell/ppu/cell_state_surface.c +++ b/src/mesa/pipe/cell/ppu/cell_state_surface.c @@ -27,10 +27,8 @@ #include "pipe/p_inlines.h" -#include "cell_batch.h" #include "cell_context.h" #include "cell_state.h" -#include "cell_spu.h" void @@ -39,14 +37,11 @@ cell_set_framebuffer_state(struct pipe_context *pipe, { struct cell_context *cell = cell_context(pipe); - /* XXX revisit this memcmp! */ - if (memcmp(&cell->framebuffer, fb, sizeof(*fb))) { + if (1 /*memcmp(&cell->framebuffer, fb, sizeof(*fb))*/) { struct pipe_surface *csurf = fb->cbufs[0]; struct pipe_surface *zsurf = fb->zsbuf; uint i; - /* change in fb state */ - /* unmap old surfaces */ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { if (cell->framebuffer.cbufs[i] && cell->cbuf_map[i]) { @@ -70,118 +65,7 @@ cell_set_framebuffer_state(struct pipe_context *pipe, if (zsurf) cell->zsbuf_map = pipe_surface_map(zsurf); -#if 0 - for (i = 0; i < cell->num_spus; i++) { - struct cell_command_framebuffer *fb = &cell_global.command[i].fb; - fb->opcode = CELL_CMD_FRAMEBUFFER; - fb->color_start = csurf->map; - fb->color_format = csurf->format; - fb->depth_start = zsurf ? zsurf->map : NULL; - fb->depth_format = zsurf ? zsurf->format : PIPE_FORMAT_NONE; - fb->width = csurf->width; - fb->height = csurf->height; - send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_FRAMEBUFFER); - } -#endif -#if 1 - { - struct cell_command_framebuffer *fb - = cell_batch_alloc(cell, sizeof(*fb)); - fb->opcode = CELL_CMD_FRAMEBUFFER; - fb->color_start = cell->cbuf_map[0]; - fb->color_format = csurf->format; - fb->depth_start = cell->zsbuf_map; - fb->depth_format = zsurf ? zsurf->format : PIPE_FORMAT_NONE; - fb->width = csurf->width; - fb->height = csurf->height; - /*cell_batch_flush(cell);*/ - /*cell_flush(&cell->pipe, 0x0);*/ - } -#endif 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 } |