intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/19] drm/i915: Micro-optimise	i915_get_ggtt_vma_pages()
Date: Tue, 07 Feb 2017 17:30:55 +0200	[thread overview]
Message-ID: <87a89yrpao.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170202150248.27860-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> The predominant VMA class is normal GTT, so allow gcc to emphasize that
> path and avoid unnecessary stack movement.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 61 +++++++++++++++++++------------------
>  1 file changed, 32 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index ec360ab939b8..f8cef51cf24c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2615,14 +2615,16 @@ static int ggtt_bind_vma(struct i915_vma *vma,
>  {
>  	struct drm_i915_private *i915 = vma->vm->i915;
>  	struct drm_i915_gem_object *obj = vma->obj;
> -	u32 pte_flags = 0;
> -	int ret;
> +	u32 pte_flags;
>  
> -	ret = i915_get_ggtt_vma_pages(vma);
> -	if (ret)
> -		return ret;
> +	if (unlikely(!vma->pages)) {
> +		int ret = i915_get_ggtt_vma_pages(vma);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	/* Currently applicable only to VLV */
> +	pte_flags = 0;
>  	if (obj->gt_ro)
>  		pte_flags |= PTE_READ_ONLY;
>  
> @@ -2647,18 +2649,18 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma,
>  {
>  	struct drm_i915_private *i915 = vma->vm->i915;
>  	u32 pte_flags;
> -	int ret;
>  
> -	ret = i915_get_ggtt_vma_pages(vma);
> -	if (ret)
> -		return ret;
> +	if (unlikely(!vma->pages)) {
> +		int ret = i915_get_ggtt_vma_pages(vma);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	/* Currently applicable only to VLV */
>  	pte_flags = 0;
>  	if (vma->obj->gt_ro)
>  		pte_flags |= PTE_READ_ONLY;
>  
> -
>  	if (flags & I915_VMA_GLOBAL_BIND) {
>  		intel_runtime_pm_get(i915);
>  		vma->vm->insert_entries(vma->vm,
> @@ -3397,9 +3399,9 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,
>  	return sg;
>  }
>  
> -static struct sg_table *
> -intel_rotate_fb_obj_pages(const struct intel_rotation_info *rot_info,
> -			  struct drm_i915_gem_object *obj)
> +static noinline struct sg_table *
> +intel_rotate_pages(struct intel_rotation_info *rot_info,
> +		   struct drm_i915_gem_object *obj)
>  {
>  	const size_t n_pages = obj->base.size / PAGE_SIZE;
>  	unsigned int size = intel_rotation_info_size(rot_info);
> @@ -3460,7 +3462,7 @@ intel_rotate_fb_obj_pages(const struct intel_rotation_info *rot_info,
>  	return ERR_PTR(ret);
>  }
>  
> -static struct sg_table *
> +static noinline struct sg_table *
>  intel_partial_pages(const struct i915_ggtt_view *view,
>  		    struct drm_i915_gem_object *obj)
>  {
> @@ -3514,7 +3516,7 @@ intel_partial_pages(const struct i915_ggtt_view *view,
>  static int
>  i915_get_ggtt_vma_pages(struct i915_vma *vma)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	/* The vma->pages are only valid within the lifespan of the borrowed
>  	 * obj->mm.pages. When the obj->mm.pages sg_table is regenerated, so
> @@ -3523,32 +3525,33 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
>  	 */
>  	GEM_BUG_ON(!i915_gem_object_has_pinned_pages(vma->obj));
>  
> -	if (vma->pages)
> +	switch (vma->ggtt_view.type) {
> +	case I915_GGTT_VIEW_NORMAL:
> +		vma->pages = vma->obj->mm.pages;
>  		return 0;
>  
> -	if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL)
> -		vma->pages = vma->obj->mm.pages;
> -	else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED)
> +	case I915_GGTT_VIEW_ROTATED:
>  		vma->pages =
> -			intel_rotate_fb_obj_pages(&vma->ggtt_view.rotated,
> -						  vma->obj);
> -	else if (vma->ggtt_view.type == I915_GGTT_VIEW_PARTIAL)
> +			intel_rotate_pages(&vma->ggtt_view.rotated, vma->obj);
> +		break;
> +
> +	case I915_GGTT_VIEW_PARTIAL:
>  		vma->pages = intel_partial_pages(&vma->ggtt_view, vma->obj);
> -	else
> +		break;
> +
> +	default:
>  		WARN_ONCE(1, "GGTT view %u not implemented!\n",
>  			  vma->ggtt_view.type);
> +		return -EINVAL;
> +	}
>  
> -	if (!vma->pages) {
> -		DRM_ERROR("Failed to get pages for GGTT view type %u!\n",
> -			  vma->ggtt_view.type);
> -		ret = -EINVAL;
> -	} else if (IS_ERR(vma->pages)) {
> +	ret = 0;
> +	if (unlikely(IS_ERR(vma->pages))) {
>  		ret = PTR_ERR(vma->pages);
>  		vma->pages = NULL;
>  		DRM_ERROR("Failed to get pages for VMA view type %u (%d)!\n",
>  			  vma->ggtt_view.type, ret);
>  	}
> -
>  	return ret;
>  }
>  
> -- 
> 2.11.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2017-02-07 15:31 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 15:02 [PATCH 01/19] drm/i915: Micro-optimise i915_get_ggtt_vma_pages() Chris Wilson
2017-02-02 15:02 ` [PATCH 02/19] drm/i915: Micro-optimise gen6_ppgtt_insert_entries() Chris Wilson
2017-02-09 11:34   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 03/19] drm/i915: Micro-optimise gen8_ppgtt_insert_entries() Chris Wilson
2017-02-02 15:32   ` Chris Wilson
2017-02-02 15:57     ` Tvrtko Ursulin
2017-02-02 16:10       ` Chris Wilson
2017-02-02 16:39         ` Tvrtko Ursulin
2017-02-02 17:05           ` Chris Wilson
2017-02-02 17:17             ` Tvrtko Ursulin
2017-02-03  8:34               ` Chris Wilson
2017-02-02 15:02 ` [PATCH 04/19] drm/i915: Don't special case teardown of aliasing_ppgtt Chris Wilson
2017-02-06 14:21   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 05/19] drm/i915: Split ggtt/alasing_gtt unbind_vma Chris Wilson
2017-02-06 15:07   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 06/19] drm/i915: Convert clflushed pagetables over to WC maps Chris Wilson
2017-02-09 15:08   ` Mika Kuoppala
2017-02-09 15:11     ` Mika Kuoppala
2017-02-02 15:02 ` [PATCH 07/19] drm/i915: Remove kmap/kunmap wrappers Chris Wilson
2017-02-10 11:25   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 08/19] drm/i915: Remove user-triggerable WARN for large objects Chris Wilson
2017-02-02 15:07   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 09/19] drm/i915: Move allocate_va_range to GTT Chris Wilson
2017-02-07 10:01   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 10/19] drm/i915: Remove redundant clear of appgtt Chris Wilson
2017-02-07 10:06   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 11/19] drm/i915: Tidy gen6_write_pde() Chris Wilson
2017-02-07 10:18   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 12/19] drm/i915: Remove bitmap tracking for used-ptes Chris Wilson
2017-02-06 20:32   ` Michał Winiarski
2017-02-02 15:02 ` [PATCH 13/19] drm/i915: Remove bitmap tracking for used-pdes Chris Wilson
2017-02-08 16:30   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 14/19] drm/i915: Remove bitmap tracking for used-pdpes Chris Wilson
2017-02-08 17:42   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 15/19] drm/i915: Remove bitmap tracking for used-pml4 Chris Wilson
2017-02-08 17:47   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 16/19] drm/i915: Remove superfluous posting reads after clear GGTT Chris Wilson
2017-02-08 17:48   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 17/19] drm/i915: Always mark the PDP as dirty when altered Chris Wilson
2017-02-08 17:53   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 18/19] drm/i915: Remove defunct GTT tracepoints Chris Wilson
2017-02-08 18:01   ` Matthew Auld
2017-02-02 15:02 ` [PATCH 19/19] drm/i915: Remove unused ppgtt->enable() Chris Wilson
2017-02-03 13:04   ` Joonas Lahtinen
2017-02-02 17:54 ` ✓ Fi.CI.BAT: success for series starting with [01/19] drm/i915: Micro-optimise i915_get_ggtt_vma_pages() Patchwork
2017-02-07 15:30 ` Mika Kuoppala [this message]

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=87a89yrpao.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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;
as well as URLs for NNTP newsgroup(s).