From 3723d2051a782e994517fb6eaac8ede9e82ecf78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 3 Mar 2017 19:55:00 +0100 Subject: [PATCH] plugins: retry to create the VA display Particularly in GNOME Wayland, the negotiated or created GL context defines a GLX environment, but VAAPI fails to create a GLX VA display because there is no a DRI2 connection. This patch retries to create the VA display if VA cannot create one with the GL context parameters. Now using the old list of display types. This should also work in the case of systems with two GPU, when the non-VAAPI has the graphics environment, and the VAAPI-enabled one shall work headless. https://bugzilla.gnome.org/show_bug.cgi?id=772838 --- gst/vaapi/gstvaapipluginutil.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 2ac5a1a9d5..9a12472baa 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -268,7 +268,7 @@ gboolean gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type) { GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (element); - GstVaapiDisplay *display; + GstVaapiDisplay *display = NULL; g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); @@ -284,9 +284,15 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type) gst_vaapi_find_gl_context (element); /* If no neighboor, or application not interested, use system default */ - if (plugin->gl_context) + if (plugin->gl_context) { display = gst_vaapi_create_display_from_gl_context (plugin->gl_context); - else + /* Cannot instantiate VA display based on GL context. Reset the + * requested display type to ANY to try again */ + if (!display) + gst_vaapi_plugin_base_set_display_type (plugin, + GST_VAAPI_DISPLAY_TYPE_ANY); + } + if (!display) display = gst_vaapi_create_display (type, plugin->display_name); if (!display) return FALSE;