Created attachment 117666 [details]
Right now gstreamer-vaapi uses vaPutImage for encoding (jpeg encoding in this particular case).
When adding support for other input video formats, I just found that the i965_hw_putimage() doesn't handle the case when the surface and the image have different color format.
Looking at i965_sw_putimage(), it does (triggers an error).
In the case of i965_hw_putimage(), as far as I understand, the postprocessor is used for the color conversion, nonetheless the generated jpeg image is corrupted.
I attach a minimal case-test:
$ make run
$ display tulips_uyvy.jpg
You can "fix" the output changing the define SAMEFORMAT to 1
Comment on attachment 117666 [details]
fix mime type
$ wget https://bugs.freedesktop.org/attachment.cgi?id=117666 -O test.tgz
$ tar tf test.tgz
va_status = i965_hw_getimage(ctx, obj_surface, obj_image, &rect);
va_status = i965_sw_getimage(ctx, obj_surface, obj_image, &rect);
above is the latest implementation, if the hardware has VPP, it only select i965_hw_getimage() no mater what the color format it is. and i965_hw_getimage() do support some color formats conversion. if the comment has some mistake or misunderstanding, just feel free to let me know.