drm/i915: Export i915_request_skip()

In the next patch, we will want to start skipping requests on failing to
complete their payloads. So export the utility function current used to
make requests inoperable following a failed gpu reset.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180706103947.15919-2-chris@chris-wilson.co.uk
This commit is contained in:
Chris Wilson
2018-07-06 11:39:43 +01:00
parent da99fe5f85
commit 6dd7526f6f
3 changed files with 26 additions and 22 deletions

View File

@@ -1013,6 +1013,27 @@ i915_request_await_object(struct i915_request *to,
return ret;
}
void i915_request_skip(struct i915_request *rq, int error)
{
void *vaddr = rq->ring->vaddr;
u32 head;
GEM_BUG_ON(!IS_ERR_VALUE((long)error));
dma_fence_set_error(&rq->fence, error);
/*
* As this request likely depends on state from the lost
* context, clear out all the user operations leaving the
* breadcrumb at the end (so we get the fence notifications).
*/
head = rq->infix;
if (rq->postfix < head) {
memset(vaddr + head, 0, rq->ring->size - head);
head = 0;
}
memset(vaddr + head, 0, rq->postfix - head);
}
/*
* NB: This function is not allowed to fail. Doing so would mean the the
* request is not being tracked for completion but the work itself is