diff mbox

[RFC,41/44] drm/i915: Added validation callback to trace points

Message ID 1403803475-16337-42-git-send-email-John.C.Harrison@Intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

John Harrison June 26, 2014, 5:24 p.m. UTC
From: John Harrison <John.C.Harrison@Intel.com>

The validation tests require hooks into the GPU scheduler to allow them to
analyse what the scheduler is doing internally.
---
 drivers/gpu/drm/i915/i915_scheduler.c |    4 ++++
 drivers/gpu/drm/i915/i915_scheduler.h |   16 ++++++++++++++++
 drivers/gpu/drm/i915/i915_trace.h     |   16 ++++++++++++++++
 3 files changed, 36 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
index 0eb6a31..8d45b73 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.c
+++ b/drivers/gpu/drm/i915/i915_scheduler.c
@@ -26,6 +26,10 @@ 
 #include "intel_drv.h"
 #include "i915_scheduler.h"
 
+i915_scheduler_validation_callback_type
+				i915_scheduler_validation_callback = NULL;
+EXPORT_SYMBOL(i915_scheduler_validation_callback);
+
 bool i915_scheduler_is_enabled(struct drm_device *dev)
 {
 #ifdef CONFIG_DRM_I915_SCHEDULER
diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h
index f86b687..2f8c566 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.h
+++ b/drivers/gpu/drm/i915/i915_scheduler.h
@@ -196,4 +196,20 @@  void i915_scheduler_file_queue_dec(struct drm_file *file);
 
 int i915_gem_do_execbuffer_final(struct i915_execbuffer_params *params);
 
+/* A callback mechanism to allow validation tests to hook into the internal
+ * state of the scheduler. */
+enum i915_scheduler_validation_op {
+	i915_scheduler_validation_op_state_change	= 1,
+	i915_scheduler_validation_op_queue,
+	i915_scheduler_validation_op_dispatch,
+	i915_scheduler_validation_op_complete,
+};
+typedef int (*i915_scheduler_validation_callback_type)
+	(enum i915_scheduler_validation_op op,
+	 struct intel_engine_cs *ring,
+	 uint32_t seqno,
+	 struct i915_scheduler_queue_entry *node);
+extern i915_scheduler_validation_callback_type
+				i915_scheduler_validation_callback;
+
 #endif  /* _I915_SCHEDULER_H_ */
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index 40b1c6f..2029d8b 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -369,6 +369,10 @@  TRACE_EVENT(i915_gem_ring_dispatch,
 			   __entry->seqno = seqno;
 			   __entry->flags = flags;
 			   i915_trace_irq_get(ring, seqno);
+			   if (i915_scheduler_validation_callback)
+				i915_scheduler_validation_callback(
+				      i915_scheduler_validation_op_dispatch,
+				      ring, seqno, NULL);
 			   ),
 
 	    TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
@@ -660,6 +664,10 @@  TRACE_EVENT(i915_scheduler_landing,
 			   __entry->ring   = ring->id;
 			   __entry->seqno  = seqno;
 			   __entry->status = node ? node->status : ~0U;
+			   if (i915_scheduler_validation_callback)
+				i915_scheduler_validation_callback(
+				      i915_scheduler_validation_op_complete,
+				      ring, seqno, node);
 			   ),
 
 	    TP_printk("ring=%d, seqno=%d, status=%d",
@@ -740,6 +748,10 @@  TRACE_EVENT(i915_scheduler_node_state_change,
 			   __entry->ring   = ring->id;
 			   __entry->seqno  = node->params.seqno;
 			   __entry->status = node->status;
+			   if (i915_scheduler_validation_callback)
+				i915_scheduler_validation_callback(
+				      i915_scheduler_validation_op_state_change,
+				      ring, node->params.seqno, node);
 			   ),
 
 	    TP_printk("ring=%d, seqno=%d, status=%d",
@@ -789,6 +801,10 @@  TRACE_EVENT(i915_gem_ring_queue,
 	    TP_fast_assign(
 			   __entry->ring   = ring->id;
 			   __entry->seqno  = node->params.seqno;
+			   if (i915_scheduler_validation_callback)
+				i915_scheduler_validation_callback(
+				      i915_scheduler_validation_op_queue,
+				      ring, node->params.seqno, node);
 			   ),
 
 	    TP_printk("ring=%d, seqno=%d", __entry->ring, __entry->seqno)