From eff70f67c558c90c5419b43729a6dc8a9a8c47ec Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 14 Jan 2008 11:11:08 -0700 Subject: Cell: update surface map code to match recent changes in pipe_surface struct --- src/mesa/pipe/cell/ppu/cell_context.h | 2 ++ src/mesa/pipe/cell/ppu/cell_spu.c | 6 +++--- src/mesa/pipe/cell/ppu/cell_state_surface.c | 21 +++++++++++---------- src/mesa/pipe/cell/ppu/cell_surface.c | 4 ++-- 4 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src/mesa/pipe/cell/ppu') diff --git a/src/mesa/pipe/cell/ppu/cell_context.h b/src/mesa/pipe/cell/ppu/cell_context.h index 94d8f08da8..43e32a8abb 100644 --- a/src/mesa/pipe/cell/ppu/cell_context.h +++ b/src/mesa/pipe/cell/ppu/cell_context.h @@ -78,6 +78,8 @@ struct cell_context struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX]; struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX]; + ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS]; + ubyte *zbuf_map; uint dirty; diff --git a/src/mesa/pipe/cell/ppu/cell_spu.c b/src/mesa/pipe/cell/ppu/cell_spu.c index 88a620e669..77ddd9ccbf 100644 --- a/src/mesa/pipe/cell/ppu/cell_spu.c +++ b/src/mesa/pipe/cell/ppu/cell_spu.c @@ -168,8 +168,8 @@ test_spus(struct cell_context *cell) sleep(2); for (i = 0; i < cell->num_spus; i++) { - cell_global.command[i].fb.color_start = csurf->map; - cell_global.command[i].fb.depth_start = zsurf ? zsurf->map : NULL; + cell_global.command[i].fb.color_start = cell->cbuf_map[0]; + cell_global.command[i].fb.depth_start = cell->zbuf_map; cell_global.command[i].fb.width = csurf->width; cell_global.command[i].fb.height = csurf->height; cell_global.command[i].fb.color_format = PIPE_FORMAT_A8R8G8B8_UNORM; @@ -186,7 +186,7 @@ test_spus(struct cell_context *cell) finish_all(cell->num_spus); { - uint *b = (uint*) csurf->map; + uint *b = (uint*) cell->cbuf_map[0]; printf("PPU: Clear results: 0x%x 0x%x 0x%x 0x%x\n", b[0], b[1000], b[2000], b[3000]); } diff --git a/src/mesa/pipe/cell/ppu/cell_state_surface.c b/src/mesa/pipe/cell/ppu/cell_state_surface.c index ff8fdbd334..9bf3c339d2 100644 --- a/src/mesa/pipe/cell/ppu/cell_state_surface.c +++ b/src/mesa/pipe/cell/ppu/cell_state_surface.c @@ -39,6 +39,7 @@ 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))) { struct pipe_surface *csurf = fb->cbufs[0]; struct pipe_surface *zsurf = fb->zbuf; @@ -48,26 +49,26 @@ cell_set_framebuffer_state(struct pipe_context *pipe, /* unmap old surfaces */ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - if (cell->framebuffer.cbufs[i] && - cell->framebuffer.cbufs[i]->map) { + if (cell->framebuffer.cbufs[i] && cell->cbuf_map[i]) { pipe_surface_unmap(cell->framebuffer.cbufs[i]); + cell->cbuf_map[i] = NULL; } } - if (cell->framebuffer.zbuf && - cell->framebuffer.zbuf->map) { + if (cell->framebuffer.zbuf && cell->zbuf_map) { pipe_surface_unmap(cell->framebuffer.zbuf); + cell->zbuf_map = NULL; } /* update my state */ cell->framebuffer = *fb; /* map new surfaces */ - if (csurf && !csurf->map) - pipe_surface_map(csurf); + if (csurf) + cell->cbuf_map[0] = pipe_surface_map(csurf); - if (zsurf && !zsurf->map) - pipe_surface_map(zsurf); + if (zsurf) + cell->zbuf_map = pipe_surface_map(zsurf); #if 0 for (i = 0; i < cell->num_spus; i++) { @@ -87,9 +88,9 @@ cell_set_framebuffer_state(struct pipe_context *pipe, struct cell_command_framebuffer *fb = cell_batch_alloc(cell, sizeof(*fb)); fb->opcode = CELL_CMD_FRAMEBUFFER; - fb->color_start = csurf->map; + fb->color_start = cell->cbuf_map[0]; fb->color_format = csurf->format; - fb->depth_start = zsurf ? zsurf->map : NULL; + fb->depth_start = cell->zbuf_map; fb->depth_format = zsurf ? zsurf->format : PIPE_FORMAT_NONE; fb->width = csurf->width; fb->height = csurf->height; diff --git a/src/mesa/pipe/cell/ppu/cell_surface.c b/src/mesa/pipe/cell/ppu/cell_surface.c index ea1c2bd644..53c5325ddd 100644 --- a/src/mesa/pipe/cell/ppu/cell_surface.c +++ b/src/mesa/pipe/cell/ppu/cell_surface.c @@ -50,8 +50,8 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps, uint i; uint surfIndex; - if (!ps->map) - pipe_surface_map(ps); + if (!cell->cbuf_map[0]) + cell->cbuf_map[0] = pipe_surface_map(ps); if (ps == cell->framebuffer.zbuf) { surfIndex = 1; -- cgit v1.2.3