From: Ben Skeggs Date: Sat, 6 Jun 2020 23:52:43 +0000 (+1000) Subject: nvc0: move setting of entrypoint for a shader stage to a function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f3fbfb82e6559fbf44c5384f8639e73ec6dd82b;p=mesa.git nvc0: move setting of entrypoint for a shader stage to a function GV100 requires something different, cleaner to move this to a single place. Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Part-of: --- diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index 32aa82d168c..4f3d1cd5b3b 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -874,8 +874,7 @@ nvc0_program_upload(struct nvc0_context *nvc0, struct nvc0_program *prog) BEGIN_NVC0(nvc0->base.pushbuf, NVC0_CP(FLUSH), 1); PUSH_DATA (nvc0->base.pushbuf, NVC0_COMPUTE_FLUSH_CODE); } else { - BEGIN_NVC0(nvc0->base.pushbuf, NVC0_3D(SP_START_ID(i)), 1); - PUSH_DATA (nvc0->base.pushbuf, progs[i]->code_base); + nvc0_program_sp_start_id(nvc0, i, progs[i]); } } } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.h b/src/gallium/drivers/nouveau/nvc0/nvc0_program.h index 5684207aa54..6e965ae9d9e 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.h @@ -72,4 +72,6 @@ struct nvc0_program { struct nouveau_heap *mem; }; +void +nvc0_program_sp_start_id(struct nvc0_context *, int, struct nvc0_program *); #endif diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c index b7e0c8a930f..02f1c6fba8f 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c @@ -64,6 +64,16 @@ nvc0_program_validate(struct nvc0_context *nvc0, struct nvc0_program *prog) return true; /* stream output info only */ } +void +nvc0_program_sp_start_id(struct nvc0_context *nvc0, int stage, + struct nvc0_program *prog) +{ + struct nouveau_pushbuf *push = nvc0->base.pushbuf; + + BEGIN_NVC0(push, NVC0_3D(SP_START_ID(stage)), 1); + PUSH_DATA (push, prog->code_base); +} + void nvc0_vertprog_validate(struct nvc0_context *nvc0) { @@ -74,9 +84,9 @@ nvc0_vertprog_validate(struct nvc0_context *nvc0) return; nvc0_program_update_context_state(nvc0, vp, 0); - BEGIN_NVC0(push, NVC0_3D(SP_SELECT(1)), 2); + BEGIN_NVC0(push, NVC0_3D(SP_SELECT(1)), 1); PUSH_DATA (push, 0x11); - PUSH_DATA (push, vp->code_base); + nvc0_program_sp_start_id(nvc0, 1, vp); BEGIN_NVC0(push, NVC0_3D(SP_GPR_ALLOC(1)), 1); PUSH_DATA (push, vp->num_gprs); @@ -152,9 +162,9 @@ nvc0_fragprog_validate(struct nvc0_context *nvc0) fp->fp.post_depth_coverage); } - BEGIN_NVC0(push, NVC0_3D(SP_SELECT(5)), 2); + BEGIN_NVC0(push, NVC0_3D(SP_SELECT(5)), 1); PUSH_DATA (push, 0x51); - PUSH_DATA (push, fp->code_base); + nvc0_program_sp_start_id(nvc0, 5, fp); BEGIN_NVC0(push, NVC0_3D(SP_GPR_ALLOC(5)), 1); PUSH_DATA (push, fp->num_gprs); @@ -176,9 +186,9 @@ nvc0_tctlprog_validate(struct nvc0_context *nvc0) BEGIN_NVC0(push, NVC0_3D(TESS_MODE), 1); PUSH_DATA (push, tp->tp.tess_mode); } - BEGIN_NVC0(push, NVC0_3D(SP_SELECT(2)), 2); + BEGIN_NVC0(push, NVC0_3D(SP_SELECT(2)), 1); PUSH_DATA (push, 0x21); - PUSH_DATA (push, tp->code_base); + nvc0_program_sp_start_id(nvc0, 2, tp); BEGIN_NVC0(push, NVC0_3D(SP_GPR_ALLOC(2)), 1); PUSH_DATA (push, tp->num_gprs); } else { @@ -186,9 +196,9 @@ nvc0_tctlprog_validate(struct nvc0_context *nvc0) /* not a whole lot we can do to handle this failure */ if (!nvc0_program_validate(nvc0, tp)) assert(!"unable to validate empty tcp"); - BEGIN_NVC0(push, NVC0_3D(SP_SELECT(2)), 2); + BEGIN_NVC0(push, NVC0_3D(SP_SELECT(2)), 1); PUSH_DATA (push, 0x20); - PUSH_DATA (push, tp->code_base); + nvc0_program_sp_start_id(nvc0, 2, tp); } nvc0_program_update_context_state(nvc0, tp, 1); } @@ -206,8 +216,7 @@ nvc0_tevlprog_validate(struct nvc0_context *nvc0) } BEGIN_NVC0(push, NVC0_3D(MACRO_TEP_SELECT), 1); PUSH_DATA (push, 0x31); - BEGIN_NVC0(push, NVC0_3D(SP_START_ID(3)), 1); - PUSH_DATA (push, tp->code_base); + nvc0_program_sp_start_id(nvc0, 3, tp); BEGIN_NVC0(push, NVC0_3D(SP_GPR_ALLOC(3)), 1); PUSH_DATA (push, tp->num_gprs); } else { @@ -227,8 +236,7 @@ nvc0_gmtyprog_validate(struct nvc0_context *nvc0) if (gp && nvc0_program_validate(nvc0, gp) && gp->code_size) { BEGIN_NVC0(push, NVC0_3D(MACRO_GP_SELECT), 1); PUSH_DATA (push, 0x41); - BEGIN_NVC0(push, NVC0_3D(SP_START_ID(4)), 1); - PUSH_DATA (push, gp->code_base); + nvc0_program_sp_start_id(nvc0, 4, gp); BEGIN_NVC0(push, NVC0_3D(SP_GPR_ALLOC(4)), 1); PUSH_DATA (push, gp->num_gprs); } else {