From c21aefbfb05ac48a839dd93be960be2acbd9bb37 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 15 Jun 2020 01:38:03 +1000 Subject: [PATCH] vulkan: log extension/layers available/enabled on instance/device creation Part-of: --- gst-libs/gst/vulkan/gstvkdevice.c | 11 +++++ gst-libs/gst/vulkan/gstvkinstance.c | 49 +++++++++++++++++++---- gst-libs/gst/vulkan/gstvkphysicaldevice.c | 13 +++++- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/gst-libs/gst/vulkan/gstvkdevice.c b/gst-libs/gst/vulkan/gstvkdevice.c index 76be6449b0..9cdc62f203 100644 --- a/gst-libs/gst/vulkan/gstvkdevice.c +++ b/gst-libs/gst/vulkan/gstvkdevice.c @@ -294,6 +294,17 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error) priv->queue_family_id = i; priv->n_queues = 1; + GST_INFO_OBJECT (device, "Creating a device from physical %" GST_PTR_FORMAT + " with %u layers and %u extensions", device->physical_device, + priv->enabled_layers->len, priv->enabled_extensions->len); + + for (i = 0; i < priv->enabled_layers->len; i++) + GST_DEBUG_OBJECT (device, "layer %u: %s", i, + (gchar *) g_ptr_array_index (priv->enabled_layers, i)); + for (i = 0; i < priv->enabled_extensions->len; i++) + GST_DEBUG_OBJECT (device, "extension %u: %s", i, + (gchar *) g_ptr_array_index (priv->enabled_extensions, i)); + { VkDeviceQueueCreateInfo queue_info = { 0, }; VkDeviceCreateInfo device_info = { 0, }; diff --git a/gst-libs/gst/vulkan/gstvkinstance.c b/gst-libs/gst/vulkan/gstvkinstance.c index fd16a0ca0d..1773358865 100644 --- a/gst-libs/gst/vulkan/gstvkinstance.c +++ b/gst-libs/gst/vulkan/gstvkinstance.c @@ -713,6 +713,7 @@ gst_vulkan_instance_fill_info_unlocked (GstVulkanInstance * instance, { GstVulkanInstancePrivate *priv; VkResult err; + guint i; priv = GET_PRIV (instance); @@ -756,6 +757,16 @@ gst_vulkan_instance_fill_info_unlocked (GstVulkanInstance * instance, return FALSE; } + GST_INFO_OBJECT (instance, "found %u layers and %u extensions", + priv->n_available_layers, priv->n_available_extensions); + + for (i = 0; i < priv->n_available_layers; i++) + GST_DEBUG_OBJECT (instance, "available layer %u: %s", i, + priv->available_layers[i].layerName); + for (i = 0; i < priv->n_available_extensions; i++) + GST_DEBUG_OBJECT (instance, "available extension %u: %s", i, + priv->available_extensions[i].extensionName); + /* configure default extensions */ { GstVulkanDisplayType display_type; @@ -854,15 +865,8 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error) requested_instance_api = VK_MAKE_VERSION (priv->requested_api_major, priv->requested_api_minor, 0); - GST_INFO_OBJECT (instance, "requesting Vulkan API %u.%u, max supported " - "%u.%u", priv->requested_api_major, priv->requested_api_minor, - VK_VERSION_MAJOR (priv->supported_instance_api), - VK_VERSION_MINOR (priv->supported_instance_api)); } else { requested_instance_api = priv->supported_instance_api; - GST_INFO_OBJECT (instance, "requesting maximum supported API %u.%u", - VK_VERSION_MAJOR (priv->supported_instance_api), - VK_VERSION_MINOR (priv->supported_instance_api)); } if (requested_instance_api > priv->supported_instance_api) { @@ -875,6 +879,37 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error) goto error; } + /* list of known vulkan loader environment variables taken from: + * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/loader/LoaderAndLayerInterface.md#table-of-debug-environment-variables */ + GST_DEBUG_OBJECT (instance, "VK_ICD_FILENAMES: %s", + g_getenv ("VK_ICD_FILENAMES")); + GST_DEBUG_OBJECT (instance, "VK_INSTANCE_LAYERS: %s", + g_getenv ("VK_INSTANCE_LAYERS")); + GST_DEBUG_OBJECT (instance, "VK_LAYER_PATH: %s", g_getenv ("VK_LAYER_PATH")); + GST_DEBUG_OBJECT (instance, "VK_LOADER_DISABLE_INST_EXT_FILTER: %s", + g_getenv ("VK_LOADER_DISABLE_INST_EXT_FILTER")); + GST_DEBUG_OBJECT (instance, "VK_LOADER_DEBUG: %s", + g_getenv ("VK_LOADER_DEBUG")); + + { + guint i; + + GST_INFO_OBJECT (instance, "attempting to create instance for Vulkan API " + "%u.%u, max supported %u.%u with %u layers and %u extensions", + VK_VERSION_MAJOR (requested_instance_api), + VK_VERSION_MINOR (requested_instance_api), + VK_VERSION_MAJOR (priv->supported_instance_api), + VK_VERSION_MINOR (priv->supported_instance_api), + priv->enabled_layers->len, priv->enabled_extensions->len); + + for (i = 0; i < priv->enabled_layers->len; i++) + GST_DEBUG_OBJECT (instance, "layer %u: %s", i, + (gchar *) g_ptr_array_index (priv->enabled_layers, i)); + for (i = 0; i < priv->enabled_extensions->len; i++) + GST_DEBUG_OBJECT (instance, "extension %u: %s", i, + (gchar *) g_ptr_array_index (priv->enabled_extensions, i)); + } + { VkApplicationInfo app = { 0, }; VkInstanceCreateInfo inst_info = { 0, }; diff --git a/gst-libs/gst/vulkan/gstvkphysicaldevice.c b/gst-libs/gst/vulkan/gstvkphysicaldevice.c index f55e0f4754..cf9be303bb 100644 --- a/gst-libs/gst/vulkan/gstvkphysicaldevice.c +++ b/gst-libs/gst/vulkan/gstvkphysicaldevice.c @@ -802,6 +802,7 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device, { GstVulkanPhysicalDevicePrivate *priv = GET_PRIV (device); VkResult err; + guint i; device->device = gst_vulkan_physical_device_get_handle (device); if (!device->device) { @@ -833,8 +834,6 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device, "vkEnumerateDeviceExtensionProperties") < 0) { goto error; } - GST_DEBUG_OBJECT (device, "Found %u extensions", - priv->n_available_extensions); priv->available_extensions = g_new0 (VkExtensionProperties, priv->n_available_extensions); @@ -846,6 +845,16 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device, goto error; } + GST_INFO_OBJECT (device, "found %u layers and %u extensions", + priv->n_available_layers, priv->n_available_extensions); + + for (i = 0; i < priv->n_available_layers; i++) + GST_DEBUG_OBJECT (device, "available layer %u: %s", i, + priv->available_layers[i].layerName); + for (i = 0; i < priv->n_available_extensions; i++) + GST_DEBUG_OBJECT (device, "available extension %u: %s", i, + priv->available_extensions[i].extensionName); + vkGetPhysicalDeviceProperties (device->device, &device->properties); #if defined (VK_API_VERSION_1_2) if (gst_vulkan_instance_check_version (device->instance, 1, 2, 0)) { -- 2.34.1