summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/cell/ppu
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-02-04 18:05:37 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-02-04 18:05:37 -0700
commit5db1593c78192b764ad2ef7bdc5182d8ec4aed7c (patch)
tree3933e394cc5b3f938160493e1d7075e96aec3584 /src/mesa/pipe/cell/ppu
parent684d320ea2e7ec03d01275a544068cc6b45e1e9a (diff)
Cell: fix some alignment issues by aligning commands to 8-byte boundaries
Contributed by Ian Romanick. Also, temporarily disable inlined vertex buffers. They need to be 16-byte aligned...
Diffstat (limited to 'src/mesa/pipe/cell/ppu')
-rw-r--r--src/mesa/pipe/cell/ppu/cell_batch.c4
-rw-r--r--src/mesa/pipe/cell/ppu/cell_flush.c2
-rw-r--r--src/mesa/pipe/cell/ppu/cell_state_emit.c3
-rw-r--r--src/mesa/pipe/cell/ppu/cell_vbuf.c4
-rw-r--r--src/mesa/pipe/cell/ppu/cell_vertex_shader.c22
5 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_batch.c b/src/mesa/pipe/cell/ppu/cell_batch.c
index 2d032fc902..2fb49711b2 100644
--- a/src/mesa/pipe/cell/ppu/cell_batch.c
+++ b/src/mesa/pipe/cell/ppu/cell_batch.c
@@ -136,7 +136,7 @@ cell_batch_append(struct cell_context *cell, const void *data, uint bytes)
{
uint size;
- ASSERT(bytes % 4 == 0);
+ ASSERT(bytes % 8 == 0);
ASSERT(bytes <= CELL_BUFFER_SIZE);
ASSERT(cell->cur_batch >= 0);
@@ -171,7 +171,7 @@ cell_batch_alloc(struct cell_context *cell, uint bytes)
void *pos;
uint size;
- ASSERT(bytes % 4 == 0);
+ ASSERT(bytes % 8 == 0);
ASSERT(bytes <= CELL_BUFFER_SIZE);
assert(cell->cur_batch >= 0);
diff --git a/src/mesa/pipe/cell/ppu/cell_flush.c b/src/mesa/pipe/cell/ppu/cell_flush.c
index cf4e676645..f62bc4650c 100644
--- a/src/mesa/pipe/cell/ppu/cell_flush.c
+++ b/src/mesa/pipe/cell/ppu/cell_flush.c
@@ -59,7 +59,7 @@ cell_flush_int(struct pipe_context *pipe, unsigned flags)
flushing = TRUE;
if (flags & PIPE_FLUSH_WAIT) {
- uint *cmd = (uint *) cell_batch_alloc(cell, sizeof(uint));
+ uint64_t *cmd = (uint64_t *) cell_batch_alloc(cell, sizeof(uint64_t));
*cmd = CELL_CMD_FINISH;
}
diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.c b/src/mesa/pipe/cell/ppu/cell_state_emit.c
index 3b2670f786..5d2a786449 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_emit.c
+++ b/src/mesa/pipe/cell/ppu/cell_state_emit.c
@@ -37,7 +37,8 @@ static void
emit_state_cmd(struct cell_context *cell, uint cmd,
const void *state, uint state_size)
{
- uint *dst = (uint *) cell_batch_alloc(cell, sizeof(uint) + state_size);
+ uint64_t *dst = (uint64_t *)
+ cell_batch_alloc(cell, ROUNDUP8(sizeof(uint64_t) + state_size));
*dst = cmd;
memcpy(dst + 1, state, state_size);
}
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/mesa/pipe/cell/ppu/cell_vbuf.c
index e63b34cf52..0fee61821a 100644
--- a/src/mesa/pipe/cell/ppu/cell_vbuf.c
+++ b/src/mesa/pipe/cell/ppu/cell_vbuf.c
@@ -40,7 +40,7 @@
/** Allow vertex data to be inlined after RENDER command */
-#define ALLOW_INLINE_VERTS 1
+#define ALLOW_INLINE_VERTS 0
/**
@@ -197,7 +197,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
/* build/insert batch RENDER command */
{
- const uint index_bytes = ROUNDUP4(nr_indices * 2);
+ const uint index_bytes = ROUNDUP8(nr_indices * 2);
const uint vertex_bytes = nr_vertices * 4 * cell->vertex_info.size;
const uint batch_size = sizeof(struct cell_command_render)
diff --git a/src/mesa/pipe/cell/ppu/cell_vertex_shader.c b/src/mesa/pipe/cell/ppu/cell_vertex_shader.c
index aef329a902..80dd500b34 100644
--- a/src/mesa/pipe/cell/ppu/cell_vertex_shader.c
+++ b/src/mesa/pipe/cell/ppu/cell_vertex_shader.c
@@ -52,8 +52,8 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
struct cell_context *const cell =
(struct cell_context *) draw->driver_private;
struct cell_command_vs *const vs = &cell_global.command[0].vs;
- unsigned *batch;
- struct cell_array_info array_info;
+ uint64_t *batch;
+ struct cell_array_info *array_info;
unsigned i, j;
assert(draw->vs.queue_nr != 0);
@@ -63,17 +63,19 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
draw_update_vertex_fetch(draw);
for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) {
- array_info.opcode = CELL_CMD_STATE_VS_ARRAY_INFO;
- assert(draw->vertex_fetch.src_ptr[i] != NULL);
- array_info.base = (uintptr_t) draw->vertex_fetch.src_ptr[i];
- array_info.attr = i;
- array_info.pitch = draw->vertex_fetch.pitch[i];
- array_info.format = draw->vertex_element[i].src_format;
+ batch = cell_batch_alloc(cell, sizeof(batch[0]) + sizeof(*array_info));
+
+ batch[0] = CELL_CMD_STATE_VS_ARRAY_INFO;
- cell_batch_append(cell, & array_info, sizeof(array_info));
+ array_info = (struct cell_array_info *) &batch[1];
+ assert(draw->vertex_fetch.src_ptr[i] != NULL);
+ array_info->base = (uintptr_t) draw->vertex_fetch.src_ptr[i];
+ array_info->attr = i;
+ array_info->pitch = draw->vertex_fetch.pitch[i];
+ array_info->format = draw->vertex_element[i].src_format;
}
- batch = cell_batch_alloc(cell, sizeof(unsigned)
+ batch = cell_batch_alloc(cell, sizeof(batch[0])
+ sizeof(struct pipe_viewport_state));
batch[0] = CELL_CMD_STATE_VIEWPORT;
(void) memcpy(&batch[1], &draw->viewport,