From 863e78577010129d2c5061f6ef14b4dfa3f477a2 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 16 Sep 2019 11:24:13 +1000 Subject: [PATCH] vulkan: expose various flags to string methods --- gst-libs/gst/vulkan/gstvkdebug-private.h | 5 ----- gst-libs/gst/vulkan/gstvkdebug.c | 20 ++++++++++++++++++++ gst-libs/gst/vulkan/gstvkdebug.h | 12 ++++++++++++ gst-libs/gst/vulkan/gstvkdevice.c | 21 +-------------------- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/gst-libs/gst/vulkan/gstvkdebug-private.h b/gst-libs/gst/vulkan/gstvkdebug-private.h index 899749e25c..08a8c8259e 100644 --- a/gst-libs/gst/vulkan/gstvkdebug-private.h +++ b/gst-libs/gst/vulkan/gstvkdebug-private.h @@ -27,11 +27,6 @@ G_BEGIN_DECLS -gchar * gst_vulkan_memory_property_flags_to_string (VkMemoryPropertyFlags prop_bits); -gchar * gst_vulkan_memory_heap_flags_to_string (VkMemoryHeapFlags prop_bits); -gchar * gst_vulkan_queue_flags_to_string (VkQueueFlags queue_bits); -gchar * gst_vulkan_sample_count_flags_to_string (VkSampleCountFlags sample_count_bits); - G_END_DECLS #endif /* __GST_VULKAN_DEBUG_PRIVATE_H__ */ diff --git a/gst-libs/gst/vulkan/gstvkdebug.c b/gst-libs/gst/vulkan/gstvkdebug.c index e587a23632..99069c292d 100644 --- a/gst-libs/gst/vulkan/gstvkdebug.c +++ b/gst-libs/gst/vulkan/gstvkdebug.c @@ -25,6 +25,7 @@ #include #include "gstvkerror.h" +#include "gstvkdebug.h" #include "gstvkdebug-private.h" #define FLAGS_TO_STRING(under_name, VkType) \ @@ -108,3 +109,22 @@ static const struct }; FLAGS_TO_STRING(sample_count, VkSampleCountFlags); /* *INDENT-ON* */ + +const gchar * +gst_vulkan_device_type_to_string (VkPhysicalDeviceType type) +{ + switch (type) { + case VK_PHYSICAL_DEVICE_TYPE_OTHER: + return "other"; + case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: + return "integrated"; + case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: + return "discrete"; + case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: + return "virtual"; + case VK_PHYSICAL_DEVICE_TYPE_CPU: + return "CPU"; + default: + return "unknown"; + } +} diff --git a/gst-libs/gst/vulkan/gstvkdebug.h b/gst-libs/gst/vulkan/gstvkdebug.h index 04345c04da..7d4da912aa 100644 --- a/gst-libs/gst/vulkan/gstvkdebug.h +++ b/gst-libs/gst/vulkan/gstvkdebug.h @@ -30,6 +30,18 @@ G_BEGIN_DECLS #define GST_VULKAN_EXTENT3D_FORMAT G_GUINT32_FORMAT ", %" G_GUINT32_FORMAT ", %" G_GUINT32_FORMAT #define GST_VULKAN_EXTENT3D_ARGS(var) (var).width, (var).height, (var).depth +GST_VULKAN_API +const gchar * gst_vulkan_device_type_to_string (VkPhysicalDeviceType type); + +GST_VULKAN_API +gchar * gst_vulkan_memory_property_flags_to_string (VkMemoryPropertyFlags prop_bits); +GST_VULKAN_API +gchar * gst_vulkan_memory_heap_flags_to_string (VkMemoryHeapFlags prop_bits); +GST_VULKAN_API +gchar * gst_vulkan_queue_flags_to_string (VkQueueFlags queue_bits); +GST_VULKAN_API +gchar * gst_vulkan_sample_count_flags_to_string (VkSampleCountFlags sample_count_bits); + G_END_DECLS #endif /* __GST_VULKAN_DEBUG_H__ */ diff --git a/gst-libs/gst/vulkan/gstvkdevice.c b/gst-libs/gst/vulkan/gstvkdevice.c index c1e20dfc91..925eada945 100644 --- a/gst-libs/gst/vulkan/gstvkdevice.c +++ b/gst-libs/gst/vulkan/gstvkdevice.c @@ -511,25 +511,6 @@ dump_sparse_properties (GstVulkanDevice * device, GError ** error) return TRUE; } -static const gchar * -_device_type_to_string (VkPhysicalDeviceType type) -{ - switch (type) { - case VK_PHYSICAL_DEVICE_TYPE_OTHER: - return "other"; - case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: - return "integrated"; - case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: - return "discrete"; - case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: - return "virtual"; - case VK_PHYSICAL_DEVICE_TYPE_CPU: - return "CPU"; - default: - return "unknown"; - } -} - static gboolean _physical_device_info (GstVulkanDevice * device, GError ** error) { @@ -548,7 +529,7 @@ _physical_device_info (GstVulkanDevice * device, GError ** error) GST_INFO_OBJECT (device, "pyhsical device %i name \'%s\' type \'%s\' " "api version %u.%u.%u, driver version %u.%u.%u vendor ID 0x%x, " "device ID 0x%x", device->device_index, props.deviceName, - _device_type_to_string (props.deviceType), + gst_vulkan_device_type_to_string (props.deviceType), VK_VERSION_MAJOR (props.apiVersion), VK_VERSION_MINOR (props.apiVersion), VK_VERSION_PATCH (props.apiVersion), VK_VERSION_MAJOR (props.driverVersion),