summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_vaapi.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-11-14 21:25:00 +0000
committerMark Thompson <sw@jkqxz.net>2019-06-02 23:03:27 +0100
commit7f3f5a24a1c70c6a8e72cdf387252ce0d1afee7f (patch)
treed6b0aafa758c5722f69a20e21fd2048ffa08ea66 /libavutil/hwcontext_vaapi.c
parent6b6b8a63713cf730a3793b7715be0470d6152191 (diff)
hwcontext_vaapi: Add option to set driver name
For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo This may be more convenient that using the environment variable, and allows loading different drivers for different devices in the same process.
Diffstat (limited to 'libavutil/hwcontext_vaapi.c')
-rw-r--r--libavutil/hwcontext_vaapi.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 941c257b1b..f05b9ee9cf 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1598,6 +1598,23 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
return AVERROR(EINVAL);
}
+ ent = av_dict_get(opts, "driver", NULL, 0);
+ if (ent) {
+#if VA_CHECK_VERSION(0, 38, 0)
+ VAStatus vas;
+ vas = vaSetDriverName(display, ent->value);
+ if (vas != VA_STATUS_SUCCESS) {
+ av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to "
+ "%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas));
+ vaTerminate(display);
+ return AVERROR_EXTERNAL;
+ }
+#else
+ av_log(ctx, AV_LOG_WARNING, "Driver name setting is not "
+ "supported with this VAAPI version.\n");
+#endif
+ }
+
return vaapi_device_connect(ctx, display);
}