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

wm4 nfxjfg at googlemail.com
Tue Jan 30 06:30:47 CET 2018


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).


More information about the libav-devel mailing list