Commit 2dcdaaf7 authored by Matthew Waters's avatar Matthew Waters 🐨

vulkan: ensure initialization of a couple of debug categories

Needed when some of the context querying functions can be called before
an instance has been created.
parent db617a98
......@@ -46,12 +46,23 @@ struct _GstVulkanDevicePrivate
gboolean opened;
};
#define gst_vulkan_device_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanDevice, gst_vulkan_device, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstVulkanDevice)
static void
_init_debug (void)
{
static volatile gsize init;
if (g_once_init_enter (&init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkandevice", 0,
"Vulkan Device");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
g_once_init_leave (&init, 1);
}
}
#define gst_vulkan_device_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanDevice, gst_vulkan_device, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstVulkanDevice);
_init_debug ());
/**
* gst_vulkan_device_new:
......@@ -567,6 +578,8 @@ gst_vulkan_device_run_context_query (GstElement * element,
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (device != NULL, FALSE);
_init_debug ();
if (*device && GST_IS_VULKAN_DEVICE (*device))
return TRUE;
......
......@@ -603,6 +603,8 @@ gst_vulkan_display_run_context_query (GstElement * element,
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (display != NULL, FALSE);
_init_debug ();
if (*display && GST_IS_VULKAN_DISPLAY (*display))
return TRUE;
......
......@@ -59,14 +59,25 @@ struct _GstVulkanInstancePrivate
gboolean opened;
};
static void
_init_debug (void)
{
static volatile gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkaninstance", 0,
"Vulkan Instance");
GST_DEBUG_CATEGORY_INIT (GST_VULKAN_DEBUG_CAT, "vulkandebug", 0,
"Vulkan Debug");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
g_once_init_leave (&_init, 1);
}
}
#define gst_vulkan_instance_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanInstance, gst_vulkan_instance,
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstVulkanInstance)
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
"vulkaninstance", 0, "Vulkan Instance");
GST_DEBUG_CATEGORY_INIT (GST_VULKAN_DEBUG_CAT,
"vulkandebug", 0, "Vulkan Debug");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
_init_debug ());
GstVulkanInstance *
gst_vulkan_instance_new (void)
......@@ -578,6 +589,8 @@ gst_vulkan_instance_run_context_query (GstElement * element,
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (instance != NULL, FALSE);
_init_debug ();
if (*instance && GST_IS_VULKAN_INSTANCE (*instance))
return TRUE;
......
......@@ -37,11 +37,21 @@
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
static void
_init_debug (void)
{
static volatile gsize init;
if (g_once_init_enter (&init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkanqueue", 0, "Vulkan Queue");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
g_once_init_leave (&init, 1);
}
}
#define parent_class gst_vulkan_queue_parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanQueue, gst_vulkan_queue, GST_TYPE_OBJECT,
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkanqueue", 0,
"Vulkan Queue");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
_init_debug ());
static void gst_vulkan_queue_dispose (GObject * object);
......@@ -255,6 +265,8 @@ gst_vulkan_queue_run_context_query (GstElement * element,
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (queue != NULL, FALSE);
_init_debug ();
if (*queue && GST_IS_VULKAN_QUEUE (*queue))
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment