[FFmpeg-devel] [PATCH] hwcontext_opencl: choose the first device if multiple devices are available

Xiang, Haihao haihao.xiang at intel.com
Tue Jan 23 04:52:11 EET 2024


On Ma, 2024-01-22 at 20:32 +0000, Mark Thompson wrote:
> On 17/01/2024 07:36, Xiang, Haihao wrote:
> > From: Haihao Xiang <haihao.xiang at intel.com>
> > 
> > This makes '-init_hw_device opencl' work in a multiple-device system.
> 
> Under what circumstances is this more useful than the existing behaviour which
> prompts the user to select the device they intend?

@item -init_hw_device
@var{type}[=@var{name}][:@var{device}[, at var{key=value}...]]

My understanding is that only @var{type} is mandatory, @var{device} (and others)
is optional, indeed '-init_hw_device opencl' works well in a single-device
system, however the same command doesn't work in a multiple-device system. It is
not a good experience for me. 

> 
> There is no particular ordering to devices, the first one is just random. 
> Having your process fail with an opaque message (because the device picked
> lacks some operation) or run many times slower than expected (because the
> smallest device happened to be first in the list) or do something different on
> a machine which looks the same (because it has an extra driver for something
> else) rather than just saying up front that there are multiple devices and the
> user needs to pick seems worse to me, since it is much harder to see where the
> problem is.

I understand your concern, how about making the default works while prompting a
warning about the device selection ? 

Thanks
Haihao



More information about the ffmpeg-devel mailing list