libs: display: pass display info when foreign display

When creating a GstVaapiDisplay using a foreign VADisplay, and render
with that display, it also requires native display of the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
This commit is contained in:
Hyunjun Ko 2017-07-05 14:32:35 +09:00 committed by Víctor Manuel Jáquez Leal
parent ec3e10f666
commit 356212214b

View file

@ -852,29 +852,38 @@ gst_vaapi_display_destroy (GstVaapiDisplay * display)
static gboolean static gboolean
gst_vaapi_display_create_unlocked (GstVaapiDisplay * display, gst_vaapi_display_create_unlocked (GstVaapiDisplay * display,
GstVaapiDisplayInitType init_type, gpointer init_value) GstVaapiDisplayInitType init_type, gpointer data)
{ {
GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display); GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display);
const GstVaapiDisplayClass *const klass = const GstVaapiDisplayClass *const klass =
GST_VAAPI_DISPLAY_GET_CLASS (display); GST_VAAPI_DISPLAY_GET_CLASS (display);
GstVaapiDisplayInfo info; GstVaapiDisplayInfo info = {
.display = display,
memset (&info, 0, sizeof (info)); .display_type = priv->display_type,
info.display = display; };
info.display_type = priv->display_type;
switch (init_type) { switch (init_type) {
case GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY: case GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY:{
info.va_display = init_value; GstVaapiDisplayInfo *p_info = data;
priv->display = init_value;
info.va_display = p_info->va_display;
info.display_type = p_info->display_type;
priv->display = p_info->va_display;
priv->use_foreign_display = TRUE; priv->use_foreign_display = TRUE;
break;
if (!klass->bind_display)
break;
data = p_info->native_display;
goto bind_display;
}
case GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME: case GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME:
if (klass->open_display && !klass->open_display (display, init_value)) if (klass->open_display && !klass->open_display (display, data))
return FALSE; return FALSE;
goto create_display; goto create_display;
case GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY: case GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY:
if (klass->bind_display && !klass->bind_display (display, init_value)) bind_display:
if (klass->bind_display && !klass->bind_display (display, data))
return FALSE; return FALSE;
// fall-through // fall-through
create_display: create_display:
@ -1068,8 +1077,13 @@ error:
GstVaapiDisplay * GstVaapiDisplay *
gst_vaapi_display_new_with_display (VADisplay va_display) gst_vaapi_display_new_with_display (VADisplay va_display)
{ {
GstVaapiDisplayInfo info = {
.va_display = va_display,
.display_type = GST_VAAPI_DISPLAY_TYPE_ANY,
};
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY, NULL), return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY, NULL),
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, va_display); GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, &info);
} }
/** /**