Lines Matching refs:cursor
354 static void dma_resv_iter_restart_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_restart_unlocked() argument
356 cursor->index = 0; in dma_resv_iter_restart_unlocked()
357 cursor->num_fences = 0; in dma_resv_iter_restart_unlocked()
358 cursor->fences = dma_resv_fences_list(cursor->obj); in dma_resv_iter_restart_unlocked()
359 if (cursor->fences) in dma_resv_iter_restart_unlocked()
360 cursor->num_fences = cursor->fences->num_fences; in dma_resv_iter_restart_unlocked()
361 cursor->is_restarted = true; in dma_resv_iter_restart_unlocked()
365 static void dma_resv_iter_walk_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_walk_unlocked() argument
367 if (!cursor->fences) in dma_resv_iter_walk_unlocked()
372 dma_fence_put(cursor->fence); in dma_resv_iter_walk_unlocked()
374 if (cursor->index >= cursor->num_fences) { in dma_resv_iter_walk_unlocked()
375 cursor->fence = NULL; in dma_resv_iter_walk_unlocked()
380 dma_resv_list_entry(cursor->fences, cursor->index++, in dma_resv_iter_walk_unlocked()
381 cursor->obj, &cursor->fence, in dma_resv_iter_walk_unlocked()
382 &cursor->fence_usage); in dma_resv_iter_walk_unlocked()
383 cursor->fence = dma_fence_get_rcu(cursor->fence); in dma_resv_iter_walk_unlocked()
384 if (!cursor->fence) { in dma_resv_iter_walk_unlocked()
385 dma_resv_iter_restart_unlocked(cursor); in dma_resv_iter_walk_unlocked()
389 if (!dma_fence_is_signaled(cursor->fence) && in dma_resv_iter_walk_unlocked()
390 cursor->usage >= cursor->fence_usage) in dma_resv_iter_walk_unlocked()
407 struct dma_fence *dma_resv_iter_first_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_first_unlocked() argument
411 dma_resv_iter_restart_unlocked(cursor); in dma_resv_iter_first_unlocked()
412 dma_resv_iter_walk_unlocked(cursor); in dma_resv_iter_first_unlocked()
413 } while (dma_resv_fences_list(cursor->obj) != cursor->fences); in dma_resv_iter_first_unlocked()
416 return cursor->fence; in dma_resv_iter_first_unlocked()
430 struct dma_fence *dma_resv_iter_next_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_next_unlocked() argument
435 cursor->is_restarted = false; in dma_resv_iter_next_unlocked()
436 restart = dma_resv_fences_list(cursor->obj) != cursor->fences; in dma_resv_iter_next_unlocked()
439 dma_resv_iter_restart_unlocked(cursor); in dma_resv_iter_next_unlocked()
440 dma_resv_iter_walk_unlocked(cursor); in dma_resv_iter_next_unlocked()
442 } while (dma_resv_fences_list(cursor->obj) != cursor->fences); in dma_resv_iter_next_unlocked()
445 return cursor->fence; in dma_resv_iter_next_unlocked()
458 struct dma_fence *dma_resv_iter_first(struct dma_resv_iter *cursor) in dma_resv_iter_first() argument
462 dma_resv_assert_held(cursor->obj); in dma_resv_iter_first()
464 cursor->index = 0; in dma_resv_iter_first()
465 cursor->fences = dma_resv_fences_list(cursor->obj); in dma_resv_iter_first()
467 fence = dma_resv_iter_next(cursor); in dma_resv_iter_first()
468 cursor->is_restarted = true; in dma_resv_iter_first()
480 struct dma_fence *dma_resv_iter_next(struct dma_resv_iter *cursor) in dma_resv_iter_next() argument
484 dma_resv_assert_held(cursor->obj); in dma_resv_iter_next()
486 cursor->is_restarted = false; in dma_resv_iter_next()
489 if (!cursor->fences || in dma_resv_iter_next()
490 cursor->index >= cursor->fences->num_fences) in dma_resv_iter_next()
493 dma_resv_list_entry(cursor->fences, cursor->index++, in dma_resv_iter_next()
494 cursor->obj, &fence, &cursor->fence_usage); in dma_resv_iter_next()
495 } while (cursor->fence_usage > cursor->usage); in dma_resv_iter_next()
510 struct dma_resv_iter cursor; in dma_resv_copy_fences() local
518 dma_resv_iter_begin(&cursor, src, DMA_RESV_USAGE_BOOKKEEP); in dma_resv_copy_fences()
519 dma_resv_for_each_fence_unlocked(&cursor, f) { in dma_resv_copy_fences()
521 if (dma_resv_iter_is_restarted(&cursor)) { in dma_resv_copy_fences()
524 list = dma_resv_list_alloc(cursor.num_fences); in dma_resv_copy_fences()
526 dma_resv_iter_end(&cursor); in dma_resv_copy_fences()
534 dma_resv_iter_usage(&cursor)); in dma_resv_copy_fences()
536 dma_resv_iter_end(&cursor); in dma_resv_copy_fences()
559 struct dma_resv_iter cursor; in dma_resv_get_fences() local
565 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_get_fences()
566 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_get_fences()
568 if (dma_resv_iter_is_restarted(&cursor)) { in dma_resv_get_fences()
574 count = cursor.num_fences + 1; in dma_resv_get_fences()
581 dma_resv_iter_end(&cursor); in dma_resv_get_fences()
588 dma_resv_iter_end(&cursor); in dma_resv_get_fences()
664 struct dma_resv_iter cursor; in dma_resv_wait_timeout() local
667 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_wait_timeout()
668 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_wait_timeout()
672 dma_resv_iter_end(&cursor); in dma_resv_wait_timeout()
676 dma_resv_iter_end(&cursor); in dma_resv_wait_timeout()
698 struct dma_resv_iter cursor; in dma_resv_test_signaled() local
701 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_test_signaled()
702 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_test_signaled()
703 dma_resv_iter_end(&cursor); in dma_resv_test_signaled()
706 dma_resv_iter_end(&cursor); in dma_resv_test_signaled()
722 struct dma_resv_iter cursor; in dma_resv_describe() local
725 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) { in dma_resv_describe()
727 usage[dma_resv_iter_usage(&cursor)]); in dma_resv_describe()