From 381c2aded223abce3635b530334f0f0ae8b8397c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 6 May 2019 18:24:08 -0700 Subject: [PATCH] i965: Pass compiler to default key populators This lets us get devinfo and other misc. compiler settings. Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_cs.c | 5 +++-- src/mesa/drivers/dri/i965/brw_cs.h | 2 +- src/mesa/drivers/dri/i965/brw_gs.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_gs.h | 2 +- src/mesa/drivers/dri/i965/brw_program.c | 14 +++++++------- src/mesa/drivers/dri/i965/brw_program.h | 6 +++--- src/mesa/drivers/dri/i965/brw_program_binary.c | 2 +- src/mesa/drivers/dri/i965/brw_tcs.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_tes.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_vs.c | 5 +++-- src/mesa/drivers/dri/i965/brw_vs.h | 2 +- src/mesa/drivers/dri/i965/brw_wm.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- 13 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index ea78471d763..58adbda2fb6 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -185,10 +185,11 @@ brw_upload_cs_prog(struct brw_context *brw) } void -brw_cs_populate_default_key(const struct gen_device_info *devinfo, +brw_cs_populate_default_key(const struct brw_compiler *compiler, struct brw_cs_prog_key *key, struct gl_program *prog) { + const struct gen_device_info *devinfo = compiler->devinfo; memset(key, 0, sizeof(*key)); key->program_string_id = brw_program(prog)->id; @@ -203,7 +204,7 @@ brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog) struct brw_program *bcp = brw_program(prog); - brw_cs_populate_default_key(&brw->screen->devinfo, &key, prog); + brw_cs_populate_default_key(brw->screen->compiler, &key, prog); uint32_t old_prog_offset = brw->cs.base.prog_offset; struct brw_stage_prog_data *old_prog_data = brw->cs.base.prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_cs.h b/src/mesa/drivers/dri/i965/brw_cs.h index 669d4b544eb..a0d43abaae4 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.h +++ b/src/mesa/drivers/dri/i965/brw_cs.h @@ -35,7 +35,7 @@ brw_upload_cs_prog(struct brw_context *brw); void brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key); void -brw_cs_populate_default_key(const struct gen_device_info *devinfo, +brw_cs_populate_default_key(const struct brw_compiler *compiler, struct brw_cs_prog_key *key, struct gl_program *prog); diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index eeff4784e72..34e37373999 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -186,10 +186,12 @@ brw_upload_gs_prog(struct brw_context *brw) } void -brw_gs_populate_default_key(const struct gen_device_info *devinfo, +brw_gs_populate_default_key(const struct brw_compiler *compiler, struct brw_gs_prog_key *key, struct gl_program *prog) { + const struct gen_device_info *devinfo = compiler->devinfo; + memset(key, 0, sizeof(*key)); brw_setup_tex_for_precompile(devinfo, &key->tex, prog); @@ -207,7 +209,7 @@ brw_gs_precompile(struct gl_context *ctx, struct gl_program *prog) struct brw_program *bgp = brw_program(prog); - brw_gs_populate_default_key(&brw->screen->devinfo, &key, prog); + brw_gs_populate_default_key(brw->screen->compiler, &key, prog); success = brw_codegen_gs_prog(brw, bgp, &key); diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index cff994a9323..7dab548e4b3 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -41,7 +41,7 @@ void brw_gs_populate_key(struct brw_context *brw, struct brw_gs_prog_key *key); void -brw_gs_populate_default_key(const struct gen_device_info *devinfo, +brw_gs_populate_default_key(const struct brw_compiler *compiler, struct brw_gs_prog_key *key, struct gl_program *prog); diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index defb465a2e2..deb0f1cf225 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -885,29 +885,29 @@ brw_prog_key_set_id(union brw_any_prog_key *key, gl_shader_stage stage, } void -brw_populate_default_key(const struct gen_device_info *devinfo, +brw_populate_default_key(const struct brw_compiler *compiler, union brw_any_prog_key *prog_key, struct gl_shader_program *sh_prog, struct gl_program *prog) { switch (prog->info.stage) { case MESA_SHADER_VERTEX: - brw_vs_populate_default_key(devinfo, &prog_key->vs, prog); + brw_vs_populate_default_key(compiler, &prog_key->vs, prog); break; case MESA_SHADER_TESS_CTRL: - brw_tcs_populate_default_key(devinfo, &prog_key->tcs, sh_prog, prog); + brw_tcs_populate_default_key(compiler, &prog_key->tcs, sh_prog, prog); break; case MESA_SHADER_TESS_EVAL: - brw_tes_populate_default_key(devinfo, &prog_key->tes, sh_prog, prog); + brw_tes_populate_default_key(compiler, &prog_key->tes, sh_prog, prog); break; case MESA_SHADER_GEOMETRY: - brw_gs_populate_default_key(devinfo, &prog_key->gs, prog); + brw_gs_populate_default_key(compiler, &prog_key->gs, prog); break; case MESA_SHADER_FRAGMENT: - brw_wm_populate_default_key(devinfo, &prog_key->wm, prog); + brw_wm_populate_default_key(compiler, &prog_key->wm, prog); break; case MESA_SHADER_COMPUTE: - brw_cs_populate_default_key(devinfo, &prog_key->cs, prog); + brw_cs_populate_default_key(compiler, &prog_key->cs, prog); break; default: unreachable("Unsupported stage!"); diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h index fc10433f322..117019d00c7 100644 --- a/src/mesa/drivers/dri/i965/brw_program.h +++ b/src/mesa/drivers/dri/i965/brw_program.h @@ -86,7 +86,7 @@ brw_prog_key_set_id(union brw_any_prog_key *key, gl_shader_stage stage, unsigned id); void -brw_populate_default_key(const struct gen_device_info *devinfo, +brw_populate_default_key(const struct brw_compiler *compiler, union brw_any_prog_key *prog_key, struct gl_shader_program *sh_prog, struct gl_program *prog); @@ -113,14 +113,14 @@ GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog void brw_upload_tcs_prog(struct brw_context *brw); void brw_tcs_populate_key(struct brw_context *brw, struct brw_tcs_prog_key *key); -void brw_tcs_populate_default_key(const struct gen_device_info *devinfo, +void brw_tcs_populate_default_key(const struct brw_compiler *compiler, struct brw_tcs_prog_key *key, struct gl_shader_program *sh_prog, struct gl_program *prog); void brw_upload_tes_prog(struct brw_context *brw); void brw_tes_populate_key(struct brw_context *brw, struct brw_tes_prog_key *key); -void brw_tes_populate_default_key(const struct gen_device_info *devinfo, +void brw_tes_populate_default_key(const struct brw_compiler *compiler, struct brw_tes_prog_key *key, struct gl_shader_program *sh_prog, struct gl_program *prog); diff --git a/src/mesa/drivers/dri/i965/brw_program_binary.c b/src/mesa/drivers/dri/i965/brw_program_binary.c index 1298d9e765e..a1502695ac1 100644 --- a/src/mesa/drivers/dri/i965/brw_program_binary.c +++ b/src/mesa/drivers/dri/i965/brw_program_binary.c @@ -251,7 +251,7 @@ serialize_gen_part(struct blob *writer, struct gl_context *ctx, struct brw_context *brw = brw_context(ctx); union brw_any_prog_key key; - brw_populate_default_key(&brw->screen->devinfo, &key, sh_prog, prog); + brw_populate_default_key(brw->screen->compiler, &key, sh_prog, prog); const gl_shader_stage stage = prog->info.stage; uint32_t offset = 0; diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index dbb469214b2..1c4d7988638 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -235,11 +235,12 @@ brw_upload_tcs_prog(struct brw_context *brw) } void -brw_tcs_populate_default_key(const struct gen_device_info *devinfo, +brw_tcs_populate_default_key(const struct brw_compiler *compiler, struct brw_tcs_prog_key *key, struct gl_shader_program *sh_prog, struct gl_program *prog) { + const struct gen_device_info *devinfo = compiler->devinfo; struct brw_program *btcp = brw_program(prog); const struct gl_linked_shader *tes = sh_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]; @@ -272,6 +273,7 @@ brw_tcs_precompile(struct gl_context *ctx, struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); + const struct brw_compiler *compiler = brw->screen->compiler; struct brw_tcs_prog_key key; uint32_t old_prog_offset = brw->tcs.base.prog_offset; struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data; @@ -282,7 +284,7 @@ brw_tcs_precompile(struct gl_context *ctx, shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]; struct brw_program *btep = tes ? brw_program(tes->Program) : NULL; - brw_tcs_populate_default_key(&brw->screen->devinfo, &key, shader_prog, prog); + brw_tcs_populate_default_key(compiler, &key, shader_prog, prog); success = brw_codegen_tcs_prog(brw, btcp, btep, &key); diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 6bdd9c0fdca..7a55251363c 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -184,11 +184,12 @@ brw_upload_tes_prog(struct brw_context *brw) } void -brw_tes_populate_default_key(const struct gen_device_info *devinfo, +brw_tes_populate_default_key(const struct brw_compiler *compiler, struct brw_tes_prog_key *key, struct gl_shader_program *sh_prog, struct gl_program *prog) { + const struct gen_device_info *devinfo = compiler->devinfo; struct brw_program *btep = brw_program(prog); memset(key, 0, sizeof(*key)); @@ -214,6 +215,7 @@ brw_tes_precompile(struct gl_context *ctx, struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); + const struct brw_compiler *compiler = brw->screen->compiler; struct brw_tes_prog_key key; uint32_t old_prog_offset = brw->tes.base.prog_offset; struct brw_stage_prog_data *old_prog_data = brw->tes.base.prog_data; @@ -221,7 +223,7 @@ brw_tes_precompile(struct gl_context *ctx, struct brw_program *btep = brw_program(prog); - brw_tes_populate_default_key(&brw->screen->devinfo, &key, shader_prog, prog); + brw_tes_populate_default_key(compiler, &key, shader_prog, prog); success = brw_codegen_tes_prog(brw, btep, &key); diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 12ab05c67c4..c19a326a455 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -318,10 +318,11 @@ brw_upload_vs_prog(struct brw_context *brw) } void -brw_vs_populate_default_key(const struct gen_device_info *devinfo, +brw_vs_populate_default_key(const struct brw_compiler *compiler, struct brw_vs_prog_key *key, struct gl_program *prog) { + const struct gen_device_info *devinfo = compiler->devinfo; struct brw_program *bvp = brw_program(prog); memset(key, 0, sizeof(*key)); @@ -345,7 +346,7 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_program *prog) struct brw_program *bvp = brw_program(prog); - brw_vs_populate_default_key(&brw->screen->devinfo, &key, prog); + brw_vs_populate_default_key(brw->screen->compiler, &key, prog); success = brw_codegen_vs_prog(brw, bvp, &key); diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 94419f3af0c..207853c7fb5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -46,7 +46,7 @@ void brw_vs_populate_key(struct brw_context *brw, struct brw_vs_prog_key *key); void -brw_vs_populate_default_key(const struct gen_device_info *devinfo, +brw_vs_populate_default_key(const struct brw_compiler *compiler, struct brw_vs_prog_key *key, struct gl_program *prog); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 996e7a9884c..bb0fd789d50 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -524,10 +524,12 @@ brw_upload_wm_prog(struct brw_context *brw) } void -brw_wm_populate_default_key(const struct gen_device_info *devinfo, +brw_wm_populate_default_key(const struct brw_compiler *compiler, struct brw_wm_prog_key *key, struct gl_program *prog) { + const struct gen_device_info *devinfo = compiler->devinfo; + memset(key, 0, sizeof(*key)); uint64_t outputs_written = prog->info.outputs_written; @@ -571,7 +573,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_program *prog) struct brw_program *bfp = brw_program(prog); - brw_wm_populate_default_key(&brw->screen->devinfo, &key, prog); + brw_wm_populate_default_key(brw->screen->compiler, &key, prog); /* check brw_wm_populate_default_key coherent_fb_fetch setting */ assert(key.coherent_fb_fetch == diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index ea944972997..86980c3dadc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -48,7 +48,7 @@ void brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key); void -brw_wm_populate_default_key(const struct gen_device_info *devinfo, +brw_wm_populate_default_key(const struct brw_compiler *compiler, struct brw_wm_prog_key *key, struct gl_program *prog); -- 2.30.2