anv: Add an anv_queue_family struct
This is modeled on anv_memory_type and anv_memory_heap which we already use for managing memory types. Each anv_queue_family contains some data which is returned by vkGetPhysicalDeviceQueueFamilyProperties() verbatim as well as some internal book-keeping bits. An array of queue families along with a count is stored in the physical device. Each anv_queue then contains a pointer to the anv_queue_family to which it belongs. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8667>
This commit is contained in:
parent
4b920ba5ab
commit
89ae945730
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue