Skip to contentSkip to conversation

drm/i915: restore ggtt double-bind avoidance

PATCH In review Daniel Vetter 3 participants 3 messages May 6, 2015 – May 7, 2015

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

PATCH 1/1 drm/i915: restore ggtt double-bind avoidance

This was accidentally lost in

commit 75d04a3773ecee617847de963ae4195d6aa74c28

Author: Mika Kuoppala <[email protected]>
Date:   Tue Apr 28 17:56:17 2015 +0300

drm/i915/gtt: Allocate va range only if vma is not bound

While at it implement an improved version suggested by Chris which avoids the double-bind irrespective of what type of bind is done first.

Cc Chris Wilson <[email protected]>
Cc Michel Thierry <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +3 -0
index 8fee6789fae2..11a3b511ae64 100644
@@ -1928,6 +1928,9 @@ static int ggtt_bind_vma(struct i915_vma *vma,
 					    cache_level, pte_flags);
 	}
 
+	if (!dev_priv->mm.aliasing_ppgtt)
+		vma->bound |= GLOBAL_BIND | LOCAL_BIND;
+
 	return 0;
 }
 
Signature · 6 lines
2.1.0

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

This was accidentally lost in

commit 75d04a3773ecee617847de963ae4195d6aa74c28

Author: Mika Kuoppala <[email protected]>
Date:   Tue Apr 28 17:56:17 2015 +0300

drm/i915/gtt: Allocate va range only if vma is not bound

While at it implement an improved version suggested by Chris which avoids the double-bind irrespective of what type of bind is done first.

Cc Chris Wilson <[email protected]>
Cc Michel Thierry <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 8fee6789fae2..11a3b511ae64 100644

drivers/gpu/drm/i915/i915_gem_gtt.c static int ggtt_bind_vma(struct i915_vma *vma, · line 1935

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +3 -0
@@ -1928,6 +1928,9 @@ static int ggtt_bind_vma(struct i915_vma *vma,
 					    cache_level, pte_flags);
 	}
 
+	if (!dev_priv->mm.aliasing_ppgtt)
+		vma->bound |= GLOBAL_BIND | LOCAL_BIND;
+
 	return 0;
 }

Meh, it wasn't quite what I had in mind. If we do it there, we may as well go whole hog and do the vma->bound manipulation for both ggtt and ppgtt in the bind_vma()

Something like:

ickle@crystalwell:/usr/src/linux$ vim drivers/gpu/drm/i915/i915_gem_gtt.c 
ickle@crystalwell:/usr/src/linux$ git diff
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
index 698a30b..59114af 100644
@@ -148,7 +148,7 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int
 
 static int ppgtt_bind_vma(struct i915_vma *vma,
                          enum i915_cache_level cache_level,
-                         u32 unused)
+                         u32 bind_flags)
 {
        u32 pte_flags = 0;
 
@@ -159,6 +159,7 @@ static int ppgtt_bind_vma(struct i915_vma *vma,
        vma->vm->insert_entries(vma->vm, vma->obj->pages, vma->node.start,
                                cache_level, pte_flags);
 
+       vma->bound |= bind_flags;
        return 0;
 }
 
@@ -1956,6 +1957,7 @@ static int ggtt_bind_vma(struct i915_vma *vma,
                vma->vm->insert_entries(vma->vm, pages,

:

drivers/gpu/drm/i915/i915_gem_gtt.c +5 -7
index 698a30b..59114af 100644
@@ -148,7 +148,7 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
 
 static int ppgtt_bind_vma(struct i915_vma *vma,
                          enum i915_cache_level cache_level,
-                         u32 unused)
+                         u32 bind_flags)
 {
        u32 pte_flags = 0;
 
@@ -159,6 +159,7 @@ static int ppgtt_bind_vma(struct i915_vma *vma,
        vma->vm->insert_entries(vma->vm, vma->obj->pages, vma->node.start,
                                cache_level, pte_flags);
 
+       vma->bound |= bind_flags;
        return 0;
 }
 
@@ -1956,6 +1957,7 @@ static int ggtt_bind_vma(struct i915_vma *vma,
                vma->vm->insert_entries(vma->vm, pages,
                                        vma->node.start,
                                        cache_level, pte_flags);
+               flags |= GLOBAL_BIND;
        }
 
        if (dev_priv->mm.aliasing_ppgtt && flags & LOCAL_BIND) {
@@ -1965,6 +1967,7 @@ static int ggtt_bind_vma(struct i915_vma *vma,
                                            cache_level, pte_flags);
        }
 
+       vma->bound |= flags;
        return 0;
 }
 
@@ -2945,10 +2948,5 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
        }
 
        trace_i915_vma_bind(vma, bind_flags);
-       ret = vma->vm->bind_vma(vma, cache_level, bind_flags);
-       if (ret)
-               return ret;
-
-       vma->bound |= bind_flags;
-       return 0;
+       return vma->vm->bind_vma(vma, cache_level, bind_flags);
 }
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter

Task id: 6333 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  276/276              276/276
ILK                                  302/302              302/302
SNB                                  316/316              316/316
IVB                                  342/342              342/342
BYT                                  286/286              286/286
BDW                                  321/321              321/321

-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx