All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/3] drm/i915: Stop putting GGTT VMA at the head of the list
Date: Wed,  3 Dec 2014 14:59:24 +0000	[thread overview]
Message-ID: <1417618766-14845-2-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <1417618766-14845-1-git-send-email-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Multiple GGTT VMAs per object will be introduced in the near future which will
make it impossible to guarantee normal GGTT view is at the head of the list.

Purpose of this patch is to break this assumption straight away so any
potential hidden assumptions in the code base can be bisected to this
simple patch.

For: VIZ-4544
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem.c     | 10 ++++++----
 drivers/gpu/drm/i915/i915_gem_gtt.c |  8 ++------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9d362d3..c1c1141 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5303,11 +5303,13 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
 
 struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj)
 {
+	struct i915_address_space *ggtt = i915_obj_to_ggtt(obj);
 	struct i915_vma *vma;
 
-	vma = list_first_entry(&obj->vma_list, typeof(*vma), vma_link);
-	if (vma->vm != i915_obj_to_ggtt(obj))
-		return NULL;
+	list_for_each_entry(vma, &obj->vma_list, vma_link) {
+		if (vma->vm == ggtt)
+			return vma;
+	}
 
-	return vma;
+	return NULL;
 }
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 171f6ea..ac03a38 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2202,13 +2202,9 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj,
 		BUG();
 	}
 
-	/* Keep GGTT vmas first to make debug easier */
-	if (i915_is_ggtt(vm))
-		list_add(&vma->vma_link, &obj->vma_list);
-	else {
-		list_add_tail(&vma->vma_link, &obj->vma_list);
+	list_add_tail(&vma->vma_link, &obj->vma_list);
+	if (!i915_is_ggtt(vm))
 		i915_ppgtt_get(i915_vm_to_ppgtt(vm));
-	}
 
 	return vma;
 }
-- 
2.1.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-12-03 19:24 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 14:59 [PATCH 0/3] Multiple GGTT views Tvrtko Ursulin
2014-12-03 14:59 ` Tvrtko Ursulin [this message]
2014-12-04  9:48   ` [PATCH 1/3] drm/i915: Stop putting GGTT VMA at the head of the list Chris Wilson
2014-12-04 10:02     ` Tvrtko Ursulin
2014-12-04 10:17       ` Chris Wilson
2014-12-04 10:30         ` Tvrtko Ursulin
2014-12-04 10:39           ` Chris Wilson
2014-12-04 10:48             ` Tvrtko Ursulin
2014-12-04 10:54     ` Daniel Vetter
2014-12-03 14:59 ` [PATCH 2/3] drm/i915: Infrastructure for supporting different GGTT views per object Tvrtko Ursulin
2014-12-04  9:53   ` Chris Wilson
2014-12-04 10:19     ` Tvrtko Ursulin
2014-12-04 10:26       ` Chris Wilson
2014-12-04 10:59         ` Daniel Vetter
2014-12-04 12:17           ` Tvrtko Ursulin
2014-12-04 12:27             ` Chris Wilson
2014-12-04 13:01             ` Daniel Vetter
2014-12-03 14:59 ` [PATCH 3/3] drm/i915: Documentation for multiple GGTT views Tvrtko Ursulin
2014-12-04  7:12   ` shuang.he
2014-12-05 12:11 ` [PATCH v2 0/2] Multiple " Tvrtko Ursulin
2014-12-05 12:11   ` [PATCH 1/2] drm/i915: Infrastructure for supporting different GGTT views per object Tvrtko Ursulin
2014-12-05 14:25     ` Daniel Vetter
2014-12-09 15:23     ` Michel Thierry
2014-12-10  9:16       ` Daniel Vetter
2014-12-10 10:17         ` Tvrtko Ursulin
2014-12-05 12:11   ` [PATCH 2/2] drm/i915: Documentation for multiple GGTT views Tvrtko Ursulin
2014-12-09 15:41     ` Michel Thierry
2014-12-10 17:27 ` [PATCH v3 0/2] Multiple " Tvrtko Ursulin
2014-12-10 17:27   ` [PATCH 1/2] drm/i915: Infrastructure for supporting different GGTT views per object Tvrtko Ursulin
2014-12-11 10:18     ` Michel Thierry
2014-12-15 10:24     ` Daniel Vetter
2014-12-15 11:23       ` Tvrtko Ursulin
2014-12-10 17:27   ` [PATCH 2/2] drm/i915: Documentation for multiple GGTT views Tvrtko Ursulin
2014-12-11  3:41     ` shuang.he
2014-12-11 10:19     ` Michel Thierry
2014-12-15  8:30       ` Daniel Vetter
2014-12-15 10:01         ` Michel Thierry

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=1417618766-14845-2-git-send-email-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.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 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.