diff mbox

[2/2] drm/i915/selftests: Skip live context execution test without logical contexts

Message ID 20180706101442.21279-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 6, 2018, 10:14 a.m. UTC
If the HW (or driver) doesn't support logical contexts, don't pretend we
gain anything from trying to execute GPU commands with them. At best it
reports -ENODEV, which is an unhelpful failure that we should just skip.

v2: Be more specific and check the driver/engine caps for logical (HW)
context support.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Chris Wilson July 6, 2018, 10:18 a.m. UTC | #1
Quoting Chris Wilson (2018-07-06 11:14:42)
> If the HW (or driver) doesn't support logical contexts, don't pretend we
> gain anything from trying to execute GPU commands with them. At best it
> reports -ENODEV, which is an unhelpful failure that we should just skip.
> 
> v2: Be more specific and check the driver/engine caps for logical (HW)
> context support.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_context.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> index cc848ceeb3c3..66b2c6f96b90 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> @@ -336,11 +336,15 @@ static int igt_ctx_exec(void *arg)
>         bool first_shared_gtt = true;
>         int err = -ENODEV;
>  
> -       /* Create a few different contexts (with different mm) and write
> +       /*
> +        * Create a few different contexts (with different mm) and write
>          * through each ctx/mm using the GPU making sure those writes end
>          * up in the expected pages of our obj.
>          */
>  
> +       if (!DRIVER_CAPS(i915)->has_logical_contexts)
> +               return 0;
> +
>         file = mock_file(i915);
>         if (IS_ERR(file))
>                 return PTR_ERR(file);
> @@ -363,10 +367,13 @@ static int igt_ctx_exec(void *arg)
>                 }
>                 if (IS_ERR(ctx)) {
>                         err = PTR_ERR(ctx);
> -                       goto out_unlock;
> +                       break;

Oops, should be still goto out_unlock after undoing v1.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index cc848ceeb3c3..66b2c6f96b90 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -336,11 +336,15 @@  static int igt_ctx_exec(void *arg)
 	bool first_shared_gtt = true;
 	int err = -ENODEV;
 
-	/* Create a few different contexts (with different mm) and write
+	/*
+	 * Create a few different contexts (with different mm) and write
 	 * through each ctx/mm using the GPU making sure those writes end
 	 * up in the expected pages of our obj.
 	 */
 
+	if (!DRIVER_CAPS(i915)->has_logical_contexts)
+		return 0;
+
 	file = mock_file(i915);
 	if (IS_ERR(file))
 		return PTR_ERR(file);
@@ -363,10 +367,13 @@  static int igt_ctx_exec(void *arg)
 		}
 		if (IS_ERR(ctx)) {
 			err = PTR_ERR(ctx);
-			goto out_unlock;
+			break;
 		}
 
 		for_each_engine(engine, i915, id) {
+			if (!engine->context_size)
+				continue; /* No logical context support in HW */
+
 			if (!intel_engine_can_store_dword(engine))
 				continue;