diff mbox

[FFmpeg-devel] vaapi_vp9: Do not set bit_depth on old versions

Message ID 01ee65fc-c93d-7142-333f-aad786d3384b@jkqxz.net
State Superseded
Headers show

Commit Message

Mark Thompson Dec. 8, 2016, 3:51 p.m. UTC
Fixes ticket #6003.
---
On 08/12/16 15:16, Carl Eugen Hoyos wrote:
> 2016-12-05 21:32 GMT+01:00 Mathieu Velten <matmaul@gmail.com>:
>> ---
>>  libavcodec/vaapi_vp9.c |  1 +
>>  libavcodec/vp9.c       | 10 +++++++++-
>>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> (This is missing a review here but I guess it's just me
> who can't work with gmail.)
> 
> May I suggest to revert this?
> 
>> +    pp->bit_depth = h->h.bpp;
> 
> Google doesn't easily find a version of va_dec_vp9.h
> with _VADecPictureParameterBufferVP9->bit_depth.

Urgh: libva 1.6.0 to 1.6.2 don't have this field.

Hacky fix enclosing, only compile tested.

A configure test for this might be better, because we could then check it sensibly in the generic code and bail out earlier?  (Which would permit software decode, this will attempt hardware decode and fail.)


 libavcodec/vaapi_vp9.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Mark Thompson Dec. 8, 2016, 3:55 p.m. UTC | #1
On 08/12/16 15:51, Mark Thompson wrote:
> Hacky fix enclosing, only compile tested.
> 
> A configure test for this might be better, because we could then check it sensibly in the generic code and bail out earlier?  (Which would permit software decode, this will attempt hardware decode and fail.)

Or maybe change the current configure test to drop support for VP9 in those versions entirely?  Newer versions of libva including the field already existed when the first hardware which could do VP9 at all through this was released.

- Mark
James Almer Dec. 8, 2016, 4:13 p.m. UTC | #2
On 12/8/2016 12:55 PM, Mark Thompson wrote:
> On 08/12/16 15:51, Mark Thompson wrote:
>> Hacky fix enclosing, only compile tested.
>>
>> A configure test for this might be better, because we could then check it sensibly in the generic code and bail out earlier?  (Which would permit software decode, this will attempt hardware decode and fail.)
> 
> Or maybe change the current configure test to drop support for VP9 in those versions entirely?  Newer versions of libva including the field already existed when the first hardware which could do VP9 at all through this was released.
> 
> - Mark

Definitely make the first version with that field the minimum in that case.
The least amount of ifdeffery the better.
Carl Eugen Hoyos Dec. 10, 2016, 12:09 p.m. UTC | #3
2016-12-08 16:51 GMT+01:00 Mark Thompson <sw@jkqxz.net>:
> Fixes ticket #6003.

>> May I suggest to revert this?
>>
>>> +    pp->bit_depth = h->h.bpp;
>>
>> Google doesn't easily find a version of va_dec_vp9.h
>> with _VADecPictureParameterBufferVP9->bit_depth.
>
> Urgh: libva 1.6.0 to 1.6.2 don't have this field.
>
> Hacky fix enclosing, only compile tested.

As long as you work on a "better" fix, please either
apply or revert the original patch, build regressions
are not acceptable.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
index 9b3e81a..5bc413d 100644
--- a/libavcodec/vaapi_vp9.c
+++ b/libavcodec/vaapi_vp9.c
@@ -38,7 +38,10 @@  static void fill_picture_parameters(AVCodecContext                 *avctx,
     pp->first_partition_size = h->h.compressed_header_size;
 
     pp->profile = h->h.profile;
+
+#if VA_CHECK_VERSION(0, 39, 0)
     pp->bit_depth = h->h.bpp;
+#endif
 
     pp->filter_level = h->h.filter.level;
     pp->sharpness_level = h->h.filter.sharpness;
@@ -97,6 +100,14 @@  static int vaapi_vp9_start_frame(AVCodecContext          *avctx,
     FFVAContext * const vactx = ff_vaapi_get_context(avctx);
     VADecPictureParameterBufferVP9 *pic_param;
 
+#if !VA_CHECK_VERSION(0, 39, 0)
+    if (h->h.profile >= 2) {
+        av_log(avctx, AV_LOG_ERROR, "VP9 profile %d is not supported "
+               "with this libva version.\n", h->h.profile);
+        return AVERROR
+    }
+#endif
+
     vactx->slice_param_size = sizeof(VASliceParameterBufferVP9);
 
     pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VADecPictureParameterBufferVP9));