Mesa (pipe-video): [g3dvl] fix vertex buffer size calculation
Christian König
deathsimple at kemper.freedesktop.org
Sun Apr 3 19:01:21 UTC 2011
Module: Mesa
Branch: pipe-video
Commit: 087e17f52e6391cecc002066f53dadc8f1b53074
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=087e17f52e6391cecc002066f53dadc8f1b53074
Author: Christian König <deathsimple at vodafone.de>
Date: Sun Apr 3 20:49:15 2011 +0200
[g3dvl] fix vertex buffer size calculation
---
src/gallium/auxiliary/vl/vl_mpeg12_context.c | 4 ++--
src/gallium/auxiliary/vl/vl_mpeg12_context.h | 1 -
src/gallium/auxiliary/vl/vl_vertex_buffers.c | 1 +
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 d860539..0eab9e3 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 a90110b..698522f 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 59aa1e9..1094b76 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++;
More information about the mesa-commit
mailing list