From patchwork Sat May 10 03:59:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 4146381 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 526899F23C for ; Sat, 10 May 2014 04:02:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DCE5201E7 for ; Sat, 10 May 2014 04:02:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D9F2C201F7 for ; Sat, 10 May 2014 04:02:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62E7D6F09C; Fri, 9 May 2014 21:02:16 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.bwidawsk.net (bwidawsk.net [166.78.191.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E8BD6F094 for ; Fri, 9 May 2014 21:02:15 -0700 (PDT) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id 67D605808F; Fri, 9 May 2014 21:02:14 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from ironside.intel.com (c-24-21-100-90.hsd1.or.comcast.net [24.21.100.90]) by mail.bwidawsk.net (Postfix) with ESMTPSA id 45CE858094; Fri, 9 May 2014 21:00:24 -0700 (PDT) From: Ben Widawsky To: Intel GFX Date: Fri, 9 May 2014 20:59:35 -0700 Message-Id: <1399694391-3935-41-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1399694391-3935-1-git-send-email-benjamin.widawsky@intel.com> References: <1399694391-3935-1-git-send-email-benjamin.widawsky@intel.com> Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH 40/56] drm/i915/bdw: Add ppgtt info for dynamic pages X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_debugfs.c | 59 +++++++++++++++++++++++++++---------- drivers/gpu/drm/i915/i915_gem_gtt.c | 32 ++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 9 ++++++ 3 files changed, 85 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 40aca7f..c29c71a 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1826,11 +1826,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) @@ -1873,7 +1902,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_ring_buffer *ring; - struct drm_file *file; int i; if (INTEL_INFO(dev)->gen == 6) @@ -1897,18 +1925,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; - struct i915_hw_ppgtt *pvt_ppgtt; - - pvt_ppgtt = ctx_to_ppgtt(file_priv->private_default_ctx); - seq_printf(m, "\nproc: %s\n", - get_pid_task(file->pid, PIDTYPE_PID)->comm); - print_ppgtt(m, pvt_ppgtt, "Default context"); - 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) @@ -1917,6 +1933,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) @@ -1928,6 +1945,18 @@ 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; + + pvt_ppgtt = ctx_to_ppgtt(file_priv->private_default_ctx); + seq_printf(m, "\nproc: %s\n", + get_pid_task(file->pid, PIDTYPE_PID)->comm); + print_ppgtt(m, pvt_ppgtt, "Default context"); + 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 2b732ca..d8bb4dc 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1993,6 +1993,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 bce4124..b3d0776 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.h +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h @@ -469,6 +469,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,