Debian Codegraph @

src/imagination/include/hwdef/pvr_hw_utils.h

raw
1 /*
2 * Copyright © 2022 Imagination Technologies Ltd.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef PVR_HW_UTILS_H
8 #define PVR_HW_UTILS_H
9
10 #include <stdint.h>
11 #include <assert.h>
12
13 #include "util/macros.h"
14
15 #include "pvr_device_info.h"
16
17 static inline uint32_t
18 pvr_get_slc_cache_line_size(const struct pvr_device_info *dev_info)
19 {
20 return PVR_GET_FEATURE_VALUE(dev_info, slc_cache_line_size_bits, 8U) / 8U;
21 }
22
23 static inline uint32_t pvr_get_max_user_vertex_output_components(
24 const struct pvr_device_info *dev_info)
25 {
26 /* Default value based on the minimum value found in all existing cores. */
27 const uint32_t uvs_pba_entries =
28 PVR_GET_FEATURE_VALUE(dev_info, uvs_pba_entries, 160U);
29
30 /* Default value based on the minimum value found in all existing cores. */
31 const uint32_t uvs_banks = PVR_GET_FEATURE_VALUE(dev_info, uvs_banks, 2U);
32
33 if (uvs_banks <= 8U && uvs_pba_entries == 160U) {
34 ASSERTED const uint32_t tpu_parallel_instances =
35 PVR_GET_FEATURE_VALUE(dev_info, tpu_parallel_instances, 1U);
36
37 /* Cores with > 2 ppc support vertex sizes of >= 128 dwords */
38 assert(tpu_parallel_instances <= 2 ||
39 (dev_info->ident.b <= 36 || dev_info->ident.b == 46));
40
41 return 64U;
42 }
43
44 return 128U;
45 }
46
47 #endif /* PVR_HW_UTILS_H */