[Libva] [PATCH] vaDeriveImage: properly set VAImage format

Xiang, Haihao haihao.xiang at intel.com
Mon Sep 28 19:36:21 PDT 2015


> https://bugs.freedesktop.org/show_bug.cgi?id=92088
> 
> Signed-off-by: Julien Isorce <j.isorce at samsung.com>
> ---
>  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 9bbd67f..bf599d6 100644
> --- a/src/i965_drv_video.c
> +++ b/src/i965_drv_video.c
> @@ -4008,6 +4008,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;
> @@ -4055,9 +4056,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;
> +        }
> +    }

i965_image_formats_map() holds images exposed by vaQueryImageFormats()
only. it doesn't include the derived image formats.



> +
> +    if (!i965_image_formats_map[i].va_format.fourcc)
> +        goto error;
>  
>      switch (image->format.fourcc) {
>      case VA_FOURCC_YV12:




More information about the Libva mailing list