From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 17/17] drm/i915: Move i915_get_ggtt_vma_pages into ggtt_bind_vma
Date: Tue, 21 Apr 2015 16:36:55 +0300 [thread overview]
Message-ID: <87zj61zjpk.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <1429025727-15380-18-git-send-email-daniel.vetter@ffwll.ch>
Daniel Vetter <daniel.vetter@ffwll.ch> writes:
> We have this neat abstraction between ppgtt and ggtt for (un)bind_vma
> and didn't end up using it really. What a shame, so fix this and make
> the ->bind_vma hook a bit more useful.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This one I had problems with applying. But it looks simple enough.
Patches 13-17,
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
With 12/17 I don't yet understand all the implications so I left
that out.
-Mika
> ---
> drivers/gpu/drm/i915/i915_gem_gtt.c | 41 ++++++++++++++++++++++---------------
> drivers/gpu/drm/i915/i915_gem_gtt.h | 6 +++---
> 2 files changed, 27 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 458819b99a0b..763c17dd2118 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -92,6 +92,9 @@
> *
> */
>
> +static int
> +i915_get_ggtt_vma_pages(struct i915_vma *vma);
> +
> const struct i915_ggtt_view i915_ggtt_view_normal;
> const struct i915_ggtt_view i915_ggtt_view_rotated = {
> .type = I915_GGTT_VIEW_ROTATED
> @@ -143,9 +146,9 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
> return has_aliasing_ppgtt ? 1 : 0;
> }
>
> -static void ppgtt_bind_vma(struct i915_vma *vma,
> - enum i915_cache_level cache_level,
> - u32 unused)
> +static int ppgtt_bind_vma(struct i915_vma *vma,
> + enum i915_cache_level cache_level,
> + u32 unused)
> {
> u32 pte_flags = 0;
>
> @@ -155,6 +158,8 @@ static void ppgtt_bind_vma(struct i915_vma *vma,
>
> vma->vm->insert_entries(vma->vm, vma->obj->pages, vma->node.start,
> cache_level, pte_flags);
> +
> + return 0;
> }
>
> static void ppgtt_unbind_vma(struct i915_vma *vma)
> @@ -1898,22 +1903,26 @@ static void i915_ggtt_clear_range(struct i915_address_space *vm,
> intel_gtt_clear_range(first_entry, num_entries);
> }
>
> -static void ggtt_bind_vma(struct i915_vma *vma,
> - enum i915_cache_level cache_level,
> - u32 flags)
> +static int ggtt_bind_vma(struct i915_vma *vma,
> + enum i915_cache_level cache_level,
> + u32 flags)
> {
> struct drm_device *dev = vma->vm->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_i915_gem_object *obj = vma->obj;
> struct sg_table *pages = obj->pages;
> u32 pte_flags = 0;
> + int ret;
> +
> + ret = i915_get_ggtt_vma_pages(vma);
> + if (ret)
> + return ret;
> + pages = vma->ggtt_view.pages;
>
> /* Currently applicable only to VLV */
> if (obj->gt_ro)
> pte_flags |= PTE_READ_ONLY;
>
> - if (i915_is_ggtt(vma->vm))
> - pages = vma->ggtt_view.pages;
>
> if (!dev_priv->mm.aliasing_ppgtt || flags & GLOBAL_BIND) {
> vma->vm->insert_entries(vma->vm, pages,
> @@ -1929,6 +1938,8 @@ static void ggtt_bind_vma(struct i915_vma *vma,
> vma->node.start,
> cache_level, pte_flags);
> }
> +
> + return 0;
> }
>
> static void ggtt_unbind_vma(struct i915_vma *vma)
> @@ -2749,7 +2760,7 @@ err_st_alloc:
> return ERR_PTR(ret);
> }
>
> -static inline int
> +static int
> i915_get_ggtt_vma_pages(struct i915_vma *vma)
> {
> int ret = 0;
> @@ -2793,8 +2804,8 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
> int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> u32 flags)
> {
> + int ret = 0;
> u32 bind_flags = 0;
> - int ret;
>
> if (vma->vm->allocate_va_range) {
> trace_i915_va_alloc(vma->vm, vma->node.start,
> @@ -2808,12 +2819,6 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> return ret;
> }
>
> - if (i915_is_ggtt(vma->vm)) {
> - ret = i915_get_ggtt_vma_pages(vma);
> - if (ret)
> - return 0;
> - }
> -
> if (flags & PIN_GLOBAL)
> bind_flags |= GLOBAL_BIND;
> if (flags & PIN_EXECBUF)
> @@ -2825,7 +2830,9 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> bind_flags &= ~vma->bound;
>
> if (bind_flags)
> - vma->vm->bind_vma(vma, cache_level, bind_flags);
> + ret = vma->vm->bind_vma(vma, cache_level, bind_flags);
> + if (ret)
> + return ret;
>
> vma->bound |= bind_flags;
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index fb0a04aa5363..4e6cac575cd8 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -278,9 +278,9 @@ struct i915_address_space {
> * setting the valid PTE entries to a reserved scratch page. */
> void (*unbind_vma)(struct i915_vma *vma);
> /* Map an object into an address space with the given cache flags. */
> - void (*bind_vma)(struct i915_vma *vma,
> - enum i915_cache_level cache_level,
> - u32 flags);
> + int (*bind_vma)(struct i915_vma *vma,
> + enum i915_cache_level cache_level,
> + u32 flags);
> };
>
> /* The Graphics Translation Table is the way in which GEN hardware translates a
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-04-21 13:37 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 15:35 [PATCH 00/17] i915_gem_gtt.c polish Daniel Vetter
2015-04-14 15:35 ` [PATCH 01/17] drm/i915: Move gen8 clear_range vfunc setup into common code Daniel Vetter
2015-04-17 14:11 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 02/17] drm/i915: Move vma vfuns to adddress_space Daniel Vetter
2015-04-14 16:09 ` Chris Wilson
2015-04-14 16:12 ` Chris Wilson
2015-04-14 17:08 ` Daniel Vetter
2015-04-14 17:23 ` Chris Wilson
2015-04-16 6:18 ` Mika Kuoppala
2015-04-16 7:39 ` Chris Wilson
2015-04-17 14:15 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 03/17] drm/i915: Clean up aliasing ppgtt correctly on error paths Daniel Vetter
2015-04-17 14:34 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 04/17] drm/i915: Unify aliasing ppgtt handling Daniel Vetter
2015-04-17 13:36 ` Mika Kuoppala
2015-04-17 16:21 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 05/17] drm/i915: Move PTE_READ_ONLY to ->pte_encode vfunc Daniel Vetter
2015-04-17 16:22 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 06/17] drm/i915: Dont clear PIN_GLOBAL in the execbuf pinning fallback Daniel Vetter
2015-04-14 15:53 ` Chris Wilson
2015-04-14 16:33 ` Chris Wilson
2015-04-14 17:01 ` [PATCH] " Daniel Vetter
2015-04-15 21:50 ` shuang.he
2015-04-14 15:35 ` [PATCH 07/17] drm/i915: Drop redundant GGTT rebinding Daniel Vetter
2015-04-14 16:03 ` Chris Wilson
2015-04-14 15:35 ` [PATCH 08/17] drm/i915: Don't look at pg_dirty_rings for aliasing ppgtt Daniel Vetter
2015-04-14 16:06 ` Chris Wilson
2015-04-14 17:11 ` Daniel Vetter
2015-04-14 17:53 ` Chris Wilson
2015-04-15 10:44 ` Daniel Vetter
2015-04-17 13:49 ` Mika Kuoppala
2015-04-20 16:02 ` Daniel Vetter
2015-04-20 16:08 ` Daniel Vetter
2015-04-21 8:18 ` Mika Kuoppala
2015-04-23 15:43 ` Chris Wilson
2015-04-23 18:56 ` Daniel Vetter
2015-04-23 19:52 ` Chris Wilson
2015-04-23 21:52 ` Chris Wilson
2015-07-31 16:26 ` Chris Wilson
2015-07-31 17:38 ` Chris Wilson
2015-04-14 15:35 ` [PATCH 09/17] drm/i915: Don't use atomics for pg_dirty_rings Daniel Vetter
2015-04-17 16:39 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 10/17] drm/i915: Remove misleading comment around bind_to_vm Daniel Vetter
2015-04-17 18:09 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 11/17] drm/i915: Fix up the vma aliasing ppgtt binding Daniel Vetter
2015-04-15 10:47 ` Chris Wilson
2015-04-16 8:01 ` Daniel Vetter
2015-04-16 8:07 ` Chris Wilson
2015-04-16 8:57 ` Daniel Vetter
2015-04-20 16:04 ` [PATCH] " Daniel Vetter
2015-04-21 13:29 ` Mika Kuoppala
2015-04-24 11:14 ` Chris Wilson
2015-04-24 11:55 ` Chris Wilson
2015-05-04 8:49 ` Daniel Vetter
2015-05-04 9:06 ` Chris Wilson
2015-05-04 9:20 ` Daniel Vetter
2015-04-14 15:35 ` [PATCH 12/17] drm/i915: Arm cmd parser with aliasng ppgtt only Daniel Vetter
2015-04-14 18:10 ` Chris Wilson
2015-04-15 9:43 ` Daniel Vetter
2015-04-15 10:07 ` Chris Wilson
2015-04-15 10:28 ` Daniel Vetter
2015-04-30 10:37 ` Jani Nikula
2015-04-24 12:57 ` Mika Kuoppala
2015-05-04 8:54 ` [PATCH] drm/i915: Simplify cmd-parser DISPATCH_SECURE check Daniel Vetter
2015-05-04 9:23 ` Daniel Vetter
2015-05-04 12:52 ` shuang.he
2015-04-14 15:35 ` [PATCH 13/17] drm/i915: move i915_gem_restore_gtt_mappings around Daniel Vetter
2015-04-14 15:35 ` [PATCH 14/17] drm/i915: Move ppgtt_bind/unbind around Daniel Vetter
2015-04-14 15:35 ` [PATCH 15/17] drm/i915: Unduplicate i915_ggtt_unbind/bind_vma Daniel Vetter
2015-04-14 15:35 ` [PATCH 16/17] drm/i915: Don't try to outsmart gcc in i915_gem_gtt.c Daniel Vetter
2015-04-14 15:35 ` [PATCH 17/17] drm/i915: Move i915_get_ggtt_vma_pages into ggtt_bind_vma Daniel Vetter
2015-04-21 13:36 ` Mika Kuoppala [this message]
2015-04-23 19:08 ` Daniel Vetter
2015-04-15 10:49 ` [PATCH 00/17] i915_gem_gtt.c polish 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=87zj61zjpk.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--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