@@ -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;
@@ -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);
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@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(-)