[Intel-gfx] [PATCH 4/6] drm/i915: Synchronous execbuf for debug

Ben Widawsky ben at bwidawsk.net
Sat Jun 29 00:23:35 CEST 2013


In order to be able to hit the previously introduced page faults,
userspace may also want to make sure it's buffers are evicted, so that
it doesn't get lucky on accident.

This debug feature will have a horrible performance implication (I
measure roughly 3x in the negative direction for some basic tests).

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.h            | 1 +
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b99087f8..c9e38a6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1179,6 +1179,7 @@ typedef struct drm_i915_private {
 
 #define I915_DEBUG_NONE 0
 #define I915_SCRATCH_FAULTS (1<<0)
+#define I915_SYNC_EXECBUF (1<<1)
 	u64 debug_flags;
 } drm_i915_private_t;
 
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 87a3227..fe3bb5f 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -150,7 +150,8 @@ eb_get_object(struct eb_objects *eb, unsigned long handle)
 }
 
 static void
-eb_destroy(struct eb_objects *eb)
+eb_destroy(struct drm_i915_private *dev_priv,
+	   struct eb_objects *eb)
 {
 	while (!list_empty(&eb->objects)) {
 		struct drm_i915_gem_object *obj;
@@ -158,6 +159,8 @@ eb_destroy(struct eb_objects *eb)
 		obj = list_first_entry(&eb->objects,
 				       struct drm_i915_gem_object,
 				       exec_list);
+		if (unlikely(dev_priv->debug_flags & I915_SYNC_EXECBUF))
+			i915_gem_object_unbind(obj);
 		list_del_init(&obj->exec_list);
 		drm_gem_object_unreference(&obj->base);
 	}
@@ -1087,7 +1090,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	i915_gem_execbuffer_retire_commands(dev, file, ring, batch_obj);
 
 err:
-	eb_destroy(eb);
+	eb_destroy(dev_priv, eb);
 
 	mutex_unlock(&dev->struct_mutex);
 
-- 
1.8.3.1




More information about the Intel-gfx mailing list