Commit 0e21834e authored by Chris Wilson's avatar Chris Wilson

drm/i915: Tidy common test_bit probing of i915_request->fence.flags

A repeated pattern is to test the signaled bit of our
request->fence.flags. Make this an inline to shorten a few lines and
remove unnecessary line continuations.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190121222117.23305-20-chris@chris-wilson.co.uk
parent 924090f4
...@@ -1182,8 +1182,7 @@ static void notify_ring(struct intel_engine_cs *engine) ...@@ -1182,8 +1182,7 @@ static void notify_ring(struct intel_engine_cs *engine)
struct i915_request *waiter = wait->request; struct i915_request *waiter = wait->request;
if (waiter && if (waiter &&
!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, !i915_request_signaled(waiter) &&
&waiter->fence.flags) &&
intel_wait_check_request(wait, waiter)) intel_wait_check_request(wait, waiter))
rq = i915_request_get(waiter); rq = i915_request_get(waiter);
......
...@@ -198,7 +198,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine, ...@@ -198,7 +198,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine,
spin_unlock(&engine->timeline.lock); spin_unlock(&engine->timeline.lock);
spin_lock(&rq->lock); spin_lock(&rq->lock);
if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags)) if (!i915_request_signaled(rq))
dma_fence_signal_locked(&rq->fence); dma_fence_signal_locked(&rq->fence);
if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &rq->fence.flags)) if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &rq->fence.flags))
intel_engine_cancel_signaling(rq); intel_engine_cancel_signaling(rq);
......
...@@ -280,6 +280,11 @@ long i915_request_wait(struct i915_request *rq, ...@@ -280,6 +280,11 @@ long i915_request_wait(struct i915_request *rq,
#define I915_WAIT_ALL BIT(3) /* used by i915_gem_object_wait() */ #define I915_WAIT_ALL BIT(3) /* used by i915_gem_object_wait() */
#define I915_WAIT_FOR_IDLE_BOOST BIT(4) #define I915_WAIT_FOR_IDLE_BOOST BIT(4)
static inline bool i915_request_signaled(const struct i915_request *rq)
{
return test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags);
}
static inline bool intel_engine_has_started(struct intel_engine_cs *engine, static inline bool intel_engine_has_started(struct intel_engine_cs *engine,
u32 seqno); u32 seqno);
static inline bool intel_engine_has_completed(struct intel_engine_cs *engine, static inline bool intel_engine_has_completed(struct intel_engine_cs *engine,
......
...@@ -631,8 +631,7 @@ static int intel_breadcrumbs_signaler(void *arg) ...@@ -631,8 +631,7 @@ static int intel_breadcrumbs_signaler(void *arg)
rq->signaling.wait.seqno = 0; rq->signaling.wait.seqno = 0;
__list_del_entry(&rq->signaling.link); __list_del_entry(&rq->signaling.link);
if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, if (!i915_request_signaled(rq)) {
&rq->fence.flags)) {
list_add_tail(&rq->signaling.link, list_add_tail(&rq->signaling.link,
&list); &list);
i915_request_get(rq); i915_request_get(rq);
......
...@@ -816,7 +816,7 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) ...@@ -816,7 +816,7 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
list_for_each_entry(rq, &engine->timeline.requests, link) { list_for_each_entry(rq, &engine->timeline.requests, link) {
GEM_BUG_ON(!rq->global_seqno); GEM_BUG_ON(!rq->global_seqno);
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags)) if (i915_request_signaled(rq))
continue; continue;
dma_fence_set_error(&rq->fence, -EIO); dma_fence_set_error(&rq->fence, -EIO);
......
...@@ -6662,7 +6662,7 @@ void gen6_rps_boost(struct i915_request *rq, ...@@ -6662,7 +6662,7 @@ void gen6_rps_boost(struct i915_request *rq,
if (!rps->enabled) if (!rps->enabled)
return; return;
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags)) if (i915_request_signaled(rq))
return; return;
/* Serializes with i915_request_retire() */ /* Serializes with i915_request_retire() */
......
...@@ -836,8 +836,7 @@ static void cancel_requests(struct intel_engine_cs *engine) ...@@ -836,8 +836,7 @@ static void cancel_requests(struct intel_engine_cs *engine)
list_for_each_entry(request, &engine->timeline.requests, link) { list_for_each_entry(request, &engine->timeline.requests, link) {
GEM_BUG_ON(!request->global_seqno); GEM_BUG_ON(!request->global_seqno);
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, if (i915_request_signaled(request))
&request->fence.flags))
continue; continue;
dma_fence_set_error(&request->fence, -EIO); dma_fence_set_error(&request->fence, -EIO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment