summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-07-13 15:01:40 +0200
committerChristian König <[email protected]>2011-07-13 15:01:40 +0200
commit7c48575402e8c384db2fab24e4dd0fc72bef0451 (patch)
tree03d40737db263211c1c79916724ce6c9d7d027e9 /src
parent5e5d7acc2f93ddad8212b00c845dbd6381ee4119 (diff)
[g3dvl] keep a pointer in idct buffer to idct object
So we always know to which idct object a buffer belongs
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/vl/vl_idct.c25
-rw-r--r--src/gallium/auxiliary/vl/vl_idct.h8
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_decoder.c13
3 files changed, 26 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
index 744a35603d7..75e76c09f63 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -791,6 +791,8 @@ vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer,
memset(buffer, 0, sizeof(struct vl_idct_buffer));
+ buffer->idct = idct;
+
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, idct->matrix);
pipe_sampler_view_reference(&buffer->sampler_views.individual.source, source);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, idct->transpose);
@@ -806,22 +808,24 @@ vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer,
}
void
-vl_idct_cleanup_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer)
{
- assert(idct && buffer);
+ assert(buffer);
- cleanup_source(idct, buffer);
- cleanup_intermediate(idct, buffer);
+ cleanup_source(buffer->idct, buffer);
+ cleanup_intermediate(buffer->idct, buffer);
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, NULL);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, NULL);
}
void
-vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_instances)
+vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_instances)
{
- assert(idct);
+ struct vl_idct *idct;
assert(buffer);
+
+ idct = buffer->idct;
idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
idct->pipe->bind_blend_state(idct->pipe, idct->blend);
@@ -844,14 +848,13 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_
}
void
-vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+vl_idct_prepare_stage2(struct vl_idct_buffer *buffer)
{
- assert(idct);
assert(buffer);
/* second stage */
- idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
- idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers);
- idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[1]);
+ buffer->idct->pipe->bind_rasterizer_state(buffer->idct->pipe, buffer->idct->rs_state);
+ buffer->idct->pipe->bind_fragment_sampler_states(buffer->idct->pipe, 2, buffer->idct->samplers);
+ buffer->idct->pipe->set_fragment_sampler_views(buffer->idct->pipe, 2, buffer->sampler_views.stage[1]);
}
diff --git a/src/gallium/auxiliary/vl/vl_idct.h b/src/gallium/auxiliary/vl/vl_idct.h
index 119a53dbf27..98e2c795564 100644
--- a/src/gallium/auxiliary/vl/vl_idct.h
+++ b/src/gallium/auxiliary/vl/vl_idct.h
@@ -58,6 +58,8 @@ struct vl_idct
/* a set of buffers to work with */
struct vl_idct_buffer
{
+ struct vl_idct *idct;
+
struct pipe_viewport_state viewport_mismatch;
struct pipe_viewport_state viewport;
@@ -107,13 +109,13 @@ vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer,
/* cleanup a buffer of an idct instance */
void
-vl_idct_cleanup_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer);
+vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer);
/* flush the buffer and start rendering, vertex buffers needs to be setup before calling this */
void
-vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_verts);
+vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_verts);
void
-vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer);
+vl_idct_prepare_stage2(struct vl_idct_buffer *buffer);
#endif
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 7bb5a695e40..98b0adabb2b 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -177,7 +177,7 @@ init_idct_buffer(struct vl_mpeg12_buffer *buffer)
error_plane:
for (; i > 0; --i)
- vl_idct_cleanup_buffer(i == 1 ? &dec->idct_c : &dec->idct_y, &buffer->idct[i - 1]);
+ vl_idct_cleanup_buffer(&buffer->idct[i - 1]);
error_mc_source_sv:
error_source_sv:
@@ -188,14 +188,15 @@ static void
cleanup_idct_buffer(struct vl_mpeg12_buffer *buf)
{
struct vl_mpeg12_decoder *dec;
+ unsigned i;
+
assert(buf);
dec = (struct vl_mpeg12_decoder*)buf->base.decoder;
assert(dec);
- vl_idct_cleanup_buffer(&dec->idct_y, &buf->idct[0]);
- vl_idct_cleanup_buffer(&dec->idct_c, &buf->idct[1]);
- vl_idct_cleanup_buffer(&dec->idct_c, &buf->idct[2]);
+ for (i = 0; i < 3; ++i)
+ vl_idct_cleanup_buffer(&buf->idct[0]);
}
static bool
@@ -574,7 +575,7 @@ vl_mpeg12_decoder_flush_buffer(struct pipe_video_decode_buffer *buffer,
vl_zscan_render(&buf->zscan[i] , num_ycbcr_blocks[i]);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
- vl_idct_flush(i == 0 ? &dec->idct_y : &dec->idct_c, &buf->idct[i], num_ycbcr_blocks[i]);
+ vl_idct_flush(&buf->idct[i], num_ycbcr_blocks[i]);
}
mc_source_sv = dec->mc_source->get_sampler_view_planes(dec->mc_source);
@@ -589,7 +590,7 @@ vl_mpeg12_decoder_flush_buffer(struct pipe_video_decode_buffer *buffer,
dec->base.context->set_vertex_buffers(dec->base.context, 3, vb);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
- vl_idct_prepare_stage2(component == 0 ? &dec->idct_y : &dec->idct_c, &buf->idct[component]);
+ vl_idct_prepare_stage2(&buf->idct[component]);
else {
dec->base.context->set_fragment_sampler_views(dec->base.context, 1, &mc_source_sv[component]);
dec->base.context->bind_fragment_sampler_states(dec->base.context, 1, &dec->sampler_ycbcr);