[Intel-gfx] [PATCH 58/68] drm/i915/bdw: Add ppgtt info for dynamic pages
Ben Widawsky
benjamin.widawsky at intel.com
Fri Aug 22 05:12:21 CEST 2014
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
drivers/gpu/drm/i915/i915_debugfs.c | 52 ++++++++++++++++++++++++++++---------
drivers/gpu/drm/i915/i915_gem_gtt.c | 33 +++++++++++++++++++++++
drivers/gpu/drm/i915/i915_gem_gtt.h | 9 +++++++
3 files changed, 82 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 09a64e6..1322718 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1825,10 +1825,38 @@ 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)
{
- 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));
+ struct drm_device *dev = ppgtt->base.dev;
+
+ 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)
@@ -1876,7 +1904,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)
@@ -1901,15 +1928,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)
@@ -1918,6 +1936,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)
@@ -1929,6 +1948,15 @@ 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;
+
+ 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 679fe0d..43df3ee 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2151,6 +2151,39 @@ 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)
+{
+ struct drm_device *dev = ppgtt->base.dev;
+ 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 95b5d16..9d90995 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -508,6 +508,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,
--
2.0.4
More information about the Intel-gfx
mailing list