Commit 6f9ec414 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Remove the impedance mismatch around intel_engine_enable_signaling

There is some redundancy between dma_fence->ops->enable_signaling (via
i915_fence_enable_signaling) and our backend,
intel_engine_enable_signaling() in that both levels recheck the fence
status multiple times. If we convert intel_engine_enable_signaling() to
return the information desired by dma_fence->ops->enable_signaling, we
can reduce i915_fence_enable_signaling to a simple stub and avoid
trying to reinterpret the same information.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180308140732.25090-1-chris@chris-wilson.co.uk
parent caa1fd66
...@@ -59,11 +59,7 @@ static bool i915_fence_signaled(struct dma_fence *fence) ...@@ -59,11 +59,7 @@ static bool i915_fence_signaled(struct dma_fence *fence)
static bool i915_fence_enable_signaling(struct dma_fence *fence) static bool i915_fence_enable_signaling(struct dma_fence *fence)
{ {
if (i915_fence_signaled(fence)) return intel_engine_enable_signaling(to_request(fence), true);
return false;
intel_engine_enable_signaling(to_request(fence), true);
return !i915_fence_signaled(fence);
} }
static signed long i915_fence_wait(struct dma_fence *fence, static signed long i915_fence_wait(struct dma_fence *fence,
......
...@@ -730,10 +730,11 @@ static void insert_signal(struct intel_breadcrumbs *b, ...@@ -730,10 +730,11 @@ static void insert_signal(struct intel_breadcrumbs *b,
list_add(&request->signaling.link, &iter->signaling.link); list_add(&request->signaling.link, &iter->signaling.link);
} }
void intel_engine_enable_signaling(struct i915_request *request, bool wakeup) bool intel_engine_enable_signaling(struct i915_request *request, bool wakeup)
{ {
struct intel_engine_cs *engine = request->engine; struct intel_engine_cs *engine = request->engine;
struct intel_breadcrumbs *b = &engine->breadcrumbs; struct intel_breadcrumbs *b = &engine->breadcrumbs;
struct intel_wait *wait = &request->signaling.wait;
u32 seqno; u32 seqno;
/* /*
...@@ -750,12 +751,12 @@ void intel_engine_enable_signaling(struct i915_request *request, bool wakeup) ...@@ -750,12 +751,12 @@ void intel_engine_enable_signaling(struct i915_request *request, bool wakeup)
seqno = i915_request_global_seqno(request); seqno = i915_request_global_seqno(request);
if (!seqno) /* will be enabled later upon execution */ if (!seqno) /* will be enabled later upon execution */
return; return true;
GEM_BUG_ON(request->signaling.wait.seqno); GEM_BUG_ON(wait->seqno);
request->signaling.wait.tsk = b->signaler; wait->tsk = b->signaler;
request->signaling.wait.request = request; wait->request = request;
request->signaling.wait.seqno = seqno; wait->seqno = seqno;
/* /*
* Add ourselves into the list of waiters, but registering our * Add ourselves into the list of waiters, but registering our
...@@ -768,11 +769,15 @@ void intel_engine_enable_signaling(struct i915_request *request, bool wakeup) ...@@ -768,11 +769,15 @@ void intel_engine_enable_signaling(struct i915_request *request, bool wakeup)
*/ */
spin_lock(&b->rb_lock); spin_lock(&b->rb_lock);
insert_signal(b, request, seqno); insert_signal(b, request, seqno);
wakeup &= __intel_engine_add_wait(engine, &request->signaling.wait); wakeup &= __intel_engine_add_wait(engine, wait);
spin_unlock(&b->rb_lock); spin_unlock(&b->rb_lock);
if (wakeup) if (wakeup) {
wake_up_process(b->signaler); wake_up_process(b->signaler);
return !intel_wait_complete(wait);
}
return true;
} }
void intel_engine_cancel_signaling(struct i915_request *request) void intel_engine_cancel_signaling(struct i915_request *request)
......
...@@ -940,7 +940,7 @@ bool intel_engine_add_wait(struct intel_engine_cs *engine, ...@@ -940,7 +940,7 @@ bool intel_engine_add_wait(struct intel_engine_cs *engine,
struct intel_wait *wait); struct intel_wait *wait);
void intel_engine_remove_wait(struct intel_engine_cs *engine, void intel_engine_remove_wait(struct intel_engine_cs *engine,
struct intel_wait *wait); struct intel_wait *wait);
void intel_engine_enable_signaling(struct i915_request *request, bool wakeup); bool intel_engine_enable_signaling(struct i915_request *request, bool wakeup);
void intel_engine_cancel_signaling(struct i915_request *request); void intel_engine_cancel_signaling(struct i915_request *request);
static inline bool intel_engine_has_waiter(const struct intel_engine_cs *engine) static inline bool intel_engine_has_waiter(const struct intel_engine_cs *engine)
......
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