vl: replace decode_buffers with auxiliary data field
authorChristian König <deathsimple@vodafone.de>
Fri, 23 Dec 2011 15:14:31 +0000 (16:14 +0100)
committerChristian König <deathsimple@vodafone.de>
Mon, 9 Jan 2012 11:21:22 +0000 (12:21 +0100)
Based on patches from Maarten Lankhorst <m.b.lankhorst@gmail.com>

Signed-off-by: Christian König <deathsimple@vodafone.de>
Acked-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
19 files changed:
src/gallium/auxiliary/vl/vl_decoder.c
src/gallium/auxiliary/vl/vl_decoder.h
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
src/gallium/auxiliary/vl/vl_mpeg12_decoder.h
src/gallium/auxiliary/vl/vl_video_buffer.c
src/gallium/auxiliary/vl/vl_video_buffer.h
src/gallium/drivers/nouveau/nouveau_video.c
src/gallium/drivers/nvfx/nvfx_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_video_decoder.h
src/gallium/include/pipe/p_video_enums.h
src/gallium/state_trackers/vdpau/decode.c
src/gallium/state_trackers/vdpau/vdpau_private.h
src/gallium/state_trackers/xorg/xvmc/context.c
src/gallium/state_trackers/xorg/xvmc/surface.c
src/gallium/state_trackers/xorg/xvmc/xvmc_private.h

index 383e02d910c40d8f878564ab3e4073ce434b4b76..a88347fca62746991c57803b654b3c697481cee8 100644 (file)
@@ -44,25 +44,13 @@ vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile
    }
 }
 
-unsigned
-vl_num_buffers_desired(struct pipe_screen *screen, enum pipe_video_profile profile)
-{
-   assert(screen);
-   switch (u_reduce_video_profile(profile)) {
-      case PIPE_VIDEO_CODEC_MPEG12:
-         return 4;
-
-      default:
-         return 1;
-   }
-}
-
 struct pipe_video_decoder *
 vl_create_decoder(struct pipe_context *pipe,
                   enum pipe_video_profile profile,
                   enum pipe_video_entrypoint entrypoint,
                   enum pipe_video_chroma_format chroma_format,
-                  unsigned width, unsigned height, unsigned max_references)
+                  unsigned width, unsigned height, unsigned max_references,
+                  bool expect_chunked_decode)
 {
    unsigned buffer_width, buffer_height;
    bool pot_buffers;
@@ -82,7 +70,9 @@ vl_create_decoder(struct pipe_context *pipe,
 
    switch (u_reduce_video_profile(profile)) {
       case PIPE_VIDEO_CODEC_MPEG12:
-         return vl_create_mpeg12_decoder(pipe, profile, entrypoint, chroma_format, buffer_width, buffer_height, max_references);
+         return vl_create_mpeg12_decoder(pipe, profile, entrypoint, chroma_format,
+                                         buffer_width, buffer_height, max_references,
+                                         expect_chunked_decode);
       default:
          return NULL;
    }
index a9975169885e2853309709808cff479f5ebe5f0d..8fa6527ce5493dd42ddb4eeb98c2cc50456180d8 100644 (file)
 bool
 vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
 
-/**
- * the desired number of buffers for optimal operation
- */
-unsigned
-vl_num_buffers_desired(struct pipe_screen *screen, enum pipe_video_profile profile);
-
 /**
  * standard implementation of pipe->create_video_decoder
  */
@@ -51,6 +45,7 @@ vl_create_decoder(struct pipe_context *pipe,
                   enum pipe_video_profile profile,
                   enum pipe_video_entrypoint entrypoint,
                   enum pipe_video_chroma_format chroma_format,
-                  unsigned width, unsigned height, unsigned max_references);
+                  unsigned width, unsigned height, unsigned max_references,
+                  bool expect_chunked_decode);
 
 #endif /* vl_decoder_h */
index 1a3a2a4bb22fde51b9ceb9b316f48f7941d8edd2..cb55fa6f61122e4fa30e7671d9a6f5972ff2f529 100644 (file)
@@ -383,10 +383,26 @@ UploadYcbcrBlocks(struct vl_mpeg12_decoder *dec,
    buf->texels += 64 * num_blocks;
 }
 
+static void
+vl_mpeg12_destroy_buffer(void *buffer)
+{
+   struct vl_mpeg12_buffer *buf = buffer;
+
+   assert(buf);
+
+   cleanup_zscan_buffer(buf);
+   cleanup_idct_buffer(buf);
+   cleanup_mc_buffer(buf);
+   vl_vb_cleanup(&buf->vertex_stream);
+
+   FREE(buf);
+}
+
 static void
 vl_mpeg12_destroy(struct pipe_video_decoder *decoder)
 {
    struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder*)decoder;
+   unsigned i;
 
    assert(decoder);
 
@@ -420,17 +436,28 @@ vl_mpeg12_destroy(struct pipe_video_decoder *decoder)
    pipe_sampler_view_reference(&dec->zscan_normal, NULL);
    pipe_sampler_view_reference(&dec->zscan_alternate, NULL);
 
+   for (i = 0; i < 4; ++i)
+      if (dec->dec_buffers[i])
+         vl_mpeg12_destroy_buffer(dec->dec_buffers[i]);
+
    FREE(dec);
 }
 
-static void *
-vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder)
+static struct vl_mpeg12_buffer *
+vl_mpeg12_get_decode_buffer(struct vl_mpeg12_decoder *dec)
 {
-   struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder*)decoder;
    struct vl_mpeg12_buffer *buffer;
 
    assert(dec);
 
+   buffer = vl_video_buffer_get_associated_data(dec->target, &dec->base);
+   if (buffer)
+      return buffer;
+
+   buffer = dec->dec_buffers[dec->current_buffer];
+   if (buffer)
+      return buffer;
+
    buffer = CALLOC_STRUCT(vl_mpeg12_buffer);
    if (buffer == NULL)
       return NULL;
@@ -451,13 +478,18 @@ vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder)
       goto error_zscan;
 
    if (dec->base.entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM)
-      vl_mpg12_bs_init(&buffer->bs, decoder);
+      vl_mpg12_bs_init(&buffer->bs, &dec->base);
+
+   if (dec->expect_chunked_decode)
+      vl_video_buffer_set_associated_data(dec->target, &dec->base,
+                                          buffer, vl_mpeg12_destroy_buffer);
+   else
+      dec->dec_buffers[dec->current_buffer] = buffer;
 
    return buffer;
 
 error_zscan:
-   if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
-      cleanup_idct_buffer(buffer);
+   cleanup_idct_buffer(buffer);
 
 error_idct:
    cleanup_mc_buffer(buffer);
@@ -470,36 +502,6 @@ error_vertex_buffer:
    return NULL;
 }
 
-static void
-vl_mpeg12_destroy_buffer(struct pipe_video_decoder *decoder, void *buffer)
-{
-   struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder*)decoder;
-   struct vl_mpeg12_buffer *buf = buffer;
-
-   assert(dec && buf);
-
-   cleanup_zscan_buffer(buf);
-
-   if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
-      cleanup_idct_buffer(buf);
-
-   cleanup_mc_buffer(buf);
-
-   vl_vb_cleanup(&buf->vertex_stream);
-
-   FREE(buf);
-}
-
-static void
-vl_mpeg12_set_decode_buffer(struct pipe_video_decoder *decoder, void *buffer)
-{
-   struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
-
-   assert(dec && buffer);
-
-   dec->current_buffer = buffer;
-}
-
 static void
 vl_mpeg12_set_picture_parameters(struct pipe_video_decoder *decoder,
                                  struct pipe_picture_desc *picture)
@@ -536,6 +538,7 @@ vl_mpeg12_set_decode_target(struct pipe_video_decoder *decoder,
 
    assert(dec);
 
+   dec->target = target;
    surfaces = target->get_surfaces(target);
    for (i = 0; i < VL_MAX_PLANES; ++i)
       pipe_surface_reference(&dec->target_surfaces[i], surfaces[i]);
@@ -575,9 +578,9 @@ vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder)
 
    unsigned i;
 
-   assert(dec);
+   assert(dec && dec->target);
 
-   buf = dec->current_buffer;
+   buf = vl_mpeg12_get_decode_buffer(dec);
    assert(buf);
 
    if (dec->base.entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM)
@@ -634,10 +637,10 @@ vl_mpeg12_decode_macroblock(struct pipe_video_decoder *decoder,
 
    unsigned i, j, mv_weights[2];
 
-   assert(dec && dec->current_buffer);
+   assert(dec && dec->target);
    assert(macroblocks && macroblocks->codec == PIPE_VIDEO_CODEC_MPEG12);
 
-   buf = dec->current_buffer;
+   buf = vl_mpeg12_get_decode_buffer(dec);
    assert(buf);
 
    for (; num_macroblocks > 0; --num_macroblocks) {
@@ -701,9 +704,9 @@ vl_mpeg12_decode_bitstream(struct pipe_video_decoder *decoder,
    
    unsigned i;
 
-   assert(dec && dec->current_buffer);
+   assert(dec && dec->target);
 
-   buf = dec->current_buffer;
+   buf = vl_mpeg12_get_decode_buffer(dec);
    assert(buf);
 
    for (i = 0; i < VL_MAX_PLANES; ++i)
@@ -724,9 +727,9 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder)
    unsigned i, j, component;
    unsigned nr_components;
 
-   assert(dec && dec->current_buffer);
+   assert(dec && dec->target);
 
-   buf = dec->current_buffer;
+   buf = vl_mpeg12_get_decode_buffer(dec);
 
    vl_vb_unmap(&buf->vertex_stream, dec->base.context);
 
@@ -785,6 +788,8 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder)
          vl_mc_render_ycbcr(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], j, buf->num_ycbcr_blocks[component]);
       }
    }
+   ++dec->current_buffer;
+   dec->current_buffer %= 4;
 }
 
 static void
@@ -1039,7 +1044,8 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
                          enum pipe_video_profile profile,
                          enum pipe_video_entrypoint entrypoint,
                          enum pipe_video_chroma_format chroma_format,
-                         unsigned width, unsigned height, unsigned max_references)
+                         unsigned width, unsigned height, unsigned max_references,
+                         bool expect_chunked_decode)
 {
    const unsigned block_size_pixels = BLOCK_WIDTH * BLOCK_HEIGHT;
    const struct format_config *format_config;
@@ -1061,9 +1067,6 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
    dec->base.max_references = max_references;
 
    dec->base.destroy = vl_mpeg12_destroy;
-   dec->base.create_buffer = vl_mpeg12_create_buffer;
-   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;
@@ -1077,6 +1080,7 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
    dec->blocks_per_line = MAX2(util_next_power_of_two(dec->base.width) / block_size_pixels, 4);
    dec->num_blocks = (dec->base.width * dec->base.height) / block_size_pixels;
    dec->width_in_macroblocks = align(dec->base.width, MACROBLOCK_WIDTH) / MACROBLOCK_WIDTH;
+   dec->expect_chunked_decode = expect_chunked_decode;
 
    /* TODO: Implement 422, 444 */
    assert(dec->base.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420);
index 817c1ffd110d3b45cf3a4b87ba9899ffceece3b8..c5dff49cd6da2f0c435d936bd921bb7a8d31f10e 100644 (file)
@@ -50,6 +50,7 @@ struct vl_mpeg12_decoder
    unsigned blocks_per_line;
    unsigned num_blocks;
    unsigned width_in_macroblocks;
+   bool expect_chunked_decode;
 
    enum pipe_format zscan_source_format;
 
@@ -74,11 +75,15 @@ struct vl_mpeg12_decoder
 
    void *dsa;
 
-   struct vl_mpeg12_buffer *current_buffer;
+   unsigned current_buffer;
+   struct vl_mpeg12_buffer *dec_buffers[4];
+
    struct pipe_mpeg12_picture_desc picture_desc;
    uint8_t intra_matrix[64];
    uint8_t non_intra_matrix[64];
    struct pipe_sampler_view *ref_frames[VL_MAX_REF_FRAMES][VL_MAX_PLANES];
+
+   struct pipe_video_buffer *target;
    struct pipe_surface *target_surfaces[VL_MAX_PLANES];
 };
 
@@ -111,6 +116,7 @@ vl_create_mpeg12_decoder(struct pipe_context *pipe,
                          enum pipe_video_profile profile,
                          enum pipe_video_entrypoint entrypoint,
                          enum pipe_video_chroma_format chroma_format,
-                         unsigned width, unsigned height, unsigned max_references);
+                         unsigned width, unsigned height, unsigned max_references,
+                         bool expect_chunked_decode);
 
 #endif /* vl_mpeg12_decoder_h */
index 6d714d49f4aefad42a6f930a6b1e199115132952..8ceb71384796a6d8021a05a033c5a66c0e1a20e1 100644 (file)
@@ -98,6 +98,34 @@ vl_video_buffer_max_size(struct pipe_screen *screen)
    return 1 << (max_2d_texture_level-1);
 }
 
+void
+vl_video_buffer_set_associated_data(struct pipe_video_buffer *vbuf,
+                                    struct pipe_video_decoder *vdec,
+                                    void *associated_data,
+                                    void (*destroy_associated_data)(void *))
+{
+   vbuf->decoder = vdec;
+
+   if (vbuf->associated_data == associated_data)
+      return;
+
+   if (vbuf->associated_data)
+      vbuf->destroy_associated_data(vbuf->associated_data);
+
+   vbuf->associated_data = associated_data;
+   vbuf->destroy_associated_data = destroy_associated_data;
+}
+
+void *
+vl_video_buffer_get_associated_data(struct pipe_video_buffer *vbuf,
+                                    struct pipe_video_decoder *vdec)
+{
+   if (vbuf->decoder == vdec)
+      return vbuf->associated_data;
+   else
+      return NULL;
+}
+
 static void
 vl_video_buffer_destroy(struct pipe_video_buffer *buffer)
 {
@@ -112,6 +140,7 @@ vl_video_buffer_destroy(struct pipe_video_buffer *buffer)
       pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL);
       pipe_resource_reference(&buf->resources[i], NULL);
    }
+   vl_video_buffer_set_associated_data(buffer, NULL, NULL, NULL);
 
    FREE(buffer);
 }
index 8c80b36fbf2180395bb9035e63d68bc985ac0bc6..e096ccdaac23dfe3898e30382dcf2239b5def5d2 100644 (file)
@@ -69,6 +69,22 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,
                                     enum pipe_format format,
                                     enum pipe_video_profile profile);
 
+/*
+ * set the associated data for the given video buffer
+ */
+void
+vl_video_buffer_set_associated_data(struct pipe_video_buffer *vbuf,
+                                    struct pipe_video_decoder *vdec,
+                                    void *associated_data,
+                                    void (*destroy_associated_data)(void *));
+
+/*
+ * get the associated data for the given video buffer
+ */
+void *
+vl_video_buffer_get_associated_data(struct pipe_video_buffer *vbuf,
+                                    struct pipe_video_decoder *vdec);
+
 /**
  * creates a video buffer, can be used as a standard implementation for pipe->create_video_buffer
  */
index a442537c3206bfe631dcf7e8a4765c983b103ff5..24a63644b5d341ebba089aca51d22d9df906a16a 100644 (file)
@@ -527,7 +527,8 @@ nouveau_create_decoder(struct pipe_context *context,
                        enum pipe_video_profile profile,
                        enum pipe_video_entrypoint entrypoint,
                        enum pipe_video_chroma_format chroma_format,
-                       unsigned width, unsigned height, unsigned max_references)
+                       unsigned width, unsigned height,
+                       unsigned max_references, bool expect_chunked_decode)
 {
    struct nouveau_channel *chan = screen->channel;
    struct nouveau_grobj *mpeg = NULL;
@@ -646,7 +647,8 @@ fail:
 vl:
    debug_printf("Using g3dvl renderer\n");
    return vl_create_decoder(context, profile, entrypoint,
-                            chroma_format, width, height, max_references);
+                            chroma_format, width, height,
+                            max_references, expect_chunked_decode);
 }
 
 static struct pipe_sampler_view **
@@ -851,8 +853,6 @@ nouveau_screen_get_video_param(struct pipe_screen *pscreen,
    case PIPE_VIDEO_CAP_MAX_WIDTH:
    case PIPE_VIDEO_CAP_MAX_HEIGHT:
       return vl_video_buffer_max_size(pscreen);
-   case PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED:
-      return vl_num_buffers_desired(pscreen, profile);
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
@@ -871,11 +871,13 @@ nvfx_context_create_decoder(struct pipe_context *context,
                             enum pipe_video_profile profile,
                             enum pipe_video_entrypoint entrypoint,
                             enum pipe_video_chroma_format chroma_format,
-                            unsigned width, unsigned height, unsigned max_references)
+                            unsigned width, unsigned height,
+                            unsigned max_references, bool expect_chunked_decode)
 {
    struct nouveau_screen *screen = &nvfx_context(context)->screen->base;
    return nouveau_create_decoder(context, screen, profile, entrypoint,
-                                 chroma_format, width, height, max_references);
+                                 chroma_format, width, height,
+                                 max_references, expect_chunked_decode);
 }
 
 static struct pipe_video_buffer *
@@ -900,11 +902,13 @@ nouveau_context_create_decoder(struct pipe_context *context,
                                enum pipe_video_profile profile,
                                enum pipe_video_entrypoint entrypoint,
                                enum pipe_video_chroma_format chroma_format,
-                               unsigned width, unsigned height, unsigned max_references)
+                               unsigned width, unsigned height,
+                               unsigned max_references, bool expect_chunked_decode)
 {
    struct nouveau_screen *screen = nouveau_context(context)->screen;
    return nouveau_create_decoder(context, screen, profile, entrypoint,
-                                 chroma_format, width, height, max_references);
+                                 chroma_format, width, height,
+                                 max_references, expect_chunked_decode);
 }
 
 static struct pipe_video_buffer *
index 960cd884b8a1e882cfc2e90cad2744028805bf3f..abf4937e8cb29d7cf034c28f9c40bde3c29df263 100644 (file)
@@ -226,8 +226,6 @@ nvfx_screen_get_video_param(struct pipe_screen *screen,
        case PIPE_VIDEO_CAP_MAX_WIDTH:
        case PIPE_VIDEO_CAP_MAX_HEIGHT:
                return vl_video_buffer_max_size(screen);
-       case PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED:
-               return vl_num_buffers_desired(screen, profile);
        default:
                return 0;
        }
index eb75a535a72e7cae81ab38dceeb1682e426a37d8..d79ed99aee716daef575beae9954a47671b10c07 100644 (file)
@@ -307,8 +307,6 @@ static int r300_get_video_param(struct pipe_screen *screen,
       case PIPE_VIDEO_CAP_MAX_WIDTH:
       case PIPE_VIDEO_CAP_MAX_HEIGHT:
          return vl_video_buffer_max_size(screen);
-      case PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED:
-         return vl_num_buffers_desired(screen, profile);
       default:
          return 0;
    }
index 9f090807f82dffd807ae7fca26938b204e4c2e3c..4a31b43269aa352c8a30ed389ec1f07d753d3245 100644 (file)
@@ -528,8 +528,6 @@ static int r600_get_video_param(struct pipe_screen *screen,
        case PIPE_VIDEO_CAP_MAX_WIDTH:
        case PIPE_VIDEO_CAP_MAX_HEIGHT:
                return vl_video_buffer_max_size(screen);
-       case PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED:
-               return vl_num_buffers_desired(screen, profile);
        default:
                return 0;
        }
index e58a4867cad8d0dd7eee9f8e056b320f9a7889b1..07f1970b38568cd012c198b29bcd7aaf26f01cd3 100644 (file)
@@ -188,8 +188,6 @@ softpipe_get_video_param(struct pipe_screen *screen,
    case PIPE_VIDEO_CAP_MAX_WIDTH:
    case PIPE_VIDEO_CAP_MAX_HEIGHT:
       return vl_video_buffer_max_size(screen);
-   case PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED:
-      return vl_num_buffers_desired(screen, profile);
    default:
       return 0;
    }
index de79a9bfff136cdf7f71dd26a2fc7caf4cb784de..f7ee52298a829576b2da44d792344eb395d43ab0 100644 (file)
@@ -410,7 +410,8 @@ struct pipe_context {
                                                        enum pipe_video_profile profile,
                                                        enum pipe_video_entrypoint entrypoint,
                                                        enum pipe_video_chroma_format chroma_format,
-                                                       unsigned width, unsigned height, unsigned max_references );
+                                                       unsigned width, unsigned height, unsigned max_references,
+                                                       bool expect_chunked_decode);
 
    /**
     * Creates a video buffer as decoding target
index aa535898f2d1c32dca374324ff59489974021cbe..69e59a6fa4b0eb6e5096a1c6406316b8bf1e3cc1 100644 (file)
@@ -59,21 +59,6 @@ struct pipe_video_decoder
     */
    void (*destroy)(struct pipe_video_decoder *decoder);
 
-   /**
-    * Creates a decoder buffer
-    */
-   void *(*create_buffer)(struct pipe_video_decoder *decoder);
-
-   /**
-    * Destroys a decoder buffer
-    */
-   void (*destroy_buffer)(struct pipe_video_decoder *decoder, void *buffer);
-
-   /**
-    * set the current decoder buffer
-    */
-   void (*set_decode_buffer)(struct pipe_video_decoder *decoder, void *buffer);
-
    /**
     * set the picture parameters for the next frame
     * only used for bitstream decoding
@@ -163,6 +148,21 @@ struct pipe_video_buffer
     * get a individual surfaces for each plane
     */
    struct pipe_surface **(*get_surfaces)(struct pipe_video_buffer *buffer);
+
+   /*
+    * auxiliary associated data
+    */
+   void *associated_data;
+
+   /*
+    * decoder where the associated data came from
+    */
+   struct pipe_video_decoder *decoder;
+
+   /*
+    * destroy the associated data
+    */
+   void (*destroy_associated_data)(void *associated_data);
 };
 
 #ifdef __cplusplus
index ea25a25883db4dfa44b9a5936cddaee5caab051b..13786067d53534208a4d488723490cec4fcb9ac1 100644 (file)
@@ -50,8 +50,7 @@ enum pipe_video_cap
    PIPE_VIDEO_CAP_SUPPORTED = 0,
    PIPE_VIDEO_CAP_NPOT_TEXTURES = 1,
    PIPE_VIDEO_CAP_MAX_WIDTH = 2,
-   PIPE_VIDEO_CAP_MAX_HEIGHT = 3,
-   PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED = 4
+   PIPE_VIDEO_CAP_MAX_HEIGHT = 3
 };
 
 enum pipe_video_codec
index a5a01fb21a39f0268228133321bebd8e584e5ee6..ab7bf113fa6fe38a0cd3bf2afa5e6268ba6eadf6 100644 (file)
@@ -48,7 +48,6 @@ vlVdpDecoderCreate(VdpDevice device,
    vlVdpDevice *dev;
    vlVdpDecoder *vldecoder;
    VdpStatus ret;
-   unsigned i;
    bool supported;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating decoder\n");
@@ -90,7 +89,8 @@ vlVdpDecoderCreate(VdpDevice device,
       pipe, p_profile,
       PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
       PIPE_VIDEO_CHROMA_FORMAT_420,
-      width, height, max_references
+      width, height, max_references,
+      false
    );
 
    if (!vldecoder->decoder) {
@@ -98,25 +98,6 @@ vlVdpDecoderCreate(VdpDevice device,
       goto error_decoder;
    }
 
-   vldecoder->num_buffers = pipe->screen->get_video_param
-   (
-      pipe->screen, p_profile,
-      PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED
-   );
-   vldecoder->cur_buffer = 0;
-
-   vldecoder->buffers = CALLOC(vldecoder->num_buffers, sizeof(void*));
-   if (!vldecoder->buffers)
-         goto error_alloc_buffers;
-
-   for (i = 0; i < vldecoder->num_buffers; ++i) {
-      vldecoder->buffers[i] = vldecoder->decoder->create_buffer(vldecoder->decoder);
-      if (!vldecoder->buffers[i]) {
-         ret = VDP_STATUS_ERROR;
-         goto error_create_buffers;
-      }
-   }
-
    *decoder = vlAddDataHTAB(vldecoder);
    if (*decoder == 0) {
       ret = VDP_STATUS_ERROR;
@@ -128,15 +109,6 @@ vlVdpDecoderCreate(VdpDevice device,
    return VDP_STATUS_OK;
 
 error_handle:
-error_create_buffers:
-
-   for (i = 0; i < vldecoder->num_buffers; ++i)
-      if (vldecoder->buffers[i])
-         vldecoder->decoder->destroy_buffer(vldecoder->decoder, vldecoder->buffers[i]);
-
-   FREE(vldecoder->buffers);
-
-error_alloc_buffers:
 
    vldecoder->decoder->destroy(vldecoder->decoder);
 
@@ -152,7 +124,6 @@ VdpStatus
 vlVdpDecoderDestroy(VdpDecoder decoder)
 {
    vlVdpDecoder *vldecoder;
-   unsigned i;
 
    VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying decoder\n");
 
@@ -160,12 +131,6 @@ vlVdpDecoderDestroy(VdpDecoder decoder)
    if (!vldecoder)
       return VDP_STATUS_INVALID_HANDLE;
 
-   for (i = 0; i < vldecoder->num_buffers; ++i)
-      if (vldecoder->buffers[i])
-         vldecoder->decoder->destroy_buffer(vldecoder->decoder, vldecoder->buffers[i]);
-
-   FREE(vldecoder->buffers);
-
    vldecoder->decoder->destroy(vldecoder->decoder);
 
    FREE(vldecoder);
@@ -413,10 +378,6 @@ vlVdpDecoderRender(VdpDecoder decoder,
       // TODO: Recreate decoder with correct chroma
       return VDP_STATUS_INVALID_CHROMA_TYPE;
 
-   ++vldecoder->cur_buffer;
-   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)) {
index 84c5b82cacb126c0534818bd048eebab6f5063f5..1bbbaa9fbeacb32e480331faefbe4138b3fb83c5 100644 (file)
@@ -335,9 +335,6 @@ typedef struct
 {
    vlVdpDevice *device;
    struct pipe_video_decoder *decoder;
-   unsigned num_buffers;
-   void **buffers;
-   unsigned cur_buffer;
 } vlVdpDecoder;
 
 typedef uint32_t vlHandle;
index 848da408c049d2c2acffaba3a2e66031b24e9be0..b11f10fe402c5e5527e1bc1a2001318d280abb91 100644 (file)
@@ -250,7 +250,8 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       ProfileToPipe(mc_type),
       (mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC,
       FormatToPipe(chroma_format),
-      width, height, 2
+      width, height, 2,
+      true
    );
 
    if (!context_priv->decoder) {
index bb7ba1e1ed24f4c88606e34d7f564b666c980ca1..b4447c4460977cfb0ee1a4ad250411593dec5a90 100644 (file)
@@ -114,8 +114,6 @@ SetDecoderStatus(XvMCSurfacePrivate *surface)
    context_priv = surface->context->privData;
    decoder = context_priv->decoder;
 
-   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) {
@@ -186,8 +184,6 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
    if (!surface_priv)
       return BadAlloc;
 
-   if (context_priv->decoder->create_buffer)
-      surface_priv->decode_buffer = context_priv->decoder->create_buffer(context_priv->decoder);
    surface_priv->video_buffer = pipe->create_video_buffer
    (
       pipe, PIPE_FORMAT_NV12, context_priv->decoder->chroma_format,
@@ -504,8 +500,6 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
       SetDecoderStatus(surface_priv);
       context_priv->decoder->end_frame(context_priv->decoder);
    }
-   if (surface_priv->decode_buffer)
-      context_priv->decoder->destroy_buffer(context_priv->decoder, surface_priv->decode_buffer);
    surface_priv->video_buffer->destroy(surface_priv->video_buffer);
    FREE(surface_priv);
    surface->privData = NULL;
index 5656c65dc5910b7c9ca88533cb507b3a198f0ef2..daddba5fe54ac41523d5abbf5b5ef85dabe82eef 100644 (file)
@@ -71,7 +71,6 @@ typedef struct
 
 typedef struct
 {
-   void *decode_buffer;
    struct pipe_video_buffer *video_buffer;
 
    /* nonzero if this picture is already being decoded */