[Mesa-dev] [PATCH 3/6] pipe_video: Get rid of a few pipe_video_decoder members

Maarten Lankhorst m.b.lankhorst at gmail.com
Wed Nov 16 02:49:04 PST 2011


You won't be missed, functionality folded into picture_desc and
decode..

Signed-off-by: Maarten Lankhorst <m.b.lankhorst at gmail.com>
---
 src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c |    4 +-
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c   |   68 ++++++++-----------
 src/gallium/drivers/nouveau/nouveau_video.c    |   26 ++------
 src/gallium/include/pipe/p_video_decoder.h     |   21 +-----
 src/gallium/include/pipe/p_video_state.h       |   15 +---
 src/gallium/state_trackers/vdpau/decode.c      |   86 ++++++++++-------------
 src/gallium/state_trackers/xorg/xvmc/surface.c |   19 ++----
 7 files changed, 85 insertions(+), 154 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index 936cf2c..b586a00 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
@@ -823,7 +823,7 @@ decode_slice(struct vl_mpg12_bs *bs)
       inc += vl_vlc_get_vlclbf(&bs->vlc, tbl_B1, 11);
       if (x != -1) {
          mb.num_skipped_macroblocks = inc - 1;
-         bs->decoder->decode_macroblock(bs->decoder, &mb.base, 1);
+         bs->decoder->decode_macroblock(bs->decoder, NULL, &mb.base, 1);
       }
       mb.x = x += inc;
 
@@ -927,7 +927,7 @@ decode_slice(struct vl_mpg12_bs *bs)
    } while (vl_vlc_bits_left(&bs->vlc) && vl_vlc_peekbits(&bs->vlc, 23));
 
    mb.num_skipped_macroblocks = 0;
-   bs->decoder->decode_macroblock(bs->decoder, &mb.base, 1);
+   bs->decoder->decode_macroblock(bs->decoder, NULL, &mb.base, 1);
    return true;
 }
 
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 32501e0..18ba12d 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -507,24 +507,38 @@ vl_mpeg12_set_picture_parameters(struct pipe_video_decoder *decoder,
 {
    struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
    struct pipe_mpeg12_picture_desc *pic = (struct pipe_mpeg12_picture_desc *)picture;
+   struct pipe_sampler_view **sv;
+   struct vl_video_buffer *ref;
+   int i = 0, j;
 
    assert(dec && pic);
 
    dec->picture_desc = *pic;
-}
+   assert(2 <= VL_MAX_REF_FRAMES);
 
-static void
-vl_mpeg12_set_quant_matrix(struct pipe_video_decoder *decoder,
-                           const struct pipe_quant_matrix *matrix)
-{
-   struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
-   const struct pipe_mpeg12_quant_matrix *m = (const struct pipe_mpeg12_quant_matrix *)matrix;
+   ref = (struct vl_video_buffer *)pic->ref_forward;
+   if (ref) {
+      sv = ref->get_sampler_view_planes(&ref->base);
+      for (j = 0; j < VL_MAX_PLANES; ++j)
+         pipe_sampler_view_reference(&dec->ref_frames[i][j], sv[j]);
+      i++;
+   }
+   ref = (struct vl_video_buffer *)pic->ref_backward;
+   if (ref) {
+      sv = ref->get_sampler_view_planes(&ref->base);
+      for (j = 0; j < VL_MAX_PLANES; ++j)
+         pipe_sampler_view_reference(&dec->ref_frames[i][j], sv[j]);
+      i++;
+   }
 
-   assert(dec);
-   assert(matrix->codec == PIPE_VIDEO_CODEC_MPEG12);
+   for (; i < VL_MAX_REF_FRAMES; ++i)
+      for (j = 0; j < VL_MAX_PLANES; ++j)
+         pipe_sampler_view_reference(&dec->ref_frames[i][j], NULL);
 
-   memcpy(dec->intra_matrix, m->intra_matrix, 64);
-   memcpy(dec->non_intra_matrix, m->non_intra_matrix, 64);
+   if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_BITSTREAM) {
+      memcpy(dec->intra_matrix, pic->intra_matrix, 64);
+      memcpy(dec->non_intra_matrix, pic->non_intra_matrix, 64);
+   }
 }
 
 static void
@@ -543,30 +557,6 @@ vl_mpeg12_set_decode_target(struct pipe_video_decoder *decoder,
 }
 
 static void
-vl_mpeg12_set_reference_frames(struct pipe_video_decoder *decoder,
-                               struct pipe_video_buffer **ref_frames,
-                               unsigned num_ref_frames)
-{
-   struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
-   struct pipe_sampler_view **sv;
-   unsigned i,j;
-
-   assert(dec);
-   assert(num_ref_frames <= VL_MAX_REF_FRAMES);
-
-   for (i = 0; i < num_ref_frames; ++i) {
-      struct vl_video_buffer *ref = (struct vl_video_buffer *)ref_frames[i];
-      sv = ref->get_sampler_view_planes(&ref->base);
-      for (j = 0; j < VL_MAX_PLANES; ++j)
-         pipe_sampler_view_reference(&dec->ref_frames[i][j], sv[j]);
-   }
-
-   for (; i < VL_MAX_REF_FRAMES; ++i)
-      for (j = 0; j < VL_MAX_PLANES; ++j)
-         pipe_sampler_view_reference(&dec->ref_frames[i][j], NULL);
-}
-
-static void
 vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder)
 {
    struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
@@ -626,6 +616,7 @@ vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder)
 
 static void
 vl_mpeg12_decode_macroblock(struct pipe_video_decoder *decoder,
+                            struct pipe_video_buffer *target,
                             const struct pipe_macroblock *macroblocks,
                             unsigned num_macroblocks)
 {
@@ -640,6 +631,8 @@ vl_mpeg12_decode_macroblock(struct pipe_video_decoder *decoder,
 
    buf = dec->current_buffer;
    assert(buf);
+   if (target)
+      vl_mpeg12_set_decode_target(&dec->base, target);
 
    for (; num_macroblocks > 0; --num_macroblocks) {
       unsigned mb_addr = mb->y * dec->width_in_macroblocks + mb->x;
@@ -693,6 +686,7 @@ vl_mpeg12_decode_macroblock(struct pipe_video_decoder *decoder,
 
 static void
 vl_mpeg12_decode_bitstream(struct pipe_video_decoder *decoder,
+                           struct pipe_video_buffer *target,
                            unsigned num_bytes, const void *data)
 {
    struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
@@ -701,6 +695,7 @@ vl_mpeg12_decode_bitstream(struct pipe_video_decoder *decoder,
    unsigned i;
 
    assert(dec && dec->current_buffer);
+   vl_mpeg12_set_decode_target(&dec->base, target);
 
    buf = dec->current_buffer;
    assert(buf);
@@ -1066,9 +1061,6 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
    dec->base.destroy_buffer = vl_mpeg12_destroy_buffer;
    dec->base.set_decode_buffer = vl_mpeg12_set_decode_buffer;
    dec->base.set_picture_parameters = vl_mpeg12_set_picture_parameters;
-   dec->base.set_quant_matrix = vl_mpeg12_set_quant_matrix;
-   dec->base.set_decode_target = vl_mpeg12_set_decode_target;
-   dec->base.set_reference_frames = vl_mpeg12_set_reference_frames;
    dec->base.begin_frame = vl_mpeg12_begin_frame;
    dec->base.decode_macroblock = vl_mpeg12_decode_macroblock;
    dec->base.decode_bitstream = vl_mpeg12_decode_bitstream;
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index fb3c49a..879f569 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -431,36 +431,24 @@ nouveau_decoder_set_picture_parameters(struct pipe_video_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]);
-}
+   if (desc->ref_backward)
+      dec->past = nouveau_decoder_surface_index(dec, desc->ref_backward);
+   if (desc->ref_forward)
+      dec->future = nouveau_decoder_surface_index(dec, desc->ref_forward);
 
-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,
                                   const struct pipe_macroblock *pipe_mb,
                                   unsigned num_macroblocks)
 {
    struct nouveau_decoder *dec = (struct nouveau_decoder *)decoder;
    const struct pipe_mpeg12_macroblock *mb;
    unsigned i;
+   dec->current = nouveau_decoder_surface_index(dec, target);
    assert(dec->current < 8);
 
    if (nouveau_vpe_init(dec)) return;
@@ -573,9 +561,7 @@ nouveau_create_decoder(struct pipe_context *context,
    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.flush = nouveau_decoder_flush;
    dec->screen = screen;
diff --git a/src/gallium/include/pipe/p_video_decoder.h b/src/gallium/include/pipe/p_video_decoder.h
index 5bd6664..7596ead 100644
--- a/src/gallium/include/pipe/p_video_decoder.h
+++ b/src/gallium/include/pipe/p_video_decoder.h
@@ -82,25 +82,6 @@ struct pipe_video_decoder
                                   struct pipe_picture_desc *picture);
 
    /**
-    * set the quantification matrixes
-    */
-   void (*set_quant_matrix)(struct pipe_video_decoder *decoder,
-                            const struct pipe_quant_matrix *matrix);
-
-   /**
-    * set target where video data is decoded to
-    */
-   void (*set_decode_target)(struct pipe_video_decoder *decoder,
-                             struct pipe_video_buffer *target);
-
-   /**
-    * set reference frames for motion compensation
-    */
-   void (*set_reference_frames)(struct pipe_video_decoder *decoder,
-                                struct pipe_video_buffer **ref_frames,
-                                unsigned num_ref_frames);
-
-   /**
     * start decoding of a new frame
     */
    void (*begin_frame)(struct pipe_video_decoder *decoder);
@@ -109,6 +90,7 @@ struct pipe_video_decoder
     * decode a macroblock
     */
    void (*decode_macroblock)(struct pipe_video_decoder *decoder,
+                             struct pipe_video_buffer *target,
                              const struct pipe_macroblock *macroblocks,
                              unsigned num_macroblocks);
 
@@ -116,6 +98,7 @@ struct pipe_video_decoder
     * decode a bitstream
     */
    void (*decode_bitstream)(struct pipe_video_decoder *decoder,
+                            struct pipe_video_buffer *target,
                             unsigned num_bytes, const void *data);
 
    /**
diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
index 9a70eb7..0650b19 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -124,6 +124,7 @@ struct pipe_macroblock
 struct pipe_mpeg12_picture_desc
 {
    struct pipe_picture_desc base;
+   struct pipe_video_buffer *ref_forward, *ref_backward;
 
    unsigned picture_coding_type;
    unsigned picture_structure;
@@ -138,12 +139,6 @@ struct pipe_mpeg12_picture_desc
    unsigned full_pel_forward_vector;
    unsigned full_pel_backward_vector;
    unsigned num_slices;
-};
-
-struct pipe_mpeg12_quant_matrix
-{
-   struct pipe_quant_matrix base;
-
    const uint8_t *intra_matrix;
    const uint8_t *non_intra_matrix;
 };
@@ -191,6 +186,7 @@ struct pipe_mpeg12_macroblock
 struct pipe_mpeg4_picture_desc
 {
    struct pipe_picture_desc base;
+   struct pipe_video_buffer *ref_forward, *ref_backward;
    int32_t trd[2];
    int32_t trb[2];
    uint16_t vop_time_increment_resolution;
@@ -205,12 +201,6 @@ struct pipe_mpeg4_picture_desc
    uint8_t rounding_control;
    uint8_t alternate_vertical_scan_flag;
    uint8_t top_field_first;
-};
-
-struct pipe_mpeg4_quant_matrix
-{
-   struct pipe_quant_matrix base;
-
    const uint8_t *intra_matrix;
    const uint8_t *non_intra_matrix;
 };
@@ -218,6 +208,7 @@ struct pipe_mpeg4_quant_matrix
 struct pipe_vc1_picture_desc
 {
    struct pipe_picture_desc base;
+   struct pipe_video_buffer *ref_forward, *ref_backward;
    uint32_t slice_count;
    uint8_t picture_type;
    uint8_t frame_coding_mode;
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index 47212e3..4286e8c 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -205,33 +205,29 @@ vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder,
                          VdpPictureInfoMPEG1Or2 *picture_info)
 {
    struct pipe_mpeg12_picture_desc picture;
-   struct pipe_mpeg12_quant_matrix quant;
-   struct pipe_video_buffer *ref_frames[2];
-   unsigned i;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding MPEG12\n");
 
-   i = 0;
+   memset(&picture, 0, sizeof(picture));
+   picture.base.profile = decoder->profile;
 
    /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
    if (picture_info->forward_reference !=  VDP_INVALID_HANDLE) {
-      ref_frames[i] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
-      if (!ref_frames[i])
+      picture.ref_forward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
+      if (!picture.ref_forward)
          return VDP_STATUS_INVALID_HANDLE;
-      ++i;
    }
+   else
+      picture.ref_forward = NULL;
 
    if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
-      ref_frames[i] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
-      if (!ref_frames[i])
+      picture.ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!picture.ref_backward)
          return VDP_STATUS_INVALID_HANDLE;
-      ++i;
    }
+   else
+      picture.ref_backward = NULL;
 
-   decoder->set_reference_frames(decoder, ref_frames, i);
-
-   memset(&picture, 0, sizeof(picture));
-   picture.base.profile = decoder->profile;
    picture.picture_coding_type = picture_info->picture_coding_type;
    picture.picture_structure = picture_info->picture_structure;
    picture.frame_pred_frame_dct = picture_info->frame_pred_frame_dct;
@@ -248,15 +244,10 @@ vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder,
    picture.top_field_first = picture_info->top_field_first;
    picture.full_pel_forward_vector = picture_info->full_pel_forward_vector;
    picture.full_pel_backward_vector = picture_info->full_pel_backward_vector;
+   picture.intra_matrix = picture_info->intra_quantizer_matrix;
+   picture.non_intra_matrix = picture_info->non_intra_quantizer_matrix;
 
    decoder->set_picture_parameters(decoder, &picture.base);
-
-   memset(&quant, 0, sizeof(quant));
-   quant.base.codec = PIPE_VIDEO_CODEC_MPEG12;
-   quant.intra_matrix = picture_info->intra_quantizer_matrix;
-   quant.non_intra_matrix = picture_info->non_intra_quantizer_matrix;
-
-   decoder->set_quant_matrix(decoder, &quant.base);
    return VDP_STATUS_OK;
 }
 
@@ -268,28 +259,28 @@ vlVdpDecoderRenderMpeg4(struct pipe_video_decoder *decoder,
                          VdpPictureInfoMPEG4Part2 *picture_info)
 {
    struct pipe_mpeg4_picture_desc picture;
-   struct pipe_mpeg4_quant_matrix quant;
-   struct pipe_video_buffer *ref_frames[2] = {};
    unsigned i;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding MPEG4\n");
 
-   /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
+   memset(&picture, 0, sizeof(picture));
+   picture.base.profile = decoder->profile;
    if (picture_info->forward_reference !=  VDP_INVALID_HANDLE) {
-      ref_frames[0] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
-      if (!ref_frames[0])
+      picture.ref_forward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
+      if (!picture.ref_forward)
          return VDP_STATUS_INVALID_HANDLE;
    }
+   else
+      picture.ref_forward = NULL;
 
    if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
-      ref_frames[1] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
-      if (!ref_frames[1])
+      picture.ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!picture.ref_backward)
          return VDP_STATUS_INVALID_HANDLE;
    }
-   decoder->set_reference_frames(decoder, ref_frames, 2);
+   else
+      picture.ref_backward = NULL;
 
-   memset(&picture, 0, sizeof(picture));
-   picture.base.profile = decoder->profile;
    for (i = 0; i < 2; ++i) {
       picture.trd[i] = picture_info->trd[i];
       picture.trb[i] = picture_info->trb[i];
@@ -306,13 +297,9 @@ vlVdpDecoderRenderMpeg4(struct pipe_video_decoder *decoder,
    picture.rounding_control = picture_info->rounding_control;
    picture.alternate_vertical_scan_flag = picture_info->alternate_vertical_scan_flag;
    picture.top_field_first = picture_info->top_field_first;
+   picture.intra_matrix = picture_info->intra_quantizer_matrix;
+   picture.non_intra_matrix = picture_info->non_intra_quantizer_matrix;
    decoder->set_picture_parameters(decoder, &picture.base);
-
-   memset(&quant, 0, sizeof(quant));
-   quant.base.codec = PIPE_VIDEO_CODEC_MPEG4;
-   quant.intra_matrix = picture_info->intra_quantizer_matrix;
-   quant.non_intra_matrix = picture_info->non_intra_quantizer_matrix;
-   decoder->set_quant_matrix(decoder, &quant.base);
    return VDP_STATUS_OK;
 }
 
@@ -322,26 +309,27 @@ vlVdpDecoderRenderVC1(struct pipe_video_decoder *decoder,
 {
    struct pipe_vc1_picture_desc picture;
    struct pipe_video_buffer *ref_frames[2] = {};
-   unsigned i;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding VC-1\n");
 
-   /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
+   memset(&picture, 0, sizeof(picture));
+   picture.base.profile = decoder->profile;
    if (picture_info->forward_reference !=  VDP_INVALID_HANDLE) {
-      ref_frames[0] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
-      if (!ref_frames[0])
+      picture.ref_forward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
+      if (!picture.ref_forward)
          return VDP_STATUS_INVALID_HANDLE;
    }
+   else
+      picture.ref_forward = NULL;
 
    if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
-      ref_frames[1] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
-      if (!ref_frames[1])
+      picture.ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!picture.ref_backward)
          return VDP_STATUS_INVALID_HANDLE;
    }
-   decoder->set_reference_frames(decoder, ref_frames, 2);
+   else
+      picture.ref_backward = NULL;
 
-   memset(&picture, 0, sizeof(picture));
-   picture.base.profile = decoder->profile;
    picture.slice_count = picture_info->slice_count;
    picture.picture_type = picture_info->picture_type;
    picture.frame_coding_mode = picture_info->frame_coding_mode;
@@ -416,7 +404,6 @@ vlVdpDecoderRender(VdpDecoder decoder,
    vldecoder->cur_buffer %= vldecoder->num_buffers;
 
    dec->set_decode_buffer(dec, vldecoder->buffers[vldecoder->cur_buffer]);
-   dec->set_decode_target(dec, vlsurf->video_buffer);
 
    switch (u_reduce_video_profile(dec->profile)) {
    case PIPE_VIDEO_CODEC_MPEG12:
@@ -436,8 +423,9 @@ vlVdpDecoderRender(VdpDecoder decoder,
 
    dec->begin_frame(dec);
    for (i = 0; i < bitstream_buffer_count; ++i)
-      dec->decode_bitstream(dec, bitstream_buffers[i].bitstream_bytes,
-                                           bitstream_buffers[i].bitstream);
+      dec->decode_bitstream(dec, vlsurf->video_buffer,
+                            bitstream_buffers[i].bitstream_bytes,
+                            bitstream_buffers[i].bitstream);
    dec->end_frame(dec);
    return ret;
 }
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index e6c5a89..ffdac3d 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -100,13 +100,10 @@ static void
 SetDecoderStatus(XvMCSurfacePrivate *surface)
 {
    struct pipe_video_decoder *decoder;
-   struct pipe_video_buffer *ref_frames[2];
    struct pipe_mpeg12_picture_desc desc = { { PIPE_VIDEO_PROFILE_MPEG1} };
 
    XvMCContextPrivate *context_priv;
 
-   unsigned i, num_refs = 0;
-
    desc.picture_structure = surface->picture_structure;
 
    assert(surface);
@@ -116,17 +113,11 @@ SetDecoderStatus(XvMCSurfacePrivate *surface)
 
    if (surface->decode_buffer)
       decoder->set_decode_buffer(decoder, surface->decode_buffer);
-   decoder->set_decode_target(decoder, surface->video_buffer);
-
-   for (i = 0; i < 2; ++i) {
-      if (surface->ref[i]) {
-         XvMCSurfacePrivate *ref = surface->ref[i]->privData;
 
-         if (ref)
-            ref_frames[num_refs++] = ref->video_buffer;
-      }
-   }
-   decoder->set_reference_frames(decoder, ref_frames, num_refs);
+   if (surface->ref[0])
+      desc.ref_forward = ((XvMCSurfacePrivate*)surface->ref[0]->privData)->video_buffer;
+   if (surface->ref[1])
+      desc.ref_backward = ((XvMCSurfacePrivate*)surface->ref[1]->privData)->video_buffer;
    decoder->set_picture_parameters(context_priv->decoder, &desc.base);
 }
 
@@ -301,7 +292,7 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
    MacroBlocksToPipe(context_priv, target_surface_priv, picture_structure,
                      xvmc_mb, blocks, mb, num_macroblocks);
 
-   context_priv->decoder->decode_macroblock(context_priv->decoder, &mb[0].base, num_macroblocks);
+   context_priv->decoder->decode_macroblock(context_priv->decoder, target_surface_priv->video_buffer, &mb[0].base, num_macroblocks);
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for rendering.\n", target_surface);
 
-- 
1.7.7.1




More information about the mesa-dev mailing list