summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <benjamin.widawsky@intel.com>2014-03-08 14:16:35 -0800
committerBen Widawsky <benjamin.widawsky@intel.com>2014-06-20 16:13:58 -0700
commitd437c5999b1f73836bb6e8b908f4d1ffec4b859b (patch)
tree5053a87c22e4a76ea7473a27d18c30fa209061b6
parentfb95318b6ca86dfd20a40a48f4928cdfabe9f1b2 (diff)
drm/i915: Split out verbose PPGTT dumping
There often is not enough memory to dump the full contents of the PPGTT. As a temporary bandage, to continue getting valuable basic PPGTT info, wrap the dangerous, memory hungry part inside of a new verbose version of the debugfs file. Also while here we can split out the PPGTT print function so it's more reusable. I'd really like to get PPGTT info into our error state, but I found it too difficult to make work in the limited time I have. Maybe Mika can find a way. v2: Get the info for the non-default contexts. Merge a patch from Chris into this patch (Chris). All credit goes to him. References: 20140320115742.GA4463@nuc-i3427.alporthouse.com Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 6b7b32baefb1..ae89527573de 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1858,22 +1858,13 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
return 0;
}
-static int per_file_ctx(int id, void *ptr, void *data)
+static void print_ppgtt(struct seq_file *m, struct i915_hw_ppgtt *ppgtt, const char *name)
{
- struct intel_context *ctx = ptr;
- struct seq_file *m = data;
- struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(ctx);
-
- if (i915_gem_context_is_default(ctx))
- seq_puts(m, " default context:\n");
- else
- seq_printf(m, " context %d:\n", ctx->id);
- ppgtt->debug_dump(ppgtt, m);
-
- return 0;
+ seq_printf(m, "%s:\n", name);
+ seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd_offset);
}
-static void gen8_ppgtt_info(struct seq_file *m, struct drm_device *dev)
+static void gen8_ppgtt_info(struct seq_file *m, struct drm_device *dev, int verbose)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_engine_cs *ring;
@@ -1897,7 +1888,21 @@ static void gen8_ppgtt_info(struct seq_file *m, struct drm_device *dev)
}
}
-static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev)
+static int per_file_ctx(int id, void *ptr, void *data)
+{
+ struct intel_context *ctx = ptr;
+ struct seq_file *m = data;
+ bool verbose = (unsigned long)data & 1;
+ struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(ctx);
+
+ print_ppgtt(m, ppgtt, i915_gem_context_is_default(ctx) ? "Default context" : "User context");
+ if (verbose)
+ ppgtt->debug_dump(ppgtt, m);
+
+ return 0;
+}
+
+static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev, bool verbose)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_engine_cs *ring;
@@ -1918,10 +1923,9 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev)
if (dev_priv->mm.aliasing_ppgtt) {
struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
- seq_puts(m, "aliasing PPGTT:\n");
- seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd_offset);
-
- ppgtt->debug_dump(ppgtt, m);
+ print_ppgtt(m, ppgtt, "Aliasing PPGTT");
+ if (verbose)
+ ppgtt->debug_dump(ppgtt, m);
} else
return;
@@ -1930,7 +1934,8 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev)
seq_printf(m, "proc: %s\n",
get_pid_task(file->pid, PIDTYPE_PID)->comm);
- idr_for_each(&file_priv->context_idr, per_file_ctx, m);
+ idr_for_each(&file_priv->context_idr, per_file_ctx,
+ (void *)((unsigned long)m | verbose));
}
seq_printf(m, "ECOCHK: 0x%08x\n", I915_READ(GAM_ECOCHK));
}
@@ -1940,6 +1945,7 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
+ bool verbose = node->info_ent->data ? true : false;
int ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
@@ -1947,9 +1953,9 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
intel_runtime_pm_get(dev_priv);
if (INTEL_INFO(dev)->gen >= 8)
- gen8_ppgtt_info(m, dev);
+ gen8_ppgtt_info(m, dev, verbose);
else if (INTEL_INFO(dev)->gen >= 6)
- gen6_ppgtt_info(m, dev);
+ gen6_ppgtt_info(m, dev, verbose);
intel_runtime_pm_put(dev_priv);
mutex_unlock(&dev->struct_mutex);
@@ -3830,6 +3836,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
{"i915_gen6_forcewake_count", i915_gen6_forcewake_count_info, 0},
{"i915_swizzle_info", i915_swizzle_info, 0},
{"i915_ppgtt_info", i915_ppgtt_info, 0},
+ {"i915_ppgtt_verbose_info", i915_ppgtt_info, 0, (void *)1},
{"i915_llc", i915_llc, 0},
{"i915_edp_psr_status", i915_edp_psr_status, 0},
{"i915_sink_crc_eDP1", i915_sink_crc, 0},