1 /*
2  * Copyright © 2021 Collabora Ltd.
3  *
4  * Derived from tu_pipeline.c which is:
5  * Copyright © 2016 Red Hat.
6  * Copyright © 2016 Bas Nieuwenhuizen
7  * Copyright © 2015 Intel Corporation
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice (including the next
17  * paragraph) shall be included in all copies or substantial portions of the
18  * Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  * DEALINGS IN THE SOFTWARE.
27  */
28 
29 #include "panvk_cs.h"
30 #include "panvk_private.h"
31 
32 #include "pan_bo.h"
33 
34 #include "nir/nir.h"
35 #include "nir/nir_builder.h"
36 #include "spirv/nir_spirv.h"
37 #include "util/debug.h"
38 #include "util/mesa-sha1.h"
39 #include "util/u_atomic.h"
40 #include "vk_format.h"
41 #include "vk_util.h"
42 
43 #include "panfrost-quirks.h"
44 
45 VkResult
panvk_CreateComputePipelines(VkDevice _device,VkPipelineCache pipelineCache,uint32_t count,const VkComputePipelineCreateInfo * pCreateInfos,const VkAllocationCallbacks * pAllocator,VkPipeline * pPipelines)46 panvk_CreateComputePipelines(VkDevice _device,
47                              VkPipelineCache pipelineCache,
48                              uint32_t count,
49                              const VkComputePipelineCreateInfo *pCreateInfos,
50                              const VkAllocationCallbacks *pAllocator,
51                              VkPipeline *pPipelines)
52 {
53    panvk_stub();
54    return VK_SUCCESS;
55 }
56 
57 void
panvk_DestroyPipeline(VkDevice _device,VkPipeline _pipeline,const VkAllocationCallbacks * pAllocator)58 panvk_DestroyPipeline(VkDevice _device,
59                       VkPipeline _pipeline,
60                       const VkAllocationCallbacks *pAllocator)
61 {
62    VK_FROM_HANDLE(panvk_device, device, _device);
63    VK_FROM_HANDLE(panvk_pipeline, pipeline, _pipeline);
64 
65    panfrost_bo_unreference(pipeline->binary_bo);
66    panfrost_bo_unreference(pipeline->state_bo);
67    vk_object_free(&device->vk, pAllocator, pipeline);
68 }
69