Module: Mesa
Branch: master
Commit: 5567145d59d5d539474fb68155dba4dec716e32e

Author: Boyuan Zhang <>
Date:   Mon Oct 17 16:11:48 2016 -0400

st/va: force to flush the last p frame in idr period

During dual instance encoding submission, if the second encode task and first
encode task have no reference dependency, e.g. p following with idr-frame,
there is a chance the second task will use for its reconstructed picture
buffer the same buffer used by first task for its reference/reconstructed
picture. In this case, buffer corruption may occur depending on encoding
speed. Fix is to force flush these two tasks separately to avoid race condition


Signed-off-by: Boyuan Zhang <>
Reviewed-by: Christian K├Ânig <>


 src/gallium/state_trackers/va/picture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/state_trackers/va/picture.c 
index 66e6e0d..a8102a4 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -578,6 +578,9 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
    context->decoder->end_frame(context->decoder, context->target, 
+   if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE &&
+       context->desc.h264enc.p_remain == 1)
+      context->decoder->flush(context->decoder);

mesa-commit mailing list

Reply via email to