From 8930b196762294abb9069b261e502586d2d434bd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 10 Jul 2020 14:40:01 -0400 Subject: [PATCH] zink: store valid timestamp bits onto zink_screen we need this for converting timestamp ticks to nonoseconds Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/zink/zink_screen.c | 19 ++++++++++--------- src/gallium/drivers/zink/zink_screen.h | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 64ea00786d0..6df0127b243 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -662,24 +662,25 @@ choose_pdev(const VkInstance instance) return pdev; } -static uint32_t -find_gfx_queue(const VkPhysicalDevice pdev) +static void +update_queue_props(struct zink_screen *screen) { uint32_t num_queues; - vkGetPhysicalDeviceQueueFamilyProperties(pdev, &num_queues, NULL); + vkGetPhysicalDeviceQueueFamilyProperties(screen->pdev, &num_queues, NULL); assert(num_queues > 0); VkQueueFamilyProperties *props = malloc(sizeof(*props) * num_queues); - vkGetPhysicalDeviceQueueFamilyProperties(pdev, &num_queues, props); + vkGetPhysicalDeviceQueueFamilyProperties(screen->pdev, &num_queues, props); for (uint32_t i = 0; i < num_queues; i++) { if (props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) { - free(props); - return i; + screen->gfx_queue = i; + screen->timestamp_valid_bits = props[i].timestampValidBits; + assert(screen->timestamp_valid_bits); + break; } } - - return UINT32_MAX; + free(props); } static void @@ -768,7 +769,7 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd) screen->instance = create_instance(); screen->pdev = choose_pdev(screen->instance); - screen->gfx_queue = find_gfx_queue(screen->pdev); + update_queue_props(screen); vkGetPhysicalDeviceMemoryProperties(screen->pdev, &screen->mem_props); diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index a4fae652738..0b6e62ed569 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -66,6 +66,7 @@ struct zink_screen { bool have_D24_UNORM_S8_UINT; uint32_t gfx_queue; + uint32_t timestamp_valid_bits; VkDevice dev; PFN_vkGetMemoryFdKHR vk_GetMemoryFdKHR; -- 2.30.2