@@ -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
@@ -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