From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v3 1/4] drm/i915: Do not make assumptions on GGTT VMA sizes
Date: Wed, 06 May 2015 13:23:08 +0100 [thread overview]
Message-ID: <554A07AC.1070103@linux.intel.com> (raw)
In-Reply-To: <1430912038.9311.3.camel@jlahtine-mobl1>
On 05/06/2015 12:33 PM, Joonas Lahtinen wrote:
> GGTT VMA sizes might be smaller than the whole object size due to
> different GGTT views.
>
> v2:
> - Separate GGTT view constraint calculations from normal view
> constraint calculations (Chris Wilson)
> v3:
> - Do not bother with debug wording. (Tvrtko Ursulin)
> v4:
> - Clearer logic for calculating map_and_fenceable (Tvrtko Ursulin)
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 74 +++++++++++++++++++++++++------------
> drivers/gpu/drm/i915/i915_gem_gtt.c | 23 ++++++++++++
> drivers/gpu/drm/i915/i915_gem_gtt.h | 4 ++
> 3 files changed, 77 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index c378f04..473e947 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3498,7 +3498,8 @@ static bool i915_gem_valid_gtt_space(struct i915_vma *vma,
> }
>
> /**
> - * Finds free space in the GTT aperture and binds the object there.
> + * Finds free space in the GTT aperture and binds the object or a view of it
> + * there.
> */
> static struct i915_vma *
> i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,
> @@ -3517,36 +3518,60 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,
> struct i915_vma *vma;
> int ret;
>
> - if(WARN_ON(i915_is_ggtt(vm) != !!ggtt_view))
> - return ERR_PTR(-EINVAL);
> + if (i915_is_ggtt(vm)) {
> + u32 view_size;
> +
> + if (WARN_ON(!ggtt_view))
> + return ERR_PTR(-EINVAL);
>
> - fence_size = i915_gem_get_gtt_size(dev,
> - obj->base.size,
> - obj->tiling_mode);
> - fence_alignment = i915_gem_get_gtt_alignment(dev,
> - obj->base.size,
> - obj->tiling_mode, true);
> - unfenced_alignment =
> - i915_gem_get_gtt_alignment(dev,
> - obj->base.size,
> - obj->tiling_mode, false);
> + view_size = i915_ggtt_view_size(obj, ggtt_view);
> +
> + fence_size = i915_gem_get_gtt_size(dev,
> + view_size,
> + obj->tiling_mode);
> + fence_alignment = i915_gem_get_gtt_alignment(dev,
> + view_size,
> + obj->tiling_mode,
> + true);
> + unfenced_alignment = i915_gem_get_gtt_alignment(dev,
> + view_size,
> + obj->tiling_mode,
> + false);
> + size = flags & PIN_MAPPABLE ? fence_size : view_size;
> + } else {
> + fence_size = i915_gem_get_gtt_size(dev,
> + obj->base.size,
> + obj->tiling_mode);
> + fence_alignment = i915_gem_get_gtt_alignment(dev,
> + obj->base.size,
> + obj->tiling_mode,
> + true);
> + unfenced_alignment =
> + i915_gem_get_gtt_alignment(dev,
> + obj->base.size,
> + obj->tiling_mode,
> + false);
> + size = flags & PIN_MAPPABLE ? fence_size : obj->base.size;
> + }
I don't like this duplication, but apparently Chris wants it like this
and plans to change it all shortly AFAIR. In the view of that:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-05-06 12:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 11:18 [PATCH v2 0/5] Partial GGTT views Joonas Lahtinen
2015-05-06 11:33 ` [PATCH v3 1/4] drm/i915: Do not make assumptions on GGTT VMA sizes Joonas Lahtinen
2015-05-06 12:23 ` Tvrtko Ursulin [this message]
2015-05-06 11:34 ` [PATCH v3 2/4] drm/i915: Consider object pinned if any VMA is pinned Joonas Lahtinen
2015-05-06 12:44 ` Tvrtko Ursulin
2015-05-06 11:35 ` [PATCH v3 3/4] drm/i915: Add a partial GGTT view type Joonas Lahtinen
2015-05-06 12:24 ` Tvrtko Ursulin
2015-05-07 16:17 ` Daniel Vetter
2015-06-09 8:56 ` Chris Wilson
2015-06-10 10:38 ` Joonas Lahtinen
2015-06-10 10:56 ` Chris Wilson
2015-05-06 11:36 ` [PATCH v3 4/4] drm/i915: Use partial view in mmap fault handler Joonas Lahtinen
2015-05-06 12:33 ` Tvrtko Ursulin
2015-05-07 11:27 ` shuang.he
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=554A07AC.1070103@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
/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