Debian Codegraph @

src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h

raw
1 /*
2 * Copyright © 2022 Imagination Technologies Ltd.
3 *
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:
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 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
21 * SOFTWARE.
22 */
23
24 #ifndef PVR_SRV_H
25 #define PVR_SRV_H
26
27 #include <stdint.h>
28 #include <pthread.h>
29 #include <vulkan/vulkan.h>
30
31 #include "pvr_srv_sync.h"
32 #include "pvr_srv_sync_prim.h"
33 #include "pvr_winsys.h"
34 #include "util/macros.h"
35 #include "util/vma.h"
36
37 /*******************************************
38 Misc defines
39 *******************************************/
40
41 /* 64KB is MAX anticipated OS page size */
42 #define PVR_SRV_CARVEOUT_SIZE_GRANULARITY 0x10000
43
44 #define PVR_SRV_DEVMEM_HEAPNAME_MAXLENGTH 160
45
46 #define PVR_SRV_GENERAL_HEAP_IDENT "General"
47 #define PVR_SRV_PDSCODEDATA_HEAP_IDENT "PDS Code and Data"
48 #define PVR_SRV_RGNHDR_BRN_63142_HEAP_IDENT "RgnHdr BRN63142"
49 #define PVR_SRV_TRANSFER_3D_HEAP_IDENT "TQ3DParameters"
50 #define PVR_SRV_USCCODE_HEAP_IDENT "USC Code"
51 #define PVR_SRV_VISIBILITY_TEST_HEAP_IDENT "Visibility Test"
52
53 #define FWIF_PDS_HEAP_TOTAL_BYTES 4096
54 #define FWIF_PDS_HEAP_VDM_SYNC_OFFSET_BYTES 0
55 #define FWIF_PDS_HEAP_EOT_OFFSET_BYTES 128
56 #define FWIF_GENERAL_HEAP_TOTAL_BYTES 4096
57 #define FWIF_USC_HEAP_TOTAL_BYTES 4096
58 #define FWIF_USC_HEAP_VDM_SYNC_OFFSET_BYTES 0
59 #define FWIF_GENERAL_HEAP_YUV_CSC_OFFSET_BYTES 128U
60
61 /*******************************************
62 structure definitions
63 *******************************************/
64 struct pvr_srv_winsys_heap {
65 struct pvr_winsys_heap base;
66
67 void *server_heap;
68 };
69
70 struct pvr_srv_winsys {
71 struct pvr_winsys base;
72
73 struct pvr_device *presignaled_sync_device;
74 struct pvr_srv_sync *presignaled_sync;
75
76 struct pvr_device_info dev_info;
77
78 void *server_memctx;
79 void *server_memctx_data;
80
81 /* Required heaps */
82 struct pvr_srv_winsys_heap general_heap;
83 struct pvr_srv_winsys_heap pds_heap;
84 struct pvr_srv_winsys_heap transfer_3d_heap;
85 struct pvr_srv_winsys_heap usc_heap;
86 struct pvr_srv_winsys_heap vis_test_heap;
87
88 /* Optional heaps */
89 bool rgn_hdr_heap_present;
90 struct pvr_srv_winsys_heap rgn_hdr_heap;
91
92 /* vma's for carveout memory regions */
93 struct pvr_winsys_vma *pds_vma;
94 struct pvr_winsys_vma *usc_vma;
95 struct pvr_winsys_vma *general_vma;
96
97 struct pvr_srv_sync_prim_ctx sync_prim_ctx;
98 };
99
100 /*******************************************
101 helper macros
102 *******************************************/
103
104 #define to_pvr_srv_winsys(ws) container_of((ws), struct pvr_srv_winsys, base)
105 #define to_pvr_srv_winsys_heap(heap) \
106 container_of((heap), struct pvr_srv_winsys_heap, base)
107
108 /*******************************************
109 functions
110 *******************************************/
111
112 VkResult pvr_srv_sync_get_presignaled_sync(struct pvr_device *device,
113 struct pvr_srv_sync **out_sync);
114
115 #endif /* PVR_SRV_H */