From abee68a7220e5ee16216caf22841ad934fb37334 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 9 Jan 2008 14:10:59 -0700 Subject: Cell: implemement basic Z testing Also, improve some surface clearing code --- src/mesa/pipe/cell/ppu/cell_spu.c | 3 ++- src/mesa/pipe/cell/ppu/cell_surface.c | 47 ++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 24 deletions(-) (limited to 'src/mesa/pipe/cell/ppu') diff --git a/src/mesa/pipe/cell/ppu/cell_spu.c b/src/mesa/pipe/cell/ppu/cell_spu.c index 15b89682fa..a7dbf24dd8 100644 --- a/src/mesa/pipe/cell/ppu/cell_spu.c +++ b/src/mesa/pipe/cell/ppu/cell_spu.c @@ -176,7 +176,8 @@ test_spus(struct cell_context *cell) for (i = 0; i < cell->num_spus; i++) { cell_global.command[i].clear.value = 0xff880044; /* XXX */ - send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_CLEAR_TILES); + cell_global.command[i].clear.surface = 0; + send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_CLEAR_SURFACE); } finish_all(cell->num_spus); diff --git a/src/mesa/pipe/cell/ppu/cell_surface.c b/src/mesa/pipe/cell/ppu/cell_surface.c index 62e0febc0c..1e1548c8b6 100644 --- a/src/mesa/pipe/cell/ppu/cell_surface.c +++ b/src/mesa/pipe/cell/ppu/cell_surface.c @@ -47,42 +47,43 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps, { struct cell_context *cell = cell_context(pipe); uint i; + uint surfIndex; if (!ps->map) pipe_surface_map(ps); - if (pf_get_size(ps->format) != 4) { - printf("Cell: Skipping non 32bpp clear_surface\n"); - return; + if (ps == cell->framebuffer.zbuf) { + surfIndex = 1; } -#if 0 - for (i = 0; i < cell->num_spus; i++) { - struct cell_command_framebuffer *fb = &cell_global.command[i].fb; - printf("%s %u start = 0x%x\n", __FUNCTION__, i, ps->map); - fb->color_start = ps->map; - fb->width = ps->width; - fb->height = ps->height; - fb->color_format = ps->format; - send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_FRAMEBUFFER); + else { + surfIndex = 0; } -#endif + + printf("Clear surf %u\n", surfIndex); for (i = 0; i < cell->num_spus; i++) { #if 1 uint clr = clearValue; - /* XXX debug: clear color varied per-SPU to visualize tiles */ - if ((clr & 0xff) == 0) - clr |= 64 + i * 8; - if ((clr & 0xff00) == 0) - clr |= (64 + i * 8) << 8; - if ((clr & 0xff0000) == 0) - clr |= (64 + i * 8) << 16; - if ((clr & 0xff000000) == 0) - clr |= (64 + i * 8) << 24; + if (surfIndex == 0) { + /* XXX debug: clear color varied per-SPU to visualize tiles */ + if ((clr & 0xff) == 0) + clr |= 64 + i * 8; + if ((clr & 0xff00) == 0) + clr |= (64 + i * 8) << 8; + if ((clr & 0xff0000) == 0) + clr |= (64 + i * 8) << 16; + if ((clr & 0xff000000) == 0) + clr |= (64 + i * 8) << 24; + } cell_global.command[i].clear.value = clr; #else cell_global.command[i].clear.value = clearValue; #endif - send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_CLEAR_TILES); + cell_global.command[i].clear.surface = surfIndex; + send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_CLEAR_SURFACE); } + + /* XXX temporary */ + cell_flush(&cell->pipe, 0x0); + } -- cgit v1.2.3