st/va: delay calling begin_frame until we have all parameters
authorNayan Deshmukh <nayan26deshmukh@gmail.com>
Fri, 13 Jan 2017 13:15:31 +0000 (18:45 +0530)
committerChristian König <christian.koenig@amd.com>
Mon, 16 Jan 2017 14:09:01 +0000 (15:09 +0100)
If begin_frame is called before setting intra_matrix and
non_intra_matrix it leads to segmentation faults when
vl_mpeg12_decoder.c is used.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92634
Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/picture.c

index b5b9a8361b97ee82b93699cfb4894b817476e965..dc7121c3037ff17e808de5fc78f9e7dc5d3a1c5b 100644 (file)
@@ -178,9 +178,6 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
 
       if (!context->decoder)
          return VA_STATUS_ERROR_ALLOCATION_FAILED;
-
-      context->decoder->begin_frame(context->decoder, context->target,
-         &context->desc.base);
    }
 
    return vaStatus;
@@ -310,6 +307,9 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf)
    buffers[num_buffers] = buf->data;
    sizes[num_buffers] = buf->size;
    ++num_buffers;
+
+   context->decoder->begin_frame(context->decoder, context->target,
+      &context->desc.base);
    context->decoder->decode_bitstream(context->decoder, context->target, &context->desc.base,
       num_buffers, (const void * const*)buffers, sizes);
 }