[vlc-devel] [PATCH 4/4] avcodec: va: get the picture to send to the vout during Extract() not Get()

Steve Lhomme robux4 at gmail.com
Wed Nov 30 09:03:34 CET 2016

On Tue, Nov 29, 2016 at 5:48 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le tiistaina 29. marraskuuta 2016, 14.19.38 EET Steve Lhomme a écrit :
>> In some cases the decoder pool is stuck on picture_pool_Wait() because the
>> va keeps requesting referenced pictures without outputing anything (yet).
> I have not seen this in recent times and the problem is in no way specific to
> hardware acceleration in any case.

It it related to the fact the library we use (libavcodec) requires all
decoding buffers to be allocated and provided at once for DVXA2 and
D3D11VA. And there's at least a good reason for that, the pool must
provide the pictures in LIFO order. The surface copying in Direct3D is
asynchronous and when a B frame is decoded it's released right away by
the decoder and possibly reused for the next decoding, if the pool
provides pictures in FIFO order. That results in glitches or crashes.

> The eventual intent is to use the picture pool normally even in hardware decoding case.

This is precisely because I changed to code to use that pool, rather
than allocating twice the amount of pictures, that I have the issue.
But this is incompatible with the fact that the va code also gets
pictures from the same pool to decode pictures. Hence the asynchronous
copy during Extract() which wouldn't be necessary if only one picture
was used.

I don't see many solutions to this. Changing the algorithm of the
picture pool to do LIFO instead of FIFO would help. Changes may also
be needed in libavcodec so that it doesn't need to preallocate all the
decoding buffers.

Would the picture pool change be OK with you ? If we can avoid one
copy for each picture decoded by the hardware that's also a good
performance boost.

> --
> Rémi Denis-Courmont
> https://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

More information about the vlc-devel mailing list