mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device
Vendor id will help to select desired device in case of kernel driver is unknow or unsupported, for vendor may support different kernel driver on different platforms. Signed-off-by: Fei Wang <fei.w.wang@intel.com>
This commit is contained in:
parent
c390234da2
commit
dbd74ba3c8
@ -1458,6 +1458,11 @@ The following options are recognized:
|
||||
When @var{device} is not specified, use this option to specify the name of the kernel
|
||||
driver associated with the desired device. This option is available only when
|
||||
the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled.
|
||||
@item vendor_id
|
||||
When @var{device} and @var{kernel_driver} are not specified, use this option to specify
|
||||
the vendor id associated with the desired device. This option is available only when the
|
||||
hardware acceleration method @emph{drm} and @emph{vaapi} are enabled and @emph{kernel_driver}
|
||||
is not specified.
|
||||
@end table
|
||||
|
||||
Examples:
|
||||
@ -1473,6 +1478,9 @@ Create a vaapi device on DirectX adapter 1.
|
||||
|
||||
@item -init_hw_device vaapi:,kernel_driver=i915
|
||||
Create a vaapi device on a device associated with kernel driver @samp{i915}.
|
||||
|
||||
@item -init_hw_device vaapi:,vendor_id=0x8086
|
||||
Create a vaapi device on a device associated with vendor id @samp{0x8086}.
|
||||
@end table
|
||||
|
||||
@item vdpau
|
||||
|
@ -1748,7 +1748,9 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
|
||||
#if CONFIG_LIBDRM
|
||||
drmVersion *info;
|
||||
const AVDictionaryEntry *kernel_driver;
|
||||
const AVDictionaryEntry *vendor_id;
|
||||
kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0);
|
||||
vendor_id = av_dict_get(opts, "vendor_id", NULL, 0);
|
||||
#endif
|
||||
for (n = 0; n < max_devices; n++) {
|
||||
snprintf(path, sizeof(path),
|
||||
@ -1803,6 +1805,33 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
continue;
|
||||
} else if (vendor_id) {
|
||||
drmDevicePtr device;
|
||||
char drm_vendor[8];
|
||||
if (drmGetDevice(priv->drm_fd, &device)) {
|
||||
av_log(ctx, AV_LOG_VERBOSE,
|
||||
"Failed to get DRM device info for device %d.\n", n);
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
snprintf(drm_vendor, sizeof(drm_vendor), "0x%x", device->deviceinfo.pci->vendor_id);
|
||||
if (strcmp(vendor_id->value, drm_vendor)) {
|
||||
av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d "
|
||||
"with non-matching vendor id (%s).\n",
|
||||
n, vendor_id->value);
|
||||
drmFreeDevice(&device);
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
continue;
|
||||
}
|
||||
av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
|
||||
"DRM render node for device %d, "
|
||||
"with matching vendor id (%s).\n",
|
||||
n, vendor_id->value);
|
||||
drmFreeDevice(&device);
|
||||
break;
|
||||
}
|
||||
drmFreeVersion(info);
|
||||
#endif
|
||||
|
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 59
|
||||
#define LIBAVUTIL_VERSION_MINOR 32
|
||||
#define LIBAVUTIL_VERSION_MINOR 33
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user