aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-25 06:15:50 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2009-09-22 20:05:21 -0400
commit1c5d22f76dc721f3acb7a3dadc657a221e487fb7 (patch)
tree99a69f1be4f10d1e38af2c5ece4b5905f7a5701a /drivers/gpu/drm/i915/i915_dma.c
parent74dff282237ea8c0a5df1afd8526eac4b6cee063 (diff)
drm/i915: Add tracepoints
By adding tracepoint equivalents for WATCH_BUF/EXEC we are able to monitor the lifetimes of objects, requests and significant events. These events can then be probed using the tracing frameworks, such as systemtap and, in particular, perf. For example to record the stack trace for every GPU stall during a run, use $ perf record -e i915:i915_gem_request_wait_begin -c 1 -g And $ perf report to view the results. [Updated to fix compilation issues caused.] Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Ben Gamari <bgamari@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 59826c5b8760..ae7ec0390024 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -33,6 +33,7 @@
33#include "intel_drv.h" 33#include "intel_drv.h"
34#include "i915_drm.h" 34#include "i915_drm.h"
35#include "i915_drv.h" 35#include "i915_drv.h"
36#include "i915_trace.h"
36 37
37/* Really want an OS-independent resettable timer. Would like to have 38/* Really want an OS-independent resettable timer. Would like to have
38 * this loop run for (eg) 3 sec, but have the timer reset every time 39 * this loop run for (eg) 3 sec, but have the timer reset every time
@@ -49,14 +50,18 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
49 u32 last_head = I915_READ(PRB0_HEAD) & HEAD_ADDR; 50 u32 last_head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
50 int i; 51 int i;
51 52
53 trace_i915_ring_wait_begin (dev);
54
52 for (i = 0; i < 100000; i++) { 55 for (i = 0; i < 100000; i++) {
53 ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR; 56 ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
54 acthd = I915_READ(acthd_reg); 57 acthd = I915_READ(acthd_reg);
55 ring->space = ring->head - (ring->tail + 8); 58 ring->space = ring->head - (ring->tail + 8);
56 if (ring->space < 0) 59 if (ring->space < 0)
57 ring->space += ring->Size; 60 ring->space += ring->Size;
58 if (ring->space >= n) 61 if (ring->space >= n) {
62 trace_i915_ring_wait_end (dev);
59 return 0; 63 return 0;
64 }
60 65
61 if (dev->primary->master) { 66 if (dev->primary->master) {
62 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; 67 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
@@ -76,6 +81,7 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
76 81
77 } 82 }
78 83
84 trace_i915_ring_wait_end (dev);
79 return -EBUSY; 85 return -EBUSY;
80} 86}
81 87