Lines Matching refs:cursor
358 /* Restart the unlocked iteration by initializing the cursor object. */
359 static void dma_resv_iter_restart_unlocked(struct dma_resv_iter *cursor)
361 cursor->index = 0;
362 cursor->num_fences = 0;
363 cursor->fences = dma_resv_fences_list(cursor->obj);
364 if (cursor->fences)
365 cursor->num_fences = cursor->fences->num_fences;
366 cursor->is_restarted = true;
370 static void dma_resv_iter_walk_unlocked(struct dma_resv_iter *cursor)
372 if (!cursor->fences)
377 dma_fence_put(cursor->fence);
379 if (cursor->index >= cursor->num_fences) {
380 cursor->fence = NULL;
385 dma_resv_list_entry(cursor->fences, cursor->index++,
386 cursor->obj, &cursor->fence,
387 &cursor->fence_usage);
388 cursor->fence = dma_fence_get_rcu(cursor->fence);
389 if (!cursor->fence) {
390 dma_resv_iter_restart_unlocked(cursor);
394 if (!dma_fence_is_signaled(cursor->fence) &&
395 cursor->usage >= cursor->fence_usage)
402 * @cursor: the cursor with the current position
412 struct dma_fence *dma_resv_iter_first_unlocked(struct dma_resv_iter *cursor)
416 dma_resv_iter_restart_unlocked(cursor);
417 dma_resv_iter_walk_unlocked(cursor);
418 } while (dma_resv_fences_list(cursor->obj) != cursor->fences);
421 return cursor->fence;
427 * @cursor: the cursor with the current position
435 struct dma_fence *dma_resv_iter_next_unlocked(struct dma_resv_iter *cursor)
440 cursor->is_restarted = false;
441 restart = dma_resv_fences_list(cursor->obj) != cursor->fences;
444 dma_resv_iter_restart_unlocked(cursor);
445 dma_resv_iter_walk_unlocked(cursor);
447 } while (dma_resv_fences_list(cursor->obj) != cursor->fences);
450 return cursor->fence;
456 * @cursor: cursor to record the current position
463 struct dma_fence *dma_resv_iter_first(struct dma_resv_iter *cursor)
467 dma_resv_assert_held(cursor->obj);
469 cursor->index = 0;
470 cursor->fences = dma_resv_fences_list(cursor->obj);
472 fence = dma_resv_iter_next(cursor);
473 cursor->is_restarted = true;
480 * @cursor: cursor to record the current position
485 struct dma_fence *dma_resv_iter_next(struct dma_resv_iter *cursor)
489 dma_resv_assert_held(cursor->obj);
491 cursor->is_restarted = false;
494 if (!cursor->fences ||
495 cursor->index >= cursor->fences->num_fences)
498 dma_resv_list_entry(cursor->fences, cursor->index++,
499 cursor->obj, &fence, &cursor->fence_usage);
500 } while (cursor->fence_usage > cursor->usage);
515 struct dma_resv_iter cursor;
523 dma_resv_iter_begin(&cursor, src, DMA_RESV_USAGE_BOOKKEEP);
524 dma_resv_for_each_fence_unlocked(&cursor, f) {
526 if (dma_resv_iter_is_restarted(&cursor)) {
529 list = dma_resv_list_alloc(cursor.num_fences);
531 dma_resv_iter_end(&cursor);
539 dma_resv_iter_usage(&cursor));
541 dma_resv_iter_end(&cursor);
564 struct dma_resv_iter cursor;
570 dma_resv_iter_begin(&cursor, obj, usage);
571 dma_resv_for_each_fence_unlocked(&cursor, fence) {
573 if (dma_resv_iter_is_restarted(&cursor)) {
580 count = cursor.num_fences + 1;
590 dma_resv_iter_end(&cursor);
598 dma_resv_iter_end(&cursor);
674 struct dma_resv_iter cursor;
677 dma_resv_iter_begin(&cursor, obj, usage);
678 dma_resv_for_each_fence_unlocked(&cursor, fence) {
682 dma_resv_iter_end(&cursor);
686 dma_resv_iter_end(&cursor);
704 struct dma_resv_iter cursor;
707 dma_resv_iter_begin(&cursor, obj, usage);
708 dma_resv_for_each_fence_unlocked(&cursor, fence) {
711 dma_resv_iter_end(&cursor);
730 struct dma_resv_iter cursor;
733 dma_resv_iter_begin(&cursor, obj, usage);
734 dma_resv_for_each_fence_unlocked(&cursor, fence) {
735 dma_resv_iter_end(&cursor);
738 dma_resv_iter_end(&cursor);
754 struct dma_resv_iter cursor;
757 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) {
759 usage[dma_resv_iter_usage(&cursor)]);