public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 3/4] drm/i915: Introduce i915_vm_to_ggtt()
Date: Mon, 18 Apr 2016 16:37:12 +0300	[thread overview]
Message-ID: <1460986632.6027.20.camel@linux.intel.com> (raw)
In-Reply-To: <1460978042-9953-3-git-send-email-chris@chris-wilson.co.uk>

On ma, 2016-04-18 at 12:14 +0100, Chris Wilson wrote:
> In a couple of places, we have an i915_address_space that we know is
> really an i915_ggtt that we want to use. Create an inline helper to
> convert from the i915_address_space subclass into its container.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Comment below.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 9f165feb54ae..b3af2e808b49 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -93,6 +93,13 @@
>   *
>   */
>  
> +static inline struct i915_ggtt *
> +i915_vm_to_ggtt(struct i915_address_space *vm)
> +{
> +	GEM_BUG_ON(!i915_is_ggtt(vm));
> +	return container_of(vm, struct i915_ggtt, base);
> +}
> +
>  static int
>  i915_get_ggtt_vma_pages(struct i915_vma *vma);
>  
> @@ -2359,7 +2366,7 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm,
>  				     enum i915_cache_level level, u32 unused)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(vm->dev);
> -	struct i915_ggtt *ggtt = &dev_priv->ggtt;
> +	struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);

I do not see this as a very necessary change, because we are going to
have only one Global XYZ per device by definiton of "global".

Especially after the rename it's going to be;

struct i915_ggtt *ggtt = &i915->ggtt;

But regardless my R-b.

Regards, Joonas

>  	unsigned first_entry = start >> PAGE_SHIFT;
>  	gen8_pte_t __iomem *gtt_entries =
>  		(gen8_pte_t __iomem *)ggtt->gsm + first_entry;
> @@ -2437,7 +2444,7 @@ static void gen6_ggtt_insert_entries(struct i915_address_space *vm,
>  				     enum i915_cache_level level, u32 flags)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(vm->dev);
> -	struct i915_ggtt *ggtt = &dev_priv->ggtt;
> +	struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);
>  	unsigned first_entry = start >> PAGE_SHIFT;
>  	gen6_pte_t __iomem *gtt_entries =
>  		(gen6_pte_t __iomem *)ggtt->gsm + first_entry;
> @@ -2481,7 +2488,7 @@ static void gen8_ggtt_clear_range(struct i915_address_space *vm,
>  				  bool use_scratch)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(vm->dev);
> -	struct i915_ggtt *ggtt = &dev_priv->ggtt;
> +	struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);
>  	unsigned first_entry = start >> PAGE_SHIFT;
>  	unsigned num_entries = length >> PAGE_SHIFT;
>  	gen8_pte_t scratch_pte, __iomem *gtt_base =
> @@ -2513,7 +2520,7 @@ static void gen6_ggtt_clear_range(struct i915_address_space *vm,
>  				  bool use_scratch)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(vm->dev);
> -	struct i915_ggtt *ggtt = &dev_priv->ggtt;
> +	struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);
>  	unsigned first_entry = start >> PAGE_SHIFT;
>  	unsigned num_entries = length >> PAGE_SHIFT;
>  	gen6_pte_t scratch_pte, __iomem *gtt_base =
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-04-18 13:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 11:13 [PATCH v2 1/4] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Chris Wilson
2016-04-18 11:14 ` [PATCH v2 2/4] io-mapping: Specify mapping size for io_mapping_map_wc() Chris Wilson
2016-04-19 12:02   ` Chris Wilson
2016-04-19 12:30     ` Luis R. Rodriguez
2016-04-19 12:34       ` Chris Wilson
     [not found]       ` <1461069238-31539-1-git-send-email-chris@chris-wilson.co.uk>
     [not found]         ` <1461069238-31539-4-git-send-email-chris@chris-wilson.co.uk>
2016-04-20  9:10           ` [PATCH 4/4] drm/i915: Move ioremap_wc tracking onto VMA Luis R. Rodriguez
2016-04-20  9:38             ` Chris Wilson
2016-04-20 11:17             ` [Intel-gfx] " Daniel Vetter
     [not found]               ` <20160420111730.GL2510-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-04-20 21:27                 ` Luis R. Rodriguez
2016-04-21  7:27                   ` Daniel Vetter
2016-04-18 11:14 ` [PATCH v2 3/4] drm/i915: Introduce i915_vm_to_ggtt() Chris Wilson
2016-04-18 12:01   ` Tvrtko Ursulin
2016-04-18 13:37   ` Joonas Lahtinen [this message]
2016-04-18 14:02     ` Chris Wilson
2016-04-18 11:14 ` [PATCH v2 4/4] drm/i915: Move ioremap_wc tracking onto VMA Chris Wilson
2016-04-18 11:56   ` Chris Wilson
2016-04-18 12:08     ` Tvrtko Ursulin
2016-04-18 14:54       ` [PATCH] " Chris Wilson
2016-04-18 15:08         ` Tvrtko Ursulin
2016-04-18 15:22           ` Chris Wilson
2016-04-18 15:27             ` Tvrtko Ursulin
2016-04-19 11:06               ` Chris Wilson
2016-04-19 12:19                 ` Tvrtko Ursulin
2016-04-19 17:33                 ` kbuild test robot
2016-04-18 15:20         ` kbuild test robot
2016-04-18 12:03   ` [PATCH v2 4/4] " Tvrtko Ursulin
2016-04-18 13:26 ` ✗ Fi.CI.BAT: warning for series starting with [v2,1/4] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Patchwork
2016-04-18 15:29 ` ✗ Fi.CI.BAT: warning for series starting with [v2,1/4] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr (rev2) Patchwork
2016-04-19 11:57 ` ✗ Fi.CI.BAT: failure for series starting with [v2,1/4] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr (rev3) Patchwork

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=1460986632.6027.20.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.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