diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-12-07 15:37:06 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-12-18 15:55:25 -0500 |
commit | b81034506fc9b879cb726feb01342be0cdbe6e25 (patch) | |
tree | 5fba979473159b2786b77cea622cce9581454760 | |
parent | b0a2658acb5bf9ca86b4aab011b7106de3af0add (diff) |
drm: Export routines for inserting preallocated nodes into the mm manager
Required by i915 in order to avoid the allocation in the middle of
manipulating the drm_mm lists.
Use a pair of stubs to preserve the existing EXPORT_SYMBOLs for
backporting; to be removed later.
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
[danvet: bikeshedded-away the atomic parameter, it's not yet used
anywhere.]
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 41 | ||||
-rw-r--r-- | include/drm/drm_mm.h | 25 |
2 files changed, 50 insertions, 16 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 0761a03cdbb..2bf9670ba29 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -184,19 +184,27 @@ EXPORT_SYMBOL(drm_mm_get_block_generic); | |||
184 | * -ENOSPC if no suitable free area is available. The preallocated memory node | 184 | * -ENOSPC if no suitable free area is available. The preallocated memory node |
185 | * must be cleared. | 185 | * must be cleared. |
186 | */ | 186 | */ |
187 | int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, | 187 | int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node, |
188 | unsigned long size, unsigned alignment) | 188 | unsigned long size, unsigned alignment, |
189 | unsigned long color) | ||
189 | { | 190 | { |
190 | struct drm_mm_node *hole_node; | 191 | struct drm_mm_node *hole_node; |
191 | 192 | ||
192 | hole_node = drm_mm_search_free(mm, size, alignment, false); | 193 | hole_node = drm_mm_search_free_generic(mm, size, alignment, |
194 | color, 0); | ||
193 | if (!hole_node) | 195 | if (!hole_node) |
194 | return -ENOSPC; | 196 | return -ENOSPC; |
195 | 197 | ||
196 | drm_mm_insert_helper(hole_node, node, size, alignment, 0); | 198 | drm_mm_insert_helper(hole_node, node, size, alignment, color); |
197 | |||
198 | return 0; | 199 | return 0; |
199 | } | 200 | } |
201 | EXPORT_SYMBOL(drm_mm_insert_node_generic); | ||
202 | |||
203 | int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, | ||
204 | unsigned long size, unsigned alignment) | ||
205 | { | ||
206 | return drm_mm_insert_node_generic(mm, node, size, alignment, 0); | ||
207 | } | ||
200 | EXPORT_SYMBOL(drm_mm_insert_node); | 208 | EXPORT_SYMBOL(drm_mm_insert_node); |
201 | 209 | ||
202 | static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, | 210 | static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, |
@@ -275,22 +283,31 @@ EXPORT_SYMBOL(drm_mm_get_block_range_generic); | |||
275 | * -ENOSPC if no suitable free area is available. This is for range | 283 | * -ENOSPC if no suitable free area is available. This is for range |
276 | * restricted allocations. The preallocated memory node must be cleared. | 284 | * restricted allocations. The preallocated memory node must be cleared. |
277 | */ | 285 | */ |
278 | int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, | 286 | int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node, |
279 | unsigned long size, unsigned alignment, | 287 | unsigned long size, unsigned alignment, unsigned long color, |
280 | unsigned long start, unsigned long end) | 288 | unsigned long start, unsigned long end) |
281 | { | 289 | { |
282 | struct drm_mm_node *hole_node; | 290 | struct drm_mm_node *hole_node; |
283 | 291 | ||
284 | hole_node = drm_mm_search_free_in_range(mm, size, alignment, | 292 | hole_node = drm_mm_search_free_in_range_generic(mm, |
285 | start, end, false); | 293 | size, alignment, color, |
294 | start, end, 0); | ||
286 | if (!hole_node) | 295 | if (!hole_node) |
287 | return -ENOSPC; | 296 | return -ENOSPC; |
288 | 297 | ||
289 | drm_mm_insert_helper_range(hole_node, node, size, alignment, 0, | 298 | drm_mm_insert_helper_range(hole_node, node, |
299 | size, alignment, color, | ||
290 | start, end); | 300 | start, end); |
291 | |||
292 | return 0; | 301 | return 0; |
293 | } | 302 | } |
303 | EXPORT_SYMBOL(drm_mm_insert_node_in_range_generic); | ||
304 | |||
305 | int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, | ||
306 | unsigned long size, unsigned alignment, | ||
307 | unsigned long start, unsigned long end) | ||
308 | { | ||
309 | return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 0, start, end); | ||
310 | } | ||
294 | EXPORT_SYMBOL(drm_mm_insert_node_in_range); | 311 | EXPORT_SYMBOL(drm_mm_insert_node_in_range); |
295 | 312 | ||
296 | /** | 313 | /** |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 06d7f798a08..0f4a366f6fa 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -158,12 +158,29 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range( | |||
158 | return drm_mm_get_block_range_generic(parent, size, alignment, 0, | 158 | return drm_mm_get_block_range_generic(parent, size, alignment, 0, |
159 | start, end, 1); | 159 | start, end, 1); |
160 | } | 160 | } |
161 | extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, | 161 | |
162 | unsigned long size, unsigned alignment); | 162 | extern int drm_mm_insert_node(struct drm_mm *mm, |
163 | struct drm_mm_node *node, | ||
164 | unsigned long size, | ||
165 | unsigned alignment); | ||
163 | extern int drm_mm_insert_node_in_range(struct drm_mm *mm, | 166 | extern int drm_mm_insert_node_in_range(struct drm_mm *mm, |
164 | struct drm_mm_node *node, | 167 | struct drm_mm_node *node, |
165 | unsigned long size, unsigned alignment, | 168 | unsigned long size, |
166 | unsigned long start, unsigned long end); | 169 | unsigned alignment, |
170 | unsigned long start, | ||
171 | unsigned long end); | ||
172 | extern int drm_mm_insert_node_generic(struct drm_mm *mm, | ||
173 | struct drm_mm_node *node, | ||
174 | unsigned long size, | ||
175 | unsigned alignment, | ||
176 | unsigned long color); | ||
177 | extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, | ||
178 | struct drm_mm_node *node, | ||
179 | unsigned long size, | ||
180 | unsigned alignment, | ||
181 | unsigned long color, | ||
182 | unsigned long start, | ||
183 | unsigned long end); | ||
167 | extern void drm_mm_put_block(struct drm_mm_node *cur); | 184 | extern void drm_mm_put_block(struct drm_mm_node *cur); |
168 | extern void drm_mm_remove_node(struct drm_mm_node *node); | 185 | extern void drm_mm_remove_node(struct drm_mm_node *node); |
169 | extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); | 186 | extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); |