drm/i915: Convert the register access tracepoint to be conditional
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 19 Jul 2013 19:36:56 +0000 (20:36 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 25 Jul 2013 13:22:07 +0000 (15:22 +0200)
The TRACE_EVENT_CONDITION is supposed to generate more efficient code
than if (cond) trace(), which is what we are currently using inside the
register access functions.

v2: Rebase onto uncore

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_trace.h
drivers/gpu/drm/i915/intel_uncore.c

index 0e904986f3e93ed96064a8d42895a28059e6cada..ed72fe08217c7ce62ae0f7d7642c7d6661dfb5f7 100644 (file)
@@ -1004,7 +1004,7 @@ static int gen6_drpc_info(struct seq_file *m)
        }
 
        gt_core_status = readl(dev_priv->regs + GEN6_GT_CORE_STATUS);
-       trace_i915_reg_rw(false, GEN6_GT_CORE_STATUS, gt_core_status, 4);
+       trace_i915_reg_rw(false, GEN6_GT_CORE_STATUS, gt_core_status, 4, true);
 
        rpmodectl1 = I915_READ(GEN6_RP_CONTROL);
        rcctl1 = I915_READ(GEN6_RC_CONTROL);
index 7d283b5fcbf93125989aeafc588a0b43634dfa34..2933e2ffeaa4f53f372c0e1661f5f8bd23df146e 100644 (file)
@@ -406,10 +406,12 @@ TRACE_EVENT(i915_flip_complete,
            TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
 );
 
-TRACE_EVENT(i915_reg_rw,
-       TP_PROTO(bool write, u32 reg, u64 val, int len),
+TRACE_EVENT_CONDITION(i915_reg_rw,
+       TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace),
 
-       TP_ARGS(write, reg, val, len),
+       TP_ARGS(write, reg, val, len, trace),
+
+       TP_CONDITION(trace),
 
        TP_STRUCT__entry(
                __field(u64, val)
index 89bb9da377fc24ab788a190d97aa89b08f677379..8f5bc869c02373402ce5c3d03197137adaee75e8 100644 (file)
@@ -359,7 +359,7 @@ u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg, bool trace) { \
                val = __raw_i915_read##x(dev_priv, reg); \
        } \
        spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); \
-       if (trace) trace_i915_reg_rw(false, reg, val, sizeof(val)); \
+       trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
        return val; \
 }
 
@@ -373,7 +373,7 @@ __i915_read(64)
 void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val, bool trace) { \
        unsigned long irqflags; \
        u32 __fifo_ret = 0; \
-       if (trace) trace_i915_reg_rw(true, reg, val, sizeof(val)); \
+       trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
        spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); \
        if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
                __fifo_ret = __gen6_gt_wait_for_fifo(dev_priv); \