aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_mm.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-12-22 03:36:31 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-12-28 05:50:28 -0500
commit2c4b389518fbe552188928aadcd3815d5116a05c (patch)
tree741bd09ab8f830f5a9cb984ce623f0a4595507fd /include/drm/drm_mm.h
parent4a6c156f56beaaf83102c8b29baeef070c697093 (diff)
drm: Unconditionally do the range check in drm_mm_scan_add_block()
Doing the check is trivial (low cost in comparison to overall eviction) and helps simplify the code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-29-chris@chris-wilson.co.uk
Diffstat (limited to 'include/drm/drm_mm.h')
-rw-r--r--include/drm/drm_mm.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index fcad718c5fb4..bae0f10da8e3 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -120,7 +120,6 @@ struct drm_mm_scan {
120 struct drm_mm_node *prev_scanned_node; 120 struct drm_mm_node *prev_scanned_node;
121 121
122 unsigned long color; 122 unsigned long color;
123 bool check_range : 1;
124}; 123};
125 124
126/** 125/**
@@ -387,11 +386,6 @@ __drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last);
387 node__ && node__->start < (end__); \ 386 node__ && node__->start < (end__); \
388 node__ = list_next_entry(node__, node_list)) 387 node__ = list_next_entry(node__, node_list))
389 388
390void drm_mm_scan_init(struct drm_mm_scan *scan,
391 struct drm_mm *mm,
392 u64 size,
393 u64 alignment,
394 unsigned long color);
395void drm_mm_scan_init_with_range(struct drm_mm_scan *scan, 389void drm_mm_scan_init_with_range(struct drm_mm_scan *scan,
396 struct drm_mm *mm, 390 struct drm_mm *mm,
397 u64 size, 391 u64 size,
@@ -399,6 +393,33 @@ void drm_mm_scan_init_with_range(struct drm_mm_scan *scan,
399 unsigned long color, 393 unsigned long color,
400 u64 start, 394 u64 start,
401 u64 end); 395 u64 end);
396
397/**
398 * drm_mm_scan_init - initialize lru scanning
399 * @scan: scan state
400 * @mm: drm_mm to scan
401 * @size: size of the allocation
402 * @alignment: alignment of the allocation
403 * @color: opaque tag value to use for the allocation
404 *
405 * This simply sets up the scanning routines with the parameters for the desired
406 * hole. Note that there's no need to specify allocation flags, since they only
407 * change the place a node is allocated from within a suitable hole.
408 *
409 * Warning:
410 * As long as the scan list is non-empty, no other operations than
411 * adding/removing nodes to/from the scan list are allowed.
412 */
413static inline void drm_mm_scan_init(struct drm_mm_scan *scan,
414 struct drm_mm *mm,
415 u64 size,
416 u64 alignment,
417 unsigned long color)
418{
419 drm_mm_scan_init_with_range(scan, mm, size, alignment, color,
420 0, U64_MAX);
421}
422
402bool drm_mm_scan_add_block(struct drm_mm_scan *scan, 423bool drm_mm_scan_add_block(struct drm_mm_scan *scan,
403 struct drm_mm_node *node); 424 struct drm_mm_node *node);
404bool drm_mm_scan_remove_block(struct drm_mm_scan *scan, 425bool drm_mm_scan_remove_block(struct drm_mm_scan *scan,