[g3dvl] fix a whole bunch of memory leaks
This commit is contained in:
parent
a7ec477ebc
commit
df5e0b9435
|
@ -749,7 +749,8 @@ bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe,
|
||||||
struct pipe_sampler_view *matrix,
|
struct pipe_sampler_view *matrix,
|
||||||
struct pipe_sampler_view *transpose)
|
struct pipe_sampler_view *transpose)
|
||||||
{
|
{
|
||||||
assert(idct && pipe && matrix);
|
assert(idct && pipe);
|
||||||
|
assert(matrix && transpose);
|
||||||
|
|
||||||
idct->pipe = pipe;
|
idct->pipe = pipe;
|
||||||
idct->buffer_width = buffer_width;
|
idct->buffer_width = buffer_width;
|
||||||
|
@ -777,6 +778,7 @@ vl_idct_cleanup(struct vl_idct *idct)
|
||||||
cleanup_state(idct);
|
cleanup_state(idct);
|
||||||
|
|
||||||
pipe_sampler_view_reference(&idct->matrix, NULL);
|
pipe_sampler_view_reference(&idct->matrix, NULL);
|
||||||
|
pipe_sampler_view_reference(&idct->transpose, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -784,9 +786,8 @@ vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer,
|
||||||
struct pipe_sampler_view *source,
|
struct pipe_sampler_view *source,
|
||||||
struct pipe_sampler_view *intermediate)
|
struct pipe_sampler_view *intermediate)
|
||||||
{
|
{
|
||||||
assert(buffer);
|
assert(buffer && idct);
|
||||||
assert(idct);
|
assert(source && intermediate);
|
||||||
assert(source);
|
|
||||||
|
|
||||||
memset(buffer, 0, sizeof(struct vl_idct_buffer));
|
memset(buffer, 0, sizeof(struct vl_idct_buffer));
|
||||||
|
|
||||||
|
@ -811,6 +812,9 @@ vl_idct_cleanup_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer)
|
||||||
|
|
||||||
cleanup_source(idct, buffer);
|
cleanup_source(idct, buffer);
|
||||||
cleanup_intermediate(idct, buffer);
|
cleanup_intermediate(idct, buffer);
|
||||||
|
|
||||||
|
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, NULL);
|
||||||
|
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -447,6 +447,7 @@ vl_mpeg12_destroy(struct pipe_video_decoder *decoder)
|
||||||
|
|
||||||
pipe_resource_reference(&dec->quads.buffer, NULL);
|
pipe_resource_reference(&dec->quads.buffer, NULL);
|
||||||
pipe_resource_reference(&dec->pos.buffer, NULL);
|
pipe_resource_reference(&dec->pos.buffer, NULL);
|
||||||
|
pipe_resource_reference(&dec->block_num.buffer, NULL);
|
||||||
|
|
||||||
pipe_sampler_view_reference(&dec->zscan_linear, NULL);
|
pipe_sampler_view_reference(&dec->zscan_linear, NULL);
|
||||||
pipe_sampler_view_reference(&dec->zscan_normal, NULL);
|
pipe_sampler_view_reference(&dec->zscan_normal, NULL);
|
||||||
|
|
|
@ -102,6 +102,8 @@ vl_video_buffer_destroy(struct pipe_video_buffer *buffer)
|
||||||
pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL);
|
pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL);
|
||||||
pipe_resource_reference(&buf->resources[i], NULL);
|
pipe_resource_reference(&buf->resources[i], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FREE(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pipe_sampler_view **
|
static struct pipe_sampler_view **
|
||||||
|
|
|
@ -152,6 +152,9 @@ vlVdpDeviceDestroy(VdpDevice device)
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return VDP_STATUS_INVALID_HANDLE;
|
return VDP_STATUS_INVALID_HANDLE;
|
||||||
|
|
||||||
|
vl_video_destroy(dev->context);
|
||||||
|
vl_screen_destroy(dev->vscreen);
|
||||||
|
|
||||||
FREE(dev);
|
FREE(dev);
|
||||||
vlDestroyHTAB();
|
vlDestroyHTAB();
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ vlVdpOutputSurfaceCreate(VdpDevice device,
|
||||||
|
|
||||||
vlsurface->sampler_view = pipe->create_sampler_view(pipe, res, &sv_templ);
|
vlsurface->sampler_view = pipe->create_sampler_view(pipe, res, &sv_templ);
|
||||||
if (!vlsurface->sampler_view) {
|
if (!vlsurface->sampler_view) {
|
||||||
|
pipe_resource_reference(&res, NULL);
|
||||||
FREE(dev);
|
FREE(dev);
|
||||||
return VDP_STATUS_ERROR;
|
return VDP_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -97,16 +98,20 @@ vlVdpOutputSurfaceCreate(VdpDevice device,
|
||||||
surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
|
surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
|
||||||
vlsurface->surface = pipe->create_surface(pipe, res, &surf_templ);
|
vlsurface->surface = pipe->create_surface(pipe, res, &surf_templ);
|
||||||
if (!vlsurface->surface) {
|
if (!vlsurface->surface) {
|
||||||
|
pipe_resource_reference(&res, NULL);
|
||||||
FREE(dev);
|
FREE(dev);
|
||||||
return VDP_STATUS_ERROR;
|
return VDP_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*surface = vlAddDataHTAB(vlsurface);
|
*surface = vlAddDataHTAB(vlsurface);
|
||||||
if (*surface == 0) {
|
if (*surface == 0) {
|
||||||
|
pipe_resource_reference(&res, NULL);
|
||||||
FREE(dev);
|
FREE(dev);
|
||||||
return VDP_STATUS_ERROR;
|
return VDP_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pipe_resource_reference(&res, NULL);
|
||||||
|
|
||||||
return VDP_STATUS_OK;
|
return VDP_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,8 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
|
||||||
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Dumping surface %d failed.\n", surface);
|
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Dumping surface %d failed.\n", surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pipe_surface_reference(&drawable_surface, NULL);
|
||||||
|
|
||||||
return VDP_STATUS_OK;
|
return VDP_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,6 +522,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
|
||||||
context_priv->dst_rect.x != dst_rect.x || context_priv->dst_rect.y != dst_rect.y ||
|
context_priv->dst_rect.x != dst_rect.x || context_priv->dst_rect.y != dst_rect.y ||
|
||||||
context_priv->dst_rect.w != dst_rect.w || context_priv->dst_rect.h != dst_rect.h) {
|
context_priv->dst_rect.w != dst_rect.w || context_priv->dst_rect.h != dst_rect.h) {
|
||||||
|
|
||||||
|
pipe_surface_reference(&context_priv->drawable_surface, NULL);
|
||||||
context_priv->drawable_surface = vl_drawable_surface_get(context_priv->vctx, drawable);
|
context_priv->drawable_surface = vl_drawable_surface_get(context_priv->vctx, drawable);
|
||||||
context_priv->dst_rect = dst_rect;
|
context_priv->dst_rect = dst_rect;
|
||||||
vl_compositor_reset_dirty_area(compositor);
|
vl_compositor_reset_dirty_area(compositor);
|
||||||
|
@ -636,6 +637,9 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
|
||||||
return XvMCBadSurface;
|
return XvMCBadSurface;
|
||||||
|
|
||||||
surface_priv = surface->privData;
|
surface_priv = surface->privData;
|
||||||
|
|
||||||
|
if (surface_priv->mapped)
|
||||||
|
surface_priv->decode_buffer->end_frame(surface_priv->decode_buffer);
|
||||||
surface_priv->decode_buffer->destroy(surface_priv->decode_buffer);
|
surface_priv->decode_buffer->destroy(surface_priv->decode_buffer);
|
||||||
surface_priv->video_buffer->destroy(surface_priv->video_buffer);
|
surface_priv->video_buffer->destroy(surface_priv->video_buffer);
|
||||||
FREE(surface_priv);
|
FREE(surface_priv);
|
||||||
|
|
Loading…
Reference in New Issue