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.
Unified · Split
| @@ -1458,6 +1458,11 @@ The following options are recognized: · 1457 unmodified lines | |||
| 1458 | When @var{device} is not specified, use this option to specify the name of the kernel | 1458 | When @var{device} is not specified, use this option to specify the name of the kernel |
| 1459 | driver associated with the desired device. This option is available only when | 1459 | driver associated with the desired device. This option is available only when |
| 1460 | the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled. | 1460 | the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled. |
| 1461 | @item vendor_id | ||
| 1462 | When @var{device} and @var{kernel_driver} are not specified, use this option to specify | ||
| 1463 | the vendor id associated with the desired device. This option is available only when the | ||
| 1464 | hardware acceleration method @emph{drm} and @emph{vaapi} are enabled and @emph{kernel_driver} | ||
| 1465 | is not specified. | ||
| 1461 | @end table | 1466 | @end table |
| 1462 | 1467 | ||
| 1463 | Examples: | 1468 | Examples: |
| @@ -1473,6 +1478,9 @@ Create a vaapi device on DirectX adapter 1. · 9 unmodified lines | |||
| 1473 | 1478 | ||
| 1474 | @item -init_hw_device vaapi:,kernel_driver=i915 | 1479 | @item -init_hw_device vaapi:,kernel_driver=i915 |
| 1475 | Create a vaapi device on a device associated with kernel driver @samp{i915}. | 1480 | Create a vaapi device on a device associated with kernel driver @samp{i915}. |
| 1481 | |||
| 1482 | @item -init_hw_device vaapi:,vendor_id=0x8086 | ||
| 1483 | Create a vaapi device on a device associated with vendor id @samp{0x8086}. | ||
| 1476 | @end table | 1484 | @end table |
| 1477 | 1485 | ||
| 1478 | @item vdpau | 1486 | @item vdpau |
| @@ -1748,7 +1748,9 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, · 1747 unmodified lines | |||
| 1748 | #if CONFIG_LIBDRM | 1748 | #if CONFIG_LIBDRM |
| 1749 | drmVersion *info; | 1749 | drmVersion *info; |
| 1750 | const AVDictionaryEntry *kernel_driver; | 1750 | const AVDictionaryEntry *kernel_driver; |
| 1751 | const AVDictionaryEntry *vendor_id; | ||
| 1751 | kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0); | 1752 | kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0); |
| 1753 | vendor_id = av_dict_get(opts, "vendor_id", NULL, 0); | ||
| 1752 | #endif | 1754 | #endif |
| 1753 | for (n = 0; n < max_devices; n++) { | 1755 | for (n = 0; n < max_devices; n++) { |
| 1754 | snprintf(path, sizeof(path), | 1756 | snprintf(path, sizeof(path), |
| @@ -1803,6 +1805,33 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, · 48 unmodified lines | |||
| 1803 | close(priv->drm_fd); | 1805 | close(priv->drm_fd); |
| 1804 | priv->drm_fd = -1; | 1806 | priv->drm_fd = -1; |
| 1805 | continue; | 1807 | continue; |
| 1808 | } else if (vendor_id) { | ||
| 1809 | drmDevicePtr device; | ||
| 1810 | char drm_vendor[8]; | ||
| 1811 | if (drmGetDevice(priv->drm_fd, &device)) { | ||
| 1812 | av_log(ctx, AV_LOG_VERBOSE, | ||
| 1813 | "Failed to get DRM device info for device %d.\n", n); | ||
| 1814 | close(priv->drm_fd); | ||
| 1815 | priv->drm_fd = -1; | ||
| 1816 | continue; | ||
| 1817 | } | ||
| 1818 | |||
| 1819 | snprintf(drm_vendor, sizeof(drm_vendor), "0x%x", device->deviceinfo.pci->vendor_id); | ||
| 1820 | if (strcmp(vendor_id->value, drm_vendor)) { | ||
| 1821 | av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d " | ||
| 1822 | "with non-matching vendor id (%s).\n", | ||
| 1823 | n, vendor_id->value); | ||
| 1824 | drmFreeDevice(&device); | ||
| 1825 | close(priv->drm_fd); | ||
| 1826 | priv->drm_fd = -1; | ||
| 1827 | continue; | ||
| 1828 | } | ||
| 1829 | av_log(ctx, AV_LOG_VERBOSE, "Trying to use " | ||
| 1830 | "DRM render node for device %d, " | ||
| 1831 | "with matching vendor id (%s).\n", | ||
| 1832 | n, vendor_id->value); | ||
| 1833 | drmFreeDevice(&device); | ||
| 1834 | break; | ||
| 1806 | } | 1835 | } |
| 1807 | drmFreeVersion(info); | 1836 | drmFreeVersion(info); |
| 1808 | #endif | 1837 | #endif |
| @@ -79,7 +79,7 @@ · 78 unmodified lines | |||
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | #define LIBAVUTIL_VERSION_MAJOR 59 | 81 | #define LIBAVUTIL_VERSION_MAJOR 59 |
| 82 | #define LIBAVUTIL_VERSION_MINOR 32 | 82 | #define LIBAVUTIL_VERSION_MINOR 33 |
| 83 | #define LIBAVUTIL_VERSION_MICRO 100 | 83 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 84 | 84 | ||
| 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |