From d7b3ab3bc2fa6adff32e0e130b4d6266673ce4b1 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sun, 20 Apr 2025 17:55:37 +0200 Subject: [PATCH] nv50: move pipe_grid_info::input into the driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is left-over from clover, but nv50 used it for hw sm queries Acked-by: Mike Blumenkrantz Reviewed-by: Marek Olšák Part-of: --- .../drivers/nouveau/nv50/nv50_compute.c | 18 +++++++++++++----- .../drivers/nouveau/nv50/nv50_context.h | 3 +++ .../drivers/nouveau/nv50/nv50_program.h | 1 - .../drivers/nouveau/nv50/nv50_query_hw_sm.c | 4 +--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_compute.c b/src/gallium/drivers/nouveau/nv50/nv50_compute.c index e6a597c8182..eb65544be6f 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_compute.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_compute.c @@ -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); +} diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.h b/src/gallium/drivers/nouveau/nv50/nv50_context.h index cd8f903ac0f..e1272381997 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_context.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.h @@ -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 diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h b/src/gallium/drivers/nouveau/nv50/nv50_program.h index d4900a2390f..1784aad19a2 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_program.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h @@ -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 */ diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c index a6c92bbbd1e..52a984c2a49 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c @@ -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);