i915g: Add a way to profile the contents of command buffers.

This commit is contained in:
Stéphane Marchesin 2012-02-08 22:43:14 -08:00
parent 8b3e0b2715
commit 633f21652a
1 changed files with 12 additions and 0 deletions

View File

@ -429,10 +429,22 @@ i915_validate_state(struct i915_context *i915, unsigned *batch_space)
else
*batch_space = 0;
#if 0
static int counter_total = 0;
#define VALIDATE_ATOM(atom, hw_dirty) \
if (i915->hardware_dirty & hw_dirty) { \
static int counter_##atom = 0;\
validate_##atom(i915, &tmp); \
*batch_space += tmp;\
counter_##atom += tmp;\
counter_total += tmp;\
printf("%s: \t%d/%d \t%2.2f\n",#atom, counter_##atom, counter_total, counter_##atom*100.f/counter_total);}
#else
#define VALIDATE_ATOM(atom, hw_dirty) \
if (i915->hardware_dirty & hw_dirty) { \
validate_##atom(i915, &tmp); \
*batch_space += tmp; }
#endif
VALIDATE_ATOM(flush, I915_HW_FLUSH);
VALIDATE_ATOM(immediate, I915_HW_IMMEDIATE);
VALIDATE_ATOM(dynamic, I915_HW_DYNAMIC);