summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-11-27 14:10:52 -0800
committerEric Anholt <eric@anholt.net>2012-12-05 14:29:44 -0800
commit71f06344a0d72a6bd27750ceca571fc016b8de85 (patch)
tree4a32ebc3e5bff0ad16665a5a0737b2da1c0e0683 /src/mesa/drivers/dri/i965/brw_vs_surface_state.c
parentef2fbf67d4bd941a9a0e1c6f8515fb4911e05c50 (diff)
downloadexternal_mesa3d-71f06344a0d72a6bd27750ceca571fc016b8de85.zip
external_mesa3d-71f06344a0d72a6bd27750ceca571fc016b8de85.tar.gz
external_mesa3d-71f06344a0d72a6bd27750ceca571fc016b8de85.tar.bz2
i965: Add a debug flag for counting cycles spent in each compiled shader.
This can be used for two purposes: Using hand-coded shaders to determine per-instruction timings, or figuring out which shader to optimize in a whole application. Note that this doesn't cover the instructions that set up the message to the URB/FB write -- we'd need to convert the MRF usage in these instructions to GRFs so that our offsets/times don't overwrite our shader outputs. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1) v2: Check the timestamp reset flag in the VS, which is apparently getting set fairly regularly in the range we watch, resulting in negative numbers getting added to our 32-bit counter, and thus large values added to our uint64_t. v3: Rebase on reladdr changes, removing a new safety check that proved impossible to satisfy. Add a comment to the AOP defs from Ken's review, and put them in a slightly more sensible spot. v4: Check timestamp reset in the FS as well.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vs_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index d70c36e..3985b48 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -138,9 +138,19 @@ const struct brw_tracked_state brw_vs_ubo_surfaces = {
static void
brw_vs_upload_binding_table(struct brw_context *brw)
{
+ struct intel_context *intel = &brw->intel;
uint32_t *bind;
int i;
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
+ intel->vtbl.create_constant_surface(brw, brw->shader_time.bo, 0,
+ brw->shader_time.bo->size,
+ &brw->vs.surf_offset[SURF_INDEX_VS_SHADER_TIME]);
+
+ assert(brw->vs.prog_data->num_surfaces <= SURF_INDEX_VS_SHADER_TIME);
+ brw->vs.prog_data->num_surfaces = SURF_INDEX_VS_SHADER_TIME;
+ }
+
/* CACHE_NEW_VS_PROG: Skip making a binding table if we don't use textures or
* pull constants.
*/