mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +00:00
vadisplay: only register elements of allowed drivers
Now that nvidia-vaapi-driver appeared and isn't yet supported by GstVA, we've to add an allowed list of supported drivers. This patch implements it adding a environment variable to disable this driver check: GST_VA_ALL_DRIVERS Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5616>
This commit is contained in:
parent
49865826b0
commit
d7b5b54eda
2 changed files with 13 additions and 4 deletions
|
@ -128,6 +128,7 @@ _gst_va_display_filter_driver (GstVaDisplay * self, gpointer foreign_display)
|
|||
GstVaDisplayPrivate *priv = GET_PRIV (self);
|
||||
VADisplay dpy;
|
||||
const char *vendor;
|
||||
GstVaImplementation impl;
|
||||
|
||||
g_assert ((foreign_display != NULL) ^ (priv->display != NULL));
|
||||
dpy = foreign_display ? foreign_display : priv->display;
|
||||
|
@ -135,13 +136,19 @@ _gst_va_display_filter_driver (GstVaDisplay * self, gpointer foreign_display)
|
|||
vendor = vaQueryVendorString (dpy);
|
||||
GST_INFO ("VA-API driver vendor: %s", vendor);
|
||||
|
||||
/* XXX(victor): driver allow list */
|
||||
impl = _get_implementation (vendor);
|
||||
|
||||
if (foreign_display) {
|
||||
priv->display = foreign_display;
|
||||
priv->foreign = TRUE;
|
||||
} else {
|
||||
if (g_getenv ("GST_VA_ALL_DRIVERS") == NULL
|
||||
&& impl == GST_VA_IMPLEMENTATION_OTHER) {
|
||||
GST_WARNING_OBJECT (self, "Unsupported driver: %s", vendor);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
priv->impl = _get_implementation (vendor);
|
||||
priv->impl = impl;
|
||||
priv->vendor_desc = _get_desc (vendor, priv->impl);
|
||||
|
||||
return TRUE;
|
||||
|
@ -164,6 +171,7 @@ gst_va_display_set_display (GstVaDisplay * self, gpointer display)
|
|||
/* assume driver is already initialized */
|
||||
priv->init = TRUE;
|
||||
|
||||
/* assumed that user knows what's doing so all drivers are allowed */
|
||||
_gst_va_display_filter_driver (self, display);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static void
|
|||
plugin_add_dependencies (GstPlugin * plugin)
|
||||
{
|
||||
#ifndef G_OS_WIN32
|
||||
const gchar *env_vars[] = { "LIBVA_DRIVER_NAME", NULL };
|
||||
const gchar *env_vars[] = { "LIBVA_DRIVER_NAME", "GST_VA_ALL_DRIVERS", NULL };
|
||||
const gchar *kernel_paths[] = { "/dev/dri", NULL };
|
||||
const gchar *kernel_names[] = { "renderD", NULL };
|
||||
|
||||
|
@ -66,7 +66,8 @@ plugin_add_dependencies (GstPlugin * plugin)
|
|||
gst_plugin_add_dependency (plugin, NULL, kernel_paths, kernel_names,
|
||||
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX);
|
||||
|
||||
/* features get updated upon changes on LIBVA_DRIVER_NAME envvar */
|
||||
/* features get updated upon changes on LIBVA_DRIVER_NAME and
|
||||
* GST_VA_ALL_DRIVERS envvar */
|
||||
gst_plugin_add_dependency (plugin, env_vars, NULL, NULL,
|
||||
GST_PLUGIN_DEPENDENCY_FLAG_NONE);
|
||||
|
||||
|
|
Loading…
Reference in a new issue