drm/i915: Use ww pinning for intel_context_create_request()

We want to get rid of intel_context_pin(), convert
intel_context_create_request() first. :)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200819140904.1708856-21-maarten.lankhorst@linux.intel.com
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
This commit is contained in:
Maarten Lankhorst 2020-08-19 16:09:00 +02:00 committed by Joonas Lahtinen
parent 052e04f170
commit 8a929c9eb1
1 changed files with 15 additions and 5 deletions

View File

@ -449,15 +449,25 @@ int intel_context_prepare_remote_request(struct intel_context *ce,
struct i915_request *intel_context_create_request(struct intel_context *ce) struct i915_request *intel_context_create_request(struct intel_context *ce)
{ {
struct i915_gem_ww_ctx ww;
struct i915_request *rq; struct i915_request *rq;
int err; int err;
err = intel_context_pin(ce); i915_gem_ww_ctx_init(&ww, true);
if (unlikely(err)) retry:
return ERR_PTR(err); err = intel_context_pin_ww(ce, &ww);
if (!err) {
rq = i915_request_create(ce); rq = i915_request_create(ce);
intel_context_unpin(ce); intel_context_unpin(ce);
} else if (err == -EDEADLK) {
err = i915_gem_ww_ctx_backoff(&ww);
if (!err)
goto retry;
} else {
rq = ERR_PTR(err);
}
i915_gem_ww_ctx_fini(&ww);
if (IS_ERR(rq)) if (IS_ERR(rq))
return rq; return rq;