Skip to contentSkip to conversation

drm/i915: Move has_aliasing_ppgtt_mapping setup into PPGTT funcs

PATCH In review [email protected] 3 participants 4 messages Mar 7, 2013

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

PATCH 1/1 drm/i915: Move has_aliasing_ppgtt_mapping setup into PPGTT funcs

From: Ville Syrjälä <[email protected]>

Set has_aliasing_ppgtt_mapping from i915_ppgtt_{bind,unbind}_object(). This matches what we're doing for has_global_gtt_mapping.

---
 drivers/gpu/drm/i915/i915_gem.c            | 4 +---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +----
 drivers/gpu/drm/i915/i915_gem_gtt.c        | 4 ++++
 3 files changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -3
index 1417fc6..4695937 100644
@@ -2491,10 +2491,8 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
 
 	if (obj->has_global_gtt_mapping)
 		i915_gem_gtt_unbind_object(obj);
-	if (obj->has_aliasing_ppgtt_mapping) {
+	if (obj->has_aliasing_ppgtt_mapping)
 		i915_ppgtt_unbind_object(dev_priv->mm.aliasing_ppgtt, obj);
-		obj->has_aliasing_ppgtt_mapping = 0;
-	}
 	i915_gem_gtt_finish_object(obj);
 
 	list_del(&obj->mm_list);
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -4
index 934396c..5fb272a 100644
@@ -430,13 +430,10 @@ i915_gem_execbuffer_reserve_object(struct drm_i915_gem_object *obj,
 	}
 
 	/* Ensure ppgtt mapping exists if needed */
-	if (dev_priv->mm.aliasing_ppgtt && !obj->has_aliasing_ppgtt_mapping) {
+	if (dev_priv->mm.aliasing_ppgtt && !obj->has_aliasing_ppgtt_mapping)
 		i915_ppgtt_bind_object(dev_priv->mm.aliasing_ppgtt,
 				       obj, obj->cache_level);
 
-		obj->has_aliasing_ppgtt_mapping = 1;
-	}
-
 	if (entry->offset != obj->gtt_offset) {
 		entry->offset = obj->gtt_offset;
 		*need_reloc = true;
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -0
index 926a1e2..ee5ccac 100644
@@ -284,6 +284,8 @@ void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt,
 	ppgtt->insert_entries(ppgtt, obj->pages,
 			      obj->gtt_space->start >> PAGE_SHIFT,
 			      cache_level);
+
+	obj->has_aliasing_ppgtt_mapping = 1;
 }
 
 void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt,
@@ -292,6 +294,8 @@ void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt,
 	ppgtt->clear_range(ppgtt,
 			   obj->gtt_space->start >> PAGE_SHIFT,
 			   obj->base.size >> PAGE_SHIFT);
+
+	obj->has_aliasing_ppgtt_mapping = 0;
 }
 
 void i915_gem_init_ppgtt(struct drm_device *dev)
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · On Thu, Mar 7, 2013 at 12:31 PM, <[email protected]> wrote:

From: Ville Syrjälä <[email protected]>

Set has_aliasing_ppgtt_mapping from i915_ppgtt_{bind,unbind}_object(). This matches what we're doing for has_global_gtt_mapping.

The idea behind the split is that those functions are generally useful to punt ptes for a given object into an address space. It doesn't quite work like that yet, but I can keep on dreaming about different ppgtts ;-)
-Daniel

Quoted 70 lines
---
 drivers/gpu/drm/i915/i915_gem.c            | 4 +---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +----
 drivers/gpu/drm/i915/i915_gem_gtt.c        | 4 ++++
 3 files changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -3
index 1417fc6..4695937 100644
@@ -2491,10 +2491,8 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
 
        if (obj->has_global_gtt_mapping)
                i915_gem_gtt_unbind_object(obj);
-       if (obj->has_aliasing_ppgtt_mapping) {
+       if (obj->has_aliasing_ppgtt_mapping)
                i915_ppgtt_unbind_object(dev_priv->mm.aliasing_ppgtt, obj);
-               obj->has_aliasing_ppgtt_mapping = 0;
-       }
        i915_gem_gtt_finish_object(obj);
 
        list_del(&obj->mm_list);
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -4
index 934396c..5fb272a 100644
@@ -430,13 +430,10 @@ i915_gem_execbuffer_reserve_object(struct drm_i915_gem_object *obj,
        }
 
        /* Ensure ppgtt mapping exists if needed */
-       if (dev_priv->mm.aliasing_ppgtt && !obj->has_aliasing_ppgtt_mapping) {
+       if (dev_priv->mm.aliasing_ppgtt && !obj->has_aliasing_ppgtt_mapping)
                i915_ppgtt_bind_object(dev_priv->mm.aliasing_ppgtt,
                                       obj, obj->cache_level);
 
-               obj->has_aliasing_ppgtt_mapping = 1;
-       }
-
        if (entry->offset != obj->gtt_offset) {
                entry->offset = obj->gtt_offset;
                *need_reloc = true;
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
index 926a1e2..ee5ccac 100644
@@ -284,6 +284,8 @@ void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt,
        ppgtt->insert_entries(ppgtt, obj->pages,
                              obj->gtt_space->start >> PAGE_SHIFT,
                              cache_level);
+
+       obj->has_aliasing_ppgtt_mapping = 1;
 }
 
 void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt,
@@ -292,6 +294,8 @@ void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt,
        ppgtt->clear_range(ppgtt,
                           obj->gtt_space->start >> PAGE_SHIFT,
                           obj->base.size >> PAGE_SHIFT);
+
+       obj->has_aliasing_ppgtt_mapping = 0;
 }
 
 void i915_gem_init_ppgtt(struct drm_device *dev)
--

1.8.1.5

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · On Thu, Mar 7, 2013 at 12:31 PM, <[email protected]> wrote:

From: Ville Syrjälä <[email protected]>

Set has_aliasing_ppgtt_mapping from i915_ppgtt_{bind,unbind}_object(). This matches what we're doing for has_global_gtt_mapping.

Quoted 6 lines
Quoted 1 line

The idea behind the split is that those functions are generally useful to punt ptes for a given object into an address space. It doesn't quite work like that yet, but I can keep on dreaming about different ppgtts ;-)

OK that makes sense. Let's drop the patch then.

Signature · 2 lines
Ville Syrjälä
Intel OTC
Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 6 lines · On Thu, Mar 07, 2013 at 01:31:26PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Set has_aliasing_ppgtt_mapping from i915_ppgtt_{bind,unbind}_object(). This matches what we're doing for has_global_gtt_mapping.

I've been wanting to do that since the first day I saw it. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre