Lines Matching full:scan
652 * DOC: lru scan roster
662 * interfaces. First a scan operation needs to be initialized with
672 * in the scan mode no other operation is allowed.
675 * reported true) in the scan, and any overlapping nodes after color adjustment
679 * scan operation even begins this is linear in the number of objects. It
685 * @scan: scan state
686 * @mm: drm_mm to scan
698 * As long as the scan list is non-empty, no other operations than
699 * adding/removing nodes to/from the scan list are allowed.
701 void drm_mm_scan_init_with_range(struct drm_mm_scan *scan, in drm_mm_scan_init_with_range() argument
714 scan->mm = mm; in drm_mm_scan_init_with_range()
719 scan->color = color; in drm_mm_scan_init_with_range()
720 scan->alignment = alignment; in drm_mm_scan_init_with_range()
721 scan->remainder_mask = is_power_of_2(alignment) ? alignment - 1 : 0; in drm_mm_scan_init_with_range()
722 scan->size = size; in drm_mm_scan_init_with_range()
723 scan->mode = mode; in drm_mm_scan_init_with_range()
726 scan->range_start = start; in drm_mm_scan_init_with_range()
727 scan->range_end = end; in drm_mm_scan_init_with_range()
729 scan->hit_start = U64_MAX; in drm_mm_scan_init_with_range()
730 scan->hit_end = 0; in drm_mm_scan_init_with_range()
735 * drm_mm_scan_add_block - add a node to the scan list
736 * @scan: the active drm_mm scanner
739 * Add a node to the scan list that might be freed to make space for the desired
745 bool drm_mm_scan_add_block(struct drm_mm_scan *scan, in drm_mm_scan_add_block() argument
748 struct drm_mm *mm = scan->mm; in drm_mm_scan_add_block()
775 mm->color_adjust(hole, scan->color, &col_start, &col_end); in drm_mm_scan_add_block()
777 adj_start = max(col_start, scan->range_start); in drm_mm_scan_add_block()
778 adj_end = min(col_end, scan->range_end); in drm_mm_scan_add_block()
779 if (adj_end <= adj_start || adj_end - adj_start < scan->size) in drm_mm_scan_add_block()
782 if (scan->mode == DRM_MM_INSERT_HIGH) in drm_mm_scan_add_block()
783 adj_start = adj_end - scan->size; in drm_mm_scan_add_block()
785 if (scan->alignment) { in drm_mm_scan_add_block()
788 if (likely(scan->remainder_mask)) in drm_mm_scan_add_block()
789 rem = adj_start & scan->remainder_mask; in drm_mm_scan_add_block()
791 div64_u64_rem(adj_start, scan->alignment, &rem); in drm_mm_scan_add_block()
794 if (scan->mode != DRM_MM_INSERT_HIGH) in drm_mm_scan_add_block()
795 adj_start += scan->alignment; in drm_mm_scan_add_block()
796 if (adj_start < max(col_start, scan->range_start) || in drm_mm_scan_add_block()
797 min(col_end, scan->range_end) - adj_start < scan->size) in drm_mm_scan_add_block()
801 adj_end - adj_start < scan->size) in drm_mm_scan_add_block()
806 scan->hit_start = adj_start; in drm_mm_scan_add_block()
807 scan->hit_end = adj_start + scan->size; in drm_mm_scan_add_block()
809 DRM_MM_BUG_ON(scan->hit_start >= scan->hit_end); in drm_mm_scan_add_block()
810 DRM_MM_BUG_ON(scan->hit_start < hole_start); in drm_mm_scan_add_block()
811 DRM_MM_BUG_ON(scan->hit_end > hole_end); in drm_mm_scan_add_block()
818 * drm_mm_scan_remove_block - remove a node from the scan list
819 * @scan: the active drm_mm scanner
822 * Nodes **must** be removed in exactly the reverse order from the scan list as
827 * When the scan list is empty, the selected memory nodes can be freed. An
836 bool drm_mm_scan_remove_block(struct drm_mm_scan *scan, in drm_mm_scan_remove_block() argument
841 DRM_MM_BUG_ON(node->mm != scan->mm); in drm_mm_scan_remove_block()
861 return (node->start + node->size > scan->hit_start && in drm_mm_scan_remove_block()
862 node->start < scan->hit_end); in drm_mm_scan_remove_block()
868 * @scan: drm_mm scan with target hole
870 * After completing an eviction scan and removing the selected nodes, we may
877 struct drm_mm_node *drm_mm_scan_color_evict(struct drm_mm_scan *scan) in drm_mm_scan_color_evict() argument
879 struct drm_mm *mm = scan->mm; in drm_mm_scan_color_evict()
897 if (hole_start <= scan->hit_start && in drm_mm_scan_color_evict()
898 hole_end >= scan->hit_end) in drm_mm_scan_color_evict()
907 DRM_MM_BUG_ON(hole_start > scan->hit_start); in drm_mm_scan_color_evict()
908 DRM_MM_BUG_ON(hole_end < scan->hit_end); in drm_mm_scan_color_evict()
910 mm->color_adjust(hole, scan->color, &hole_start, &hole_end); in drm_mm_scan_color_evict()
911 if (hole_start > scan->hit_start) in drm_mm_scan_color_evict()
913 if (hole_end < scan->hit_end) in drm_mm_scan_color_evict()