[libav-devel] [PATCH 04/12] lavc/dxva2: Don't add per-thread surfaces twice

Mark Thompson sw at jkqxz.net
Tue Jan 30 23:34:28 CET 2018


On 30/01/18 05:30, wm4 wrote:
> On Mon, 29 Jan 2018 23:01:21 +0000
> Mark Thompson <sw at jkqxz.net> wrote:
> 
>> This is already accounted for in the generic code, so it shouldn't also
>> be added here.
>> ---
>>  libavcodec/dxva2.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
>> index edc8ade96..f111d0b79 100644
>> --- a/libavcodec/dxva2.c
>> +++ b/libavcodec/dxva2.c
>> @@ -611,10 +611,6 @@ int ff_dxva2_common_frame_params(AVCodecContext *avctx,
>>      if (avctx->extra_hw_frames > 0)
>>          num_surfaces += avctx->extra_hw_frames;
>>  
>> -    /* add extra surfaces for frame threading */
>> -    if (avctx->active_thread_type & FF_THREAD_FRAME)
>> -        num_surfaces += avctx->thread_count;
>> -
>>      frames_ctx->sw_format = avctx->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ?
>>                              AV_PIX_FMT_P010 : AV_PIX_FMT_NV12;
>>      frames_ctx->width = FFALIGN(avctx->coded_width, surface_alignment);
> 
> OK, but after this change it's still not correct.
> 
> It looks like the adding of thread surfaces should be moved from the
> ff_decode_get_hw_frames_ctx() to avcodec_get_hw_frames_parameters().
> 
> The public API is supposed to always add them (because it's pretty much
> an implementation detail). If we don't want to have them in the hwaccel
> impls. (like dxva2 in this case), then the public API function must add
> them, or it'd break API users (and require them to know about the
> additional frame threading requirements).

Hmm, yeah.  That also means it's currently wrong for VAAPI in the get_hw_frames_parameters() case, since that never gets the per-thread frames added.

Will fix this up suitably.

Thanks,

- Mark


More information about the libav-devel mailing list