[FFmpeg-devel] [PATCH] libavcodec/nvenc.c Reduce initialization time for gpu id > 0

Timo Rothenpieler timo at rothenpieler.org
Fri Jan 20 11:51:24 EET 2017


> Yes, this is a simpler logic. Works for me locally. Can you please apply this patch to ffmpeg master. Thanks.

Applied

We also discovered a case where this patch is necessary to successfully
use multiple GPUs at all.

A user asked in #ffmpeg about nvenc getting stuck when one GPU is at
full load, even when ffmpeg was instructed to use a different GPU.
Turned out that when GPU #0 is under full video engine load,
initializing CUDA/NVENC on it just hangs indefinitely until the load
drops. With the old logic this meant then when trying to use GPU #1,
ffmpeg would still initialize GPU #0 to test its capabilities and get
stuck while doing so.
Not sure if this is intended behavior, I'd expect CUDA/NVENC to just
fail when no resources are left instead of blocking indefinitely on init.

The primary problem of being unable to use GPU #1 has been fixed with
this patch though.


More information about the ffmpeg-devel mailing list