summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2017-08-15 12:33:21 -0400
committerLeo Liu <[email protected]>2017-08-21 10:09:09 -0400
commit5608f442712dc7ae7855c1bfd8059e1a62d721c7 (patch)
treebcbbf37c83e398d713b87ba343110a221f890c3a
parent2ebc530ca376fc5f07b7982d9598bdfb5fe4032e (diff)
st/va: reallocate surface with YUYV stream
Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
-rw-r--r--src/gallium/state_trackers/va/picture.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index 1e1212dd7a9..e0287d30f2c 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -592,6 +592,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
void *feedback;
struct pipe_screen *screen;
bool interlaced;
+ bool realloc = false;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -627,7 +628,23 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile,
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_PREFERS_INTERLACED);
+ realloc = true;
+ }
+
+ if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG &&
+ surf->buffer->buffer_format == PIPE_FORMAT_NV12) {
+ if (context->mjpeg.sampling_factor == 0x211111 ||
+ context->mjpeg.sampling_factor == 0x221212) {
+ surf->templat.buffer_format = PIPE_FORMAT_YUYV;
+ realloc = true;
+ } else if (context->mjpeg.sampling_factor != 0x221111) {
+ /* Not NV12 either */
+ mtx_unlock(&drv->mutex);
+ return VA_STATUS_ERROR_INVALID_SURFACE;
+ }
+ }
+ if (realloc) {
surf->buffer->destroy(surf->buffer);
if (vlVaHandleSurfaceAllocate(ctx, surf, &surf->templat) != VA_STATUS_SUCCESS) {