From 9a71e277888b39b8f0e8364813ec1ba58a5a4371 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 22 Dec 2016 08:36:29 +0000 Subject: drm: Extract struct drm_mm_scan from struct drm_mm The scan state occupies a large proportion of the struct drm_mm and is rarely used and only contains temporary state. That makes it suitable to moving to its struct and onto the stack of the callers. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen [danvet: Fix up etnaviv to compile, was missing a BUG_ON.] Signed-off-by: Daniel Vetter --- include/drm/drm_mm.h | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'include/drm/drm_mm.h') diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 72e0c0ddf8d0..fcad718c5fb4 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h @@ -98,20 +98,29 @@ struct drm_mm { /* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */ struct rb_root interval_tree; - unsigned int scan_check_range : 1; - unsigned int scanned_blocks; - unsigned long scan_color; - u64 scan_alignment; - u64 scan_size; - u64 scan_hit_start; - u64 scan_hit_end; - u64 scan_start; - u64 scan_end; - struct drm_mm_node *prev_scanned_node; - void (*color_adjust)(const struct drm_mm_node *node, unsigned long color, u64 *start, u64 *end); + + unsigned long scan_active; +}; + +struct drm_mm_scan { + struct drm_mm *mm; + + u64 size; + u64 alignment; + + u64 range_start; + u64 range_end; + + u64 hit_start; + u64 hit_end; + + struct drm_mm_node *prev_scanned_node; + + unsigned long color; + bool check_range : 1; }; /** @@ -378,18 +387,22 @@ __drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last); node__ && node__->start < (end__); \ node__ = list_next_entry(node__, node_list)) -void drm_mm_init_scan(struct drm_mm *mm, +void drm_mm_scan_init(struct drm_mm_scan *scan, + struct drm_mm *mm, u64 size, u64 alignment, unsigned long color); -void drm_mm_init_scan_with_range(struct drm_mm *mm, +void drm_mm_scan_init_with_range(struct drm_mm_scan *scan, + struct drm_mm *mm, u64 size, u64 alignment, unsigned long color, u64 start, u64 end); -bool drm_mm_scan_add_block(struct drm_mm_node *node); -bool drm_mm_scan_remove_block(struct drm_mm_node *node); +bool drm_mm_scan_add_block(struct drm_mm_scan *scan, + struct drm_mm_node *node); +bool drm_mm_scan_remove_block(struct drm_mm_scan *scan, + struct drm_mm_node *node); void drm_mm_debug_table(const struct drm_mm *mm, const char *prefix); #ifdef CONFIG_DEBUG_FS -- cgit v1.2.3