i965/vs: Add VS program key dumping to INTEL_DEBUG=perf.

Eric added support for WM key debugging.  This adds it for the VS.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Kenneth Graunke 2012-08-26 07:41:50 -07:00
parent 85b24b0751
commit c20cb8d1f6
3 changed files with 76 additions and 1 deletions

View file

@ -1023,6 +1023,7 @@ extern "C" {
bool
brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c)
{
struct brw_context *brw = c->func.brw;
struct intel_context *intel = &c->func.brw->intel;
bool start_busy = false;
float start_time = 0;
@ -1049,7 +1050,7 @@ brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c)
if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
if (shader->compiled_once) {
perf_debug("Recompiling vertex shader for program %d\n", prog->Name);
brw_vs_debug_recompile(brw, prog, &c->key);
}
if (start_busy && !drm_intel_bo_busy(intel->batch.last_bo)) {
perf_debug("VS compile took %.03f ms and stalled the GPU\n",

View file

@ -297,6 +297,77 @@ do_vs_prog(struct brw_context *brw,
return true;
}
static bool
key_debug(const char *name, int a, int b)
{
if (a != b) {
perf_debug(" %s %d->%d\n", name, a, b);
return true;
}
return false;
}
void
brw_vs_debug_recompile(struct brw_context *brw,
struct gl_shader_program *prog,
const struct brw_vs_prog_key *key)
{
struct brw_cache_item *c = NULL;
const struct brw_vs_prog_key *old_key = NULL;
bool found = false;
perf_debug("Recompiling vertex shader for program %d\n", prog->Name);
for (unsigned int i = 0; i < brw->cache.size; i++) {
for (c = brw->cache.items[i]; c; c = c->next) {
if (c->cache_id == BRW_VS_PROG) {
old_key = c->key;
if (old_key->program_string_id == key->program_string_id)
break;
}
}
if (c)
break;
}
if (!c) {
perf_debug(" Didn't find previous compile in the shader cache for "
"debug\n");
return;
}
for (unsigned int i = 0; i < VERT_ATTRIB_MAX; i++) {
found |= key_debug("GL_FIXED rescaling",
old_key->gl_fixed_input_size[i],
key->gl_fixed_input_size[i]);
}
found |= key_debug("user clip flags",
old_key->userclip_active, key->userclip_active);
found |= key_debug("user clipping planes as push constants",
old_key->nr_userclip_plane_consts,
key->nr_userclip_plane_consts);
found |= key_debug("clip distance enable",
old_key->uses_clip_distance, key->uses_clip_distance);
found |= key_debug("clip plane enable bitfield",
old_key->userclip_planes_enabled_gen_4_5,
key->userclip_planes_enabled_gen_4_5);
found |= key_debug("copy edgeflag",
old_key->copy_edgeflag, key->copy_edgeflag);
found |= key_debug("PointCoord replace",
old_key->point_coord_replace, key->point_coord_replace);
found |= key_debug("vertex color clamping",
old_key->clamp_vertex_color, key->clamp_vertex_color);
found |= brw_debug_recompile_sampler_key(&old_key->tex, &key->tex);
if (!found) {
perf_debug(" Something else\n");
}
}
static void brw_upload_vs_prog(struct brw_context *brw)
{

View file

@ -120,5 +120,8 @@ struct brw_vs_compile {
bool brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c);
void brw_old_vs_emit(struct brw_vs_compile *c);
bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
void brw_vs_debug_recompile(struct brw_context *brw,
struct gl_shader_program *prog,
const struct brw_vs_prog_key *key);
#endif