summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <benjamin.widawsky@intel.com>2014-04-01 19:15:21 -0700
committerBen Widawsky <benjamin.widawsky@intel.com>2014-06-20 17:04:58 -0700
commitabf4e134a177694976848b9c4e80039694146299 (patch)
tree96f56dadeced739d28297ef6ceb1d80ac93416b6
parentb4d193495701d94ce0c21401164819b48571b56a (diff)
drm/i915/bdw: Add ppgtt info for dynamic pages
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c54
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c32
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.h9
3 files changed, 83 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index cc71aff9efce..35b0214b3080 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1872,11 +1872,40 @@ static size_t gen6_ppgtt_count_pt_pages(struct i915_hw_ppgtt *ppgtt)
return cnt;
}
+static void gen8_ppgtt_debugfs_counter(struct i915_pagedirpo *pdp,
+ struct i915_pagedir *pd,
+ struct i915_pagetab *pt,
+ unsigned pdpe,
+ unsigned pde,
+ void *data)
+{
+ if (!pd || !pt)
+ return;
+
+ (*(size_t *)data)++;
+}
+
+static size_t gen8_ppgtt_count_pt_pages(struct i915_hw_ppgtt *ppgtt)
+{
+ size_t count = 0;
+
+ gen8_for_every_pdpe_pde(ppgtt, gen8_ppgtt_debugfs_counter, &count);
+
+ return count;
+}
+
static void print_ppgtt(struct seq_file *m, struct i915_hw_ppgtt *ppgtt, const char *name)
{
+ struct drm_device *dev = ppgtt->base.dev;
+
seq_printf(m, "%s:\n", name);
- seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd.pd_offset);
- seq_printf(m, "\tpd pages: %zu\n", gen6_ppgtt_count_pt_pages(ppgtt));
+
+ if (INTEL_INFO(dev)->gen < 8) {
+ seq_printf(m, "\tpd pages: %zu\n", gen6_ppgtt_count_pt_pages(ppgtt));
+ seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd.pd_offset);
+ } else {
+ seq_printf(m, "\tpage table overhead: %zu pages\n", gen8_ppgtt_count_pt_pages(ppgtt));
+ }
}
static void gen8_ppgtt_info(struct seq_file *m, struct drm_device *dev, int verbose)
@@ -1919,7 +1948,6 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev, bool ver
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_engine_cs *ring;
- struct drm_file *file;
int i;
if (INTEL_INFO(dev)->gen == 6)
@@ -1943,15 +1971,6 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev, bool ver
ppgtt->debug_dump(ppgtt, m);
} else
return;
-
- list_for_each_entry_reverse(file, &dev->filelist, lhead) {
- struct drm_i915_file_private *file_priv = file->driver_priv;
-
- seq_printf(m, "proc: %s\n",
- get_pid_task(file->pid, PIDTYPE_PID)->comm);
- idr_for_each(&file_priv->context_idr, per_file_ctx,
- (void *)((unsigned long)m | verbose));
- }
}
static int i915_ppgtt_info(struct seq_file *m, void *data)
@@ -1960,6 +1979,7 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
bool verbose = node->info_ent->data ? true : false;
+ struct drm_file *file;
int ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
@@ -1971,6 +1991,16 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
else if (INTEL_INFO(dev)->gen >= 6)
gen6_ppgtt_info(m, dev, verbose);
+ list_for_each_entry_reverse(file, &dev->filelist, lhead) {
+ struct drm_i915_file_private *file_priv = file->driver_priv;
+ struct i915_hw_ppgtt *pvt_ppgtt;
+
+ seq_printf(m, "\nproc: %s\n",
+ get_pid_task(file->pid, PIDTYPE_PID)->comm);
+ idr_for_each(&file_priv->context_idr, per_file_ctx,
+ (void *)((unsigned long)m | verbose));
+ }
+
intel_runtime_pm_put(dev_priv);
mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 22bf9c2f5d55..65900926de3f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2005,6 +2005,38 @@ static void gen8_ggtt_clear_range(struct i915_address_space *vm,
readl(gtt_base);
}
+void gen8_for_every_pdpe_pde(struct i915_hw_ppgtt *ppgtt,
+ void (*callback)(struct i915_pagedirpo *pdp,
+ struct i915_pagedir *pd,
+ struct i915_pagetab *pt,
+ unsigned pdpe,
+ unsigned pde,
+ void *data),
+ void *data)
+{
+ uint64_t start = ppgtt->base.start;
+ uint64_t length = ppgtt->base.total;
+ uint64_t pdpe, pde, temp;
+
+ struct i915_pagedir *pd;
+ struct i915_pagetab *pt;
+
+ gen8_for_each_pdpe(pd, &ppgtt->pdp, start, length, temp, pdpe) {
+ uint64_t pd_start = start, pd_length = length;
+ int i;
+
+ if (pd == NULL) {
+ for (i = 0; i < I915_PDES_PER_PD; i++)
+ callback(&ppgtt->pdp, NULL, NULL, pdpe, i, data);
+ continue;
+ }
+
+ gen8_for_each_pde(pt, pd, pd_start, pd_length, temp, pde) {
+ callback(&ppgtt->pdp, pd, pt, pdpe, pde, data);
+ }
+ }
+}
+
static void gen6_ggtt_clear_range(struct i915_address_space *vm,
uint64_t start,
uint64_t length,
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 64204fb4b92a..5d4bd3e83eec 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -470,6 +470,15 @@ static inline size_t gen8_pde_count(uint64_t addr, uint64_t length)
return i915_pde_count(addr, length, GEN8_PDE_SHIFT);
}
+void gen8_for_every_pdpe_pde(struct i915_hw_ppgtt *ppgtt,
+ void (*callback)(struct i915_pagedirpo *pdp,
+ struct i915_pagedir *pd,
+ struct i915_pagetab *pt,
+ unsigned pdpe,
+ unsigned pde,
+ void *data),
+ void *data);
+
int i915_gem_gtt_init(struct drm_device *dev);
void i915_gem_init_global_gtt(struct drm_device *dev);
void i915_gem_setup_global_gtt(struct drm_device *dev, unsigned long start,