drm/i915: Tidy common test_bit probing of i915_request->fence.flags
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 21 Jan 2019 22:21:02 +0000 (22:21 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 22 Jan 2019 13:13:53 +0000 (13:13 +0000)
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: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190121222117.23305-20-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_request.c
drivers/gpu/drm/i915/i915_request.h
drivers/gpu/drm/i915/intel_breadcrumbs.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_ringbuffer.c

index 1abfc3fa76add75e0f6b9d8d77099ffb61ab37e1..5fd5080c4ccb11c88f1396a8bd90ec61c154b15a 100644 (file)
@@ -1182,8 +1182,7 @@ static void notify_ring(struct intel_engine_cs *engine)
                        struct i915_request *waiter = wait->request;
 
                        if (waiter &&
-                           !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
-                                     &waiter->fence.flags) &&
+                           !i915_request_signaled(waiter) &&
                            intel_wait_check_request(wait, waiter))
                                rq = i915_request_get(waiter);
 
index c7ce27785cdad4d8ecd657feb2934e51d277ed00..426194ee978afaf226e83a65fb23af478579ae49 100644 (file)
@@ -198,7 +198,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine,
        spin_unlock(&engine->timeline.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);
        if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &rq->fence.flags))
                intel_engine_cancel_signaling(rq);
index d014b060544569727cefa9c208a81bb4e7dbba20..c0f084ca4f29c1c1cdfbdba78558436b5ca5c343 100644 (file)
@@ -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_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,
                                            u32 seqno);
 static inline bool intel_engine_has_completed(struct intel_engine_cs *engine,
index 4fad93fe3678f61cd371847ba88eed76aa889afa..b58915b8708b27d2864e8ca1bea6eac9bb3f00e5 100644 (file)
@@ -631,8 +631,7 @@ static int intel_breadcrumbs_signaler(void *arg)
                                rq->signaling.wait.seqno = 0;
                                __list_del_entry(&rq->signaling.link);
 
-                               if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
-                                             &rq->fence.flags)) {
+                               if (!i915_request_signaled(rq)) {
                                        list_add_tail(&rq->signaling.link,
                                                      &list);
                                        i915_request_get(rq);
index f0fa0f767eb6a85e159601dfcb02cc1cc846f92d..382a1262f75a76a6632eb4541ad9261baa2d1557 100644 (file)
@@ -816,7 +816,7 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
        list_for_each_entry(rq, &engine->timeline.requests, link) {
                GEM_BUG_ON(!rq->global_seqno);
 
-               if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags))
+               if (i915_request_signaled(rq))
                        continue;
 
                dma_fence_set_error(&rq->fence, -EIO);
index 8b63afa3a221e75d4cf1a69314aa42ca94530361..fdc28a3d2936f49e66c2a12440173a656b2acb3f 100644 (file)
@@ -6662,7 +6662,7 @@ void gen6_rps_boost(struct i915_request *rq,
        if (!rps->enabled)
                return;
 
-       if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags))
+       if (i915_request_signaled(rq))
                return;
 
        /* Serializes with i915_request_retire() */
index 26b7274a2d43074926c62accf6496e9b7f846ec1..e39e483d8d16b0bc224a97c4074f32cbb800e120 100644 (file)
@@ -836,8 +836,7 @@ static void cancel_requests(struct intel_engine_cs *engine)
        list_for_each_entry(request, &engine->timeline.requests, link) {
                GEM_BUG_ON(!request->global_seqno);
 
-               if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
-                            &request->fence.flags))
+               if (i915_request_signaled(request))
                        continue;
 
                dma_fence_set_error(&request->fence, -EIO);