nv50: move pipe_grid_info::input into the driver

It is left-over from clover, but nv50 used it for hw sm queries

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34623>
This commit is contained in:
Karol Herbst
2025-04-20 17:55:37 +02:00
parent 6416c49247
commit d7b3ab3bc2
4 changed files with 17 additions and 9 deletions
@@ -523,11 +523,12 @@ nv50_state_validate_cp(struct nv50_context *nv50, uint32_t mask)
}
static void
nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input)
nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input, uint32_t size)
{
struct nv50_screen *screen = nv50->screen;
struct nouveau_pushbuf *push = nv50->base.pushbuf;
unsigned size = align(nv50->compprog->parm_size, 0x4);
assert(util_is_aligned(size, 0x4));
BEGIN_NV04(push, NV50_CP(USER_PARAM_COUNT), 1);
PUSH_DATA (push, (1 + (size / 4)) << 8);
@@ -559,7 +560,8 @@ nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input)
}
void
nv50_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info)
nv50_launch_grid_with_input(struct pipe_context *pipe, const struct pipe_grid_info *info,
const void *input, uint32_t input_size)
{
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_pushbuf *push = nv50->base.pushbuf;
@@ -574,12 +576,12 @@ nv50_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info)
goto out;
}
nv50_compute_upload_input(nv50, info->input);
nv50_compute_upload_input(nv50, input, input_size);
BEGIN_NV04(push, NV50_CP(CP_START_ID), 1);
PUSH_DATA (push, cp->code_base);
int shared_size = cp->cp.smem_size + info->variable_shared_mem + cp->parm_size + 0x14;
int shared_size = cp->cp.smem_size + info->variable_shared_mem + input_size + 0x14;
BEGIN_NV04(push, NV50_CP(SHARED_SIZE), 1);
PUSH_DATA (push, align(shared_size, 0x40));
BEGIN_NV04(push, NV50_CP(CP_REG_ALLOC_TEMP), 1);
@@ -629,3 +631,9 @@ out:
PUSH_KICK(push);
simple_mtx_unlock(&nv50->screen->state_lock);
}
void
nv50_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info)
{
nv50_launch_grid_with_input(pipe, info, NULL, 0);
}
@@ -405,5 +405,8 @@ nv98_video_buffer_create(struct pipe_context *pipe,
/* nv50_compute.c */
void
nv50_launch_grid(struct pipe_context *, const struct pipe_grid_info *);
void
nv50_launch_grid_with_input(struct pipe_context *, const struct pipe_grid_info *,
const void *input, uint32_t input_size);
#endif
@@ -66,7 +66,6 @@ struct nv50_program {
unsigned code_size;
unsigned code_base;
uint32_t *immd;
unsigned parm_size; /* size limit of uniform buffer */
uint32_t tls_space; /* required local memory per thread */
uint8_t max_gpr; /* REG_ALLOC_TEMP */
@@ -231,7 +231,6 @@ nv50_hw_sm_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq)
prog->type = PIPE_SHADER_COMPUTE;
prog->translated = true;
prog->max_gpr = 7;
prog->parm_size = 8;
prog->code = (uint32_t *)nv50_read_hw_sm_counters_code;
prog->code_size = sizeof(nv50_read_hw_sm_counters_code);
screen->pm.prog = prog;
@@ -270,8 +269,7 @@ nv50_hw_sm_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq)
info.grid[i] = grid[i];
}
info.pc = 0;
info.input = input;
pipe->launch_grid(pipe, &info);
nv50_launch_grid_with_input(pipe, &info, input, 8);
pipe->bind_compute_state(pipe, old);
nouveau_bufctx_reset(nv50->bufctx_cp, NV50_BIND_CP_QUERY);