From patchwork Thu Jul 11 23:57:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2826686 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 B2B57C0AB2 for ; Thu, 11 Jul 2013 23:54:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEBF420189 for ; Thu, 11 Jul 2013 23:54:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BEA5E20119 for ; Thu, 11 Jul 2013 23:54:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 81766E66C1 for ; Thu, 11 Jul 2013 16:54:21 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 90C28E5EBB for ; Thu, 11 Jul 2013 16:54:11 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 99) id CA22B8864E; Thu, 11 Jul 2013 23:54:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bwidawsk.net (unknown [192.102.209.254]) by shiva.localdomain (Postfix) with ESMTPSA id DF4EE88167; Thu, 11 Jul 2013 23:54:09 +0000 (UTC) Date: Thu, 11 Jul 2013 16:57:30 -0700 From: Ben Widawsky To: Imre Deak Message-ID: <20130711235730.GA1535@bwidawsk.net> References: <1373350122-5118-1-git-send-email-ben@bwidawsk.net> <1373350122-5118-2-git-send-email-ben@bwidawsk.net> <1373541246.12949.4.camel@intelbox> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1373541246.12949.4.camel@intelbox> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Intel GFX Subject: Re: [Intel-gfx] [PATCH 01/11] drm/i915: Move gtt and ppgtt under address space umbrella X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jul 11, 2013 at 02:14:06PM +0300, Imre Deak wrote: > On Mon, 2013-07-08 at 23:08 -0700, Ben Widawsky wrote: > > The GTT and PPGTT can be thought of more generally as GPU address > > spaces. Many of their actions (insert entries), state (LRU lists) and > > many of their characteristics (size), can be shared. Do that. > > > > The change itself doesn't actually impact most of the VMA/VM rework > > coming up, it just fits in with the grand scheme. GGTT will usually be a > > special case where we either know an object must be in the GGTT (dislay > > engine, workarounds, etc.). > > > > v2: Drop usage of i915_gtt_vm (Daniel) > > Make cleanup also part of the parent class (Ben) > > Modified commit msg > > Rebased > > > > Signed-off-by: Ben Widawsky > > --- > > drivers/gpu/drm/i915/i915_debugfs.c | 4 +- > > drivers/gpu/drm/i915/i915_dma.c | 4 +- > > drivers/gpu/drm/i915/i915_drv.h | 57 ++++++------- > > drivers/gpu/drm/i915/i915_gem.c | 4 +- > > drivers/gpu/drm/i915/i915_gem_gtt.c | 162 ++++++++++++++++++++---------------- > > 5 files changed, 121 insertions(+), 110 deletions(-) > > > >[...] > > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c > > index 242d0f9..693115a 100644 > > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > > @@ -102,7 +102,7 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr, > > > > static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt) > > { > > - struct drm_i915_private *dev_priv = ppgtt->dev->dev_private; > > + struct drm_i915_private *dev_priv = ppgtt->base.dev->dev_private; > > gen6_gtt_pte_t __iomem *pd_addr; > > uint32_t pd_entry; > > int i; > > @@ -181,18 +181,18 @@ static int gen6_ppgtt_enable(struct drm_device *dev) > > } > > > > /* PPGTT support for Sandybdrige/Gen6 and later */ > > -static void gen6_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt, > > +static void gen6_ppgtt_clear_range(struct i915_address_space *vm, > > unsigned first_entry, > > unsigned num_entries) > > { > > - struct drm_i915_private *dev_priv = ppgtt->dev->dev_private; > > + struct i915_hw_ppgtt *ppgtt = > > + container_of(vm, struct i915_hw_ppgtt, base); > > gen6_gtt_pte_t *pt_vaddr, scratch_pte; > > unsigned act_pt = first_entry / I915_PPGTT_PT_ENTRIES; > > unsigned first_pte = first_entry % I915_PPGTT_PT_ENTRIES; > > unsigned last_pte, i; > > > > - scratch_pte = ppgtt->pte_encode(dev_priv->gtt.scratch.addr, > > - I915_CACHE_LLC); > > + scratch_pte = vm->pte_encode(vm->scratch.addr, I915_CACHE_LLC); > > I only see ggtt's scratch page being initialized, but can't find the > corresponding init/teardown for ppgtt. Btw, why do we need separate > global/per-process scratch pages? (would be nice to add it to the commit > message) > > --Imre > There is indeed a bug here, it existed somewhere, so I've mistakenly dropped it. Here is my local fix, which is what I had done previously. Not sure what you mean, there should be only 1 scratch page now. diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 552e4cb..c8130db 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -295,6 +295,7 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt) ppgtt->base.clear_range = gen6_ppgtt_clear_range; ppgtt->base.bind_object = gen6_ppgtt_bind_object; ppgtt->base.cleanup = gen6_ppgtt_cleanup; + ppgtt->base.scratch = dev_priv->gtt.base.scratch; ppgtt->pt_pages = kzalloc(sizeof(struct page *)*ppgtt->num_pd_entries, GFP_KERNEL); if (!ppgtt->pt_pages)