On 07/12/2016 13:58, Chris Wilson wrote:
A trivial kselftest to submit a request and wait upon it. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem_request.c | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 6553457adc77..9ba17d3e35cb 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -1601,10 +1601,58 @@ static int igt_add_request(void *ignore) return err; } +static int igt_wait_request(void *ignore) +{ + struct drm_i915_private *i915; + struct drm_i915_gem_request *request; + int err = -ENOMEM; + + i915 = mock_device(); + if (!i915) + goto out; + + mutex_lock(&i915->drm.struct_mutex); + request = mock_request(i915->engine[RCS], + i915->kernel_context, + HZ / 2);
Yawn, very slow. :) I suppose you have to put in some safety, but it feels too much. Is there any timer jitter by default? We could try doubling that and multiply by another two maybe?
+ if (!request) + goto out_unlock; + + i915_add_request(request); + + if (i915_gem_request_completed(request)) { + pr_err("request completed immediately!\n");
err = -Esomethingappropriate maybe?
+ goto out_unlock; + } + + if (i915_wait_request(request, I915_WAIT_LOCKED, HZ / 4) != -ETIME) { + pr_err("request wait succeeded (expected tiemout!)\n");
Here also.
+ goto out_unlock; + } + + if (i915_wait_request(request, I915_WAIT_LOCKED, HZ / 2) == -ETIME) { + pr_err("request wait timed out!\n");
And here.
+ goto out_unlock; + } + + if (!i915_gem_request_completed(request)) { + pr_err("request not complete after waiting!\n");
...
+ goto out_unlock; + } + + err = 0; +out_unlock: + mutex_unlock(&i915->drm.struct_mutex); + mock_device_free(i915); +out: + return err; +} + int i915_gem_request_selftest(void) { static const struct i915_subtest tests[] = { SUBTEST(igt_add_request), + SUBTEST(igt_wait_request), }; return i915_subtests(tests, NULL);
No other complaints. :) Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx