Lines Matching full:cursor

365 /* Restart the unlocked iteration by initializing the cursor object. */
366 static void dma_resv_iter_restart_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_restart_unlocked() argument
368 cursor->index = 0; in dma_resv_iter_restart_unlocked()
369 cursor->num_fences = 0; in dma_resv_iter_restart_unlocked()
370 cursor->fences = dma_resv_fences_list(cursor->obj); in dma_resv_iter_restart_unlocked()
371 if (cursor->fences) in dma_resv_iter_restart_unlocked()
372 cursor->num_fences = cursor->fences->num_fences; in dma_resv_iter_restart_unlocked()
373 cursor->is_restarted = true; in dma_resv_iter_restart_unlocked()
377 static void dma_resv_iter_walk_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_walk_unlocked() argument
379 if (!cursor->fences) in dma_resv_iter_walk_unlocked()
384 dma_fence_put(cursor->fence); in dma_resv_iter_walk_unlocked()
386 if (cursor->index >= cursor->num_fences) { in dma_resv_iter_walk_unlocked()
387 cursor->fence = NULL; in dma_resv_iter_walk_unlocked()
392 dma_resv_list_entry(cursor->fences, cursor->index++, in dma_resv_iter_walk_unlocked()
393 cursor->obj, &cursor->fence, in dma_resv_iter_walk_unlocked()
394 &cursor->fence_usage); in dma_resv_iter_walk_unlocked()
395 cursor->fence = dma_fence_get_rcu(cursor->fence); in dma_resv_iter_walk_unlocked()
396 if (!cursor->fence) { in dma_resv_iter_walk_unlocked()
397 dma_resv_iter_restart_unlocked(cursor); in dma_resv_iter_walk_unlocked()
401 if (!dma_fence_is_signaled(cursor->fence) && in dma_resv_iter_walk_unlocked()
402 cursor->usage >= cursor->fence_usage) in dma_resv_iter_walk_unlocked()
409 * @cursor: the cursor with the current position
419 struct dma_fence *dma_resv_iter_first_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_first_unlocked() argument
423 dma_resv_iter_restart_unlocked(cursor); in dma_resv_iter_first_unlocked()
424 dma_resv_iter_walk_unlocked(cursor); in dma_resv_iter_first_unlocked()
425 } while (dma_resv_fences_list(cursor->obj) != cursor->fences); in dma_resv_iter_first_unlocked()
428 return cursor->fence; in dma_resv_iter_first_unlocked()
434 * @cursor: the cursor with the current position
442 struct dma_fence *dma_resv_iter_next_unlocked(struct dma_resv_iter *cursor) in dma_resv_iter_next_unlocked() argument
447 cursor->is_restarted = false; in dma_resv_iter_next_unlocked()
448 restart = dma_resv_fences_list(cursor->obj) != cursor->fences; in dma_resv_iter_next_unlocked()
451 dma_resv_iter_restart_unlocked(cursor); in dma_resv_iter_next_unlocked()
452 dma_resv_iter_walk_unlocked(cursor); in dma_resv_iter_next_unlocked()
454 } while (dma_resv_fences_list(cursor->obj) != cursor->fences); in dma_resv_iter_next_unlocked()
457 return cursor->fence; in dma_resv_iter_next_unlocked()
463 * @cursor: cursor to record the current position
470 struct dma_fence *dma_resv_iter_first(struct dma_resv_iter *cursor) in dma_resv_iter_first() argument
474 dma_resv_assert_held(cursor->obj); in dma_resv_iter_first()
476 cursor->index = 0; in dma_resv_iter_first()
477 cursor->fences = dma_resv_fences_list(cursor->obj); in dma_resv_iter_first()
479 fence = dma_resv_iter_next(cursor); in dma_resv_iter_first()
480 cursor->is_restarted = true; in dma_resv_iter_first()
487 * @cursor: cursor to record the current position
492 struct dma_fence *dma_resv_iter_next(struct dma_resv_iter *cursor) in dma_resv_iter_next() argument
496 dma_resv_assert_held(cursor->obj); in dma_resv_iter_next()
498 cursor->is_restarted = false; in dma_resv_iter_next()
501 if (!cursor->fences || in dma_resv_iter_next()
502 cursor->index >= cursor->fences->num_fences) in dma_resv_iter_next()
505 dma_resv_list_entry(cursor->fences, cursor->index++, in dma_resv_iter_next()
506 cursor->obj, &fence, &cursor->fence_usage); in dma_resv_iter_next()
507 } while (cursor->fence_usage > cursor->usage); in dma_resv_iter_next()
522 struct dma_resv_iter cursor; in dma_resv_copy_fences() local
530 dma_resv_iter_begin(&cursor, src, DMA_RESV_USAGE_BOOKKEEP); in dma_resv_copy_fences()
531 dma_resv_for_each_fence_unlocked(&cursor, f) { in dma_resv_copy_fences()
533 if (dma_resv_iter_is_restarted(&cursor)) { in dma_resv_copy_fences()
536 list = dma_resv_list_alloc(cursor.num_fences); in dma_resv_copy_fences()
538 dma_resv_iter_end(&cursor); in dma_resv_copy_fences()
546 dma_resv_iter_usage(&cursor)); in dma_resv_copy_fences()
548 dma_resv_iter_end(&cursor); in dma_resv_copy_fences()
571 struct dma_resv_iter cursor; in dma_resv_get_fences() local
577 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_get_fences()
578 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_get_fences()
580 if (dma_resv_iter_is_restarted(&cursor)) { in dma_resv_get_fences()
587 count = cursor.num_fences + 1; in dma_resv_get_fences()
597 dma_resv_iter_end(&cursor); in dma_resv_get_fences()
605 dma_resv_iter_end(&cursor); in dma_resv_get_fences()
681 struct dma_resv_iter cursor; in dma_resv_wait_timeout() local
684 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_wait_timeout()
685 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_wait_timeout()
689 dma_resv_iter_end(&cursor); in dma_resv_wait_timeout()
693 dma_resv_iter_end(&cursor); in dma_resv_wait_timeout()
711 struct dma_resv_iter cursor; in dma_resv_set_deadline() local
714 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_set_deadline()
715 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_set_deadline()
718 dma_resv_iter_end(&cursor); in dma_resv_set_deadline()
737 struct dma_resv_iter cursor; in dma_resv_test_signaled() local
740 dma_resv_iter_begin(&cursor, obj, usage); in dma_resv_test_signaled()
741 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_test_signaled()
742 dma_resv_iter_end(&cursor); in dma_resv_test_signaled()
745 dma_resv_iter_end(&cursor); in dma_resv_test_signaled()
761 struct dma_resv_iter cursor; in dma_resv_describe() local
764 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) { in dma_resv_describe()
766 usage[dma_resv_iter_usage(&cursor)]); in dma_resv_describe()