st/va: make sure that we call begin_frame() only once v2
authorChristian König <christian.koenig@amd.com>
Thu, 19 Jan 2017 12:44:34 +0000 (13:44 +0100)
committerChristian König <christian.koenig@amd.com>
Mon, 23 Jan 2017 16:00:04 +0000 (17:00 +0100)
This fixes "st/va: delay calling begin_frame until we have all parameters".

v2: call begin frame after decoder (re)creation as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Tested-by: Andy Furniss <adf.lists@gmail.com>
src/gallium/state_trackers/va/picture.c
src/gallium/state_trackers/va/va_private.h

index dc7121c3037ff17e808de5fc78f9e7dc5d3a1c5b..82584eafc565022bc221c5e0f54df76702061776 100644 (file)
@@ -81,7 +81,7 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID rende
    }
 
    if (context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE)
-      context->decoder->begin_frame(context->decoder, context->target, &context->desc.base);
+      context->needs_begin_frame = true;
 
    return VA_STATUS_SUCCESS;
 }
@@ -178,6 +178,8 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
 
       if (!context->decoder)
          return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+      context->needs_begin_frame = true;
    }
 
    return vaStatus;
@@ -308,8 +310,11 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf)
    sizes[num_buffers] = buf->size;
    ++num_buffers;
 
-   context->decoder->begin_frame(context->decoder, context->target,
-      &context->desc.base);
+   if (context->needs_begin_frame) {
+      context->decoder->begin_frame(context->decoder, context->target,
+         &context->desc.base);
+      context->needs_begin_frame = false;
+   }
    context->decoder->decode_bitstream(context->decoder, context->target, &context->desc.base,
       num_buffers, (const void * const*)buffers, sizes);
 }
index 8faec106ea21c1d0637b012191edf74c5ce0d6d9..0877236288cc421c21ba9dab52d73bb0a5c342e6 100644 (file)
@@ -261,6 +261,7 @@ typedef struct {
    int target_id;
    bool first_single_submitted;
    int gop_coeff;
+   bool needs_begin_frame;
 } vlVaContext;
 
 typedef struct {