summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
authorChristian König <[email protected]>2015-05-29 15:10:31 +0200
committerChristian König <[email protected]>2015-07-09 10:44:03 +0200
commitbbfdf5c17b695c31915e293e1ec858cbcb340894 (patch)
treef4cff06657aa4dd64d537d6b92ebf25fd3f3d4c7 /src/gallium/auxiliary/vl
parentadc816a1e41812e6489a5bc388f80de65504be5b (diff)
vl: cleanup video buffer private when the decoder is destroyed
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90728 Signed-off-by: Christian König <[email protected]> CC: [email protected]
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_decoder.c24
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_decoder.h4
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 8579460e070..a3ad6e6623a 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -84,6 +84,9 @@ static const unsigned const_empty_block_mask_420[3][2][2] = {
struct video_buffer_private
{
+ struct list_head list;
+ struct pipe_video_buffer *video_buffer;
+
struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS];
struct pipe_surface *surfaces[VL_MAX_SURFACES];
@@ -99,6 +102,8 @@ destroy_video_buffer_private(void *private)
struct video_buffer_private *priv = private;
unsigned i;
+ list_del(&priv->list);
+
for (i = 0; i < VL_NUM_COMPONENTS; ++i)
pipe_sampler_view_reference(&priv->sampler_view_planes[i], NULL);
@@ -126,6 +131,9 @@ get_video_buffer_private(struct vl_mpeg12_decoder *dec, struct pipe_video_buffer
priv = CALLOC_STRUCT(video_buffer_private);
+ list_add(&priv->list, &dec->buffer_privates);
+ priv->video_buffer = buf;
+
sv = buf->get_sampler_view_planes(buf);
for (i = 0; i < VL_NUM_COMPONENTS; ++i)
if (sv[i])
@@ -141,6 +149,18 @@ get_video_buffer_private(struct vl_mpeg12_decoder *dec, struct pipe_video_buffer
return priv;
}
+static void
+free_video_buffer_privates(struct vl_mpeg12_decoder *dec)
+{
+ struct video_buffer_private *priv, *next;
+
+ LIST_FOR_EACH_ENTRY_SAFE(priv, next, &dec->buffer_privates, list) {
+ struct pipe_video_buffer *buf = priv->video_buffer;
+
+ vl_video_buffer_set_associated_data(buf, &dec->base, NULL, NULL);
+ }
+}
+
static bool
init_zscan_buffer(struct vl_mpeg12_decoder *dec, struct vl_mpeg12_buffer *buffer)
{
@@ -464,6 +484,8 @@ vl_mpeg12_destroy(struct pipe_video_codec *decoder)
assert(decoder);
+ free_video_buffer_privates(dec);
+
/* Asserted in softpipe_delete_fs_state() for some reason */
dec->context->bind_vs_state(dec->context, NULL);
dec->context->bind_fs_state(dec->context, NULL);
@@ -1187,6 +1209,8 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
if (!init_pipe_state(dec))
goto error_pipe_state;
+ list_inithead(&dec->buffer_privates);
+
return &dec->base;
error_pipe_state:
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h
index 2a604054387..505dd675f66 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h
@@ -30,6 +30,8 @@
#include "pipe/p_video_codec.h"
+#include "util/list.h"
+
#include "vl_mpeg12_bitstream.h"
#include "vl_zscan.h"
#include "vl_idct.h"
@@ -77,6 +79,8 @@ struct vl_mpeg12_decoder
unsigned current_buffer;
struct vl_mpeg12_buffer *dec_buffers[4];
+
+ struct list_head buffer_privates;
};
struct vl_mpeg12_buffer