Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA. |
| 4 | * All Rights Reserved. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the |
| 8 | * "Software"), to deal in the Software without restriction, including |
| 9 | * without limitation the rights to use, copy, modify, merge, publish, |
| 10 | * distribute, sub license, and/or sell copies of the Software, and to |
| 11 | * permit persons to whom the Software is furnished to do so, subject to |
| 12 | * the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice (including the |
| 15 | * next paragraph) shall be included in all copies or substantial portions |
| 16 | * of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | * |
| 26 | * |
| 27 | **************************************************************************/ |
| 28 | |
| 29 | /* |
| 30 | * Generic simple memory manager implementation. Intended to be used as a base |
| 31 | * class implementation for more advanced memory managers. |
| 32 | * |
| 33 | * Note that the algorithm used is quite simple and there might be substantial |
| 34 | * performance gains if a smarter free list is implemented. Currently it is just an |
| 35 | * unordered stack of free regions. This could easily be improved if an RB-tree |
| 36 | * is used instead. At least if we expect heavy fragmentation. |
| 37 | * |
| 38 | * Aligned allocations can also see improvement. |
| 39 | * |
| 40 | * Authors: |
Jan Engelhardt | 96de0e2 | 2007-10-19 23:21:04 +0200 | [diff] [blame] | 41 | * Thomas Hellström <thomas-at-tungstengraphics-dot-com> |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 42 | */ |
| 43 | |
| 44 | #include "drmP.h" |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 45 | #include "drm_mm.h" |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 46 | #include <linux/slab.h> |
Dave Airlie | fa8a123 | 2009-08-26 13:13:37 +1000 | [diff] [blame] | 47 | #include <linux/seq_file.h> |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 48 | |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 49 | #define MM_UNUSED_TARGET 4 |
| 50 | |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 51 | static struct drm_mm_node *drm_mm_kmalloc(struct drm_mm *mm, int atomic) |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 52 | { |
Dave Airlie | 5591051 | 2007-07-11 16:53:40 +1000 | [diff] [blame] | 53 | struct drm_mm_node *child; |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 54 | |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 55 | if (atomic) |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 56 | child = kzalloc(sizeof(*child), GFP_ATOMIC); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 57 | else |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 58 | child = kzalloc(sizeof(*child), GFP_KERNEL); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 59 | |
| 60 | if (unlikely(child == NULL)) { |
| 61 | spin_lock(&mm->unused_lock); |
| 62 | if (list_empty(&mm->unused_nodes)) |
| 63 | child = NULL; |
| 64 | else { |
| 65 | child = |
| 66 | list_entry(mm->unused_nodes.next, |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 67 | struct drm_mm_node, node_list); |
| 68 | list_del(&child->node_list); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 69 | --mm->num_unused; |
| 70 | } |
| 71 | spin_unlock(&mm->unused_lock); |
| 72 | } |
| 73 | return child; |
| 74 | } |
| 75 | |
Jerome Glisse | a698cf3 | 2009-11-13 20:56:58 +0100 | [diff] [blame] | 76 | /* drm_mm_pre_get() - pre allocate drm_mm_node structure |
| 77 | * drm_mm: memory manager struct we are pre-allocating for |
| 78 | * |
| 79 | * Returns 0 on success or -ENOMEM if allocation fails. |
| 80 | */ |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 81 | int drm_mm_pre_get(struct drm_mm *mm) |
| 82 | { |
| 83 | struct drm_mm_node *node; |
| 84 | |
| 85 | spin_lock(&mm->unused_lock); |
| 86 | while (mm->num_unused < MM_UNUSED_TARGET) { |
| 87 | spin_unlock(&mm->unused_lock); |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 88 | node = kzalloc(sizeof(*node), GFP_KERNEL); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 89 | spin_lock(&mm->unused_lock); |
| 90 | |
| 91 | if (unlikely(node == NULL)) { |
| 92 | int ret = (mm->num_unused < 2) ? -ENOMEM : 0; |
| 93 | spin_unlock(&mm->unused_lock); |
| 94 | return ret; |
| 95 | } |
| 96 | ++mm->num_unused; |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 97 | list_add_tail(&node->node_list, &mm->unused_nodes); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 98 | } |
| 99 | spin_unlock(&mm->unused_lock); |
| 100 | return 0; |
| 101 | } |
| 102 | EXPORT_SYMBOL(drm_mm_pre_get); |
| 103 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 104 | static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node) |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 105 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 106 | return hole_node->start + hole_node->size; |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 107 | } |
| 108 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 109 | static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 110 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 111 | struct drm_mm_node *next_node = |
| 112 | list_entry(hole_node->node_list.next, struct drm_mm_node, |
| 113 | node_list); |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 114 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 115 | return next_node->start; |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 116 | } |
| 117 | |
Daniel Vetter | 9fc935d | 2011-02-18 17:59:13 +0100 | [diff] [blame^] | 118 | static void drm_mm_insert_helper(struct drm_mm_node *hole_node, |
| 119 | struct drm_mm_node *node, |
| 120 | unsigned long size, unsigned alignment) |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 121 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 122 | struct drm_mm *mm = hole_node->mm; |
| 123 | unsigned long tmp = 0, wasted = 0; |
| 124 | unsigned long hole_start = drm_mm_hole_node_start(hole_node); |
| 125 | unsigned long hole_end = drm_mm_hole_node_end(hole_node); |
| 126 | |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 127 | if (alignment) |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 128 | tmp = hole_start % alignment; |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 129 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 130 | if (!tmp) { |
| 131 | hole_node->hole_follows = 0; |
| 132 | list_del_init(&hole_node->hole_stack); |
| 133 | } else |
| 134 | wasted = alignment - tmp; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 135 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 136 | node->start = hole_start + wasted; |
| 137 | node->size = size; |
| 138 | node->mm = mm; |
| 139 | |
| 140 | INIT_LIST_HEAD(&node->hole_stack); |
| 141 | list_add(&node->node_list, &hole_node->node_list); |
| 142 | |
| 143 | BUG_ON(node->start + node->size > hole_end); |
| 144 | |
| 145 | if (node->start + node->size < hole_end) { |
| 146 | list_add(&node->hole_stack, &mm->hole_stack); |
| 147 | node->hole_follows = 1; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 148 | } else { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 149 | node->hole_follows = 0; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 150 | } |
Daniel Vetter | 9fc935d | 2011-02-18 17:59:13 +0100 | [diff] [blame^] | 151 | } |
| 152 | |
| 153 | struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *hole_node, |
| 154 | unsigned long size, |
| 155 | unsigned alignment, |
| 156 | int atomic) |
| 157 | { |
| 158 | struct drm_mm_node *node; |
| 159 | |
| 160 | BUG_ON(!hole_node->hole_follows); |
| 161 | |
| 162 | node = drm_mm_kmalloc(hole_node->mm, atomic); |
| 163 | if (unlikely(node == NULL)) |
| 164 | return NULL; |
| 165 | |
| 166 | drm_mm_insert_helper(hole_node, node, size, alignment); |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 167 | |
Chris Wilson | e6c03c5 | 2009-05-22 14:14:22 +0100 | [diff] [blame] | 168 | return node; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 169 | } |
Thomas Hellstrom | 89579f7 | 2009-06-17 12:29:56 +0200 | [diff] [blame] | 170 | EXPORT_SYMBOL(drm_mm_get_block_generic); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 171 | |
Daniel Vetter | 9fc935d | 2011-02-18 17:59:13 +0100 | [diff] [blame^] | 172 | static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, |
| 173 | struct drm_mm_node *node, |
| 174 | unsigned long size, unsigned alignment, |
| 175 | unsigned long start, unsigned long end) |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 176 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 177 | struct drm_mm *mm = hole_node->mm; |
| 178 | unsigned long tmp = 0, wasted = 0; |
| 179 | unsigned long hole_start = drm_mm_hole_node_start(hole_node); |
| 180 | unsigned long hole_end = drm_mm_hole_node_end(hole_node); |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 181 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 182 | if (hole_start < start) |
| 183 | wasted += start - hole_start; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 184 | if (alignment) |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 185 | tmp = (hole_start + wasted) % alignment; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 186 | |
| 187 | if (tmp) |
| 188 | wasted += alignment - tmp; |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 189 | |
| 190 | if (!wasted) { |
| 191 | hole_node->hole_follows = 0; |
| 192 | list_del_init(&hole_node->hole_stack); |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 193 | } |
| 194 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 195 | node->start = hole_start + wasted; |
| 196 | node->size = size; |
| 197 | node->mm = mm; |
| 198 | |
| 199 | INIT_LIST_HEAD(&node->hole_stack); |
| 200 | list_add(&node->node_list, &hole_node->node_list); |
| 201 | |
| 202 | BUG_ON(node->start + node->size > hole_end); |
| 203 | BUG_ON(node->start + node->size > end); |
| 204 | |
| 205 | if (node->start + node->size < hole_end) { |
| 206 | list_add(&node->hole_stack, &mm->hole_stack); |
| 207 | node->hole_follows = 1; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 208 | } else { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 209 | node->hole_follows = 0; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 210 | } |
Daniel Vetter | 9fc935d | 2011-02-18 17:59:13 +0100 | [diff] [blame^] | 211 | } |
| 212 | |
| 213 | struct drm_mm_node *drm_mm_get_block_range_generic(struct drm_mm_node *hole_node, |
| 214 | unsigned long size, |
| 215 | unsigned alignment, |
| 216 | unsigned long start, |
| 217 | unsigned long end, |
| 218 | int atomic) |
| 219 | { |
| 220 | struct drm_mm_node *node; |
| 221 | |
| 222 | BUG_ON(!hole_node->hole_follows); |
| 223 | |
| 224 | node = drm_mm_kmalloc(hole_node->mm, atomic); |
| 225 | if (unlikely(node == NULL)) |
| 226 | return NULL; |
| 227 | |
| 228 | drm_mm_insert_helper_range(hole_node, node, size, alignment, |
| 229 | start, end); |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 230 | |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 231 | return node; |
| 232 | } |
| 233 | EXPORT_SYMBOL(drm_mm_get_block_range_generic); |
| 234 | |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 235 | /* |
| 236 | * Put a block. Merge with the previous and / or next block if they are free. |
| 237 | * Otherwise add to the free stack. |
| 238 | */ |
| 239 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 240 | void drm_mm_put_block(struct drm_mm_node *node) |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 241 | { |
| 242 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 243 | struct drm_mm *mm = node->mm; |
| 244 | struct drm_mm_node *prev_node; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 245 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 246 | BUG_ON(node->scanned_block || node->scanned_prev_free |
| 247 | || node->scanned_next_free); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 248 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 249 | prev_node = |
| 250 | list_entry(node->node_list.prev, struct drm_mm_node, node_list); |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 251 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 252 | if (node->hole_follows) { |
| 253 | BUG_ON(drm_mm_hole_node_start(node) |
| 254 | == drm_mm_hole_node_end(node)); |
| 255 | list_del(&node->hole_stack); |
| 256 | } else |
| 257 | BUG_ON(drm_mm_hole_node_start(node) |
| 258 | != drm_mm_hole_node_end(node)); |
| 259 | |
| 260 | if (!prev_node->hole_follows) { |
| 261 | prev_node->hole_follows = 1; |
| 262 | list_add(&prev_node->hole_stack, &mm->hole_stack); |
| 263 | } else |
| 264 | list_move(&prev_node->hole_stack, &mm->hole_stack); |
| 265 | |
| 266 | list_del(&node->node_list); |
| 267 | spin_lock(&mm->unused_lock); |
| 268 | if (mm->num_unused < MM_UNUSED_TARGET) { |
| 269 | list_add(&node->node_list, &mm->unused_nodes); |
| 270 | ++mm->num_unused; |
| 271 | } else |
| 272 | kfree(node); |
| 273 | spin_unlock(&mm->unused_lock); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 274 | } |
Eric Anholt | 673a394 | 2008-07-30 12:06:12 -0700 | [diff] [blame] | 275 | EXPORT_SYMBOL(drm_mm_put_block); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 276 | |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 277 | static int check_free_hole(unsigned long start, unsigned long end, |
| 278 | unsigned long size, unsigned alignment) |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 279 | { |
| 280 | unsigned wasted = 0; |
| 281 | |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 282 | if (end - start < size) |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 283 | return 0; |
| 284 | |
| 285 | if (alignment) { |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 286 | unsigned tmp = start % alignment; |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 287 | if (tmp) |
| 288 | wasted = alignment - tmp; |
| 289 | } |
| 290 | |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 291 | if (end >= start + size + wasted) { |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 292 | return 1; |
| 293 | } |
| 294 | |
| 295 | return 0; |
| 296 | } |
| 297 | |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 298 | struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, |
| 299 | unsigned long size, |
| 300 | unsigned alignment, int best_match) |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 301 | { |
Dave Airlie | 5591051 | 2007-07-11 16:53:40 +1000 | [diff] [blame] | 302 | struct drm_mm_node *entry; |
| 303 | struct drm_mm_node *best; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 304 | unsigned long best_size; |
| 305 | |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 306 | BUG_ON(mm->scanned_blocks); |
| 307 | |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 308 | best = NULL; |
| 309 | best_size = ~0UL; |
| 310 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 311 | list_for_each_entry(entry, &mm->hole_stack, hole_stack) { |
| 312 | BUG_ON(!entry->hole_follows); |
| 313 | if (!check_free_hole(drm_mm_hole_node_start(entry), |
| 314 | drm_mm_hole_node_end(entry), |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 315 | size, alignment)) |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 316 | continue; |
| 317 | |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 318 | if (!best_match) |
| 319 | return entry; |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 320 | |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 321 | if (entry->size < best_size) { |
| 322 | best = entry; |
| 323 | best_size = entry->size; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 324 | } |
| 325 | } |
| 326 | |
| 327 | return best; |
| 328 | } |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 329 | EXPORT_SYMBOL(drm_mm_search_free); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 330 | |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 331 | struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, |
| 332 | unsigned long size, |
| 333 | unsigned alignment, |
| 334 | unsigned long start, |
| 335 | unsigned long end, |
| 336 | int best_match) |
| 337 | { |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 338 | struct drm_mm_node *entry; |
| 339 | struct drm_mm_node *best; |
| 340 | unsigned long best_size; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 341 | |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 342 | BUG_ON(mm->scanned_blocks); |
| 343 | |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 344 | best = NULL; |
| 345 | best_size = ~0UL; |
| 346 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 347 | list_for_each_entry(entry, &mm->hole_stack, hole_stack) { |
| 348 | unsigned long adj_start = drm_mm_hole_node_start(entry) < start ? |
| 349 | start : drm_mm_hole_node_start(entry); |
| 350 | unsigned long adj_end = drm_mm_hole_node_end(entry) > end ? |
| 351 | end : drm_mm_hole_node_end(entry); |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 352 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 353 | BUG_ON(!entry->hole_follows); |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 354 | if (!check_free_hole(adj_start, adj_end, size, alignment)) |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 355 | continue; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 356 | |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 357 | if (!best_match) |
| 358 | return entry; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 359 | |
Daniel Vetter | 7a6b289 | 2010-07-02 15:02:15 +0100 | [diff] [blame] | 360 | if (entry->size < best_size) { |
| 361 | best = entry; |
| 362 | best_size = entry->size; |
Jerome Glisse | a2e68e9 | 2009-12-07 15:52:56 +0100 | [diff] [blame] | 363 | } |
| 364 | } |
| 365 | |
| 366 | return best; |
| 367 | } |
| 368 | EXPORT_SYMBOL(drm_mm_search_free_in_range); |
| 369 | |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 370 | /** |
| 371 | * Initializa lru scanning. |
| 372 | * |
| 373 | * This simply sets up the scanning routines with the parameters for the desired |
| 374 | * hole. |
| 375 | * |
| 376 | * Warning: As long as the scan list is non-empty, no other operations than |
| 377 | * adding/removing nodes to/from the scan list are allowed. |
| 378 | */ |
| 379 | void drm_mm_init_scan(struct drm_mm *mm, unsigned long size, |
| 380 | unsigned alignment) |
| 381 | { |
| 382 | mm->scan_alignment = alignment; |
| 383 | mm->scan_size = size; |
| 384 | mm->scanned_blocks = 0; |
| 385 | mm->scan_hit_start = 0; |
| 386 | mm->scan_hit_size = 0; |
Daniel Vetter | d935cc6 | 2010-09-16 15:13:11 +0200 | [diff] [blame] | 387 | mm->scan_check_range = 0; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 388 | } |
| 389 | EXPORT_SYMBOL(drm_mm_init_scan); |
| 390 | |
| 391 | /** |
Daniel Vetter | d935cc6 | 2010-09-16 15:13:11 +0200 | [diff] [blame] | 392 | * Initializa lru scanning. |
| 393 | * |
| 394 | * This simply sets up the scanning routines with the parameters for the desired |
| 395 | * hole. This version is for range-restricted scans. |
| 396 | * |
| 397 | * Warning: As long as the scan list is non-empty, no other operations than |
| 398 | * adding/removing nodes to/from the scan list are allowed. |
| 399 | */ |
| 400 | void drm_mm_init_scan_with_range(struct drm_mm *mm, unsigned long size, |
| 401 | unsigned alignment, |
| 402 | unsigned long start, |
| 403 | unsigned long end) |
| 404 | { |
| 405 | mm->scan_alignment = alignment; |
| 406 | mm->scan_size = size; |
| 407 | mm->scanned_blocks = 0; |
| 408 | mm->scan_hit_start = 0; |
| 409 | mm->scan_hit_size = 0; |
| 410 | mm->scan_start = start; |
| 411 | mm->scan_end = end; |
| 412 | mm->scan_check_range = 1; |
| 413 | } |
| 414 | EXPORT_SYMBOL(drm_mm_init_scan_with_range); |
| 415 | |
| 416 | /** |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 417 | * Add a node to the scan list that might be freed to make space for the desired |
| 418 | * hole. |
| 419 | * |
| 420 | * Returns non-zero, if a hole has been found, zero otherwise. |
| 421 | */ |
| 422 | int drm_mm_scan_add_block(struct drm_mm_node *node) |
| 423 | { |
| 424 | struct drm_mm *mm = node->mm; |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 425 | struct drm_mm_node *prev_node; |
| 426 | unsigned long hole_start, hole_end; |
Daniel Vetter | d935cc6 | 2010-09-16 15:13:11 +0200 | [diff] [blame] | 427 | unsigned long adj_start; |
| 428 | unsigned long adj_end; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 429 | |
| 430 | mm->scanned_blocks++; |
| 431 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 432 | BUG_ON(node->scanned_block); |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 433 | node->scanned_block = 1; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 434 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 435 | prev_node = list_entry(node->node_list.prev, struct drm_mm_node, |
| 436 | node_list); |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 437 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 438 | node->scanned_preceeds_hole = prev_node->hole_follows; |
| 439 | prev_node->hole_follows = 1; |
| 440 | list_del(&node->node_list); |
| 441 | node->node_list.prev = &prev_node->node_list; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 442 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 443 | hole_start = drm_mm_hole_node_start(prev_node); |
| 444 | hole_end = drm_mm_hole_node_end(prev_node); |
Daniel Vetter | d935cc6 | 2010-09-16 15:13:11 +0200 | [diff] [blame] | 445 | if (mm->scan_check_range) { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 446 | adj_start = hole_start < mm->scan_start ? |
| 447 | mm->scan_start : hole_start; |
| 448 | adj_end = hole_end > mm->scan_end ? |
| 449 | mm->scan_end : hole_end; |
Daniel Vetter | d935cc6 | 2010-09-16 15:13:11 +0200 | [diff] [blame] | 450 | } else { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 451 | adj_start = hole_start; |
| 452 | adj_end = hole_end; |
Daniel Vetter | d935cc6 | 2010-09-16 15:13:11 +0200 | [diff] [blame] | 453 | } |
| 454 | |
| 455 | if (check_free_hole(adj_start , adj_end, |
Daniel Vetter | 7521473 | 2010-08-26 21:44:17 +0200 | [diff] [blame] | 456 | mm->scan_size, mm->scan_alignment)) { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 457 | mm->scan_hit_start = hole_start; |
| 458 | mm->scan_hit_size = hole_end; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 459 | |
| 460 | return 1; |
| 461 | } |
| 462 | |
| 463 | return 0; |
| 464 | } |
| 465 | EXPORT_SYMBOL(drm_mm_scan_add_block); |
| 466 | |
| 467 | /** |
| 468 | * Remove a node from the scan list. |
| 469 | * |
| 470 | * Nodes _must_ be removed in the exact same order from the scan list as they |
| 471 | * have been added, otherwise the internal state of the memory manager will be |
| 472 | * corrupted. |
| 473 | * |
| 474 | * When the scan list is empty, the selected memory nodes can be freed. An |
| 475 | * immediatly following drm_mm_search_free with best_match = 0 will then return |
| 476 | * the just freed block (because its at the top of the free_stack list). |
| 477 | * |
| 478 | * Returns one if this block should be evicted, zero otherwise. Will always |
| 479 | * return zero when no hole has been found. |
| 480 | */ |
| 481 | int drm_mm_scan_remove_block(struct drm_mm_node *node) |
| 482 | { |
| 483 | struct drm_mm *mm = node->mm; |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 484 | struct drm_mm_node *prev_node; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 485 | |
| 486 | mm->scanned_blocks--; |
| 487 | |
| 488 | BUG_ON(!node->scanned_block); |
| 489 | node->scanned_block = 0; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 490 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 491 | prev_node = list_entry(node->node_list.prev, struct drm_mm_node, |
| 492 | node_list); |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 493 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 494 | prev_node->hole_follows = node->scanned_preceeds_hole; |
| 495 | INIT_LIST_HEAD(&node->node_list); |
| 496 | list_add(&node->node_list, &prev_node->node_list); |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 497 | |
| 498 | /* Only need to check for containement because start&size for the |
| 499 | * complete resulting free block (not just the desired part) is |
| 500 | * stored. */ |
| 501 | if (node->start >= mm->scan_hit_start && |
| 502 | node->start + node->size |
| 503 | <= mm->scan_hit_start + mm->scan_hit_size) { |
| 504 | return 1; |
| 505 | } |
| 506 | |
| 507 | return 0; |
| 508 | } |
| 509 | EXPORT_SYMBOL(drm_mm_scan_remove_block); |
| 510 | |
Dave Airlie | 5591051 | 2007-07-11 16:53:40 +1000 | [diff] [blame] | 511 | int drm_mm_clean(struct drm_mm * mm) |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 512 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 513 | struct list_head *head = &mm->head_node.node_list; |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 514 | |
| 515 | return (head->next->next == head); |
| 516 | } |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 517 | EXPORT_SYMBOL(drm_mm_clean); |
Thomas Hellstrom | 1d58420 | 2007-01-08 22:25:47 +1100 | [diff] [blame] | 518 | |
Dave Airlie | 5591051 | 2007-07-11 16:53:40 +1000 | [diff] [blame] | 519 | int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size) |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 520 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 521 | INIT_LIST_HEAD(&mm->hole_stack); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 522 | INIT_LIST_HEAD(&mm->unused_nodes); |
| 523 | mm->num_unused = 0; |
Daniel Vetter | 709ea97 | 2010-07-02 15:02:16 +0100 | [diff] [blame] | 524 | mm->scanned_blocks = 0; |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 525 | spin_lock_init(&mm->unused_lock); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 526 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 527 | /* Clever trick to avoid a special case in the free hole tracking. */ |
| 528 | INIT_LIST_HEAD(&mm->head_node.node_list); |
| 529 | INIT_LIST_HEAD(&mm->head_node.hole_stack); |
| 530 | mm->head_node.hole_follows = 1; |
| 531 | mm->head_node.scanned_block = 0; |
| 532 | mm->head_node.scanned_prev_free = 0; |
| 533 | mm->head_node.scanned_next_free = 0; |
| 534 | mm->head_node.mm = mm; |
| 535 | mm->head_node.start = start + size; |
| 536 | mm->head_node.size = start - mm->head_node.start; |
| 537 | list_add_tail(&mm->head_node.hole_stack, &mm->hole_stack); |
| 538 | |
| 539 | return 0; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 540 | } |
Eric Anholt | 673a394 | 2008-07-30 12:06:12 -0700 | [diff] [blame] | 541 | EXPORT_SYMBOL(drm_mm_init); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 542 | |
Dave Airlie | 5591051 | 2007-07-11 16:53:40 +1000 | [diff] [blame] | 543 | void drm_mm_takedown(struct drm_mm * mm) |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 544 | { |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 545 | struct drm_mm_node *entry, *next; |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 546 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 547 | if (!list_empty(&mm->head_node.node_list)) { |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 548 | DRM_ERROR("Memory manager not clean. Delaying takedown\n"); |
| 549 | return; |
| 550 | } |
| 551 | |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 552 | spin_lock(&mm->unused_lock); |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 553 | list_for_each_entry_safe(entry, next, &mm->unused_nodes, node_list) { |
| 554 | list_del(&entry->node_list); |
Jerome Glisse | 249d604 | 2009-04-08 17:11:16 +0200 | [diff] [blame] | 555 | kfree(entry); |
| 556 | --mm->num_unused; |
| 557 | } |
| 558 | spin_unlock(&mm->unused_lock); |
| 559 | |
| 560 | BUG_ON(mm->num_unused != 0); |
Thomas Hellstrom | 3a1bd92 | 2006-08-07 21:30:28 +1000 | [diff] [blame] | 561 | } |
Dave Airlie | f453ba0 | 2008-11-07 14:05:41 -0800 | [diff] [blame] | 562 | EXPORT_SYMBOL(drm_mm_takedown); |
Dave Airlie | fa8a123 | 2009-08-26 13:13:37 +1000 | [diff] [blame] | 563 | |
Jerome Glisse | 99d7e48 | 2009-12-09 21:55:09 +0100 | [diff] [blame] | 564 | void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) |
| 565 | { |
| 566 | struct drm_mm_node *entry; |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 567 | unsigned long total_used = 0, total_free = 0, total = 0; |
| 568 | unsigned long hole_start, hole_end, hole_size; |
Jerome Glisse | 99d7e48 | 2009-12-09 21:55:09 +0100 | [diff] [blame] | 569 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 570 | hole_start = drm_mm_hole_node_start(&mm->head_node); |
| 571 | hole_end = drm_mm_hole_node_end(&mm->head_node); |
| 572 | hole_size = hole_end - hole_start; |
| 573 | if (hole_size) |
| 574 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", |
| 575 | prefix, hole_start, hole_end, |
| 576 | hole_size); |
| 577 | total_free += hole_size; |
| 578 | |
| 579 | drm_mm_for_each_node(entry, mm) { |
| 580 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: used\n", |
Jerome Glisse | 99d7e48 | 2009-12-09 21:55:09 +0100 | [diff] [blame] | 581 | prefix, entry->start, entry->start + entry->size, |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 582 | entry->size); |
| 583 | total_used += entry->size; |
| 584 | |
| 585 | if (entry->hole_follows) { |
| 586 | hole_start = drm_mm_hole_node_start(entry); |
| 587 | hole_end = drm_mm_hole_node_end(entry); |
| 588 | hole_size = hole_end - hole_start; |
| 589 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", |
| 590 | prefix, hole_start, hole_end, |
| 591 | hole_size); |
| 592 | total_free += hole_size; |
| 593 | } |
Jerome Glisse | 99d7e48 | 2009-12-09 21:55:09 +0100 | [diff] [blame] | 594 | } |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 595 | total = total_free + total_used; |
| 596 | |
| 597 | printk(KERN_DEBUG "%s total: %lu, used %lu free %lu\n", prefix, total, |
Jerome Glisse | 99d7e48 | 2009-12-09 21:55:09 +0100 | [diff] [blame] | 598 | total_used, total_free); |
| 599 | } |
| 600 | EXPORT_SYMBOL(drm_mm_debug_table); |
| 601 | |
Dave Airlie | fa8a123 | 2009-08-26 13:13:37 +1000 | [diff] [blame] | 602 | #if defined(CONFIG_DEBUG_FS) |
| 603 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) |
| 604 | { |
| 605 | struct drm_mm_node *entry; |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 606 | unsigned long total_used = 0, total_free = 0, total = 0; |
| 607 | unsigned long hole_start, hole_end, hole_size; |
Dave Airlie | fa8a123 | 2009-08-26 13:13:37 +1000 | [diff] [blame] | 608 | |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 609 | hole_start = drm_mm_hole_node_start(&mm->head_node); |
| 610 | hole_end = drm_mm_hole_node_end(&mm->head_node); |
| 611 | hole_size = hole_end - hole_start; |
| 612 | if (hole_size) |
| 613 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", |
| 614 | hole_start, hole_end, hole_size); |
| 615 | total_free += hole_size; |
| 616 | |
| 617 | drm_mm_for_each_node(entry, mm) { |
| 618 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n", |
| 619 | entry->start, entry->start + entry->size, |
| 620 | entry->size); |
| 621 | total_used += entry->size; |
| 622 | if (entry->hole_follows) { |
| 623 | hole_start = drm_mm_hole_node_start(&mm->head_node); |
| 624 | hole_end = drm_mm_hole_node_end(&mm->head_node); |
| 625 | hole_size = hole_end - hole_start; |
| 626 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", |
| 627 | hole_start, hole_end, hole_size); |
| 628 | total_free += hole_size; |
| 629 | } |
Dave Airlie | fa8a123 | 2009-08-26 13:13:37 +1000 | [diff] [blame] | 630 | } |
Daniel Vetter | ea7b1dd | 2011-02-18 17:59:12 +0100 | [diff] [blame] | 631 | total = total_free + total_used; |
| 632 | |
| 633 | seq_printf(m, "total: %lu, used %lu free %lu\n", total, total_used, total_free); |
Dave Airlie | fa8a123 | 2009-08-26 13:13:37 +1000 | [diff] [blame] | 634 | return 0; |
| 635 | } |
| 636 | EXPORT_SYMBOL(drm_mm_dump_table); |
| 637 | #endif |