From: Daniel Vetter <daniel@ffwll.ch>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
Intel GFX <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 03/12] drm/i915: make PDE|PTE platform specific
Date: Mon, 6 May 2013 11:47:42 +0200 [thread overview]
Message-ID: <20130506094742.GB5763@phenom.ffwll.local> (raw)
In-Reply-To: <20130502142617.55bcea6f@jbarnes-desktop>
On Thu, May 02, 2013 at 02:26:17PM -0700, Jesse Barnes wrote:
> On Tue, 23 Apr 2013 23:15:31 -0700
> Ben Widawsky <ben@bwidawsk.net> wrote:
>
> > Accomplish this be removing the PDE count define which is (and has
> > always been) part of the PPGTT structure anyway. With the addition of
> > the gen specific init function, we can nicely tuck away the magic number
> > in there.
> >
> > In this vain, make the PTE define less of a magic number.
>
> vein
>
> >
> > The remaining code in the global gtt setup is a bit messy, but an
> > upcoming patch will clean that one up.
> >
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > ---
> > drivers/gpu/drm/i915/i915_drv.h | 2 --
> > drivers/gpu/drm/i915/i915_gem_gtt.c | 10 +++++-----
> > 2 files changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index d5dcf7f..0a9c7cd 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -431,8 +431,6 @@ struct i915_gtt {
> > };
> > #define gtt_total_entries(gtt) ((gtt).total >> PAGE_SHIFT)
> >
> > -#define I915_PPGTT_PD_ENTRIES 512
> > -#define I915_PPGTT_PT_ENTRIES 1024
> > struct i915_hw_ppgtt {
> > struct drm_device *dev;
> > unsigned num_pd_entries;
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 0503f09..11a50cf 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -29,6 +29,7 @@
> > #include "intel_drv.h"
> >
> > typedef uint32_t gen6_gtt_pte_t;
> > +#define I915_PPGTT_PT_ENTRIES (PAGE_SIZE / sizeof(gen6_gtt_pte_t))
> >
> > /* PPGTT stuff */
> > #define GEN6_GTT_ADDR_ENCODE(addr) ((addr) | (((addr) >> 28) & 0xff0))
> > @@ -235,10 +236,9 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
> > /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024
> > * entries. For aliasing ppgtt support we just steal them at the end for
> > * now. */
> > - first_pd_entry_in_global_pt =
> > - gtt_total_entries(dev_priv->gtt) - I915_PPGTT_PD_ENTRIES;
> > + first_pd_entry_in_global_pt = gtt_total_entries(dev_priv->gtt) - 512;
> >
> > - ppgtt->num_pd_entries = I915_PPGTT_PD_ENTRIES;
> > + ppgtt->num_pd_entries = 512;
> > ppgtt->enable = gen6_ppgtt_enable;
> > ppgtt->clear_range = gen6_ppgtt_clear_range;
> > ppgtt->insert_entries = gen6_ppgtt_insert_entries;
> > @@ -646,7 +646,7 @@ void i915_gem_init_global_gtt(struct drm_device *dev)
> > if (INTEL_INFO(dev)->gen <= 7) {
> > /* PPGTT pdes are stolen from global gtt ptes, so shrink the
> > * aperture accordingly when using aliasing ppgtt. */
> > - gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE;
> > + gtt_size -= 512 * PAGE_SIZE;
> > }
> >
> > i915_gem_setup_global_gtt(dev, 0, mappable_size, gtt_size);
> > @@ -657,7 +657,7 @@ void i915_gem_init_global_gtt(struct drm_device *dev)
> >
> > DRM_ERROR("Aliased PPGTT setup failed %d\n", ret);
> > drm_mm_takedown(&dev_priv->mm.gtt_space);
> > - gtt_size += I915_PPGTT_PD_ENTRIES*PAGE_SIZE;
> > + gtt_size += 512 * PAGE_SIZE;
> > }
> > i915_gem_setup_global_gtt(dev, 0, mappable_size, gtt_size);
> > }
>
> I thought we could have 1024 PDEs? Either way, this just drops the
> macro, which is fine, unless we want to increase our PDE count.
>
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
I've written this code, so I know what the magic 512 is all about. But
since Jesse is already confused about them I don't like removing the
#define that much. Heck, we even tend to use PAGE_SIZE instead of 4096.
What about a GEN6_ prefix instead? Or if you want to make this dynamic
(iirc we can allocated PDEs in groups of 32) call it _MAX or so?
I like the PT entries part though.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-05-06 9:44 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 6:15 [PATCH 00/12] [RFC] PPGTT prep patches part 1 Ben Widawsky
2013-04-24 6:15 ` [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup Ben Widawsky
2013-05-02 20:27 ` Jesse Barnes
2013-05-06 9:40 ` Daniel Vetter
2013-05-06 9:44 ` Daniel Vetter
2013-05-06 17:59 ` Ben Widawsky
2013-05-06 18:35 ` Daniel Vetter
2013-04-24 6:15 ` [PATCH 02/12] drm/i915: BUG_ON bad PPGTT offset Ben Widawsky
2013-05-02 20:28 ` Jesse Barnes
2013-05-06 9:48 ` Daniel Vetter
2013-05-06 18:03 ` Ben Widawsky
2013-05-06 18:37 ` Daniel Vetter
2013-05-08 16:48 ` Ben Widawsky
2013-05-08 17:55 ` Daniel Vetter
2013-04-24 6:15 ` [PATCH 03/12] drm/i915: make PDE|PTE platform specific Ben Widawsky
2013-05-02 21:26 ` Jesse Barnes
2013-05-02 22:49 ` Ben Widawsky
2013-05-02 22:55 ` Jesse Barnes
2013-05-06 9:47 ` Daniel Vetter [this message]
2013-05-08 16:49 ` Ben Widawsky
2013-05-08 17:52 ` Daniel Vetter
2013-04-24 6:15 ` [PATCH 04/12] drm/i915: Extract PDE writes Ben Widawsky
2013-05-02 21:27 ` Jesse Barnes
2013-05-06 9:50 ` Daniel Vetter
2013-04-24 6:15 ` [PATCH 05/12] drm: Optionally create mm blocks from top-to-bottom Ben Widawsky
2013-04-24 6:15 ` [PATCH 06/12] drm/i915: Use drm_mm for PPGTT PDEs Ben Widawsky
2013-05-02 21:42 ` Jesse Barnes
2013-04-24 6:15 ` [PATCH 07/12] drm/i915: Use PDEs as the guard page Ben Widawsky
2013-04-24 6:15 ` [PATCH 08/12] drm/i915: Update context_fini Ben Widawsky
2013-04-24 15:11 ` Mika Kuoppala
2013-04-25 4:11 ` Ben Widawsky
2013-04-25 5:17 ` Ben Widawsky
2013-04-25 15:01 ` Mika Kuoppala
2013-04-25 17:22 ` Ben Widawsky
2013-04-24 6:15 ` [PATCH 09/12] drm/i915: Split context enabling from init Ben Widawsky
2013-04-24 10:04 ` Chris Wilson
2013-04-24 16:39 ` Ben Widawsky
2013-04-24 6:15 ` [PATCH 10/12] drm/i915: destroy i915_gem_init_global_gtt Ben Widawsky
2013-04-24 6:15 ` [PATCH 11/12] drm/i915: Embed PPGTT into the context Ben Widawsky
2013-04-24 6:15 ` [PATCH 12/12] drm/i915: No contexts without ppgtt Ben Widawsky
2013-04-24 10:06 ` Chris Wilson
2013-04-24 16:39 ` Ben Widawsky
2013-04-24 9:53 ` [PATCH 00/12] [RFC] PPGTT prep patches part 1 Chris Wilson
2013-04-24 19:58 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130506094742.GB5763@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=ben@bwidawsk.net \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox