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
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-03-03 19:55:00 +01:00
parent 8d86b3f40a
commit 3723d2051a

View file

@ -268,7 +268,7 @@ gboolean
gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type) gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type)
{ {
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (element); GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (element);
GstVaapiDisplay *display; GstVaapiDisplay *display = NULL;
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); 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); gst_vaapi_find_gl_context (element);
/* If no neighboor, or application not interested, use system default */ /* 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); 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); display = gst_vaapi_create_display (type, plugin->display_name);
if (!display) if (!display)
return FALSE; return FALSE;