Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/drivers/freedreno/ir3/ir3_const.h
4574 views
1
/*
2
* Copyright (C) 2014 Rob Clark <[email protected]>
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is 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
18
* THE 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
* Authors:
24
* Rob Clark <[email protected]>
25
*/
26
27
#include "ir3/ir3_nir.h"
28
29
/* This has to reach into the fd_context a bit more than the rest of
30
* ir3, but it needs to be aligned with the compiler, so both agree
31
* on which const regs hold what. And the logic is identical between
32
* ir3 generations, the only difference is small details in the actual
33
* CP_LOAD_STATE packets (which is handled inside the generation
34
* specific ctx->emit_const(_bo)() fxns)
35
*
36
* This file should be included in only a single .c file per gen, which
37
* defines the following functions:
38
*/
39
40
static bool is_stateobj(struct fd_ringbuffer *ring);
41
42
static void emit_const_user(struct fd_ringbuffer *ring,
43
const struct ir3_shader_variant *v, uint32_t regid,
44
uint32_t size, const uint32_t *user_buffer);
45
46
static void emit_const_bo(struct fd_ringbuffer *ring,
47
const struct ir3_shader_variant *v, uint32_t regid,
48
uint32_t offset, uint32_t size, struct fd_bo *bo);
49
50
static void
51
emit_const_prsc(struct fd_ringbuffer *ring, const struct ir3_shader_variant *v,
52
uint32_t regid, uint32_t offset, uint32_t size,
53
struct pipe_resource *buffer)
54
{
55
struct fd_resource *rsc = fd_resource(buffer);
56
emit_const_bo(ring, v, regid, offset, size, rsc->bo);
57
}
58
59
static void emit_const_ptrs(struct fd_ringbuffer *ring,
60
const struct ir3_shader_variant *v,
61
uint32_t dst_offset, uint32_t num,
62
struct fd_bo **bos, uint32_t *offsets);
63
64
static void
65
emit_const_asserts(struct fd_ringbuffer *ring,
66
const struct ir3_shader_variant *v, uint32_t regid,
67
uint32_t sizedwords)
68
{
69
assert((regid % 4) == 0);
70
assert((sizedwords % 4) == 0);
71
assert(regid + sizedwords <= v->constlen * 4);
72
}
73
74
static void
75
ring_wfi(struct fd_batch *batch, struct fd_ringbuffer *ring) assert_dt
76
{
77
/* when we emit const state via ring (IB2) we need a WFI, but when
78
* it is emit'd via stateobj, we don't
79
*/
80
if (is_stateobj(ring))
81
return;
82
83
fd_wfi(batch, ring);
84
}
85
86
/**
87
* Indirectly calculates size of cmdstream needed for ir3_emit_user_consts().
88
* Returns number of packets, and total size of all the payload.
89
*
90
* The value can be a worst-case, ie. some shader variants may not read all
91
* consts, etc.
92
*
93
* Returns size in dwords.
94
*/
95
static inline void
96
ir3_user_consts_size(struct ir3_ubo_analysis_state *state, unsigned *packets,
97
unsigned *size)
98
{
99
*packets = *size = 0;
100
101
for (uint32_t i = 0; i < ARRAY_SIZE(state->range); i++) {
102
if (state->range[i].start < state->range[i].end) {
103
*size += state->range[i].end - state->range[i].start;
104
(*packets)++;
105
}
106
}
107
}
108
109
/**
110
* Uploads the referenced subranges of the nir constant_data to the hardware's
111
* constant buffer.
112
*/
113
static inline void
114
ir3_emit_constant_data(struct fd_screen *screen,
115
const struct ir3_shader_variant *v,
116
struct fd_ringbuffer *ring)
117
{
118
const struct ir3_const_state *const_state = ir3_const_state(v);
119
const struct ir3_ubo_analysis_state *state = &const_state->ubo_state;
120
121
for (unsigned i = 0; i < state->num_enabled; i++) {
122
unsigned ubo = state->range[i].ubo.block;
123
if (ubo != const_state->constant_data_ubo)
124
continue;
125
126
uint32_t size = state->range[i].end - state->range[i].start;
127
128
/* Pre-a6xx, we might have ranges enabled in the shader that aren't
129
* used in the binning variant.
130
*/
131
if (16 * v->constlen <= state->range[i].offset)
132
continue;
133
134
/* and even if the start of the const buffer is before
135
* first_immediate, the end may not be:
136
*/
137
size = MIN2(size, (16 * v->constlen) - state->range[i].offset);
138
139
if (size == 0)
140
continue;
141
142
emit_const_bo(ring, v, state->range[i].offset / 4,
143
v->info.constant_data_offset + state->range[i].start,
144
size / 4, v->bo);
145
}
146
}
147
148
/**
149
* Uploads sub-ranges of UBOs to the hardware's constant buffer (UBO access
150
* outside of these ranges will be done using full UBO accesses in the
151
* shader).
152
*/
153
static inline void
154
ir3_emit_user_consts(struct fd_screen *screen,
155
const struct ir3_shader_variant *v,
156
struct fd_ringbuffer *ring,
157
struct fd_constbuf_stateobj *constbuf)
158
{
159
const struct ir3_const_state *const_state = ir3_const_state(v);
160
const struct ir3_ubo_analysis_state *state = &const_state->ubo_state;
161
162
for (unsigned i = 0; i < state->num_enabled; i++) {
163
assert(!state->range[i].ubo.bindless);
164
unsigned ubo = state->range[i].ubo.block;
165
if (!(constbuf->enabled_mask & (1 << ubo)) ||
166
ubo == const_state->constant_data_ubo) {
167
continue;
168
}
169
struct pipe_constant_buffer *cb = &constbuf->cb[ubo];
170
171
uint32_t size = state->range[i].end - state->range[i].start;
172
uint32_t offset = cb->buffer_offset + state->range[i].start;
173
174
/* Pre-a6xx, we might have ranges enabled in the shader that aren't
175
* used in the binning variant.
176
*/
177
if (16 * v->constlen <= state->range[i].offset)
178
continue;
179
180
/* and even if the start of the const buffer is before
181
* first_immediate, the end may not be:
182
*/
183
size = MIN2(size, (16 * v->constlen) - state->range[i].offset);
184
185
if (size == 0)
186
continue;
187
188
/* things should be aligned to vec4: */
189
debug_assert((state->range[i].offset % 16) == 0);
190
debug_assert((size % 16) == 0);
191
debug_assert((offset % 16) == 0);
192
193
if (cb->user_buffer) {
194
emit_const_user(ring, v, state->range[i].offset / 4, size / 4,
195
cb->user_buffer + state->range[i].start);
196
} else {
197
emit_const_prsc(ring, v, state->range[i].offset / 4, offset, size / 4,
198
cb->buffer);
199
}
200
}
201
}
202
203
static inline void
204
ir3_emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v,
205
struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
206
{
207
const struct ir3_const_state *const_state = ir3_const_state(v);
208
uint32_t offset = const_state->offsets.ubo;
209
210
/* a6xx+ uses UBO state and ldc instead of pointers emitted in
211
* const state and ldg:
212
*/
213
if (ctx->screen->gpu_id >= 600)
214
return;
215
216
if (v->constlen > offset) {
217
uint32_t params = const_state->num_ubos;
218
uint32_t offsets[params];
219
struct fd_bo *bos[params];
220
221
for (uint32_t i = 0; i < params; i++) {
222
if (i == const_state->constant_data_ubo) {
223
bos[i] = v->bo;
224
offsets[i] = v->info.constant_data_offset;
225
continue;
226
}
227
228
struct pipe_constant_buffer *cb = &constbuf->cb[i];
229
230
/* If we have user pointers (constbuf 0, aka GL uniforms), upload
231
* them to a buffer now, and save it in the constbuf so that we
232
* don't have to reupload until they get changed.
233
*/
234
if (cb->user_buffer) {
235
struct pipe_context *pctx = &ctx->base;
236
u_upload_data(pctx->stream_uploader, 0, cb->buffer_size, 64,
237
cb->user_buffer, &cb->buffer_offset, &cb->buffer);
238
cb->user_buffer = NULL;
239
}
240
241
if ((constbuf->enabled_mask & (1 << i)) && cb->buffer) {
242
offsets[i] = cb->buffer_offset;
243
bos[i] = fd_resource(cb->buffer)->bo;
244
} else {
245
offsets[i] = 0;
246
bos[i] = NULL;
247
}
248
}
249
250
assert(offset * 4 + params <= v->constlen * 4);
251
252
emit_const_ptrs(ring, v, offset * 4, params, bos, offsets);
253
}
254
}
255
256
static inline void
257
ir3_emit_ssbo_sizes(struct fd_screen *screen,
258
const struct ir3_shader_variant *v,
259
struct fd_ringbuffer *ring,
260
struct fd_shaderbuf_stateobj *sb)
261
{
262
const struct ir3_const_state *const_state = ir3_const_state(v);
263
uint32_t offset = const_state->offsets.ssbo_sizes;
264
if (v->constlen > offset) {
265
uint32_t sizes[align(const_state->ssbo_size.count, 4)];
266
unsigned mask = const_state->ssbo_size.mask;
267
268
while (mask) {
269
unsigned index = u_bit_scan(&mask);
270
unsigned off = const_state->ssbo_size.off[index];
271
sizes[off] = sb->sb[index].buffer_size;
272
}
273
274
emit_const_user(ring, v, offset * 4, ARRAY_SIZE(sizes), sizes);
275
}
276
}
277
278
static inline void
279
ir3_emit_image_dims(struct fd_screen *screen,
280
const struct ir3_shader_variant *v,
281
struct fd_ringbuffer *ring,
282
struct fd_shaderimg_stateobj *si)
283
{
284
const struct ir3_const_state *const_state = ir3_const_state(v);
285
uint32_t offset = const_state->offsets.image_dims;
286
if (v->constlen > offset) {
287
uint32_t dims[align(const_state->image_dims.count, 4)];
288
unsigned mask = const_state->image_dims.mask;
289
290
while (mask) {
291
struct pipe_image_view *img;
292
struct fd_resource *rsc;
293
unsigned index = u_bit_scan(&mask);
294
unsigned off = const_state->image_dims.off[index];
295
296
img = &si->si[index];
297
rsc = fd_resource(img->resource);
298
299
dims[off + 0] = util_format_get_blocksize(img->format);
300
if (img->resource->target != PIPE_BUFFER) {
301
struct fdl_slice *slice = fd_resource_slice(rsc, img->u.tex.level);
302
/* note for 2d/cube/etc images, even if re-interpreted
303
* as a different color format, the pixel size should
304
* be the same, so use original dimensions for y and z
305
* stride:
306
*/
307
dims[off + 1] = fd_resource_pitch(rsc, img->u.tex.level);
308
/* see corresponding logic in fd_resource_offset(): */
309
if (rsc->layout.layer_first) {
310
dims[off + 2] = rsc->layout.layer_size;
311
} else {
312
dims[off + 2] = slice->size0;
313
}
314
} else {
315
/* For buffer-backed images, the log2 of the format's
316
* bytes-per-pixel is placed on the 2nd slot. This is useful
317
* when emitting image_size instructions, for which we need
318
* to divide by bpp for image buffers. Since the bpp
319
* can only be power-of-two, the division is implemented
320
* as a SHR, and for that it is handy to have the log2 of
321
* bpp as a constant. (log2 = first-set-bit - 1)
322
*/
323
dims[off + 1] = ffs(dims[off + 0]) - 1;
324
}
325
}
326
uint32_t size = MIN2(ARRAY_SIZE(dims), v->constlen * 4 - offset * 4);
327
328
emit_const_user(ring, v, offset * 4, size, dims);
329
}
330
}
331
332
static inline void
333
ir3_emit_immediates(struct fd_screen *screen,
334
const struct ir3_shader_variant *v,
335
struct fd_ringbuffer *ring)
336
{
337
const struct ir3_const_state *const_state = ir3_const_state(v);
338
uint32_t base = const_state->offsets.immediate;
339
int size = DIV_ROUND_UP(const_state->immediates_count, 4);
340
341
/* truncate size to avoid writing constants that shader
342
* does not use:
343
*/
344
size = MIN2(size + base, v->constlen) - base;
345
346
/* convert out of vec4: */
347
base *= 4;
348
size *= 4;
349
350
if (size > 0)
351
emit_const_user(ring, v, base, size, const_state->immediates);
352
353
/* NIR constant data has the same lifetime as immediates, so upload it
354
* now, too.
355
*/
356
ir3_emit_constant_data(screen, v, ring);
357
}
358
359
static inline void
360
ir3_emit_link_map(struct fd_screen *screen,
361
const struct ir3_shader_variant *producer,
362
const struct ir3_shader_variant *v,
363
struct fd_ringbuffer *ring)
364
{
365
const struct ir3_const_state *const_state = ir3_const_state(v);
366
uint32_t base = const_state->offsets.primitive_map;
367
int size = DIV_ROUND_UP(v->input_size, 4);
368
369
/* truncate size to avoid writing constants that shader
370
* does not use:
371
*/
372
size = MIN2(size + base, v->constlen) - base;
373
374
/* convert out of vec4: */
375
base *= 4;
376
size *= 4;
377
378
if (size > 0)
379
emit_const_user(ring, v, base, size, producer->output_loc);
380
}
381
382
/* emit stream-out buffers: */
383
static inline void
384
emit_tfbos(struct fd_context *ctx, const struct ir3_shader_variant *v,
385
struct fd_ringbuffer *ring)
386
{
387
/* streamout addresses after driver-params: */
388
const struct ir3_const_state *const_state = ir3_const_state(v);
389
uint32_t offset = const_state->offsets.tfbo;
390
if (v->constlen > offset) {
391
struct fd_streamout_stateobj *so = &ctx->streamout;
392
struct ir3_stream_output_info *info = &v->shader->stream_output;
393
uint32_t params = 4;
394
uint32_t offsets[params];
395
struct fd_bo *bos[params];
396
397
for (uint32_t i = 0; i < params; i++) {
398
struct pipe_stream_output_target *target = so->targets[i];
399
400
if (target) {
401
offsets[i] =
402
(so->offsets[i] * info->stride[i] * 4) + target->buffer_offset;
403
bos[i] = fd_resource(target->buffer)->bo;
404
} else {
405
offsets[i] = 0;
406
bos[i] = NULL;
407
}
408
}
409
410
assert(offset * 4 + params <= v->constlen * 4);
411
412
emit_const_ptrs(ring, v, offset * 4, params, bos, offsets);
413
}
414
}
415
416
static inline void
417
emit_common_consts(const struct ir3_shader_variant *v,
418
struct fd_ringbuffer *ring, struct fd_context *ctx,
419
enum pipe_shader_type t) assert_dt
420
{
421
enum fd_dirty_shader_state dirty = ctx->dirty_shader[t];
422
423
/* When we use CP_SET_DRAW_STATE objects to emit constant state,
424
* if we emit any of it we need to emit all. This is because
425
* we are using the same state-group-id each time for uniform
426
* state, and if previous update is never evaluated (due to no
427
* visible primitives in the current tile) then the new stateobj
428
* completely replaces the old one.
429
*
430
* Possibly if we split up different parts of the const state to
431
* different state-objects we could avoid this.
432
*/
433
if (dirty && is_stateobj(ring))
434
dirty = ~0;
435
436
if (dirty & (FD_DIRTY_SHADER_PROG | FD_DIRTY_SHADER_CONST)) {
437
struct fd_constbuf_stateobj *constbuf;
438
bool shader_dirty;
439
440
constbuf = &ctx->constbuf[t];
441
shader_dirty = !!(dirty & FD_DIRTY_SHADER_PROG);
442
443
ring_wfi(ctx->batch, ring);
444
445
ir3_emit_user_consts(ctx->screen, v, ring, constbuf);
446
ir3_emit_ubos(ctx, v, ring, constbuf);
447
if (shader_dirty)
448
ir3_emit_immediates(ctx->screen, v, ring);
449
}
450
451
if (dirty & (FD_DIRTY_SHADER_PROG | FD_DIRTY_SHADER_SSBO)) {
452
struct fd_shaderbuf_stateobj *sb = &ctx->shaderbuf[t];
453
ring_wfi(ctx->batch, ring);
454
ir3_emit_ssbo_sizes(ctx->screen, v, ring, sb);
455
}
456
457
if (dirty & (FD_DIRTY_SHADER_PROG | FD_DIRTY_SHADER_IMAGE)) {
458
struct fd_shaderimg_stateobj *si = &ctx->shaderimg[t];
459
ring_wfi(ctx->batch, ring);
460
ir3_emit_image_dims(ctx->screen, v, ring, si);
461
}
462
}
463
464
static inline void
465
ir3_emit_vs_driver_params(const struct ir3_shader_variant *v,
466
struct fd_ringbuffer *ring, struct fd_context *ctx,
467
const struct pipe_draw_info *info,
468
const struct pipe_draw_indirect_info *indirect,
469
const struct pipe_draw_start_count_bias *draw) assert_dt
470
{
471
assert(v->need_driver_params);
472
473
const struct ir3_const_state *const_state = ir3_const_state(v);
474
uint32_t offset = const_state->offsets.driver_param;
475
uint32_t vertex_params[IR3_DP_VS_COUNT] = {
476
[IR3_DP_DRAWID] = 0, /* filled by hw (CP_DRAW_INDIRECT_MULTI) */
477
[IR3_DP_VTXID_BASE] = info->index_size ? draw->index_bias : draw->start,
478
[IR3_DP_INSTID_BASE] = info->start_instance,
479
[IR3_DP_VTXCNT_MAX] = ctx->streamout.max_tf_vtx,
480
};
481
if (v->key.ucp_enables) {
482
struct pipe_clip_state *ucp = &ctx->ucp;
483
unsigned pos = IR3_DP_UCP0_X;
484
for (unsigned i = 0; pos <= IR3_DP_UCP7_W; i++) {
485
for (unsigned j = 0; j < 4; j++) {
486
vertex_params[pos] = fui(ucp->ucp[i][j]);
487
pos++;
488
}
489
}
490
}
491
492
/* Only emit as many params as needed, i.e. up to the highest enabled UCP
493
* plane. However a binning pass may drop even some of these, so limit to
494
* program max.
495
*/
496
const uint32_t vertex_params_size =
497
MIN2(const_state->num_driver_params, (v->constlen - offset) * 4);
498
assert(vertex_params_size <= IR3_DP_VS_COUNT);
499
500
bool needs_vtxid_base =
501
ir3_find_sysval_regid(v, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) !=
502
regid(63, 0);
503
504
/* for indirect draw, we need to copy VTXID_BASE from
505
* indirect-draw parameters buffer.. which is annoying
506
* and means we can't easily emit these consts in cmd
507
* stream so need to copy them to bo.
508
*/
509
if (indirect && needs_vtxid_base) {
510
struct pipe_resource *vertex_params_rsc =
511
pipe_buffer_create(&ctx->screen->base, PIPE_BIND_CONSTANT_BUFFER,
512
PIPE_USAGE_STREAM, vertex_params_size * 4);
513
unsigned src_off = indirect->offset;
514
;
515
void *ptr;
516
517
ptr = fd_bo_map(fd_resource(vertex_params_rsc)->bo);
518
memcpy(ptr, vertex_params, vertex_params_size * 4);
519
520
if (info->index_size) {
521
/* indexed draw, index_bias is 4th field: */
522
src_off += 3 * 4;
523
} else {
524
/* non-indexed draw, start is 3rd field: */
525
src_off += 2 * 4;
526
}
527
528
/* copy index_bias or start from draw params: */
529
ctx->screen->mem_to_mem(ring, vertex_params_rsc, 0, indirect->buffer,
530
src_off, 1);
531
532
emit_const_prsc(ring, v, offset * 4, 0, vertex_params_size,
533
vertex_params_rsc);
534
535
pipe_resource_reference(&vertex_params_rsc, NULL);
536
} else {
537
emit_const_user(ring, v, offset * 4, vertex_params_size, vertex_params);
538
}
539
540
/* if needed, emit stream-out buffer addresses: */
541
if (vertex_params[IR3_DP_VTXCNT_MAX] > 0) {
542
emit_tfbos(ctx, v, ring);
543
}
544
}
545
546
static inline void
547
ir3_emit_vs_consts(const struct ir3_shader_variant *v,
548
struct fd_ringbuffer *ring, struct fd_context *ctx,
549
const struct pipe_draw_info *info,
550
const struct pipe_draw_indirect_info *indirect,
551
const struct pipe_draw_start_count_bias *draw) assert_dt
552
{
553
debug_assert(v->type == MESA_SHADER_VERTEX);
554
555
emit_common_consts(v, ring, ctx, PIPE_SHADER_VERTEX);
556
557
/* emit driver params every time: */
558
if (info && v->need_driver_params) {
559
ring_wfi(ctx->batch, ring);
560
ir3_emit_vs_driver_params(v, ring, ctx, info, indirect, draw);
561
}
562
}
563
564
static inline void
565
ir3_emit_fs_consts(const struct ir3_shader_variant *v,
566
struct fd_ringbuffer *ring, struct fd_context *ctx) assert_dt
567
{
568
debug_assert(v->type == MESA_SHADER_FRAGMENT);
569
570
emit_common_consts(v, ring, ctx, PIPE_SHADER_FRAGMENT);
571
}
572
573
/* emit compute-shader consts: */
574
static inline void
575
ir3_emit_cs_consts(const struct ir3_shader_variant *v,
576
struct fd_ringbuffer *ring, struct fd_context *ctx,
577
const struct pipe_grid_info *info) assert_dt
578
{
579
debug_assert(gl_shader_stage_is_compute(v->type));
580
581
emit_common_consts(v, ring, ctx, PIPE_SHADER_COMPUTE);
582
583
/* emit compute-shader driver-params: */
584
const struct ir3_const_state *const_state = ir3_const_state(v);
585
uint32_t offset = const_state->offsets.driver_param;
586
if (v->constlen > offset) {
587
ring_wfi(ctx->batch, ring);
588
589
if (info->indirect) {
590
struct pipe_resource *indirect = NULL;
591
unsigned indirect_offset;
592
593
/* This is a bit awkward, but CP_LOAD_STATE.EXT_SRC_ADDR needs
594
* to be aligned more strongly than 4 bytes. So in this case
595
* we need a temporary buffer to copy NumWorkGroups.xyz to.
596
*
597
* TODO if previous compute job is writing to info->indirect,
598
* we might need a WFI.. but since we currently flush for each
599
* compute job, we are probably ok for now.
600
*/
601
if (info->indirect_offset & 0xf) {
602
indirect = pipe_buffer_create(&ctx->screen->base,
603
PIPE_BIND_COMMAND_ARGS_BUFFER,
604
PIPE_USAGE_STREAM, 0x1000);
605
indirect_offset = 0;
606
607
ctx->screen->mem_to_mem(ring, indirect, 0, info->indirect,
608
info->indirect_offset, 3);
609
} else {
610
pipe_resource_reference(&indirect, info->indirect);
611
indirect_offset = info->indirect_offset;
612
}
613
614
emit_const_prsc(ring, v, offset * 4, indirect_offset, 16, indirect);
615
616
pipe_resource_reference(&indirect, NULL);
617
} else {
618
uint32_t compute_params[IR3_DP_CS_COUNT] = {
619
[IR3_DP_NUM_WORK_GROUPS_X] = info->grid[0],
620
[IR3_DP_NUM_WORK_GROUPS_Y] = info->grid[1],
621
[IR3_DP_NUM_WORK_GROUPS_Z] = info->grid[2],
622
[IR3_DP_LOCAL_GROUP_SIZE_X] = info->block[0],
623
[IR3_DP_LOCAL_GROUP_SIZE_Y] = info->block[1],
624
[IR3_DP_LOCAL_GROUP_SIZE_Z] = info->block[2],
625
};
626
uint32_t size =
627
MIN2(const_state->num_driver_params, v->constlen * 4 - offset * 4);
628
629
emit_const_user(ring, v, offset * 4, size, compute_params);
630
}
631
}
632
}
633
634