2
* Copyright © 2022 Imagination Technologies Ltd.
4
* Permission is hereby granted, free of charge, to any person obtaining a copy
5
* of this software and associated documentation files (the "Software"), to deal
6
* in the Software without restriction, including without limitation the rights
7
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
* copies of the Software, and to permit persons to whom the Software is
9
* furnished to do so, subject to the following conditions:
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
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 THE
18
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
#include <vulkan/vulkan.h>
31
#include "util/list.h"
32
#include "util/macros.h"
36
struct pvr_winsys_vma;
37
struct pvr_winsys_heap;
40
/* Since multiple components (csb, caching logic, etc) can make use of
41
* linking buffers in a list, we add 'link' in pvr_bo to avoid an extra
42
* level of structure inheritance. It's the responsibility of the buffer
43
* user to manage the list and remove the buffer from the list before
46
struct list_head link;
48
struct pvr_winsys_bo *bo;
49
struct pvr_winsys_vma *vma;
53
* \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer should be
54
* CPU accessible. This is required in order to map a buffer with
57
#define PVR_BO_ALLOC_FLAG_CPU_ACCESS BITFIELD_BIT(0U)
59
* \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer should
60
* be mapped to the CPU. Implies #PVR_BO_ALLOC_FLAG_CPU_ACCESS.
62
#define PVR_BO_ALLOC_FLAG_CPU_MAPPED \
63
(BITFIELD_BIT(1U) | PVR_BO_ALLOC_FLAG_CPU_ACCESS)
65
* \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer should be
66
* mapped to the GPU as uncached.
68
#define PVR_BO_ALLOC_FLAG_GPU_UNCACHED BITFIELD_BIT(2U)
70
* \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer GPU mapping
71
* should be restricted to only allow access to the Parameter Manager unit and
74
#define PVR_BO_ALLOC_FLAG_PM_FW_PROTECT BITFIELD_BIT(3U)
76
* \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer should be
77
* zeroed at allocation time.
79
#define PVR_BO_ALLOC_FLAG_ZERO_ON_ALLOC BITFIELD_BIT(4U)
81
VkResult pvr_bo_alloc(struct pvr_device *device,
82
struct pvr_winsys_heap *heap,
86
struct pvr_bo **const bo_out);
87
void *pvr_bo_cpu_map(struct pvr_device *device, struct pvr_bo *bo);
88
void pvr_bo_cpu_unmap(struct pvr_device *device, struct pvr_bo *bo);
89
void pvr_bo_free(struct pvr_device *device, struct pvr_bo *bo);