Mesa (master): i915g: Add a way to profile the contents of command buffers.

Stephane Marchesin marcheu at kemper.freedesktop.org
Mon Feb 13 00:37:31 UTC 2012


Module: Mesa
Branch: master
Commit: 633f21652aacbcd7eebe28597cac1dc556ea2b45
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=633f21652aacbcd7eebe28597cac1dc556ea2b45

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Wed Feb  8 22:43:14 2012 -0800

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

---

 src/gallium/drivers/i915/i915_state_emit.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c
index 2aed3f1..8ab8fb8 100644
--- a/src/gallium/drivers/i915/i915_state_emit.c
+++ b/src/gallium/drivers/i915/i915_state_emit.c
@@ -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);




More information about the mesa-commit mailing list