Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not initiate VA buffers destroy from server side. #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions src/vdpau_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@
#define DEBUG 1
#include "debug.h"

// Destroy dead VA buffers
void
destroy_dead_va_buffers(
vdpau_driver_data_t *driver_data,
object_context_p obj_context
)
{
object_buffer_p obj_buffer;
unsigned int i;

if (obj_context->dead_buffers_count < 1)
return;

ASSERT(obj_context->dead_buffers);
for (i = 0; i < obj_context->dead_buffers_count; i++) {
obj_buffer = VDPAU_BUFFER(obj_context->dead_buffers[i]);
ASSERT(obj_buffer);
destroy_va_buffer(driver_data, obj_buffer);
}
obj_context->dead_buffers_count = 0;
}

// Create VA buffer object
object_buffer_p
create_va_buffer(
Expand Down Expand Up @@ -104,30 +82,6 @@ destroy_va_buffer(
object_heap_free(&driver_data->buffer_heap, (object_base_p)obj_buffer);
}

// Schedule VA buffer object for destruction
void
schedule_destroy_va_buffer(
vdpau_driver_data_p driver_data,
object_buffer_p obj_buffer
)
{
object_context_p obj_context = VDPAU_CONTEXT(obj_buffer->va_context);
if (!obj_context)
return;

realloc_buffer(
(void **)&obj_context->dead_buffers,
&obj_context->dead_buffers_count_max,
16 + obj_context->dead_buffers_count,
sizeof(*obj_context->dead_buffers)
);

ASSERT(obj_context->dead_buffers);
obj_context->dead_buffers[obj_context->dead_buffers_count] = obj_buffer->base.id;
obj_context->dead_buffers_count++;
obj_buffer->delayed_destroy = 1;
}

// vaCreateBuffer
VAStatus
vdpau_CreateBuffer(
Expand Down
14 changes: 0 additions & 14 deletions src/vdpau_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ struct object_buffer {
unsigned int delayed_destroy : 1;
};

// Destroy dead VA buffers
void
destroy_dead_va_buffers(
vdpau_driver_data_t *driver_data,
object_context_p obj_context
) attribute_hidden;

// Create VA buffer object
object_buffer_p
create_va_buffer(
Expand All @@ -60,13 +53,6 @@ destroy_va_buffer(
object_buffer_p obj_buffer
) attribute_hidden;

// Schedule VA buffer object for destruction
void
schedule_destroy_va_buffer(
vdpau_driver_data_p driver_data,
object_buffer_p obj_buffer
) attribute_hidden;

// vaCreateBuffer
VAStatus
vdpau_CreateBuffer(
Expand Down
23 changes: 0 additions & 23 deletions src/vdpau_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,6 @@ vdpau_BeginPicture(
return VA_STATUS_ERROR_UNKNOWN;
}

destroy_dead_va_buffers(driver_data, obj_context);
return VA_STATUS_SUCCESS;
}

Expand Down Expand Up @@ -1607,25 +1606,6 @@ vdpau_RenderPicture(

if (!translate_buffer(driver_data, obj_context, obj_buffer))
return VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
/* Release any buffer that is not VASliceDataBuffer */
/* VASliceParameterBuffer is also needed to check for start_codes */
switch (obj_buffer->type) {
case VASliceParameterBufferType:
case VASliceDataBufferType:
schedule_destroy_va_buffer(driver_data, obj_buffer);
break;
case VAPictureParameterBufferType:
/* Preserve VAPictureParameterBufferMPEG4 */
if (obj_context->vdp_codec == VDP_CODEC_MPEG4) {
schedule_destroy_va_buffer(driver_data, obj_buffer);
break;
}
/* fall-through */
default:
destroy_va_buffer(driver_data, obj_buffer);
break;
}
buffers[i] = VA_INVALID_BUFFER;
}

return VA_STATUS_SUCCESS;
Expand Down Expand Up @@ -1703,8 +1683,5 @@ vdpau_EndPicture(
/* XXX: assume we are done with rendering right away */
obj_context->current_render_target = VA_INVALID_SURFACE;

/* Release pending buffers */
destroy_dead_va_buffers(driver_data, obj_context);

return va_status;
}
11 changes: 0 additions & 11 deletions src/vdpau_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,6 @@ VAStatus vdpau_DestroyContext(VADriverContextP ctx, VAContextID context)
obj_context->vdp_decoder = VDP_INVALID_HANDLE;
}

destroy_dead_va_buffers(driver_data, obj_context);
if (obj_context->dead_buffers) {
free(obj_context->dead_buffers);
obj_context->dead_buffers = NULL;
}

if (obj_context->render_targets) {
for (i = 0; i < obj_context->num_render_targets; i++) {
object_surface_p obj_surface;
Expand All @@ -569,8 +563,6 @@ VAStatus vdpau_DestroyContext(VADriverContextP ctx, VAContextID context)
obj_context->picture_height = 0;
obj_context->num_render_targets = 0;
obj_context->flags = 0;
obj_context->dead_buffers_count = 0;
obj_context->dead_buffers_count_max = 0;

object_heap_free(&driver_data->context_heap, (object_base_p)obj_context);
return VA_STATUS_SUCCESS;
Expand Down Expand Up @@ -629,9 +621,6 @@ vdpau_CreateContext(
obj_context->max_ref_frames = -1;
obj_context->render_targets = (VASurfaceID *)
calloc(num_render_targets, sizeof(VASurfaceID));
obj_context->dead_buffers = NULL;
obj_context->dead_buffers_count = 0;
obj_context->dead_buffers_count_max = 0;
obj_context->vdp_codec = get_VdpCodec(vdp_profile);
obj_context->vdp_profile = vdp_profile;
obj_context->vdp_decoder = VDP_INVALID_HANDLE;
Expand Down
3 changes: 0 additions & 3 deletions src/vdpau_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ struct object_context {
int flags;
int max_ref_frames;
VASurfaceID *render_targets;
VABufferID *dead_buffers;
uint32_t dead_buffers_count;
uint32_t dead_buffers_count_max;
void *last_pic_param;
void *last_slice_params;
unsigned int last_slice_params_count;
Expand Down