@@ -527,19 +527,31 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
527527 return NOTIFY_DONE ;
528528}
529529
530+ static void irq_semaphore_cb (struct irq_work * wrk )
531+ {
532+ struct i915_request * rq =
533+ container_of (wrk , typeof (* rq ), semaphore_work );
534+
535+ i915_schedule_bump_priority (rq , I915_PRIORITY_NOSEMAPHORE );
536+ i915_request_put (rq );
537+ }
538+
530539static int __i915_sw_fence_call
531540semaphore_notify (struct i915_sw_fence * fence , enum i915_sw_fence_notify state )
532541{
533- struct i915_request * request =
534- container_of (fence , typeof (* request ), semaphore );
542+ struct i915_request * rq = container_of (fence , typeof (* rq ), semaphore );
535543
536544 switch (state ) {
537545 case FENCE_COMPLETE :
538- i915_schedule_bump_priority (request , I915_PRIORITY_NOSEMAPHORE );
546+ if (!(READ_ONCE (rq -> sched .attr .priority ) & I915_PRIORITY_NOSEMAPHORE )) {
547+ i915_request_get (rq );
548+ init_irq_work (& rq -> semaphore_work , irq_semaphore_cb );
549+ irq_work_queue (& rq -> semaphore_work );
550+ }
539551 break ;
540552
541553 case FENCE_FREE :
542- i915_request_put (request );
554+ i915_request_put (rq );
543555 break ;
544556 }
545557
@@ -776,8 +788,8 @@ i915_request_await_start(struct i915_request *rq, struct i915_request *signal)
776788 struct dma_fence * fence ;
777789 int err ;
778790
779- GEM_BUG_ON (i915_request_timeline (rq ) ==
780- rcu_access_pointer ( signal -> timeline )) ;
791+ if (i915_request_timeline (rq ) == rcu_access_pointer ( signal -> timeline ))
792+ return 0 ;
781793
782794 if (i915_request_started (signal ))
783795 return 0 ;
@@ -821,7 +833,7 @@ i915_request_await_start(struct i915_request *rq, struct i915_request *signal)
821833 return 0 ;
822834
823835 err = 0 ;
824- if (intel_timeline_sync_is_later (i915_request_timeline (rq ), fence ))
836+ if (! intel_timeline_sync_is_later (i915_request_timeline (rq ), fence ))
825837 err = i915_sw_fence_await_dma_fence (& rq -> submit ,
826838 fence , 0 ,
827839 I915_FENCE_GFP );
@@ -1318,9 +1330,9 @@ void __i915_request_queue(struct i915_request *rq,
13181330 * decide whether to preempt the entire chain so that it is ready to
13191331 * run at the earliest possible convenience.
13201332 */
1321- i915_sw_fence_commit (& rq -> semaphore );
13221333 if (attr && rq -> engine -> schedule )
13231334 rq -> engine -> schedule (rq , attr );
1335+ i915_sw_fence_commit (& rq -> semaphore );
13241336 i915_sw_fence_commit (& rq -> submit );
13251337}
13261338
0 commit comments