History

hwcontext_qsv: Try to select a matching VAAPI device by default

Tries to find a device backed by the i915 kernel driver and loads the iHD VAAPI driver to use with it. This reduces confusion on machines with multiple DRM devices and removes the surprising requirement to set the LIBVA_DRIVER_NAME environment variable to use libmfx at all.

Mark Thompson committed 7 years ago

Commit 468f0031 parent 0b4696f1 file · +12 −3Browse files

Unified · Split

libavutil/hwcontext_qsv.c+12−3
@@ -1206,6 +1206,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, · 1205 unmodified lines
12061206 QSVDevicePriv *priv;
12071207 enum AVHWDeviceType child_device_type;
12081208 AVHWDeviceContext *child_device;
1209+ AVDictionary *child_device_opts;
12091210 AVDictionaryEntry *e;
12101211
12111212 mfxIMPL impl;
@@ -1220,9 +1221,17 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, · 8 unmodified lines
12201221
12211222 e = av_dict_get(opts, "child_device", NULL, 0);
12221223
1223− if (CONFIG_VAAPI)
1224+ child_device_opts = NULL;
1225+ if (CONFIG_VAAPI) {
12241226 child_device_type = AV_HWDEVICE_TYPE_VAAPI;
1225− else if (CONFIG_DXVA2)
1227+ // libmfx does not actually implement VAAPI properly, rather it
1228+ // depends on the specific behaviour of a matching iHD driver when
1229+ // used on recent Intel hardware. Set options to the VAAPI device
1230+ // creation so that we should pick a usable setup by default if
1231+ // possible, even when multiple devices and drivers are available.
1232+ av_dict_set(&child_device_opts, "kernel_driver", "i915", 0);
1233+ av_dict_set(&child_device_opts, "driver", "iHD", 0);
1234+ } else if (CONFIG_DXVA2)
12261235 child_device_type = AV_HWDEVICE_TYPE_DXVA2;
12271236 else {
12281237 av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n");
@@ -1230,7 +1239,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, · 1 unmodified line
12301239 }
12311240
12321241 ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type,
1233− e ? e->value : NULL, NULL, 0);
1242+ e ? e->value : NULL, child_device_opts, 0);
12341243 if (ret < 0)
12351244 return ret;
12361245

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t