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

Xiang, Haihao haihao.xiang at intel.com
Mon Oct 12 22:02:34 PDT 2015


On Sun, 2015-10-11 at 16:33 +0100, Julien Isorce wrote:
> Hi Xiang,
> 
> 
> Thx for your review. I initially did not understand your remark and I
> had not time to go further.
> 
> But I figure out that indeed I cannot use i965_image_formats_map
> because it is does not entirely include the format exposes in the
> i965_DeriveImage switch. I was focus on RGB likes format.
> 
> So I submitted a v2 (see mail just before). It looks a bit verbose,
> maybe its own map would be better. 

i965_fourcc_infos[] holds fourcc info, bits_per_pixel is equal to the
sum of i965_fourcc_infos[i].bpp[].


> But I am ok with whatever solution you prefer. Just let me know.


> Cheers
> 
> Julien
> 
> 
> On 29 September 2015 at 03:36, Xiang, Haihao <haihao.xiang at intel.com>
> wrote:
>         
>         > 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