anv: Refactor anv_GetPhysicalDeviceQueueFamilyProperties()
authorChad Versace <chadversary@chromium.org>
Wed, 25 Jan 2017 20:12:19 +0000 (12:12 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 26 Jan 2017 03:18:46 +0000 (19:18 -0800)
Add a helper function, anv_get_queue_family_properties(), which fills the
struct.  This patch reduces churn in the following patch that implements
vkGetPhysicalDeviceQueueFamilyProperties2KHR.

Reviewed-by: Jason Ekstranad <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_device.c

index b24949c5f44ec0c0ac45908420b31598505ed0fc..84338dce812e2bb782de9051b563def3abc7ac61 100644 (file)
@@ -640,11 +640,27 @@ void anv_GetPhysicalDeviceProperties(
    memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
 }
 
+static void
+anv_get_queue_family_properties(struct anv_physical_device *phys_dev,
+                                VkQueueFamilyProperties *props)
+{
+   *props = (VkQueueFamilyProperties) {
+      .queueFlags = VK_QUEUE_GRAPHICS_BIT |
+                    VK_QUEUE_COMPUTE_BIT |
+                    VK_QUEUE_TRANSFER_BIT,
+      .queueCount = 1,
+      .timestampValidBits = 36, /* XXX: Real value here */
+      .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
+   };
+}
+
 void anv_GetPhysicalDeviceQueueFamilyProperties(
     VkPhysicalDevice                            physicalDevice,
     uint32_t*                                   pCount,
     VkQueueFamilyProperties*                    pQueueFamilyProperties)
 {
+   ANV_FROM_HANDLE(anv_physical_device, phys_dev, physicalDevice);
+
    if (pQueueFamilyProperties == NULL) {
       *pCount = 1;
       return;
@@ -659,16 +675,8 @@ void anv_GetPhysicalDeviceQueueFamilyProperties(
    if (*pCount == 0)
       return;
 
-   *pQueueFamilyProperties = (VkQueueFamilyProperties) {
-      .queueFlags = VK_QUEUE_GRAPHICS_BIT |
-                    VK_QUEUE_COMPUTE_BIT |
-                    VK_QUEUE_TRANSFER_BIT,
-      .queueCount = 1,
-      .timestampValidBits = 36, /* XXX: Real value here */
-      .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
-   };
-
    *pCount = 1;
+   anv_get_queue_family_properties(phys_dev, pQueueFamilyProperties);
 }
 
 void anv_GetPhysicalDeviceMemoryProperties(