From 9e1b76f03a09bf43d932a4d97126ee69235194fd Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Mon, 21 Sep 2015 21:42:03 +0100 Subject: [PATCH] vaDeriveImage: properly set VAImage format Signed-off-by: Julien Isorce --- src/i965_drv_video.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 1f4c322..54490b5 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -4006,6 +4006,7 @@ VAStatus i965_DeriveImage(VADriverContextP ctx, struct object_surface *obj_surface; VAImageID image_id; unsigned int w_pitch; + int i = 0; VAStatus va_status = VA_STATUS_ERROR_OPERATION_FAILED; out_image->image_id = VA_INVALID_ID; @@ -4053,9 +4054,16 @@ VAStatus i965_DeriveImage(VADriverContextP ctx, image->height = obj_surface->orig_height; image->data_size = obj_surface->size; - image->format.fourcc = obj_surface->fourcc; - image->format.byte_order = VA_LSB_FIRST; - image->format.bits_per_pixel = 12; + for (i = 0; i965_image_formats_map[i].va_format.fourcc != 0; i++) { + const i965_image_format_map_t * const m = &i965_image_formats_map[i]; + if (m->va_format.fourcc == obj_surface->fourcc) { + image->format = m->va_format; + break; + } + } + + if (!i965_image_formats_map[i].va_format.fourcc) + goto error; switch (image->format.fourcc) { case VA_FOURCC_YV12: -- 1.9.1