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
1206 QSVDevicePriv *priv;1206 QSVDevicePriv *priv;
1207 enum AVHWDeviceType child_device_type;1207 enum AVHWDeviceType child_device_type;
1208 AVHWDeviceContext *child_device;1208 AVHWDeviceContext *child_device;
1209 AVDictionary *child_device_opts;
1209 AVDictionaryEntry *e;1210 AVDictionaryEntry *e;
1210 1211
1211 mfxIMPL impl;1212 mfxIMPL impl;
@@ -1220,9 +1221,17 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, · 8 unmodified lines
1220 1221
1221 e = av_dict_get(opts, "child_device", NULL, 0);1222 e = av_dict_get(opts, "child_device", NULL, 0);
1222 1223
1223 if (CONFIG_VAAPI)1224 child_device_opts = NULL;
1225 if (CONFIG_VAAPI) {
1224 child_device_type = AV_HWDEVICE_TYPE_VAAPI;1226 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)
1226 child_device_type = AV_HWDEVICE_TYPE_DXVA2;1235 child_device_type = AV_HWDEVICE_TYPE_DXVA2;
1227 else {1236 else {
1228 av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n");1237 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
1230 }1239 }
1231 1240
1232 ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type,1241 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);
1234 if (ret < 0)1243 if (ret < 0)
1235 return ret;1244 return ret;
1236 1245

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