diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 4195ef9c49b..72147526461 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -296,6 +296,19 @@ anv_physical_device_free_disk_cache(struct anv_physical_device *device) #endif } +static void +anv_physical_device_init_queue_families(struct anv_physical_device *pdevice) +{ + pdevice->queue.family_count = 1; + pdevice->queue.families[0] = (struct anv_queue_family) { + .queueFlags = VK_QUEUE_GRAPHICS_BIT | + VK_QUEUE_COMPUTE_BIT | + VK_QUEUE_TRANSFER_BIT, + .queueCount = 1, + .engine_class = I915_ENGINE_CLASS_RENDER, + }; +} + static VkResult anv_physical_device_try_create(struct anv_instance *instance, drmDevicePtr drm_device, @@ -550,6 +563,8 @@ anv_physical_device_try_create(struct anv_instance *instance, } device->master_fd = master_fd; + anv_physical_device_init_queue_families(device); + result = anv_init_wsi(device); if (result != VK_SUCCESS) goto fail_disk_cache; @@ -2193,13 +2208,8 @@ void anv_GetPhysicalDeviceProperties2( #undef CORE_PROPERTY } -/* We support exactly one queue family. */ static const VkQueueFamilyProperties -anv_queue_family_properties = { - .queueFlags = VK_QUEUE_GRAPHICS_BIT | - VK_QUEUE_COMPUTE_BIT | - VK_QUEUE_TRANSFER_BIT, - .queueCount = 1, +anv_queue_family_properties_template = { .timestampValidBits = 36, /* XXX: Real value here */ .minImageTransferGranularity = { 1, 1, 1 }, }; @@ -2209,10 +2219,16 @@ void anv_GetPhysicalDeviceQueueFamilyProperties( uint32_t* pCount, VkQueueFamilyProperties* pQueueFamilyProperties) { + ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice); VK_OUTARRAY_MAKE(out, pQueueFamilyProperties, pCount); - vk_outarray_append(&out, p) { - *p = anv_queue_family_properties; + for (uint32_t i = 0; i < pdevice->queue.family_count; i++) { + struct anv_queue_family *queue_family = &pdevice->queue.families[i]; + vk_outarray_append(&out, p) { + *p = anv_queue_family_properties_template; + p->queueFlags = queue_family->queueFlags; + p->queueCount = queue_family->queueCount; + } } } @@ -2221,14 +2237,19 @@ void anv_GetPhysicalDeviceQueueFamilyProperties2( uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties) { - + ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice); VK_OUTARRAY_MAKE(out, pQueueFamilyProperties, pQueueFamilyPropertyCount); - vk_outarray_append(&out, p) { - p->queueFamilyProperties = anv_queue_family_properties; + for (uint32_t i = 0; i < pdevice->queue.family_count; i++) { + struct anv_queue_family *queue_family = &pdevice->queue.families[i]; + vk_outarray_append(&out, p) { + p->queueFamilyProperties = anv_queue_family_properties_template; + p->queueFamilyProperties.queueFlags = queue_family->queueFlags; + p->queueFamilyProperties.queueCount = queue_family->queueCount; - vk_foreach_struct(s, p->pNext) { - anv_debug_ignored_stype(s->sType); + vk_foreach_struct(s, p->pNext) { + anv_debug_ignored_stype(s->sType); + } } } } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index ef7f9a36ccd..389c1d49661 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1033,6 +1033,17 @@ struct anv_bo_cache { VkResult anv_bo_cache_init(struct anv_bo_cache *cache); void anv_bo_cache_finish(struct anv_bo_cache *cache); +struct anv_queue_family { + /* Standard bits passed on to the client */ + VkQueueFlags queueFlags; + uint32_t queueCount; + + /* Driver internal information */ + enum drm_i915_gem_engine_class engine_class; +}; + +#define ANV_MAX_QUEUE_FAMILIES 1 + struct anv_memory_type { /* Standard bits passed on to the client */ VkMemoryPropertyFlags propertyFlags; @@ -1129,6 +1140,11 @@ struct anv_physical_device { uint32_t eu_total; uint32_t subslice_total; + struct { + uint32_t family_count; + struct anv_queue_family families[ANV_MAX_QUEUE_FAMILIES]; + } queue; + struct { uint32_t type_count; struct anv_memory_type types[VK_MAX_MEMORY_TYPES]; @@ -1240,11 +1256,12 @@ struct anv_queue_submit { }; struct anv_queue { - struct vk_object_base base; + struct vk_object_base base; struct anv_device * device; VkDeviceQueueCreateFlags flags; + struct anv_queue_family * family; /* Set once from the device api calls. */ bool lost_signaled; diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c index e95ebecc11f..6a7e57db230 100644 --- a/src/intel/vulkan/anv_queue.c +++ b/src/intel/vulkan/anv_queue.c @@ -488,10 +488,15 @@ VkResult anv_queue_init(struct anv_device *device, struct anv_queue *queue, const VkDeviceQueueCreateInfo *pCreateInfo) { + struct anv_physical_device *pdevice = device->physical; VkResult result; queue->device = device; queue->flags = pCreateInfo->flags; + + assert(pCreateInfo->queueFamilyIndex < pdevice->queue.family_count); + queue->family = &pdevice->queue.families[pCreateInfo->queueFamilyIndex]; + queue->lost = false; queue->quit = false;