1 /*
2  * Copyright © 2015 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 /**
25  * This file implements VkQueue
26  */
27 
28 #include "anv_private.h"
29 
30 VkResult
anv_queue_init(struct anv_device * device,struct anv_queue * queue,uint32_t exec_flags,const VkDeviceQueueCreateInfo * pCreateInfo,uint32_t index_in_family)31 anv_queue_init(struct anv_device *device, struct anv_queue *queue,
32                uint32_t exec_flags,
33                const VkDeviceQueueCreateInfo *pCreateInfo,
34                uint32_t index_in_family)
35 {
36    struct anv_physical_device *pdevice = device->physical;
37    VkResult result;
38 
39    result = vk_queue_init(&queue->vk, &device->vk, pCreateInfo,
40                           index_in_family);
41    if (result != VK_SUCCESS)
42       return result;
43 
44    queue->vk.driver_submit = anv_queue_submit;
45 
46    queue->device = device;
47 
48    assert(queue->vk.queue_family_index < pdevice->queue.family_count);
49    queue->family = &pdevice->queue.families[queue->vk.queue_family_index];
50 
51    queue->index_in_family = index_in_family;
52 
53    queue->exec_flags = exec_flags;
54 
55    return VK_SUCCESS;
56 }
57 
58 void
anv_queue_finish(struct anv_queue * queue)59 anv_queue_finish(struct anv_queue *queue)
60 {
61    vk_queue_finish(&queue->vk);
62 }
63