aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/pipe/cell/common.h3
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/pipe/cell/common.h b/src/mesa/pipe/cell/common.h
index b9a00ccbb5f..5c437daac6f 100644
--- a/src/mesa/pipe/cell/common.h
+++ b/src/mesa/pipe/cell/common.h
@@ -43,6 +43,9 @@
assert((((unsigned long) (ptr)) & 0xf) == 0);
+/** round up value to next multiple of 16 */
+#define ROUNDUP16(k) (((k) + 0xf) & ~0xf)
+
#define TILE_SIZE 32
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c
index 03dbef051b5..1d0de7b1f9e 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/mesa/pipe/cell/spu/spu_main.c
@@ -234,7 +234,7 @@ cmd_render(const struct cell_command_render *render)
if (total_index_bytes < 16)
total_index_bytes = 16;
else
- total_index_bytes = (total_index_bytes + 15) & ~0xf; /* multiple of 16 */
+ total_index_bytes = ROUNDUP16(total_index_bytes);
/*
printf("VBUF: indices at %p, vertices at %p total_vertex_bytes %u ind_bytes %u\n",
@@ -457,10 +457,9 @@ cmd_batch(uint opcode)
ASSERT_ALIGN16(spu.init.batch_buffers[buf]);
- size = (size + 0xf) & ~0xf;
+ size = ROUNDUP16(size);
- ASSERT(size % 16 == 0);
- ASSERT((unsigned int) spu.init.batch_buffers[buf] % 16 == 0);
+ ASSERT_ALIGN16(spu.init.batch_buffers[buf]);
mfc_get(buffer, /* dest */
(unsigned int) spu.init.batch_buffers[buf], /* src */