summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/cell/common.h2
-rw-r--r--src/mesa/pipe/cell/ppu/cell_vbuf.c4
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.c30
3 files changed, 24 insertions, 12 deletions
diff --git a/src/mesa/pipe/cell/common.h b/src/mesa/pipe/cell/common.h
index d6e1dd4f7d5..5e32b209e6a 100644
--- a/src/mesa/pipe/cell/common.h
+++ b/src/mesa/pipe/cell/common.h
@@ -122,7 +122,7 @@ struct cell_command_render
uint dummy; /* XXX this dummy field works around a compiler bug */
uint num_indexes;
uint vertex_buf; /**< which cell->buffer[] contains the vertex data */
- float xmin, ymin, xmax, ymax;
+ float xmin, dummy2, ymin, xmax, ymax; /* XXX another dummy field */
boolean inline_verts;
} ALIGN16_ATTRIB;
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/mesa/pipe/cell/ppu/cell_vbuf.c
index b2a25d767b7..9f737287adb 100644
--- a/src/mesa/pipe/cell/ppu/cell_vbuf.c
+++ b/src/mesa/pipe/cell/ppu/cell_vbuf.c
@@ -180,6 +180,10 @@ cell_vbuf_draw(struct vbuf_render *vbr,
if (v[1] > ymax)
ymax = v[1];
}
+#if 0
+ printf("PPU Bounds %g, %g .. %g, %g\n", xmin, ymin, xmax, ymax);
+ fflush(stdout);
+#endif
if (cvbr->prim != PIPE_PRIM_TRIANGLES)
return; /* only render tris for now */
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c
index 62f6a357ba3..c2b05ed5a2b 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/mesa/pipe/cell/spu/spu_main.c
@@ -200,7 +200,7 @@ tile_bounding_box(const struct cell_command_render *render,
uint *txmin, uint *tymin,
uint *box_num_tiles, uint *box_width_tiles)
{
-#if 1
+#if 0
/* Debug: full-window bounding box */
uint txmax = spu.fb.width_tiles - 1;
uint tymax = spu.fb.height_tiles - 1;
@@ -223,13 +223,24 @@ tile_bounding_box(const struct cell_command_render *render,
*box_num_tiles = *box_width_tiles * box_height_tiles;
#endif
#if 0
- printf("Render bounds: %g, %g ... %g, %g\n",
+ printf("SPU %u: bounds: %g, %g ... %g, %g\n", spu.init.id,
render->xmin, render->ymin, render->xmax, render->ymax);
- printf("Render tiles: %u, %u .. %u, %u\n", *txmin, *tymin, txmax, tymax);
+ printf("SPU %u: tiles: %u, %u .. %u, %u\n",
+ spu.init.id, *txmin, *tymin, txmax, tymax);
+ ASSERT(render->xmin <= render->xmax);
+ ASSERT(render->ymin <= render->ymax);
#endif
}
+/** Check if the tile at (tx,ty) belongs to this SPU */
+static INLINE boolean
+my_tile(uint tx, uint ty)
+{
+ return (spu.fb.width_tiles * ty + tx) % spu.init.num_spus == spu.init.id;
+}
+
+
/**
* Render primitives
* \param pos_incr returns value indicating how may words to skip after
@@ -295,15 +306,9 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
** find tiles which intersect the prim bounding box
**/
uint txmin, tymin, box_width_tiles, box_num_tiles;
-#if 0
tile_bounding_box(render, &txmin, &tymin,
&box_num_tiles, &box_width_tiles);
-#else
- txmin = 0;
- tymin = 0;
- box_num_tiles = spu.fb.width_tiles * spu.fb.height_tiles;
- box_width_tiles = spu.fb.width_tiles;
-#endif
+
/* make sure any pending clears have completed */
wait_on_mask(1 << TAG_SURFACE_CLEAR); /* XXX temporary */
@@ -312,13 +317,16 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
/**
** loop over tiles, rendering tris
**/
- for (i = spu.init.id; i < box_num_tiles; i += spu.init.num_spus) {
+ for (i = 0; i < box_num_tiles; i++) {
const uint tx = txmin + i % box_width_tiles;
const uint ty = tymin + i / box_width_tiles;
ASSERT(tx < spu.fb.width_tiles);
ASSERT(ty < spu.fb.height_tiles);
+ if (!my_tile(tx, ty))
+ continue;
+
/* Start fetching color/z tiles. We'll wait for completion when
* we need read/write to them later in triangle rasterization.
*/