From patchwork Fri Aug 22 03:12:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 4761101 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43925C0338 for ; Fri, 22 Aug 2014 03:14:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4FFCF20173 for ; Fri, 22 Aug 2014 03:14:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 68A4E20155 for ; Fri, 22 Aug 2014 03:14:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0C836E889; Thu, 21 Aug 2014 20:14:11 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id D28C26E87C for ; Thu, 21 Aug 2014 20:13:54 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 21 Aug 2014 20:13:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="375576152" Received: from unknown (HELO ironside.intel.com) ([10.255.12.192]) by FMSMGA003.fm.intel.com with ESMTP; 21 Aug 2014 20:10:00 -0700 From: Ben Widawsky To: Intel GFX Date: Thu, 21 Aug 2014 20:12:21 -0700 Message-Id: <1408677155-1840-59-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1408677155-1840-1-git-send-email-benjamin.widawsky@intel.com> References: <1408677155-1840-1-git-send-email-benjamin.widawsky@intel.com> Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH 58/68] 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-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ben Widawsky --- 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,