Skip to contentSkip to conversation

drm/i915: Remove redundant check in i915_gem_obj_to_vma

PATCH Applied Tvrtko Ursulin 3 participants 4 messages Nov 12, 2015 – Nov 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Remove redundant check in i915_gem_obj_to_vma

From: Tvrtko Ursulin <[email protected]>

No need to verify VMA belongs to GGTT since:

1. The function must return a normal VMA belonging to passed in VM.
2. There can only be one normal VMA for any VM.

---
Maybe now even a candidate for making a static inline?

 drivers/gpu/drm/i915/i915_gem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -4
index d85c63dc36ac..a913387a89cb 100644
@@ -4485,10 +4485,8 @@ struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
 {
 	struct i915_vma *vma;
 	list_for_each_entry(vma, &obj->vma_list, vma_link) {
-		if (i915_is_ggtt(vma->vm) &&
-		    vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL)
-			continue;
-		if (vma->vm == vm)
+		if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL &&
+		    vma->vm == vm)
 			return vma;
 	}
 	return NULL;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 9 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

No need to verify VMA belongs to GGTT since:

1. The function must return a normal VMA belonging to passed in VM.
2. There can only be one normal VMA for any VM.

Reviewed-by Chris Wilson <[email protected]>

Quoted 1 line

Maybe now even a candidate for making a static inline?

No. After tracking vma, i915_gem_obj_to_vma() is moved off the hotpaths and mostly used for the first lookup by an execbuffer, context creation, modesetting and debug code.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Applied
#2 lore raw
Quoted 11 lines · Chris Wilson
Quoted 9 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

No need to verify VMA belongs to GGTT since:

1. The function must return a normal VMA belonging to passed in VM.
2. There can only be one normal VMA for any VM.

Reviewed-by Chris Wilson <[email protected]>

Pushed to drm-intel-next-queued, thanks for the patch and review.

BR,
Jani.

Quoted 7 lines
Quoted 2 lines

Maybe now even a candidate for making a static inline?

No. After tracking vma, i915_gem_obj_to_vma() is moved off the hotpaths and mostly used for the first lookup by an execbuffer, context creation, modesetting and debug code.
-Chris

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Chris Wilson
Quoted 11 lines · Chris Wilson
Quoted 9 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

No need to verify VMA belongs to GGTT since:

1. The function must return a normal VMA belonging to passed in VM.
2. There can only be one normal VMA for any VM.

Reviewed-by Chris Wilson <[email protected]>

Thanks!

Quoted 5 lines
Quoted 1 line

Maybe now even a candidate for making a static inline?

No. After tracking vma, i915_gem_obj_to_vma() is moved off the hotpaths and mostly used for the first lookup by an execbuffer, context creation, modesetting and debug code.

Well I thought I wouldn't harm in the interim, since there are only three callers in total, two of which are performance sensitive, and if inlined code would now probably quite compact.

How is the rewrite coming along then?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx