1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#include "pvr_device_info.h"
#include "pvr_rogue_fwif_client.h"
#include "pvr_rogue_fwif_stream.h"
#include "pvr_stream.h"
#include "pvr_stream_defs.h"
#include <linux/stddef.h>
#include <uapi/drm/pvr_drm.h>
#define PVR_STREAM_DEF_SET(owner, member, _size, _array_size, _feature) \
{ .offset = offsetof(struct owner, member), \
.size = (_size), \
.array_size = (_array_size), \
.feature = (_feature) }
#define PVR_STREAM_DEF(owner, member, member_size) \
PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ ## member_size, 0, PVR_FEATURE_NONE)
#define PVR_STREAM_DEF_FEATURE(owner, member, member_size, feature) \
PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ ## member_size, 0, feature)
#define PVR_STREAM_DEF_NOT_FEATURE(owner, member, member_size, feature) \
PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ ## member_size, 0, \
(feature) | PVR_FEATURE_NOT)
#define PVR_STREAM_DEF_ARRAY(owner, member) \
PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ARRAY, \
sizeof(((struct owner *)0)->member), PVR_FEATURE_NONE)
#define PVR_STREAM_DEF_ARRAY_FEATURE(owner, member, feature) \
PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ARRAY, \
sizeof(((struct owner *)0)->member), feature)
#define PVR_STREAM_DEF_ARRAY_NOT_FEATURE(owner, member, feature) \
PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ARRAY, \
sizeof(((struct owner *)0)->member), (feature) | PVR_FEATURE_NOT)
/*
* When adding new parameters to the stream definition, the new parameters must go after the
* existing parameters, to preserve order. As parameters are naturally aligned, care must be taken
* with respect to implicit padding in the stream; padding should be minimised as much as possible.
*/
static const struct pvr_stream_def rogue_fwif_cmd_geom_stream[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.vdm_ctrl_stream_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.tpu_border_colour_table, 64),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.vdm_draw_indirect0, 64,
PVR_FEATURE_VDM_DRAWINDIRECT),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.vdm_draw_indirect1, 32,
PVR_FEATURE_VDM_DRAWINDIRECT),
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.ppp_ctrl, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.te_psg, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.vdm_context_resume_task0_size, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.vdm_context_resume_task3_size, 32,
PVR_FEATURE_VDM_OBJECT_LEVEL_LLS),
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.view_idx, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.pds_coeff_free_prog, 32,
PVR_FEATURE_TESSELLATION),
};
static const struct pvr_stream_def rogue_fwif_cmd_geom_stream_brn49927[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.tpu, 32),
};
static const struct pvr_stream_ext_def cmd_geom_ext_streams_0[] = {
{
.stream = rogue_fwif_cmd_geom_stream_brn49927,
.stream_len = ARRAY_SIZE(rogue_fwif_cmd_geom_stream_brn49927),
.header_mask = PVR_STREAM_EXTHDR_GEOM0_BRN49927,
.quirk = 49927,
},
};
static const struct pvr_stream_ext_header cmd_geom_ext_headers[] = {
{
.ext_streams = cmd_geom_ext_streams_0,
.ext_streams_num = ARRAY_SIZE(cmd_geom_ext_streams_0),
.valid_mask = PVR_STREAM_EXTHDR_GEOM0_VALID,
},
};
const struct pvr_stream_cmd_defs pvr_cmd_geom_stream = {
.type = PVR_STREAM_TYPE_GEOM,
.main_stream = rogue_fwif_cmd_geom_stream,
.main_stream_len = ARRAY_SIZE(rogue_fwif_cmd_geom_stream),
.ext_nr_headers = ARRAY_SIZE(cmd_geom_ext_headers),
.ext_headers = cmd_geom_ext_headers,
.dest_size = sizeof(struct rogue_fwif_cmd_geom),
};
static const struct pvr_stream_def rogue_fwif_cmd_frag_stream[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_scissor_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_dbias_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_oclqry_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_zlsctl, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_zload_store_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_stencil_load_store_base, 64),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, regs.fb_cdc_zls, 64,
PVR_FEATURE_REQUIRES_FB_CDC_ZLS_SETUP),
PVR_STREAM_DEF_ARRAY(rogue_fwif_cmd_frag, regs.pbe_word),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.tpu_border_colour_table, 64),
PVR_STREAM_DEF_ARRAY(rogue_fwif_cmd_frag, regs.pds_bgnd),
PVR_STREAM_DEF_ARRAY(rogue_fwif_cmd_frag, regs.pds_pr_bgnd),
PVR_STREAM_DEF_ARRAY(rogue_fwif_cmd_frag, regs.usc_clear_register),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.usc_pixel_output_ctrl, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_bgobjdepth, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_bgobjvals, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_aa, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, regs.isp_xtp_pipe_enable, 32,
PVR_FEATURE_S7_TOP_INFRASTRUCTURE),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_ctl, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.event_pixel_pds_info, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, regs.pixel_phantom, 32,
PVR_FEATURE_CLUSTER_GROUPING),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.view_idx, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.event_pixel_pds_data, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, regs.isp_oclqry_stride, 32,
PVR_FEATURE_GPU_MULTICORE_SUPPORT),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, regs.isp_zls_pixels, 32,
PVR_FEATURE_ZLS_SUBTILE),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, regs.rgx_cr_blackpearl_fix, 32,
PVR_FEATURE_ISP_ZLS_D24_S8_PACKING_OGL_MODE),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, zls_stride, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_frag, sls_stride, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_frag, execute_count, 32,
PVR_FEATURE_GPU_MULTICORE_SUPPORT),
};
static const struct pvr_stream_def rogue_fwif_cmd_frag_stream_brn47217[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.isp_oclqry_stride, 32),
};
static const struct pvr_stream_def rogue_fwif_cmd_frag_stream_brn49927[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_frag, regs.tpu, 32),
};
static const struct pvr_stream_ext_def cmd_frag_ext_streams_0[] = {
{
.stream = rogue_fwif_cmd_frag_stream_brn47217,
.stream_len = ARRAY_SIZE(rogue_fwif_cmd_frag_stream_brn47217),
.header_mask = PVR_STREAM_EXTHDR_FRAG0_BRN47217,
.quirk = 47217,
},
{
.stream = rogue_fwif_cmd_frag_stream_brn49927,
.stream_len = ARRAY_SIZE(rogue_fwif_cmd_frag_stream_brn49927),
.header_mask = PVR_STREAM_EXTHDR_FRAG0_BRN49927,
.quirk = 49927,
},
};
static const struct pvr_stream_ext_header cmd_frag_ext_headers[] = {
{
.ext_streams = cmd_frag_ext_streams_0,
.ext_streams_num = ARRAY_SIZE(cmd_frag_ext_streams_0),
.valid_mask = PVR_STREAM_EXTHDR_FRAG0_VALID,
},
};
const struct pvr_stream_cmd_defs pvr_cmd_frag_stream = {
.type = PVR_STREAM_TYPE_FRAG,
.main_stream = rogue_fwif_cmd_frag_stream,
.main_stream_len = ARRAY_SIZE(rogue_fwif_cmd_frag_stream),
.ext_nr_headers = ARRAY_SIZE(cmd_frag_ext_headers),
.ext_headers = cmd_frag_ext_headers,
.dest_size = sizeof(struct rogue_fwif_cmd_frag),
};
static const struct pvr_stream_def rogue_fwif_cmd_compute_stream[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_compute, regs.tpu_border_colour_table, 64),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, regs.cdm_cb_queue, 64,
PVR_FEATURE_CDM_USER_MODE_QUEUE),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, regs.cdm_cb_base, 64,
PVR_FEATURE_CDM_USER_MODE_QUEUE),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, regs.cdm_cb, 64,
PVR_FEATURE_CDM_USER_MODE_QUEUE),
PVR_STREAM_DEF_NOT_FEATURE(rogue_fwif_cmd_compute, regs.cdm_ctrl_stream_base, 64,
PVR_FEATURE_CDM_USER_MODE_QUEUE),
PVR_STREAM_DEF(rogue_fwif_cmd_compute, regs.cdm_context_state_base_addr, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_compute, regs.cdm_resume_pds1, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, regs.cdm_item, 32,
PVR_FEATURE_COMPUTE_MORTON_CAPABLE),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, regs.compute_cluster, 32,
PVR_FEATURE_CLUSTER_GROUPING),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, regs.tpu_tag_cdm_ctrl, 32,
PVR_FEATURE_TPU_DM_GLOBAL_REGISTERS),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, stream_start_offset, 32,
PVR_FEATURE_CDM_USER_MODE_QUEUE),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_compute, execute_count, 32,
PVR_FEATURE_GPU_MULTICORE_SUPPORT),
};
static const struct pvr_stream_def rogue_fwif_cmd_compute_stream_brn49927[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_compute, regs.tpu, 32),
};
static const struct pvr_stream_ext_def cmd_compute_ext_streams_0[] = {
{
.stream = rogue_fwif_cmd_compute_stream_brn49927,
.stream_len = ARRAY_SIZE(rogue_fwif_cmd_compute_stream_brn49927),
.header_mask = PVR_STREAM_EXTHDR_COMPUTE0_BRN49927,
.quirk = 49927,
},
};
static const struct pvr_stream_ext_header cmd_compute_ext_headers[] = {
{
.ext_streams = cmd_compute_ext_streams_0,
.ext_streams_num = ARRAY_SIZE(cmd_compute_ext_streams_0),
.valid_mask = PVR_STREAM_EXTHDR_COMPUTE0_VALID,
},
};
const struct pvr_stream_cmd_defs pvr_cmd_compute_stream = {
.type = PVR_STREAM_TYPE_COMPUTE,
.main_stream = rogue_fwif_cmd_compute_stream,
.main_stream_len = ARRAY_SIZE(rogue_fwif_cmd_compute_stream),
.ext_nr_headers = ARRAY_SIZE(cmd_compute_ext_headers),
.ext_headers = cmd_compute_ext_headers,
.dest_size = sizeof(struct rogue_fwif_cmd_compute),
};
static const struct pvr_stream_def rogue_fwif_cmd_transfer_stream[] = {
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.pds_bgnd0_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.pds_bgnd1_base, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.pds_bgnd3_sizeinfo, 64),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_mtile_base, 64),
PVR_STREAM_DEF_ARRAY(rogue_fwif_cmd_transfer, regs.pbe_wordx_mrty),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_bgobjvals, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.usc_pixel_output_ctrl, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.usc_clear_register0, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.usc_clear_register1, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.usc_clear_register2, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.usc_clear_register3, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_mtile_size, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_render_origin, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_ctl, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_aa, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.event_pixel_pds_info, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.event_pixel_pds_code, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.event_pixel_pds_data, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_render, 32),
PVR_STREAM_DEF(rogue_fwif_cmd_transfer, regs.isp_rgn, 32),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_transfer, regs.isp_xtp_pipe_enable, 32,
PVR_FEATURE_S7_TOP_INFRASTRUCTURE),
PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_transfer, regs.frag_screen, 32,
PVR_FEATURE_GPU_MULTICORE_SUPPORT),
};
const struct pvr_stream_cmd_defs pvr_cmd_transfer_stream = {
.type = PVR_STREAM_TYPE_TRANSFER,
.main_stream = rogue_fwif_cmd_transfer_stream,
.main_stream_len = ARRAY_SIZE(rogue_fwif_cmd_transfer_stream),
.ext_nr_headers = 0,
.dest_size = sizeof(struct rogue_fwif_cmd_transfer),
};
static const struct pvr_stream_def rogue_fwif_static_render_context_state_stream[] = {
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_reg_vdm_context_state_base_addr, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_reg_vdm_context_state_resume_addr, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_reg_ta_context_state_base_addr, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task0, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task1, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task2, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task3, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task4, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task0, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task1, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task2, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task3, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task4, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task0, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task1, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task2, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task3, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task4, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task0, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task1, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task2, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task3, 64),
PVR_STREAM_DEF(rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task4, 64),
};
const struct pvr_stream_cmd_defs pvr_static_render_context_state_stream = {
.type = PVR_STREAM_TYPE_STATIC_RENDER_CONTEXT,
.main_stream = rogue_fwif_static_render_context_state_stream,
.main_stream_len = ARRAY_SIZE(rogue_fwif_static_render_context_state_stream),
.ext_nr_headers = 0,
.dest_size = sizeof(struct rogue_fwif_geom_registers_caswitch),
};
static const struct pvr_stream_def rogue_fwif_static_compute_context_state_stream[] = {
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds0, 64),
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds1, 64),
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_terminate_pds, 64),
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_terminate_pds1, 64),
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_resume_pds0, 64),
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds0_b, 64),
PVR_STREAM_DEF(rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_resume_pds0_b, 64),
};
const struct pvr_stream_cmd_defs pvr_static_compute_context_state_stream = {
.type = PVR_STREAM_TYPE_STATIC_COMPUTE_CONTEXT,
.main_stream = rogue_fwif_static_compute_context_state_stream,
.main_stream_len = ARRAY_SIZE(rogue_fwif_static_compute_context_state_stream),
.ext_nr_headers = 0,
.dest_size = sizeof(struct rogue_fwif_cdm_registers_cswitch),
};
|