Lines Matching refs:cursor

366 /* Restart the unlocked iteration by initializing the cursor object. */
367 static void dma_resv_iter_restart_unlocked(struct dma_resv_iter *cursor)
369 cursor->index = 0;
370 cursor->num_fences = 0;
371 cursor->fences = dma_resv_fences_list(cursor->obj);
372 if (cursor->fences)
373 cursor->num_fences = cursor->fences->num_fences;
374 cursor->is_restarted = true;
378 static void dma_resv_iter_walk_unlocked(struct dma_resv_iter *cursor)
380 if (!cursor->fences)
385 dma_fence_put(cursor->fence);
387 if (cursor->index >= cursor->num_fences) {
388 cursor->fence = NULL;
393 dma_resv_list_entry(cursor->fences, cursor->index++,
394 cursor->obj, &cursor->fence,
395 &cursor->fence_usage);
396 cursor->fence = dma_fence_get_rcu(cursor->fence);
397 if (!cursor->fence) {
398 dma_resv_iter_restart_unlocked(cursor);
402 if (!dma_fence_is_signaled(cursor->fence) &&
403 cursor->usage >= cursor->fence_usage)
410 * @cursor: the cursor with the current position
420 struct dma_fence *dma_resv_iter_first_unlocked(struct dma_resv_iter *cursor)
424 dma_resv_iter_restart_unlocked(cursor);
425 dma_resv_iter_walk_unlocked(cursor);
426 } while (dma_resv_fences_list(cursor->obj) != cursor->fences);
429 return cursor->fence;
435 * @cursor: the cursor with the current position
443 struct dma_fence *dma_resv_iter_next_unlocked(struct dma_resv_iter *cursor)
448 cursor->is_restarted = false;
449 restart = dma_resv_fences_list(cursor->obj) != cursor->fences;
452 dma_resv_iter_restart_unlocked(cursor);
453 dma_resv_iter_walk_unlocked(cursor);
455 } while (dma_resv_fences_list(cursor->obj) != cursor->fences);
458 return cursor->fence;
464 * @cursor: cursor to record the current position
471 struct dma_fence *dma_resv_iter_first(struct dma_resv_iter *cursor)
475 dma_resv_assert_held(cursor->obj);
477 cursor->index = 0;
478 cursor->fences = dma_resv_fences_list(cursor->obj);
480 fence = dma_resv_iter_next(cursor);
481 cursor->is_restarted = true;
488 * @cursor: cursor to record the current position
493 struct dma_fence *dma_resv_iter_next(struct dma_resv_iter *cursor)
497 dma_resv_assert_held(cursor->obj);
499 cursor->is_restarted = false;
502 if (!cursor->fences ||
503 cursor->index >= cursor->fences->num_fences)
506 dma_resv_list_entry(cursor->fences, cursor->index++,
507 cursor->obj, &fence, &cursor->fence_usage);
508 } while (cursor->fence_usage > cursor->usage);
523 struct dma_resv_iter cursor;
531 dma_resv_iter_begin(&cursor, src, DMA_RESV_USAGE_BOOKKEEP);
532 dma_resv_for_each_fence_unlocked(&cursor, f) {
534 if (dma_resv_iter_is_restarted(&cursor)) {
537 list = dma_resv_list_alloc(cursor.num_fences);
539 dma_resv_iter_end(&cursor);
547 dma_resv_iter_usage(&cursor));
549 dma_resv_iter_end(&cursor);
572 struct dma_resv_iter cursor;
578 dma_resv_iter_begin(&cursor, obj, usage);
579 dma_resv_for_each_fence_unlocked(&cursor, fence) {
581 if (dma_resv_iter_is_restarted(&cursor)) {
588 count = cursor.num_fences + 1;
598 dma_resv_iter_end(&cursor);
606 dma_resv_iter_end(&cursor);
682 struct dma_resv_iter cursor;
685 dma_resv_iter_begin(&cursor, obj, usage);
686 dma_resv_for_each_fence_unlocked(&cursor, fence) {
696 dma_resv_iter_end(&cursor);
714 struct dma_resv_iter cursor;
717 dma_resv_iter_begin(&cursor, obj, usage);
718 dma_resv_for_each_fence_unlocked(&cursor, fence) {
721 dma_resv_iter_end(&cursor);
740 struct dma_resv_iter cursor;
743 dma_resv_iter_begin(&cursor, obj, usage);
744 dma_resv_for_each_fence_unlocked(&cursor, fence) {
745 dma_resv_iter_end(&cursor);
748 dma_resv_iter_end(&cursor);
764 struct dma_resv_iter cursor;
767 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) {
769 usage[dma_resv_iter_usage(&cursor)]);