public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, miku@iki.fi
Subject: Re: [PATCH] drm/i915: Pass vmas to i915_error_object_create
Date: Mon, 3 Nov 2014 15:31:09 +0100	[thread overview]
Message-ID: <20141103143109.GL26941@phenom.ffwll.local> (raw)
In-Reply-To: <1414769911-13761-1-git-send-email-mika.kuoppala@intel.com>

On Fri, Oct 31, 2014 at 05:38:31PM +0200, Mika Kuoppala wrote:
> to move the interface to the ppgtt era.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c | 49 +++++++++++++++++++----------------
>  1 file changed, 27 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index d17360b..a3e62f00 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -561,16 +561,20 @@ static void i915_error_state_free(struct kref *error_ref)
>  
>  static struct drm_i915_error_object *
>  i915_error_object_create(struct drm_i915_private *dev_priv,
> -			 struct drm_i915_gem_object *src,
> -			 struct i915_address_space *vm)
> +			 struct i915_vma *vma)
>  {
>  	struct drm_i915_error_object *dst;
> -	struct i915_vma *vma = NULL;
> +	struct drm_i915_gem_object *src;
>  	int num_pages;
>  	bool use_ggtt;
>  	int i = 0;
>  	u32 reloc_offset;
>  
> +	if (WARN_ON(vma == NULL))
> +		return NULL;
> +
> +	src = vma->obj;
> +
>  	if (src == NULL || src->pages == NULL)
>  		return NULL;
>  
> @@ -580,23 +584,21 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
>  	if (dst == NULL)
>  		return NULL;
>  
> -	if (i915_gem_obj_bound(src, vm))
> -		dst->gtt_offset = i915_gem_obj_offset(src, vm);
> +	if (i915_gem_obj_bound(src, vma->vm))

If we have a vma, it's bound. At least after execbuf and before retiring
the cmds. So with the above early exit check (vma == NULL) you can remove
this.

> +		dst->gtt_offset = i915_gem_obj_offset(src, vma->vm);

Just look at the vma drm_mm node instead of walking the per-obj vma list
again.

>  	else
>  		dst->gtt_offset = -1;
>  
>  	reloc_offset = dst->gtt_offset;
> -	if (i915_is_ggtt(vm))
> -		vma = i915_gem_obj_to_ggtt(src);
>  	use_ggtt = (src->cache_level == I915_CACHE_NONE &&
> -		   vma && (vma->bound & GLOBAL_BIND) &&
> -		   reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end);
> +		    (vma->bound & GLOBAL_BIND) &&
> +		    reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end);
>  
>  	/* Cannot access stolen address directly, try to use the aperture */
>  	if (src->stolen) {
>  		use_ggtt = true;
>  
> -		if (!(vma && vma->bound & GLOBAL_BIND))
> +		if (!(vma->bound & GLOBAL_BIND))
>  			goto unwind;
>  
>  		reloc_offset = i915_gem_obj_ggtt_offset(src);
> @@ -658,13 +660,16 @@ unwind:
>  	kfree(dst);
>  	return NULL;
>  }
> -#define i915_error_ggtt_object_create(dev_priv, src) \
> -	i915_error_object_create((dev_priv), (src), &(dev_priv)->gtt.base)

I would have left this little helper to cut down on diff size, but that's
really just a bikeshed.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-11-03 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 15:38 [PATCH] drm/i915: Pass vmas to i915_error_object_create Mika Kuoppala
2014-11-03 14:31 ` Daniel Vetter [this message]
2014-11-03 20:55   ` 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=20141103143109.GL26941@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    --cc=miku@iki.fi \
    /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