Lines Matching refs:fence
130 struct radeon_fence **fence, in radeon_fence_emit() argument
136 *fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL); in radeon_fence_emit()
137 if ((*fence) == NULL) { in radeon_fence_emit()
140 (*fence)->rdev = rdev; in radeon_fence_emit()
141 (*fence)->seq = seq; in radeon_fence_emit()
142 (*fence)->ring = ring; in radeon_fence_emit()
143 (*fence)->is_vm_update = false; in radeon_fence_emit()
144 fence_init(&(*fence)->base, &radeon_fence_ops, in radeon_fence_emit()
146 radeon_fence_ring_emit(rdev, ring, *fence); in radeon_fence_emit()
147 trace_radeon_fence_emit(rdev->ddev, ring, (*fence)->seq); in radeon_fence_emit()
161 struct radeon_fence *fence; in radeon_fence_check_signaled() local
164 fence = container_of(wait, struct radeon_fence, fence_wake); in radeon_fence_check_signaled()
170 seq = atomic64_read(&fence->rdev->fence_drv[fence->ring].last_seq); in radeon_fence_check_signaled()
171 if (seq >= fence->seq) { in radeon_fence_check_signaled()
172 int ret = fence_signal_locked(&fence->base); in radeon_fence_check_signaled()
175 FENCE_TRACE(&fence->base, "signaled from irq context\n"); in radeon_fence_check_signaled()
177 FENCE_TRACE(&fence->base, "was already signaled\n"); in radeon_fence_check_signaled()
179 radeon_irq_kms_sw_irq_put(fence->rdev, fence->ring); in radeon_fence_check_signaled()
180 __remove_wait_queue(&fence->rdev->fence_queue, &fence->fence_wake); in radeon_fence_check_signaled()
181 fence_put(&fence->base); in radeon_fence_check_signaled()
183 FENCE_TRACE(&fence->base, "pending\n"); in radeon_fence_check_signaled()
354 static bool radeon_fence_is_signaled(struct fence *f) in radeon_fence_is_signaled()
356 struct radeon_fence *fence = to_radeon_fence(f); in radeon_fence_is_signaled() local
357 struct radeon_device *rdev = fence->rdev; in radeon_fence_is_signaled()
358 unsigned ring = fence->ring; in radeon_fence_is_signaled()
359 u64 seq = fence->seq; in radeon_fence_is_signaled()
384 static bool radeon_fence_enable_signaling(struct fence *f) in radeon_fence_enable_signaling()
386 struct radeon_fence *fence = to_radeon_fence(f); in radeon_fence_enable_signaling() local
387 struct radeon_device *rdev = fence->rdev; in radeon_fence_enable_signaling()
389 if (atomic64_read(&rdev->fence_drv[fence->ring].last_seq) >= fence->seq) in radeon_fence_enable_signaling()
393 radeon_irq_kms_sw_irq_get(rdev, fence->ring); in radeon_fence_enable_signaling()
395 if (radeon_fence_activity(rdev, fence->ring)) in radeon_fence_enable_signaling()
399 if (atomic64_read(&rdev->fence_drv[fence->ring].last_seq) >= fence->seq) { in radeon_fence_enable_signaling()
400 radeon_irq_kms_sw_irq_put(rdev, fence->ring); in radeon_fence_enable_signaling()
408 if (radeon_irq_kms_sw_irq_get_delayed(rdev, fence->ring)) in radeon_fence_enable_signaling()
409 rdev->fence_drv[fence->ring].delayed_irq = true; in radeon_fence_enable_signaling()
410 radeon_fence_schedule_check(rdev, fence->ring); in radeon_fence_enable_signaling()
413 fence->fence_wake.flags = 0; in radeon_fence_enable_signaling()
414 fence->fence_wake.private = NULL; in radeon_fence_enable_signaling()
415 fence->fence_wake.func = radeon_fence_check_signaled; in radeon_fence_enable_signaling()
416 __add_wait_queue(&rdev->fence_queue, &fence->fence_wake); in radeon_fence_enable_signaling()
419 FENCE_TRACE(&fence->base, "armed on ring %i!\n", fence->ring); in radeon_fence_enable_signaling()
431 bool radeon_fence_signaled(struct radeon_fence *fence) in radeon_fence_signaled() argument
433 if (!fence) in radeon_fence_signaled()
436 if (radeon_fence_seq_signaled(fence->rdev, fence->seq, fence->ring)) { in radeon_fence_signaled()
439 ret = fence_signal(&fence->base); in radeon_fence_signaled()
441 FENCE_TRACE(&fence->base, "signaled from radeon_fence_signaled\n"); in radeon_fence_signaled()
540 int radeon_fence_wait(struct radeon_fence *fence, bool intr) in radeon_fence_wait() argument
551 if (WARN_ON_ONCE(!to_radeon_fence(&fence->base))) in radeon_fence_wait()
552 return fence_wait(&fence->base, intr); in radeon_fence_wait()
554 seq[fence->ring] = fence->seq; in radeon_fence_wait()
555 r = radeon_fence_wait_seq_timeout(fence->rdev, seq, intr, MAX_SCHEDULE_TIMEOUT); in radeon_fence_wait()
560 r = fence_signal(&fence->base); in radeon_fence_wait()
562 FENCE_TRACE(&fence->base, "signaled from fence_wait\n"); in radeon_fence_wait()
674 struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence) in radeon_fence_ref() argument
676 fence_get(&fence->base); in radeon_fence_ref()
677 return fence; in radeon_fence_ref()
687 void radeon_fence_unref(struct radeon_fence **fence) in radeon_fence_unref() argument
689 struct radeon_fence *tmp = *fence; in radeon_fence_unref()
691 *fence = NULL; in radeon_fence_unref()
735 bool radeon_fence_need_sync(struct radeon_fence *fence, int dst_ring) in radeon_fence_need_sync() argument
739 if (!fence) { in radeon_fence_need_sync()
743 if (fence->ring == dst_ring) { in radeon_fence_need_sync()
748 fdrv = &fence->rdev->fence_drv[dst_ring]; in radeon_fence_need_sync()
749 if (fence->seq <= fdrv->sync_seq[fence->ring]) { in radeon_fence_need_sync()
765 void radeon_fence_note_sync(struct radeon_fence *fence, int dst_ring) in radeon_fence_note_sync() argument
770 if (!fence) { in radeon_fence_note_sync()
774 if (fence->ring == dst_ring) { in radeon_fence_note_sync()
779 src = &fence->rdev->fence_drv[fence->ring]; in radeon_fence_note_sync()
780 dst = &fence->rdev->fence_drv[dst_ring]; in radeon_fence_note_sync()
1007 static const char *radeon_fence_get_driver_name(struct fence *fence) in radeon_fence_get_driver_name() argument
1012 static const char *radeon_fence_get_timeline_name(struct fence *f) in radeon_fence_get_timeline_name()
1014 struct radeon_fence *fence = to_radeon_fence(f); in radeon_fence_get_timeline_name() local
1015 switch (fence->ring) { in radeon_fence_get_timeline_name()
1028 static inline bool radeon_test_signaled(struct radeon_fence *fence) in radeon_test_signaled() argument
1030 return test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->base.flags); in radeon_test_signaled()
1039 radeon_fence_wait_cb(struct fence *fence, struct fence_cb *cb) in radeon_fence_wait_cb() argument
1047 static signed long radeon_fence_default_wait(struct fence *f, bool intr, in radeon_fence_default_wait()
1050 struct radeon_fence *fence = to_radeon_fence(f); in radeon_fence_default_wait() local
1051 struct radeon_device *rdev = fence->rdev; in radeon_fence_default_wait()
1069 if (radeon_test_signaled(fence)) in radeon_fence_default_wait()