summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-04-03 20:49:15 +0200
committerChristian König <[email protected]>2011-04-03 20:49:15 +0200
commit087e17f52e6391cecc002066f53dadc8f1b53074 (patch)
tree57398150665a1092e6ee858b0d554bd6ddecad6d
parente6176ce3719e6c6e88d31ae7307154386e83553b (diff)
[g3dvl] fix vertex buffer size calculation
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_context.c4
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_context.h1
-rw-r--r--src/gallium/auxiliary/vl/vl_vertex_buffers.c1
3 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c
index d8605398d49..0eab9e3c614 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c
@@ -332,7 +332,8 @@ vl_mpeg12_create_buffer(struct pipe_video_context *vpipe)
pipe_resource_reference(&buffer->vertex_bufs.individual.quad.buffer, ctx->quads.buffer);
buffer->vertex_bufs.individual.stream = vl_vb_init(&buffer->vertex_stream, ctx->pipe,
- ctx->vertex_buffer_size);
+ ctx->buffer_width / MACROBLOCK_WIDTH *
+ ctx->buffer_height / MACROBLOCK_HEIGHT);
if (!buffer->vertex_bufs.individual.stream.buffer)
goto error_vertex_stream;
@@ -691,7 +692,6 @@ vl_create_mpeg12_context(struct pipe_context *pipe,
ctx->pot_buffers = pot_buffers;
ctx->quads = vl_vb_upload_quads(ctx->pipe, 2, 2);
- ctx->vertex_buffer_size = width / MACROBLOCK_WIDTH * height / MACROBLOCK_HEIGHT;
ctx->ves_y = vl_vb_get_elems_state(ctx->pipe, TGSI_SWIZZLE_X);
ctx->ves_cb = vl_vb_get_elems_state(ctx->pipe, TGSI_SWIZZLE_Y);
ctx->ves_cr = vl_vb_get_elems_state(ctx->pipe, TGSI_SWIZZLE_Z);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.h b/src/gallium/auxiliary/vl/vl_mpeg12_context.h
index a90110bf61b..698522f16ea 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_context.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.h
@@ -47,7 +47,6 @@ struct vl_mpeg12_context
const unsigned (*empty_block_mask)[3][2][2];
struct pipe_vertex_buffer quads;
- unsigned vertex_buffer_size;
void *ves_y, *ves_cb, *ves_cr;
struct vl_idct idct_y, idct_c;
diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
index 59aa1e9db75..1094b76ec0d 100644
--- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
+++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
@@ -264,6 +264,7 @@ vl_vb_add_block(struct vl_vertex_buffer *buffer, struct pipe_mpeg12_macroblock *
assert(buffer);
assert(mb);
+ assert(buffer->num_not_empty + buffer->num_empty < buffer->size);
if(mb->cbp)
stream = buffer->start + buffer->num_not_empty++;