All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/i915: Pin fence for iomap
Date: Tue, 4 Jul 2017 10:53:53 +0100	[thread overview]
Message-ID: <aacf4c36-49f0-32be-5ec0-6fa4e56f47d1@linux.intel.com> (raw)
In-Reply-To: <20170703101412.30820-1-chris@chris-wilson.co.uk>


On 03/07/2017 11:14, Chris Wilson wrote:
> We probably want for the caller to specify whether the fence should be
> pinned for their usage, but at the moment all callers do want the
> associated fence, or none, so take it on their behalf.
Wouldn't this be wasting fences for ring buffers?

Regards,

Tvrtko

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/i915_vma.c                  | 19 +++++++++++++++++++
>   drivers/gpu/drm/i915/i915_vma.h                  |  7 +------
>   drivers/gpu/drm/i915/selftests/i915_gem_object.c |  8 --------
>   3 files changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 958be0a95960..d7330d3eeab6 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -278,6 +278,7 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
>   void __iomem *i915_vma_pin_iomap(struct i915_vma *vma)
>   {
>   	void __iomem *ptr;
> +	int ret;
>   
>   	/* Access through the GTT requires the device to be awake. */
>   	assert_rpm_wakelock_held(vma->vm->i915);
> @@ -301,9 +302,27 @@ void __iomem *i915_vma_pin_iomap(struct i915_vma *vma)
>   	}
>   
>   	__i915_vma_pin(vma);
> +
> +	ret = i915_vma_get_fence(vma);
> +	if (ret) {
> +		__i915_vma_unpin(vma);
> +		return IO_ERR_PTR(ret);
> +	}
> +	i915_vma_pin_fence(vma);
> +
>   	return ptr;
>   }
>   
> +void i915_vma_unpin_iomap(struct i915_vma *vma)
> +{
> +	lockdep_assert_held(&vma->obj->base.dev->struct_mutex);
> +
> +	GEM_BUG_ON(vma->iomap == NULL);
> +
> +	i915_vma_unpin_fence(vma);
> +	i915_vma_unpin(vma);
> +}
> +
>   void i915_vma_unpin_and_release(struct i915_vma **p_vma)
>   {
>   	struct i915_vma *vma;
> diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
> index 4a673fc1a432..15e86e50a825 100644
> --- a/drivers/gpu/drm/i915/i915_vma.h
> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -319,12 +319,7 @@ void __iomem *i915_vma_pin_iomap(struct i915_vma *vma);
>    * Callers must hold the struct_mutex. This function is only valid to be
>    * called on a VMA previously iomapped by the caller with i915_vma_pin_iomap().
>    */
> -static inline void i915_vma_unpin_iomap(struct i915_vma *vma)
> -{
> -	lockdep_assert_held(&vma->obj->base.dev->struct_mutex);
> -	GEM_BUG_ON(vma->iomap == NULL);
> -	i915_vma_unpin(vma);
> -}
> +void i915_vma_unpin_iomap(struct i915_vma *vma);
>   
>   static inline struct page *i915_vma_first_page(struct i915_vma *vma)
>   {
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> index 8f011c447e41..1b8774a42e48 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> @@ -251,14 +251,6 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj,
>   			return PTR_ERR(io);
>   		}
>   
> -		err = i915_vma_get_fence(vma);
> -		if (err) {
> -			pr_err("Failed to get fence for partial view: offset=%lu\n",
> -			       page);
> -			i915_vma_unpin_iomap(vma);
> -			return err;
> -		}
> -
>   		iowrite32(page, io + n * PAGE_SIZE/sizeof(*io));
>   		i915_vma_unpin_iomap(vma);
>   
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-07-04  9:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 10:14 [PATCH 1/4] drm/i915: Pin fence for iomap Chris Wilson
2017-07-03 10:14 ` [PATCH 2/4] drm/i915: Consolidate get_fence with pin_fence Chris Wilson
2017-07-04 14:47   ` Tvrtko Ursulin
2017-07-03 10:14 ` [PATCH 3/4] drm/i915: Emit pipelined fence changes Chris Wilson
2017-07-05 10:19   ` Tvrtko Ursulin
2017-07-06 11:35     ` Chris Wilson
2017-07-03 10:14 ` [PATCH 4/4] drm/i915: Make fence->pin_count atomic to allow unlocked unpinning Chris Wilson
2017-07-03 11:09 ` ✓ Fi.CI.BAT: success for series starting with [1/4] drm/i915: Pin fence for iomap Patchwork
2017-07-04  9:53 ` Tvrtko Ursulin [this message]
2017-07-04 10:04   ` [PATCH 1/4] " Chris Wilson
2017-07-04 11:19     ` Tvrtko Ursulin
2017-07-04 11:25       ` 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=aacf4c36-49f0-32be-5ec0-6fa4e56f47d1@linux.intel.com \
    --to=tvrtko.ursulin@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.