From 2bd1f6049bd70c202b4704b551b180bdced8f3c0 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 27 Jul 2015 18:06:49 +0100 Subject: drm/i915: Scheduler state dump via debugfs Added a facility for triggering the scheduler state dump via a debugfs entry. v2: New patch in series. v6: Updated to newer nightly (lots of ring -> engine renaming). Updated to use 'to_i915()' instead of dev_private. Converted all enum labels to uppercase. [review feedback from Joonas Lahtinen] For: VIZ-1587 Signed-off-by: John Harrison --- drivers/gpu/drm/i915/i915_debugfs.c | 33 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_scheduler.c | 9 +++++---- drivers/gpu/drm/i915/i915_scheduler.h | 6 ++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 9ac486fd19cc..5328dc17ee60 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1306,6 +1306,38 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_scheduler_file_queue_max_fops, i915_scheduler_file_queue_max_set, "%llu\n"); +static int +i915_scheduler_dump_flags_get(void *data, u64 *val) +{ + struct drm_device *dev = data; + struct drm_i915_private *dev_priv = to_i915(dev); + struct i915_scheduler *scheduler = dev_priv->scheduler; + + *val = scheduler->dump_flags; + + return 0; +} + +static int +i915_scheduler_dump_flags_set(void *data, u64 val) +{ + struct drm_device *dev = data; + struct drm_i915_private *dev_priv = to_i915(dev); + struct i915_scheduler *scheduler = dev_priv->scheduler; + + scheduler->dump_flags = lower_32_bits(val) & I915_SF_DUMP_MASK; + + if (val & 1) + i915_scheduler_dump_all(dev, "DebugFS"); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(i915_scheduler_dump_flags_fops, + i915_scheduler_dump_flags_get, + i915_scheduler_dump_flags_set, + "0x%llx\n"); + static int i915_frequency_info(struct seq_file *m, void *unused) { struct drm_info_node *node = m->private; @@ -5724,6 +5756,7 @@ static const struct i915_debugfs_files { {"i915_scheduler_priority_preempt", &i915_scheduler_priority_preempt_fops}, {"i915_scheduler_min_flying", &i915_scheduler_min_flying_fops}, {"i915_scheduler_file_queue_max", &i915_scheduler_file_queue_max_fops}, + {"i915_scheduler_dump_flags", &i915_scheduler_dump_flags_fops}, {"i915_display_crc_ctl", &i915_display_crc_ctl_fops}, {"i915_pri_wm_latency", &i915_pri_wm_latency_fops}, {"i915_spr_wm_latency", &i915_spr_wm_latency_fops}, diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c index b68611aba39c..acf167986555 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.c +++ b/drivers/gpu/drm/i915/i915_scheduler.c @@ -160,6 +160,10 @@ int i915_scheduler_init(struct drm_device *dev) scheduler->priority_level_preempt = 900; scheduler->min_flying = 2; scheduler->file_queue_max = 64; + scheduler->dump_flags = I915_SF_DUMP_FORCE | + I915_SF_DUMP_DETAILS | + I915_SF_DUMP_SEQNO | + I915_SF_DUMP_DEPENDENCIES; dev_priv->scheduler = scheduler; @@ -1341,10 +1345,7 @@ static int i915_scheduler_dump_all_locked(struct drm_device *dev, int r, ret = 0; for_each_engine(engine, dev_priv) { - scheduler->flags[engine->id] |= I915_SF_DUMP_FORCE | - I915_SF_DUMP_DETAILS | - I915_SF_DUMP_SEQNO | - I915_SF_DUMP_DEPENDENCIES; + scheduler->flags[engine->id] |= scheduler->dump_flags & I915_SF_DUMP_MASK; r = i915_scheduler_dump_locked(engine, msg); if (ret == 0) ret = r; diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h index 783e5af26c23..6549d05c5eb5 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.h +++ b/drivers/gpu/drm/i915/i915_scheduler.h @@ -129,6 +129,7 @@ struct i915_scheduler { int32_t priority_level_preempt; uint32_t min_flying; uint32_t file_queue_max; + uint32_t dump_flags; /* Statistics: */ struct i915_scheduler_stats stats[I915_NUM_ENGINES]; @@ -145,6 +146,11 @@ enum { I915_SF_DUMP_DETAILS = (1 << 9), I915_SF_DUMP_DEPENDENCIES = (1 << 10), I915_SF_DUMP_SEQNO = (1 << 11), + + I915_SF_DUMP_MASK = I915_SF_DUMP_FORCE | + I915_SF_DUMP_DETAILS | + I915_SF_DUMP_DEPENDENCIES | + I915_SF_DUMP_SEQNO, }; const char *i915_scheduler_flag_str(uint32_t flags); -- cgit v1.2.3