vulkan: move instance_open into the utility ensure_element_data

So callers don't have to perform it themselves.
This commit is contained in:
Matthew Waters 2016-02-08 14:32:10 +11:00
parent 0bcb3cdd29
commit bfab93dabe
2 changed files with 8 additions and 6 deletions

View file

@ -252,12 +252,6 @@ gst_vulkan_sink_change_state (GstElement * element, GstStateChange transition)
return GST_STATE_CHANGE_FAILURE;
}
if (!gst_vulkan_instance_open (vk_sink->instance, &error)) {
GST_ELEMENT_ERROR (vk_sink, RESOURCE, NOT_FOUND,
("Failed to create vulkan instance"), ("%s", error->message));
return GST_STATE_CHANGE_FAILURE;
}
if (!(vk_sink->device =
gst_vulkan_instance_create_device (vk_sink->instance, &error))) {
GST_ELEMENT_ERROR (vk_sink, RESOURCE, NOT_FOUND,

View file

@ -195,6 +195,8 @@ gst_vulkan_ensure_element_data (gpointer element,
* type.
*/
if (!*instance_ptr) {
GError *error = NULL;
_vk_gst_context_query (element, GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR);
/* Neighbour found and it updated the display */
@ -209,6 +211,12 @@ gst_vulkan_ensure_element_data (gpointer element,
_vk_context_propagate (element, context);
}
if (!gst_vulkan_instance_open (*instance_ptr, &error)) {
GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
("Failed to create vulkan instance"), ("%s", error->message));
return FALSE;
}
}
if (!*display_ptr) {