From 8ea416f35de0c664ef47b71841756758f22d7faa Mon Sep 17 00:00:00 2001 From: Christian König Date: Wed, 4 Jan 2012 14:46:33 +0100 Subject: vl: move away from state like parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Again based on Maartens work, but keep begin_frame and end_frame functions for now. Signed-off-by: Christian König --- src/gallium/drivers/nouveau/nouveau_video.c | 63 +++++++++++------------------ 1 file changed, 23 insertions(+), 40 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c index 055f9253fa5..2f9f1ca74eb 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.c +++ b/src/gallium/drivers/nouveau/nouveau_video.c @@ -424,44 +424,33 @@ nouveau_decoder_surface_index(struct nouveau_decoder *dec, } static void -nouveau_decoder_set_picture_parameters(struct pipe_video_decoder *decoder, - struct pipe_picture_desc *picture_desc) +nouveau_decoder_begin_frame(struct pipe_video_decoder *decoder, + struct pipe_video_buffer *target, + struct pipe_picture_desc *picture) { - struct nouveau_decoder *dec = (struct nouveau_decoder *)decoder; - struct pipe_mpeg12_picture_desc *desc; - desc = (struct pipe_mpeg12_picture_desc *)picture_desc; - dec->picture_structure = desc->picture_structure; -} - -static void -nouveau_decoder_set_reference_frames(struct pipe_video_decoder *decoder, - struct pipe_video_buffer **buffers, - unsigned count) -{ - struct nouveau_decoder *dec = (struct nouveau_decoder *)decoder; - if (count >= 1 && buffers[0]) - dec->past = nouveau_decoder_surface_index(dec, buffers[0]); - if (count >= 2 && buffers[1]) - dec->future = nouveau_decoder_surface_index(dec, buffers[1]); -} - -static void -nouveau_decoder_set_decode_target(struct pipe_video_decoder *decoder, - struct pipe_video_buffer *buffer) -{ - struct nouveau_decoder *dec = (struct nouveau_decoder *)decoder; - dec->current = nouveau_decoder_surface_index(dec, buffer); } static void nouveau_decoder_decode_macroblock(struct pipe_video_decoder *decoder, + struct pipe_video_buffer *target, + struct pipe_picture_desc *picture, const struct pipe_macroblock *pipe_mb, unsigned num_macroblocks) { struct nouveau_decoder *dec = (struct nouveau_decoder *)decoder; + struct pipe_mpeg12_picture_desc *desc = (struct pipe_mpeg12_picture_desc*)picture; const struct pipe_mpeg12_macroblock *mb; unsigned i; + assert(target->width == decoder->width); + assert(target->height == decoder->height); + + dec->current = nouveau_decoder_surface_index(dec, target); assert(dec->current < 8); + dec->picture_structure = desc->picture_structure; + if (desc->ref[1]) + dec->future = nouveau_decoder_surface_index(dec, desc->ref[1]); + if (desc->ref[0]) + dec->past = nouveau_decoder_surface_index(dec, desc->ref[0]); if (nouveau_vpe_init(dec)) return; mb = (const struct pipe_mpeg12_macroblock *)pipe_mb; @@ -483,6 +472,13 @@ nouveau_decoder_decode_macroblock(struct pipe_video_decoder *decoder, } } +static void +nouveau_decoder_end_frame(struct pipe_video_decoder *decoder, + struct pipe_video_buffer *target, + struct pipe_picture_desc *picture) +{ +} + static void nouveau_decoder_flush(struct pipe_video_decoder *decoder) { @@ -511,16 +507,6 @@ nouveau_decoder_destroy(struct pipe_video_decoder *decoder) FREE(dec); } -static void -nouveau_decoder_begin_frame(struct pipe_video_decoder *decoder) -{ -} - -static void -nouveau_decoder_end_frame(struct pipe_video_decoder *decoder) -{ -} - static struct pipe_video_decoder * nouveau_create_decoder(struct pipe_context *context, struct nouveau_screen *screen, @@ -573,11 +559,8 @@ nouveau_create_decoder(struct pipe_context *context, dec->base.max_references = max_references; dec->base.destroy = nouveau_decoder_destroy; dec->base.begin_frame = nouveau_decoder_begin_frame; - dec->base.end_frame = nouveau_decoder_end_frame; - dec->base.set_decode_target = nouveau_decoder_set_decode_target; - dec->base.set_picture_parameters = nouveau_decoder_set_picture_parameters; - dec->base.set_reference_frames = nouveau_decoder_set_reference_frames; dec->base.decode_macroblock = nouveau_decoder_decode_macroblock; + dec->base.begin_frame = nouveau_decoder_end_frame; dec->base.flush = nouveau_decoder_flush; dec->screen = screen; -- cgit v1.2.3