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 /* TODO: This file is currently hand-maintained. However, the intention is to
25  * auto-generate it in the future based on the hwdefs.
26  */
27 
28 #include "assert.h"
29 #include "errno.h"
30 #include "pvr_device_info.h"
31 
32 const struct pvr_device_ident pvr_device_ident_4_V_2_51 = {
33    .device_id = 0x6250,
34    .series_name = "Rogue",
35    .public_name = "GX6250",
36 };
37 
38 const struct pvr_device_features pvr_device_features_4_V_2_51 = {
39    .has_astc = true,
40    .has_cluster_grouping = true,
41    .has_common_store_size_in_dwords = true,
42    .has_compute = true,
43    .has_compute_morton_capable = true,
44    .has_compute_overlap = true,
45    .has_eight_output_registers = true,
46    .has_gs_rta_support = true,
47    .has_isp_max_tiles_in_flight = true,
48    .has_isp_samples_per_pixel = true,
49    .has_max_instances_per_pds_task = true,
50    .has_max_multisample = true,
51    .has_max_partitions = true,
52    .has_max_usc_tasks = true,
53    .has_num_clusters = true,
54    .has_num_raster_pipes = true,
55    .has_num_user_clip_planes = true,
56    .has_robust_buffer_access = true,
57    .has_slc_cache_line_size_bits = true,
58    .has_slc_mcu_cache_controls = true,
59    .has_tf_bicubic_filter = true,
60    .has_tile_size_x = true,
61    .has_tile_size_y = true,
62    .has_tpu_array_textures = true,
63    .has_tpu_extended_integer_lookup = true,
64    .has_tpu_image_state_v2 = true,
65    .has_usc_f16sop_u8 = true,
66    .has_usc_min_output_registers_per_pix = true,
67    .has_usc_slots = true,
68    .has_uvs_banks = true,
69    .has_uvs_pba_entries = true,
70    .has_uvs_vtx_entries = true,
71    .has_vdm_cam_size = true,
72    .has_xt_top_infrastructure = true,
73    .has_zls_subtile = true,
74 
75    .common_store_size_in_dwords = 1280U * 4U * 4U,
76    .isp_max_tiles_in_flight = 4U,
77    .isp_samples_per_pixel = 2U,
78    .max_instances_per_pds_task = 32U,
79    .max_multisample = 8U,
80    .max_partitions = 8U,
81    .max_usc_tasks = 56U,
82    .num_clusters = 2U,
83    .num_raster_pipes = 1U,
84    .num_user_clip_planes = 8U,
85    .slc_cache_line_size_bits = 512U,
86    .tile_size_x = 32U,
87    .tile_size_y = 32U,
88    .usc_min_output_registers_per_pix = 2U,
89    .usc_slots = 32U,
90    .uvs_banks = 8U,
91    .uvs_pba_entries = 320U,
92    .uvs_vtx_entries = 288U,
93    .vdm_cam_size = 256U,
94 };
95 
96 const struct pvr_device_enhancements pvr_device_enhancements_4_40_2_51 = {
97    .has_ern35421 = true,
98    .has_ern38020 = true,
99    .has_ern38748 = true,
100    .has_ern42307 = true,
101 };
102 
103 const struct pvr_device_quirks pvr_device_quirks_4_40_2_51 = {
104    .has_brn44079 = true,
105    .has_brn47727 = true,
106    .has_brn48492 = true,
107    .has_brn48545 = true,
108    .has_brn49032 = true,
109    .has_brn49927 = true,
110    .has_brn51025 = true,
111    .has_brn51210 = true,
112    .has_brn51764 = true,
113    .has_brn52354 = true,
114    .has_brn52942 = true,
115    .has_brn56279 = true,
116    .has_brn58839 = true,
117    .has_brn62269 = true,
118    .has_brn66011 = true,
119    .has_brn70165 = true,
120 };
121 
122 const struct pvr_device_ident pvr_device_ident_33_V_11_3 = {
123    .device_id = 0x33011003,
124    .series_name = "A-Series",
125    .public_name = "AXE-1-16M",
126 };
127 
128 const struct pvr_device_features pvr_device_features_33_V_11_3 = {
129    .has_common_store_size_in_dwords = true,
130    .has_compute = true,
131    .has_isp_max_tiles_in_flight = true,
132    .has_isp_samples_per_pixel = true,
133    .has_max_instances_per_pds_task = true,
134    .has_max_multisample = true,
135    .has_max_partitions = true,
136    .has_max_usc_tasks = true,
137    .has_num_clusters = true,
138    .has_num_raster_pipes = true,
139    .has_num_user_clip_planes = true,
140    .has_roguexe = true,
141    .has_screen_size8K = true,
142    .has_simple_internal_parameter_format = true,
143    .has_simple_internal_parameter_format_v2 = true,
144    .has_simple_parameter_format_version = true,
145    .has_slc_cache_line_size_bits = true,
146    .has_tile_size_16x16 = true,
147    .has_tile_size_x = true,
148    .has_tile_size_y = true,
149    .has_tpu_extended_integer_lookup = true,
150    .has_tpu_image_state_v2 = true,
151    .has_usc_f16sop_u8 = true,
152    .has_usc_min_output_registers_per_pix = true,
153    .has_usc_pixel_partition_mask = true,
154    .has_usc_slots = true,
155    .has_uvs_banks = true,
156    .has_uvs_pba_entries = true,
157    .has_uvs_vtx_entries = true,
158    .has_vdm_cam_size = true,
159    .has_vdm_degenerate_culling = true,
160 
161    .common_store_size_in_dwords = 512U * 4U * 4U,
162    .isp_max_tiles_in_flight = 1U,
163    .isp_samples_per_pixel = 1U,
164    .max_instances_per_pds_task = 32U,
165    .max_multisample = 4U,
166    .max_partitions = 4U,
167    .max_usc_tasks = 24U,
168    .num_clusters = 1U,
169    .num_raster_pipes = 1U,
170    .num_user_clip_planes = 8U,
171    .simple_parameter_format_version = 2U,
172    .slc_cache_line_size_bits = 512U,
173    .tile_size_x = 16U,
174    .tile_size_y = 16U,
175    .usc_min_output_registers_per_pix = 1U,
176    .usc_slots = 14U,
177    .uvs_banks = 2U,
178    .uvs_pba_entries = 320U,
179    .uvs_vtx_entries = 288U,
180    .vdm_cam_size = 32U,
181 
182    .has_s8xe = true,
183 };
184 
185 const struct pvr_device_enhancements pvr_device_enhancements_33_15_11_3 = {
186    .has_ern35421 = true,
187    .has_ern38748 = true,
188    .has_ern42307 = true,
189    .has_ern45493 = true,
190 };
191 
192 const struct pvr_device_quirks pvr_device_quirks_33_15_11_3 = {
193    .has_brn70165 = true,
194 };
195 
196 const struct pvr_device_ident pvr_device_ident_36_V_104_796 = {
197    .device_id = 0x36104796,
198    .series_name = "B-Series",
199    .public_name = "BXS-4-64",
200 };
201 
202 const struct pvr_device_features pvr_device_features_36_V_104_796 = {
203    .has_astc = true,
204    .has_common_store_size_in_dwords = true,
205    .has_compute = true,
206    .has_compute_overlap = true,
207    .has_gpu_multicore_support = true,
208    .has_gs_rta_support = true,
209    .has_isp_max_tiles_in_flight = true,
210    .has_isp_samples_per_pixel = true,
211    .has_max_instances_per_pds_task = true,
212    .has_max_multisample = true,
213    .has_max_partitions = true,
214    .has_max_usc_tasks = true,
215    .has_num_clusters = true,
216    .has_num_raster_pipes = true,
217    .has_num_user_clip_planes = true,
218    .has_paired_tiles = true,
219    .has_pds_ddmadt = true,
220    .has_roguexe = true,
221    .has_screen_size8K = true,
222    .has_simple_internal_parameter_format = true,
223    .has_simple_internal_parameter_format_v2 = true,
224    .has_simple_parameter_format_version = true,
225    .has_slc_cache_line_size_bits = true,
226    .has_tile_size_16x16 = true,
227    .has_tile_size_x = true,
228    .has_tile_size_y = true,
229    .has_tpu_extended_integer_lookup = true,
230    .has_tpu_image_state_v2 = true,
231    .has_usc_f16sop_u8 = true,
232    .has_usc_min_output_registers_per_pix = true,
233    .has_usc_pixel_partition_mask = true,
234    .has_usc_slots = true,
235    .has_uvs_banks = true,
236    .has_uvs_pba_entries = true,
237    .has_uvs_vtx_entries = true,
238    .has_vdm_cam_size = true,
239    .has_vdm_degenerate_culling = true,
240    .has_xpu_max_slaves = true,
241 
242    .common_store_size_in_dwords = 1344U * 4U * 4U,
243    .isp_max_tiles_in_flight = 6U,
244    .isp_samples_per_pixel = 4U,
245    .max_instances_per_pds_task = 32U,
246    .max_multisample = 4U,
247    .max_partitions = 16U,
248    .max_usc_tasks = 156U,
249    .num_clusters = 1U,
250    .num_raster_pipes = 1U,
251    .num_user_clip_planes = 8U,
252    .simple_parameter_format_version = 2U,
253    .slc_cache_line_size_bits = 512U,
254    .tile_size_x = 16U,
255    .tile_size_y = 16U,
256    .usc_min_output_registers_per_pix = 2U,
257    .usc_slots = 64U,
258    .uvs_banks = 8U,
259    .uvs_pba_entries = 160U,
260    .uvs_vtx_entries = 144U,
261    .vdm_cam_size = 64U,
262    .xpu_max_slaves = 3U,
263 
264    .has_s8xe = true,
265 };
266 
267 const struct pvr_device_enhancements pvr_device_enhancements_36_53_104_796 = {
268    .has_ern35421 = true,
269    .has_ern38748 = true,
270    .has_ern42307 = true,
271    .has_ern45493 = true,
272 };
273 
274 const struct pvr_device_quirks pvr_device_quirks_36_53_104_796 = {
275    .has_brn44079 = true,
276    .has_brn70165 = true,
277 };
278 
279 /**
280  * Initialize PowerVR device information.
281  *
282  * \param info Device info structure to initialize.
283  * \param bvnc Packed BVNC.
284  * \return
285  *  * 0 on success, or
286  *  * -%ENODEV if the device is not supported.
287  */
pvr_device_info_init(struct pvr_device_info *info, uint64_t bvnc)288 int pvr_device_info_init(struct pvr_device_info *info, uint64_t bvnc)
289 {
290 #define CASE_PACKED_BVNC_DEVICE_INFO(_b, _v, _n, _c)                          \
291    case PVR_BVNC_PACK(_b, _v, _n, _c):                                        \
292       info->ident = pvr_device_ident_##_b##_V_##_n##_##_c;                    \
293       info->ident.b = _b;                                                     \
294       info->ident.n = _n;                                                     \
295       info->ident.v = _v;                                                     \
296       info->ident.c = _c;                                                     \
297       info->features = pvr_device_features_##_b##_V_##_n##_##_c;              \
298       info->enhancements = pvr_device_enhancements_##_b##_##_v##_##_n##_##_c; \
299       info->quirks = pvr_device_quirks_##_b##_##_v##_##_n##_##_c;             \
300       return 0
301 
302    switch (bvnc) {
303       CASE_PACKED_BVNC_DEVICE_INFO(4, 40, 2, 51);
304       CASE_PACKED_BVNC_DEVICE_INFO(33, 15, 11, 3);
305    }
306 
307 #undef CASE_PACKED_BVNC_DEVICE_INFO
308 
309    assert(!"Unsupported Device");
310 
311    return -ENODEV;
312 }
313