vulkan: only pass the device/instance/display in to *_handle_*() functions

We don't need to change the pointer value in these functions.
This commit is contained in:
Matthew Waters 2019-09-16 11:21:55 +10:00
parent 0b0d5afb53
commit 407dab607f
14 changed files with 45 additions and 38 deletions

View file

@ -546,11 +546,11 @@ gst_vulkan_download_query (GstBaseTransform * bt, GstPadDirection direction,
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONTEXT:{
if (gst_vulkan_handle_context_query (GST_ELEMENT (vk_download), query,
NULL, &vk_download->instance, &vk_download->device))
NULL, vk_download->instance, vk_download->device))
return TRUE;
if (gst_vulkan_queue_handle_context_query (GST_ELEMENT (vk_download),
query, &vk_download->queue))
query, vk_download->queue))
return TRUE;
break;

View file

@ -170,11 +170,11 @@ gst_vulkan_full_screen_render_query (GstBaseTransform * bt,
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONTEXT:{
if (gst_vulkan_handle_context_query (GST_ELEMENT (render), query,
NULL, &render->instance, &render->device))
NULL, render->instance, render->device))
return TRUE;
if (gst_vulkan_queue_handle_context_query (GST_ELEMENT (render),
query, &render->queue))
query, render->queue))
return TRUE;
break;

View file

@ -221,10 +221,10 @@ gst_vulkan_sink_query (GstBaseSink * bsink, GstQuery * query)
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONTEXT:{
if (gst_vulkan_handle_context_query (GST_ELEMENT (vk_sink), query,
&vk_sink->display, &vk_sink->instance, &vk_sink->device))
vk_sink->display, vk_sink->instance, vk_sink->device))
return TRUE;
if (gst_vulkan_queue_handle_context_query (GST_ELEMENT (vk_sink), query,
&vk_sink->swapper->queue))
vk_sink->swapper->queue))
return TRUE;
break;

View file

@ -1259,11 +1259,11 @@ gst_vulkan_upload_query (GstBaseTransform * bt, GstPadDirection direction,
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONTEXT:{
if (gst_vulkan_handle_context_query (GST_ELEMENT (vk_upload), query,
NULL, &vk_upload->instance, &vk_upload->device))
NULL, vk_upload->instance, vk_upload->device))
return TRUE;
if (gst_vulkan_queue_handle_context_query (GST_ELEMENT (vk_upload), query,
&vk_upload->queue))
vk_upload->queue))
return TRUE;
break;

View file

@ -928,7 +928,7 @@ gst_context_get_vulkan_device (GstContext * context, GstVulkanDevice ** device)
*/
gboolean
gst_vulkan_device_handle_context_query (GstElement * element, GstQuery * query,
GstVulkanDevice ** device)
GstVulkanDevice * device)
{
gboolean res = FALSE;
const gchar *context_type;
@ -937,7 +937,9 @@ gst_vulkan_device_handle_context_query (GstElement * element, GstQuery * query,
g_return_val_if_fail (element != NULL, FALSE);
g_return_val_if_fail (query != NULL, FALSE);
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE);
g_return_val_if_fail (device != NULL, FALSE);
if (!device)
return FALSE;
gst_query_parse_context_type (query, &context_type);
@ -949,11 +951,11 @@ gst_vulkan_device_handle_context_query (GstElement * element, GstQuery * query,
else
context = gst_context_new (GST_VULKAN_DEVICE_CONTEXT_TYPE_STR, TRUE);
gst_context_set_vulkan_device (context, *device);
gst_context_set_vulkan_device (context, device);
gst_query_set_context (query, context);
gst_context_unref (context);
res = *device != NULL;
res = device != NULL;
}
return res;

View file

@ -96,7 +96,7 @@ gboolean gst_context_get_vulkan_device (GstContext * contex
GST_VULKAN_API
gboolean gst_vulkan_device_handle_context_query (GstElement * element,
GstQuery * query,
GstVulkanDevice ** device);
GstVulkanDevice * device);
GST_VULKAN_API
gboolean gst_vulkan_device_run_context_query (GstElement * element,
GstVulkanDevice ** device);

View file

@ -570,7 +570,7 @@ gst_vulkan_display_type_to_extension_string (GstVulkanDisplayType type)
* gst_vulkan_display_handle_context_query:
* @element: a #GstElement
* @query: a #GstQuery of type #GST_QUERY_CONTEXT
* @display: the #GstVulkanDisplay
* @display: (nullable): the #GstVulkanDisplay
*
* If a #GstVulkanDisplay is requested in @query, sets @device as the reply.
*
@ -583,7 +583,7 @@ gst_vulkan_display_type_to_extension_string (GstVulkanDisplayType type)
*/
gboolean
gst_vulkan_display_handle_context_query (GstElement * element, GstQuery * query,
GstVulkanDisplay ** display)
GstVulkanDisplay * display)
{
gboolean res = FALSE;
const gchar *context_type;
@ -592,7 +592,9 @@ gst_vulkan_display_handle_context_query (GstElement * element, GstQuery * query,
g_return_val_if_fail (element != NULL, FALSE);
g_return_val_if_fail (query != NULL, FALSE);
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE);
g_return_val_if_fail (display != NULL, FALSE);
if (!display)
return FALSE;
gst_query_parse_context_type (query, &context_type);
@ -604,11 +606,11 @@ gst_vulkan_display_handle_context_query (GstElement * element, GstQuery * query,
else
context = gst_context_new (GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR, TRUE);
gst_context_set_vulkan_display (context, *display);
gst_context_set_vulkan_display (context, display);
gst_query_set_context (query, context);
gst_context_unref (context);
res = *display != NULL;
res = display != NULL;
}
return res;

View file

@ -125,7 +125,7 @@ void gst_context_set_vulkan_display (GstContext
GST_VULKAN_API
gboolean gst_vulkan_display_handle_context_query (GstElement * element,
GstQuery * query,
GstVulkanDisplay ** display);
GstVulkanDisplay * display);
GST_VULKAN_API
gboolean gst_vulkan_display_run_context_query (GstElement * element,
GstVulkanDisplay ** display);

View file

@ -526,7 +526,7 @@ gst_context_get_vulkan_instance (GstContext * context,
* gst_vulkan_instance_handle_context_query:
* @element: a #GstElement
* @query: a #GstQuery of type #GST_QUERY_CONTEXT
* @instance: the #GstVulkanInstance
* @instance: (nullable): the #GstVulkanInstance
*
* If a #GstVulkanInstance is requested in @query, sets @instance as the reply.
*
@ -539,7 +539,7 @@ gst_context_get_vulkan_instance (GstContext * context,
*/
gboolean
gst_vulkan_instance_handle_context_query (GstElement * element,
GstQuery * query, GstVulkanInstance ** instance)
GstQuery * query, GstVulkanInstance * instance)
{
gboolean res = FALSE;
const gchar *context_type;
@ -548,7 +548,9 @@ gst_vulkan_instance_handle_context_query (GstElement * element,
g_return_val_if_fail (element != NULL, FALSE);
g_return_val_if_fail (query != NULL, FALSE);
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE);
g_return_val_if_fail (instance != NULL, FALSE);
if (!instance)
return FALSE;
gst_query_parse_context_type (query, &context_type);
@ -560,11 +562,11 @@ gst_vulkan_instance_handle_context_query (GstElement * element,
else
context = gst_context_new (GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR, TRUE);
gst_context_set_vulkan_instance (context, *instance);
gst_context_set_vulkan_instance (context, instance);
gst_query_set_context (query, context);
gst_context_unref (context);
res = *instance != NULL;
res = instance != NULL;
}
return res;

View file

@ -80,7 +80,7 @@ gboolean gst_context_get_vulkan_instance (GstContext * co
GST_VULKAN_API
gboolean gst_vulkan_instance_handle_context_query (GstElement * element,
GstQuery * query,
GstVulkanInstance ** instance);
GstVulkanInstance * instance);
GST_VULKAN_API
gboolean gst_vulkan_instance_run_context_query (GstElement * element,
GstVulkanInstance ** instance);

View file

@ -200,7 +200,7 @@ gst_context_get_vulkan_queue (GstContext * context, GstVulkanQueue ** queue)
* gst_vulkan_queue_handle_context_query:
* @element: a #GstElement
* @query: a #GstQuery of type #GST_QUERY_CONTEXT
* @queue: the #GstVulkanQueue
* @queue: (nullable): the #GstVulkanQueue
*
* If a #GstVulkanQueue is requested in @query, sets @queue as the reply.
*
@ -213,7 +213,7 @@ gst_context_get_vulkan_queue (GstContext * context, GstVulkanQueue ** queue)
*/
gboolean
gst_vulkan_queue_handle_context_query (GstElement * element, GstQuery * query,
GstVulkanQueue ** queue)
GstVulkanQueue * queue)
{
gboolean res = FALSE;
const gchar *context_type;
@ -222,7 +222,9 @@ gst_vulkan_queue_handle_context_query (GstElement * element, GstQuery * query,
g_return_val_if_fail (element != NULL, FALSE);
g_return_val_if_fail (query != NULL, FALSE);
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE);
g_return_val_if_fail (queue != NULL, FALSE);
if (!queue)
return FALSE;
gst_query_parse_context_type (query, &context_type);
@ -234,11 +236,11 @@ gst_vulkan_queue_handle_context_query (GstElement * element, GstQuery * query,
else
context = gst_context_new (GST_VULKAN_QUEUE_CONTEXT_TYPE_STR, TRUE);
gst_context_set_vulkan_queue (context, *queue);
gst_context_set_vulkan_queue (context, queue);
gst_query_set_context (query, context);
gst_context_unref (context);
res = *queue != NULL;
res = queue != NULL;
}
return res;

View file

@ -67,7 +67,7 @@ gboolean gst_context_get_vulkan_queue (GstContext * co
GST_VULKAN_API
gboolean gst_vulkan_queue_handle_context_query (GstElement * element,
GstQuery * query,
GstVulkanQueue ** queue);
GstVulkanQueue * queue);
GST_VULKAN_API
gboolean gst_vulkan_queue_run_context_query (GstElement * element,
GstVulkanQueue ** queue);

View file

@ -390,11 +390,10 @@ gst_vulkan_handle_set_context (GstElement * element, GstContext * context,
*/
gboolean
gst_vulkan_handle_context_query (GstElement * element, GstQuery * query,
GstVulkanDisplay ** display, GstVulkanInstance ** instance,
GstVulkanDevice ** device)
GstVulkanDisplay * display, GstVulkanInstance * instance,
GstVulkanDevice * device)
{
if (display
&& gst_vulkan_display_handle_context_query (element, query, display))
if (gst_vulkan_display_handle_context_query (element, query, display))
return TRUE;
if (gst_vulkan_instance_handle_context_query (element, query, instance))
return TRUE;

View file

@ -37,9 +37,9 @@ gboolean gst_vulkan_handle_set_context (GstElement * el
GST_VULKAN_API
gboolean gst_vulkan_handle_context_query (GstElement * element,
GstQuery * query,
GstVulkanDisplay ** display,
GstVulkanInstance ** instance,
GstVulkanDevice ** device);
GstVulkanDisplay * display,
GstVulkanInstance * instance,
GstVulkanDevice * device);
GST_VULKAN_API
void gst_vulkan_global_context_query (GstElement * element,