[Mesa-dev] [PATCH 6/6] pipe_video: Remove set_picture_parameters

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


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   |   12 +-
 src/gallium/drivers/nouveau/nouveau_video.c    |   25 +--
 src/gallium/include/pipe/p_video_decoder.h     |    9 +-
 src/gallium/state_trackers/vdpau/decode.c      |  207 ++++++++++++------------
 src/gallium/state_trackers/xorg/xvmc/surface.c |   38 +----
 6 files changed, 129 insertions(+), 166 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index b586a00..5e44ede 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, NULL, &mb.base, 1);
+         bs->decoder->decode_macroblock(bs->decoder, NULL, 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, NULL, &mb.base, 1);
+   bs->decoder->decode_macroblock(bs->decoder, NULL, 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 4eaad16..c61e95c 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -626,11 +626,9 @@ error_vertex_buffer:
 }
 
 static void
-vl_mpeg12_set_picture_parameters(struct pipe_video_decoder *decoder,
-                                 struct pipe_picture_desc *picture)
+vl_mpeg12_set_picture_parameters(struct vl_mpeg12_decoder *dec,
+                                 struct pipe_mpeg12_picture_desc *pic)
 {
-   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;
@@ -691,6 +689,7 @@ vl_mpeg12_set_decode_target(struct vl_mpeg12_decoder *dec,
 static void
 vl_mpeg12_decode_macroblock(struct pipe_video_decoder *decoder,
                             struct pipe_video_buffer *target,
+                            struct pipe_picture_desc *desc,
                             const struct pipe_macroblock *macroblocks,
                             unsigned num_macroblocks)
 {
@@ -703,6 +702,8 @@ vl_mpeg12_decode_macroblock(struct pipe_video_decoder *decoder,
    assert(dec);
    assert(macroblocks && macroblocks->codec == PIPE_VIDEO_CODEC_MPEG12);
 
+   if (desc)
+      vl_mpeg12_set_picture_parameters(dec, (struct pipe_mpeg12_picture_desc*)desc);
    if (target)
       vl_mpeg12_set_decode_target(dec, (struct vl_video_buffer*)target);
    buf = dec->current_buffer;
@@ -761,6 +762,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,
+                           struct pipe_picture_desc *desc,
                            unsigned num_bytes, const void *data)
 {
    struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
@@ -769,6 +771,7 @@ vl_mpeg12_decode_bitstream(struct pipe_video_decoder *decoder,
    unsigned i;
 
    assert(dec);
+   vl_mpeg12_set_picture_parameters(dec, (struct pipe_mpeg12_picture_desc*)desc);
    vl_mpeg12_set_decode_target(dec, (struct vl_video_buffer*)target);
 
    buf = dec->current_buffer;
@@ -1047,7 +1050,6 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
    dec->base.max_references = max_references;
 
    dec->base.destroy = vl_mpeg12_destroy;
-   dec->base.set_picture_parameters = vl_mpeg12_set_picture_parameters;
    dec->base.decode_macroblock = vl_mpeg12_decode_macroblock;
    dec->base.decode_bitstream = vl_mpeg12_decode_bitstream;
    dec->base.flush = vl_mpeg12_flush;
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index bf67d03..d84d9b3 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -424,32 +424,24 @@ 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)
-{
-   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;
-
-   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_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;
+
    dec->current = nouveau_decoder_surface_index(dec, target);
    assert(dec->current < 8);
+   dec->picture_structure = desc->picture_structure;
+   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);
 
    if (nouveau_vpe_init(dec)) return;
    mb = (const struct pipe_mpeg12_macroblock *)pipe_mb;
@@ -549,7 +541,6 @@ nouveau_create_decoder(struct pipe_context *context,
    dec->base.height = height;
    dec->base.max_references = max_references;
    dec->base.destroy = nouveau_decoder_destroy;
-   dec->base.set_picture_parameters = nouveau_decoder_set_picture_parameters;
    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 3623042..04683f7 100644
--- a/src/gallium/include/pipe/p_video_decoder.h
+++ b/src/gallium/include/pipe/p_video_decoder.h
@@ -60,17 +60,11 @@ struct pipe_video_decoder
    void (*destroy)(struct pipe_video_decoder *decoder);
 
    /**
-    * set the picture parameters for the next frame
-    * only used for bitstream decoding
-    */
-   void (*set_picture_parameters)(struct pipe_video_decoder *decoder,
-                                  struct pipe_picture_desc *picture);
-
-   /**
     * decode a macroblock
     */
    void (*decode_macroblock)(struct pipe_video_decoder *decoder,
                              struct pipe_video_buffer *target,
+                             struct pipe_picture_desc *picture,
                              const struct pipe_macroblock *macroblocks,
                              unsigned num_macroblocks);
 
@@ -79,6 +73,7 @@ struct pipe_video_decoder
     */
    void (*decode_bitstream)(struct pipe_video_decoder *decoder,
                             struct pipe_video_buffer *target,
+                            struct pipe_picture_desc *picture,
                             unsigned num_bytes, const void *data);
 
    /**
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index cd8dc7a..4a5aa72 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -171,52 +171,46 @@ vlVdpDecoderGetParameters(VdpDecoder decoder,
  */
 static VdpStatus
 vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder,
+                         struct pipe_mpeg12_picture_desc *picture,
                          VdpPictureInfoMPEG1Or2 *picture_info)
 {
-   struct pipe_mpeg12_picture_desc picture;
-
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding MPEG12\n");
 
-   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) {
-      picture.ref_forward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
-      if (!picture.ref_forward)
+      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;
+      picture->ref_forward = NULL;
 
    if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
-      picture.ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
-      if (!picture.ref_backward)
+      picture->ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!picture->ref_backward)
          return VDP_STATUS_INVALID_HANDLE;
    }
    else
-      picture.ref_backward = NULL;
-
-   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;
-   picture.q_scale_type = picture_info->q_scale_type;
-   picture.alternate_scan = picture_info->alternate_scan;
-   picture.intra_vlc_format = picture_info->intra_vlc_format;
-   picture.concealment_motion_vectors = picture_info->concealment_motion_vectors;
-   picture.intra_dc_precision = picture_info->intra_dc_precision;
-   picture.f_code[0][0] = picture_info->f_code[0][0] - 1;
-   picture.f_code[0][1] = picture_info->f_code[0][1] - 1;
-   picture.f_code[1][0] = picture_info->f_code[1][0] - 1;
-   picture.f_code[1][1] = picture_info->f_code[1][1] - 1;
-   picture.num_slices = picture_info->slice_count;
-   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);
+      picture->ref_backward = NULL;
+
+   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;
+   picture->q_scale_type = picture_info->q_scale_type;
+   picture->alternate_scan = picture_info->alternate_scan;
+   picture->intra_vlc_format = picture_info->intra_vlc_format;
+   picture->concealment_motion_vectors = picture_info->concealment_motion_vectors;
+   picture->intra_dc_precision = picture_info->intra_dc_precision;
+   picture->f_code[0][0] = picture_info->f_code[0][0] - 1;
+   picture->f_code[0][1] = picture_info->f_code[0][1] - 1;
+   picture->f_code[1][0] = picture_info->f_code[1][0] - 1;
+   picture->f_code[1][1] = picture_info->f_code[1][1] - 1;
+   picture->num_slices = picture_info->slice_count;
+   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;
    return VDP_STATUS_OK;
 }
 
@@ -225,109 +219,102 @@ vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder,
  */
 static VdpStatus
 vlVdpDecoderRenderMpeg4(struct pipe_video_decoder *decoder,
-                         VdpPictureInfoMPEG4Part2 *picture_info)
+                        struct pipe_mpeg4_picture_desc *picture,
+                        VdpPictureInfoMPEG4Part2 *picture_info)
 {
-   struct pipe_mpeg4_picture_desc picture;
    unsigned i;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding MPEG4\n");
 
-   memset(&picture, 0, sizeof(picture));
-   picture.base.profile = decoder->profile;
-   if (picture_info->forward_reference !=  VDP_INVALID_HANDLE) {
-      picture.ref_forward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
-      if (!picture.ref_forward)
+   if (picture_info->forward_reference != VDP_INVALID_HANDLE) {
+      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;
+      picture->ref_forward = NULL;
 
-   if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
-      picture.ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
-      if (!picture.ref_backward)
+   if (picture_info->backward_reference != VDP_INVALID_HANDLE) {
+      picture->ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!picture->ref_backward)
          return VDP_STATUS_INVALID_HANDLE;
    }
    else
-      picture.ref_backward = NULL;
+      picture->ref_backward = NULL;
 
    for (i = 0; i < 2; ++i) {
-      picture.trd[i] = picture_info->trd[i];
-      picture.trb[i] = picture_info->trb[i];
+      picture->trd[i] = picture_info->trd[i];
+      picture->trb[i] = picture_info->trb[i];
    }
-   picture.vop_time_increment_resolution = picture_info->vop_time_increment_resolution;
-   picture.vop_coding_type = picture_info->vop_coding_type;
-   picture.vop_fcode_forward = picture_info->vop_fcode_forward;
-   picture.vop_fcode_backward = picture_info->vop_fcode_backward;
-   picture.resync_marker_disable = picture_info->resync_marker_disable;
-   picture.interlaced = picture_info->interlaced;
-   picture.quant_type = picture_info->quant_type;
-   picture.quarter_sample = picture_info->quarter_sample;
-   picture.short_video_header = picture_info->short_video_header;
-   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);
+   picture->vop_time_increment_resolution = picture_info->vop_time_increment_resolution;
+   picture->vop_coding_type = picture_info->vop_coding_type;
+   picture->vop_fcode_forward = picture_info->vop_fcode_forward;
+   picture->vop_fcode_backward = picture_info->vop_fcode_backward;
+   picture->resync_marker_disable = picture_info->resync_marker_disable;
+   picture->interlaced = picture_info->interlaced;
+   picture->quant_type = picture_info->quant_type;
+   picture->quarter_sample = picture_info->quarter_sample;
+   picture->short_video_header = picture_info->short_video_header;
+   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;
    return VDP_STATUS_OK;
 }
 
 static VdpStatus
 vlVdpDecoderRenderVC1(struct pipe_video_decoder *decoder,
+                      struct pipe_vc1_picture_desc *picture,
                       VdpPictureInfoVC1 *picture_info)
 {
-   struct pipe_vc1_picture_desc picture;
-
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding VC-1\n");
 
-   memset(&picture, 0, sizeof(picture));
-   picture.base.profile = decoder->profile;
    if (picture_info->forward_reference !=  VDP_INVALID_HANDLE) {
-      picture.ref_forward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
-      if (!picture.ref_forward)
+      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;
+      picture->ref_forward = NULL;
 
    if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
-      picture.ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
-      if (!picture.ref_backward)
+      picture->ref_backward = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!picture->ref_backward)
          return VDP_STATUS_INVALID_HANDLE;
    }
    else
-      picture.ref_backward = NULL;
-
-   picture.slice_count = picture_info->slice_count;
-   picture.picture_type = picture_info->picture_type;
-   picture.frame_coding_mode = picture_info->frame_coding_mode;
-   picture.postprocflag = picture_info->postprocflag;
-   picture.pulldown = picture_info->pulldown;
-   picture.interlace = picture_info->interlace;
-   picture.tfcntrflag = picture_info->tfcntrflag;
-   picture.finterpflag = picture_info->finterpflag;
-   picture.psf = picture_info->psf;
-   picture.dquant = picture_info->dquant;
-   picture.panscan_flag = picture_info->panscan_flag;
-   picture.refdist_flag = picture_info->refdist_flag;
-   picture.quantizer = picture_info->quantizer;
-   picture.extended_mv = picture_info->extended_mv;
-   picture.extended_dmv = picture_info->extended_dmv;
-   picture.overlap = picture_info->overlap;
-   picture.vstransform = picture_info->vstransform;
-   picture.loopfilter = picture_info->loopfilter;
-   picture.fastuvmc = picture_info->fastuvmc;
-   picture.range_mapy_flag = picture_info->range_mapy_flag;
-   picture.range_mapy = picture_info->range_mapy;
-   picture.range_mapuv_flag = picture_info->range_mapuv_flag;
-   picture.range_mapuv = picture_info->range_mapuv;
-   picture.multires = picture_info->multires;
-   picture.syncmarker = picture_info->syncmarker;
-   picture.rangered = picture_info->rangered;
-   picture.maxbframes = picture_info->maxbframes;
-   picture.deblockEnable = picture_info->deblockEnable;
-   picture.pquant = picture_info->pquant;
-   decoder->set_picture_parameters(decoder, &picture.base);
+      picture->ref_backward = NULL;
+
+   picture->slice_count = picture_info->slice_count;
+   picture->picture_type = picture_info->picture_type;
+   picture->frame_coding_mode = picture_info->frame_coding_mode;
+   picture->postprocflag = picture_info->postprocflag;
+   picture->pulldown = picture_info->pulldown;
+   picture->interlace = picture_info->interlace;
+   picture->tfcntrflag = picture_info->tfcntrflag;
+   picture->finterpflag = picture_info->finterpflag;
+   picture->psf = picture_info->psf;
+   picture->dquant = picture_info->dquant;
+   picture->panscan_flag = picture_info->panscan_flag;
+   picture->refdist_flag = picture_info->refdist_flag;
+   picture->quantizer = picture_info->quantizer;
+   picture->extended_mv = picture_info->extended_mv;
+   picture->extended_dmv = picture_info->extended_dmv;
+   picture->overlap = picture_info->overlap;
+   picture->vstransform = picture_info->vstransform;
+   picture->loopfilter = picture_info->loopfilter;
+   picture->fastuvmc = picture_info->fastuvmc;
+   picture->range_mapy_flag = picture_info->range_mapy_flag;
+   picture->range_mapy = picture_info->range_mapy;
+   picture->range_mapuv_flag = picture_info->range_mapuv_flag;
+   picture->range_mapuv = picture_info->range_mapuv;
+   picture->multires = picture_info->multires;
+   picture->syncmarker = picture_info->syncmarker;
+   picture->rangered = picture_info->rangered;
+   picture->maxbframes = picture_info->maxbframes;
+   picture->deblockEnable = picture_info->deblockEnable;
+   picture->pquant = picture_info->pquant;
    return VDP_STATUS_OK;
 }
 
@@ -346,6 +333,12 @@ vlVdpDecoderRender(VdpDecoder decoder,
    VdpStatus ret;
    struct pipe_video_decoder *dec;
    unsigned i;
+   union {
+      struct pipe_picture_desc base;
+      struct pipe_mpeg12_picture_desc mpeg12;
+      struct pipe_mpeg4_picture_desc mpeg4;
+      struct pipe_vc1_picture_desc vc1;
+   } desc;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding\n");
 
@@ -368,15 +361,17 @@ vlVdpDecoderRender(VdpDecoder decoder,
       // TODO: Recreate decoder with correct chroma
       return VDP_STATUS_INVALID_CHROMA_TYPE;
 
+   memset(&desc, 0, sizeof(desc));
+   desc.base.profile = dec->profile;
    switch (u_reduce_video_profile(dec->profile)) {
    case PIPE_VIDEO_CODEC_MPEG12:
-      ret = vlVdpDecoderRenderMpeg12(dec, (VdpPictureInfoMPEG1Or2 *)picture_info);
+      ret = vlVdpDecoderRenderMpeg12(dec, &desc.mpeg12, (VdpPictureInfoMPEG1Or2 *)picture_info);
       break;
    case PIPE_VIDEO_CODEC_MPEG4:
-      ret = vlVdpDecoderRenderMpeg4(dec, (VdpPictureInfoMPEG4Part2 *)picture_info);
+      ret = vlVdpDecoderRenderMpeg4(dec, &desc.mpeg4, (VdpPictureInfoMPEG4Part2 *)picture_info);
       break;
    case PIPE_VIDEO_CODEC_VC1:
-      ret = vlVdpDecoderRenderVC1(dec, (VdpPictureInfoVC1 *)picture_info);
+      ret = vlVdpDecoderRenderVC1(dec, &desc.vc1, (VdpPictureInfoVC1 *)picture_info);
       break;
    default:
       return VDP_STATUS_INVALID_DECODER_PROFILE;
@@ -385,7 +380,7 @@ vlVdpDecoderRender(VdpDecoder decoder,
       return ret;
 
    for (i = 0; i < bitstream_buffer_count; ++i)
-      dec->decode_bitstream(dec, vlsurf->video_buffer,
+      dec->decode_bitstream(dec, vlsurf->video_buffer, &desc.base,
                             bitstream_buffers[i].bitstream_bytes,
                             bitstream_buffers[i].bitstream);
    dec->flush(dec);
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index c7aa301..f55691d 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -96,28 +96,6 @@ MacroBlocksToPipe(XvMCContextPrivate *context,
    }
 }
 
-static void
-SetDecoderStatus(XvMCSurfacePrivate *surface)
-{
-   struct pipe_video_decoder *decoder;
-   struct pipe_mpeg12_picture_desc desc = { { PIPE_VIDEO_PROFILE_MPEG1} };
-
-   XvMCContextPrivate *context_priv;
-
-   desc.picture_structure = surface->picture_structure;
-
-   assert(surface);
-
-   context_priv = surface->context->privData;
-   decoder = context_priv->decoder;
-
-   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);
-}
-
 PUBLIC
 Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface)
 {
@@ -171,6 +149,7 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
 )
 {
    struct pipe_mpeg12_macroblock mb[num_macroblocks];
+   struct pipe_mpeg12_picture_desc desc = { { PIPE_VIDEO_PROFILE_MPEG1} };
 
    XvMCContextPrivate *context_priv;
    XvMCSurfacePrivate *target_surface_priv;
@@ -235,17 +214,18 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
    target_surface_priv->ref[0] = past_surface;
    target_surface_priv->ref[1] = future_surface;
 
-   if (target_surface_priv->picture_structure)
-      SetDecoderStatus(target_surface_priv);
-   else {
-      target_surface_priv->picture_structure = picture_structure;
-      SetDecoderStatus(target_surface_priv);
-   }
+   target_surface_priv->picture_structure = picture_structure;
+
+   desc.picture_structure = picture_structure;
+   if (past_surface)
+      desc.ref_forward = ((XvMCSurfacePrivate*)past_surface->privData)->video_buffer;
+   if (future_surface)
+      desc.ref_backward = ((XvMCSurfacePrivate*)future_surface->privData)->video_buffer;
 
    MacroBlocksToPipe(context_priv, target_surface_priv, picture_structure,
                      xvmc_mb, blocks, mb, num_macroblocks);
 
-   context_priv->decoder->decode_macroblock(context_priv->decoder, target_surface_priv->video_buffer, &mb[0].base, num_macroblocks);
+   context_priv->decoder->decode_macroblock(context_priv->decoder, target_surface_priv->video_buffer, &desc.base, &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