public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Ben Widawsky <benjamin.widawsky@intel.com>
Subject: Re: [PATCH 8/9] drm/i915: Directly return the vma from bind_to_vm
Date: Tue, 28 Jan 2014 15:21:26 +0200	[thread overview]
Message-ID: <87d2jc44yx.fsf@intel.com> (raw)
In-Reply-To: <1390846259-14915-9-git-send-email-daniel.vetter@ffwll.ch>

On Mon, 27 Jan 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> This is prep work for reworking the object_pin logic. Atm
> it still does a (now redundant) lookup of the vma. The next
> patch will fix this.
>
> Split out from Chris vma-bind rework.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ben Widawsky <benjamin.widawsky@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 680b300d7454..a3534246fbca 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3236,7 +3236,7 @@ static void i915_gem_verify_gtt(struct drm_device *dev)
>  /**
>   * Finds free space in the GTT aperture and binds the object there.
>   */
> -static int
> +static struct i915_vma *
>  i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,
>  			   struct i915_address_space *vm,
>  			   unsigned alignment,
> @@ -3266,7 +3266,7 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,
>  						unfenced_alignment;
>  	if (flags & PIN_MAPPABLE && alignment & (fence_alignment - 1)) {
>  		DRM_ERROR("Invalid object alignment requested %u\n", alignment);
> -		return -EINVAL;
> +		return ERR_PTR(-EINVAL);
>  	}
>  
>  	size = flags & PIN_MAPPABLE ? fence_size : obj->base.size;
> @@ -3279,20 +3279,18 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,
>  			  obj->base.size,
>  			  flags & PIN_MAPPABLE ? "mappable" : "total",
>  			  gtt_max);
> -		return -E2BIG;
> +		return ERR_PTR(-E2BIG);
>  	}
>  
>  	ret = i915_gem_object_get_pages(obj);
>  	if (ret)
> -		return ret;
> +		return ERR_PTR(ret);
>  
>  	i915_gem_object_pin_pages(obj);
>  
>  	vma = i915_gem_obj_lookup_or_create_vma(obj, vm);
> -	if (IS_ERR(vma)) {
> -		ret = PTR_ERR(vma);
> +	if (IS_ERR(vma))
>  		goto err_unpin;
> -	}
>  
>  search_free:
>  	ret = drm_mm_insert_node_in_range_generic(&vm->mm, &vma->node,
> @@ -3336,15 +3334,16 @@ search_free:
>  
>  	trace_i915_vma_bind(vma, flags);
>  	i915_gem_verify_gtt(dev);
> -	return 0;
> +	return vma;
>  
>  err_remove_node:
>  	drm_mm_remove_node(&vma->node);
>  err_free_vma:
>  	i915_gem_vma_destroy(vma);
> +	vma = ERR_PTR(ret);
>  err_unpin:
>  	i915_gem_object_unpin_pages(obj);
> -	return ret;
> +	return vma;
>  }
>  
>  bool
> @@ -3891,10 +3890,10 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
>  	}
>  
>  	if (!i915_gem_obj_bound(obj, vm)) {
> -		ret = i915_gem_object_bind_to_vm(obj, vm, alignment, flags);
> -		if (ret)
> -			return ret;
>  
> +		vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags);
> +		if (IS_ERR(vma))
> +			return PTR_ERR(vma);
>  	}
>  
>  	vma = i915_gem_obj_to_vma(obj, vm);
> -- 
> 1.8.5.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2014-01-28 13:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 18:10 Split-up of "drm/i915: Only bind each object rather than for every execbuffer" Daniel Vetter
2014-01-27 18:10 ` [PATCH 1/9] drm/i915: Consolidate binding parameters into flags Daniel Vetter
2014-01-27 21:47   ` Chris Wilson
2014-01-27 21:55     ` Daniel Vetter
2014-01-27 22:34   ` [PATCH] " Daniel Vetter
2014-01-28 13:09     ` Jani Nikula
2014-01-27 18:10 ` [PATCH 2/9] drm/i915: Don't set PIN_MAPPABLE for legacy ringbuffers Daniel Vetter
2014-01-27 18:10 ` [PATCH 3/9] drm/i915: Don't pin the status page as mappable Daniel Vetter
2014-01-27 18:10 ` [PATCH 4/9] drm/i915: Handle set_cache_level errors in the status page setup Daniel Vetter
2014-01-28 13:11   ` Jani Nikula
2014-01-27 18:10 ` [PATCH 5/9] drm/i915: Don't allocate context pages as mappable Daniel Vetter
2014-01-27 18:10 ` [PATCH 6/9] drm/i915: Allow blocking in the PDE alloc when running low on gtt space Daniel Vetter
2014-01-27 18:10 ` [PATCH 7/9] drm/i915: Simplify i915_gem_object_ggtt_unpin Daniel Vetter
2014-01-28 13:13   ` Jani Nikula
2014-01-28 14:21     ` Chris Wilson
2014-01-27 18:10 ` [PATCH 8/9] drm/i915: Directly return the vma from bind_to_vm Daniel Vetter
2014-01-28 13:21   ` Jani Nikula [this message]
2014-01-27 18:10 ` [PATCH 9/9] drm/i915: Only bind each object rather than for every execbuffer Daniel Vetter
2014-01-27 22:36   ` [PATCH] " Daniel Vetter
2014-01-28 13:29 ` Split-up of "drm/i915: Only bind each object rather than for every execbuffer" Jani Nikula

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=87d2jc44yx.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=benjamin.widawsky@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --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