aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va/picture.c
diff options
context:
space:
mode:
authorBoyuan Zhang <[email protected]>2016-08-15 13:23:30 -0400
committerLeo Liu <[email protected]>2016-08-19 10:36:44 -0400
commitc59628d11b134fc016388a170880f7646e100d6f (patch)
treedd6201f9ecbd023c42216a7787e1c51f5907b133 /src/gallium/state_trackers/va/picture.c
parent93d2b5c57632f5cc57e71511bc6e33f8474e40fd (diff)
st/va: enable dual instances encode by sync surface
This patch improves the performance of Vaapi Encode by enabling dual instances encoding. flush function is not called after each end_frame call. radeon/vce will do flush whenever 2 frames are submitted for encoding. Implement sync surface function to flush only if the frame hasn't been flushed yet. Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va/picture.c')
-rw-r--r--src/gallium/state_trackers/va/picture.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index b18745273c1..87567be10e7 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -62,6 +62,8 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID rende
if (!surf || !surf->buffer)
return VA_STATUS_ERROR_INVALID_SURFACE;
+ context->target_id = render_target;
+ surf->ctx = context_id;
context->target = surf->buffer;
if (!context->decoder) {
@@ -536,6 +538,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
vlVaDriver *drv;
vlVaContext *context;
vlVaBuffer *coded_buf;
+ vlVaSurface *surf;
unsigned int coded_size;
void *feedback;
@@ -560,6 +563,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
return VA_STATUS_SUCCESS;
}
+ pipe_mutex_lock(drv->mutex);
+ surf = handle_table_get(drv->htab, context->target_id);
context->mpeg4.frame_num++;
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
@@ -568,13 +573,14 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
context->decoder->begin_frame(context->decoder, context->target, &context->desc.base);
context->decoder->encode_bitstream(context->decoder, context->target,
coded_buf->derived_surface.resource, &feedback);
+ surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
+ surf->feedback = feedback;
+ surf->coded_buf = coded_buf;
context->decoder->end_frame(context->decoder, context->target, &context->desc.base);
- context->decoder->flush(context->decoder);
- context->decoder->get_feedback(context->decoder, feedback, &coded_size);
- coded_buf->coded_size = coded_size;
}
else
context->decoder->end_frame(context->decoder, context->target, &context->desc.base);
+ pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
}