[Mesa-dev] [PATCH 31/70] i965: update brw_get_shader_time_index() not to take gl_shader_program
Timothy Arceri
timothy.arceri at collabora.com
Fri Nov 11 00:46:13 UTC 2016
This removes another dependency on gl_shader_program in the codegen
functions which will help allow us to use gl_program in the
CurrentProgram array rather than gl_shader_program.
---
src/mesa/drivers/dri/i965/brw_context.h | 4 ++--
src/mesa/drivers/dri/i965/brw_cs.c | 2 +-
src/mesa/drivers/dri/i965/brw_gs.c | 2 +-
src/mesa/drivers/dri/i965/brw_program.c | 20 ++++++++------------
src/mesa/drivers/dri/i965/brw_tcs.c | 2 +-
src/mesa/drivers/dri/i965/brw_tes.c | 2 +-
src/mesa/drivers/dri/i965/brw_vs.c | 7 +++++--
src/mesa/drivers/dri/i965/brw_wm.c | 7 +++++--
8 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index f95ab49..5065b5d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1427,9 +1427,9 @@ void brw_alloc_stage_scratch(struct brw_context *brw,
unsigned thread_count);
void brw_init_shader_time(struct brw_context *brw);
int brw_get_shader_time_index(struct brw_context *brw,
- struct gl_shader_program *shader_prog,
struct gl_program *prog,
- enum shader_time_shader_type type);
+ enum shader_time_shader_type type,
+ bool is_glsl_sh);
void brw_collect_and_report_shader_time(struct brw_context *brw);
void brw_destroy_shader_time(struct brw_context *brw);
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 9123fa8..3bd6ec4 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -115,7 +115,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &cp->program, ST_CS);
+ st_index = brw_get_shader_time_index(brw, &cp->program, ST_CS, true);
char *error_str;
program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx, key,
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 4559585..1f9b133 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -144,7 +144,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, NULL, ST_GS);
+ st_index = brw_get_shader_time_index(brw, &gp->program, ST_GS, true);
if (unlikely(brw->perf_debug)) {
start_busy = brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index a70ae81..abdbf91 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -594,29 +594,25 @@ brw_collect_and_report_shader_time(struct brw_context *brw)
* change their lifetimes compared to normal operation.
*/
int
-brw_get_shader_time_index(struct brw_context *brw,
- struct gl_shader_program *shader_prog,
- struct gl_program *prog,
- enum shader_time_shader_type type)
+brw_get_shader_time_index(struct brw_context *brw, struct gl_program *prog,
+ enum shader_time_shader_type type, bool is_glsl_sh)
{
int shader_time_index = brw->shader_time.num_entries++;
assert(shader_time_index < brw->shader_time.max_entries);
brw->shader_time.types[shader_time_index] = type;
- int id = shader_prog ? shader_prog->Name : prog->Id;
const char *name;
- if (id == 0) {
+ if (prog->Id == 0) {
name = "ff";
- } else if (!shader_prog) {
- name = "prog";
- } else if (shader_prog->Label) {
- name = ralloc_strdup(brw->shader_time.names, shader_prog->Label);
+ } else if (is_glsl_sh) {
+ name = prog->info.label ?
+ ralloc_strdup(brw->shader_time.names, prog->info.label) : "glsl";
} else {
- name = "glsl";
+ name = "prog";
}
brw->shader_time.names[shader_time_index] = name;
- brw->shader_time.ids[shader_time_index] = id;
+ brw->shader_time.ids[shader_time_index] = prog->Id;
return shader_time_index;
}
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index e31b408..7830f84 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -251,7 +251,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,
int st_index = -1;
if (unlikely(INTEL_DEBUG & DEBUG_SHADER_TIME))
- st_index = brw_get_shader_time_index(brw, shader_prog, NULL, ST_TCS);
+ st_index = brw_get_shader_time_index(brw, &tcp->program, ST_TCS, true);
if (unlikely(brw->perf_debug)) {
start_busy = brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo);
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 284030f..27e7301 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -172,7 +172,7 @@ brw_codegen_tes_prog(struct brw_context *brw,
int st_index = -1;
if (unlikely(INTEL_DEBUG & DEBUG_SHADER_TIME))
- st_index = brw_get_shader_time_index(brw, shader_prog, NULL, ST_TES);
+ st_index = brw_get_shader_time_index(brw, &tep->program, ST_TES, true);
if (unlikely(brw->perf_debug)) {
start_busy = brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo);
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index bdaf8aa..970a692 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -181,8 +181,11 @@ brw_codegen_vs_prog(struct brw_context *brw,
}
int st_index = -1;
- if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &vp->program, ST_VS);
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
+ bool is_glsl_sh = prog != NULL;
+ st_index = brw_get_shader_time_index(brw, &vp->program, ST_VS,
+ is_glsl_sh);
+ }
/* Emit GEN4 code.
*/
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index e0d5684..81c0f5a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -134,8 +134,11 @@ brw_codegen_wm_prog(struct brw_context *brw,
int st_index8 = -1, st_index16 = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
- st_index8 = brw_get_shader_time_index(brw, prog, &fp->program, ST_FS8);
- st_index16 = brw_get_shader_time_index(brw, prog, &fp->program, ST_FS16);
+ bool is_glsl_sh = prog != NULL;
+ st_index8 = brw_get_shader_time_index(brw, &fp->program, ST_FS8,
+ is_glsl_sh);
+ st_index16 = brw_get_shader_time_index(brw, &fp->program, ST_FS16,
+ is_glsl_sh);
}
char *error_str = NULL;
--
2.7.4
More information about the mesa-dev
mailing list