aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2020-06-07 09:52:43 +1000
committerMarge Bot <[email protected]>2020-06-10 22:52:42 +0000
commit4f3fbfb82e6559fbf44c5384f8639e73ec6dd82b (patch)
treee43ee59287495deadf7f32724cf159f4c17e171d
parent550f1c6d33250d33a50e86f03fa4024db33d4f8a (diff)
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 <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5377>
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_program.c3
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_program.h2
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c32
3 files changed, 23 insertions, 14 deletions
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
@@ -65,6 +65,16 @@ nvc0_program_validate(struct nvc0_context *nvc0, struct nvc0_program *prog)
}
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)
{
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
@@ -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 {