[Intel-gfx] [PATCH 2/2] drm/i915: Force an aliasing_ppgtt test for context execution

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 9 10:02:49 UTC 2017


Ensure that we minimally exercise the aliasing_ppgtt, even on a
full-ppgtt, by allocating one and similarly creating a context to use
it.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 27 ++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index 00257949e195..6d3eca8c0c09 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -325,6 +325,7 @@ static int igt_ctx_exec(void *arg)
 	IGT_TIMEOUT(end_time);
 	LIST_HEAD(objects);
 	unsigned int count, dw;
+	bool first = true;
 	int err;
 
 	/* Create a few different contexts (with different mm) and write
@@ -344,9 +345,16 @@ static int igt_ctx_exec(void *arg)
 	while (!time_after(jiffies, end_time)) {
 		struct intel_engine_cs *engine;
 		struct i915_gem_context *ctx;
+		struct drm_i915_file_private *fpriv;
 		unsigned int id;
 
-		ctx = i915_gem_create_context(i915, file->driver_priv);
+		fpriv = file->driver_priv;
+		if (first) {
+			fpriv = NULL;
+			first = false;
+		}
+
+		ctx = i915_gem_create_context(i915, fpriv);
 		if (IS_ERR(ctx)) {
 			err = PTR_ERR(ctx);
 			goto out_unlock;
@@ -392,11 +400,24 @@ static int igt_ctx_exec(void *arg)
 	return err;
 }
 
-int i915_gem_context_live_selftests(struct drm_i915_private *i915)
+int i915_gem_context_live_selftests(struct drm_i915_private *dev_priv)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_ctx_exec),
 	};
+	int err;
 
-	return i915_subtests(tests, i915);
+	/* Install a fake aliasing gtt for exercise */
+	if (USES_FULL_PPGTT(dev_priv)) {
+		err = i915_gem_init_aliasing_ppgtt(dev_priv);
+		if (err)
+			return err;
+	}
+
+	err = i915_subtests(tests, dev_priv);
+
+	if (USES_FULL_PPGTT(dev_priv))
+		i915_ppgtt_put(fetch_and_zero(&dev_priv->mm.aliasing_ppgtt));
+
+	return err;
 }
-- 
2.11.0



More information about the Intel-gfx mailing list