Lines Matching full:scan

690  * DOC: lru scan roster
700 * interfaces. First a scan operation needs to be initialized with
710 * in the scan mode no other operation is allowed.
713 * reported true) in the scan, and any overlapping nodes after color adjustment
717 * scan operation even begins this is linear in the number of objects. It
723 * @scan: scan state
724 * @mm: drm_mm to scan
736 * As long as the scan list is non-empty, no other operations than
737 * adding/removing nodes to/from the scan list are allowed.
739 void drm_mm_scan_init_with_range(struct drm_mm_scan *scan, in drm_mm_scan_init_with_range() argument
752 scan->mm = mm; in drm_mm_scan_init_with_range()
757 scan->color = color; in drm_mm_scan_init_with_range()
758 scan->alignment = alignment; in drm_mm_scan_init_with_range()
759 scan->remainder_mask = is_power_of_2(alignment) ? alignment - 1 : 0; in drm_mm_scan_init_with_range()
760 scan->size = size; in drm_mm_scan_init_with_range()
761 scan->mode = mode; in drm_mm_scan_init_with_range()
764 scan->range_start = start; in drm_mm_scan_init_with_range()
765 scan->range_end = end; in drm_mm_scan_init_with_range()
767 scan->hit_start = U64_MAX; in drm_mm_scan_init_with_range()
768 scan->hit_end = 0; in drm_mm_scan_init_with_range()
773 * drm_mm_scan_add_block - add a node to the scan list
774 * @scan: the active drm_mm scanner
777 * Add a node to the scan list that might be freed to make space for the desired
783 bool drm_mm_scan_add_block(struct drm_mm_scan *scan, in drm_mm_scan_add_block() argument
786 struct drm_mm *mm = scan->mm; in drm_mm_scan_add_block()
813 mm->color_adjust(hole, scan->color, &col_start, &col_end); in drm_mm_scan_add_block()
815 adj_start = max(col_start, scan->range_start); in drm_mm_scan_add_block()
816 adj_end = min(col_end, scan->range_end); in drm_mm_scan_add_block()
817 if (adj_end <= adj_start || adj_end - adj_start < scan->size) in drm_mm_scan_add_block()
820 if (scan->mode == DRM_MM_INSERT_HIGH) in drm_mm_scan_add_block()
821 adj_start = adj_end - scan->size; in drm_mm_scan_add_block()
823 if (scan->alignment) { in drm_mm_scan_add_block()
826 if (likely(scan->remainder_mask)) in drm_mm_scan_add_block()
827 rem = adj_start & scan->remainder_mask; in drm_mm_scan_add_block()
829 div64_u64_rem(adj_start, scan->alignment, &rem); in drm_mm_scan_add_block()
832 if (scan->mode != DRM_MM_INSERT_HIGH) in drm_mm_scan_add_block()
833 adj_start += scan->alignment; in drm_mm_scan_add_block()
834 if (adj_start < max(col_start, scan->range_start) || in drm_mm_scan_add_block()
835 min(col_end, scan->range_end) - adj_start < scan->size) in drm_mm_scan_add_block()
839 adj_end - adj_start < scan->size) in drm_mm_scan_add_block()
844 scan->hit_start = adj_start; in drm_mm_scan_add_block()
845 scan->hit_end = adj_start + scan->size; in drm_mm_scan_add_block()
847 DRM_MM_BUG_ON(scan->hit_start >= scan->hit_end); in drm_mm_scan_add_block()
848 DRM_MM_BUG_ON(scan->hit_start < hole_start); in drm_mm_scan_add_block()
849 DRM_MM_BUG_ON(scan->hit_end > hole_end); in drm_mm_scan_add_block()
856 * drm_mm_scan_remove_block - remove a node from the scan list
857 * @scan: the active drm_mm scanner
860 * Nodes **must** be removed in exactly the reverse order from the scan list as
865 * When the scan list is empty, the selected memory nodes can be freed. An
874 bool drm_mm_scan_remove_block(struct drm_mm_scan *scan, in drm_mm_scan_remove_block() argument
879 DRM_MM_BUG_ON(node->mm != scan->mm); in drm_mm_scan_remove_block()
899 return (node->start + node->size > scan->hit_start && in drm_mm_scan_remove_block()
900 node->start < scan->hit_end); in drm_mm_scan_remove_block()
906 * @scan: drm_mm scan with target hole
908 * After completing an eviction scan and removing the selected nodes, we may
915 struct drm_mm_node *drm_mm_scan_color_evict(struct drm_mm_scan *scan) in drm_mm_scan_color_evict() argument
917 struct drm_mm *mm = scan->mm; in drm_mm_scan_color_evict()
935 if (hole_start <= scan->hit_start && in drm_mm_scan_color_evict()
936 hole_end >= scan->hit_end) in drm_mm_scan_color_evict()
945 DRM_MM_BUG_ON(hole_start > scan->hit_start); in drm_mm_scan_color_evict()
946 DRM_MM_BUG_ON(hole_end < scan->hit_end); in drm_mm_scan_color_evict()
948 mm->color_adjust(hole, scan->color, &hole_start, &hole_end); in drm_mm_scan_color_evict()
949 if (hole_start > scan->hit_start) in drm_mm_scan_color_evict()
951 if (hole_end < scan->hit_end) in drm_mm_scan_color_evict()