Commit c165812c authored by Michel Dänzer's avatar Michel Dänzer Committed by Alex Deucher

drm/ttm: Add DRM_MM_SEARCH_BELOW for TTM_PL_FLAG_TOPDOWN

If the BO should be placed at the top of the area, we should start looking
for holes from the top.
Reviewed-by: default avatarLauri Kasanen <cand@gmx.com>
Signed-off-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a8b5ebe6
...@@ -55,6 +55,7 @@ static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man, ...@@ -55,6 +55,7 @@ static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man,
struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
struct drm_mm *mm = &rman->mm; struct drm_mm *mm = &rman->mm;
struct drm_mm_node *node = NULL; struct drm_mm_node *node = NULL;
enum drm_mm_search_flags sflags = DRM_MM_SEARCH_BEST;
enum drm_mm_allocator_flags aflags = DRM_MM_CREATE_DEFAULT; enum drm_mm_allocator_flags aflags = DRM_MM_CREATE_DEFAULT;
unsigned long lpfn; unsigned long lpfn;
int ret; int ret;
...@@ -67,15 +68,16 @@ static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man, ...@@ -67,15 +68,16 @@ static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man,
if (!node) if (!node)
return -ENOMEM; return -ENOMEM;
if (place->flags & TTM_PL_FLAG_TOPDOWN) if (place->flags & TTM_PL_FLAG_TOPDOWN) {
sflags |= DRM_MM_SEARCH_BELOW;
aflags = DRM_MM_CREATE_TOP; aflags = DRM_MM_CREATE_TOP;
}
spin_lock(&rman->lock); spin_lock(&rman->lock);
ret = drm_mm_insert_node_in_range_generic(mm, node, mem->num_pages, ret = drm_mm_insert_node_in_range_generic(mm, node, mem->num_pages,
mem->page_alignment, 0, mem->page_alignment, 0,
place->fpfn, lpfn, place->fpfn, lpfn,
DRM_MM_SEARCH_BEST, sflags, aflags);
aflags);
spin_unlock(&rman->lock); spin_unlock(&rman->lock);
if (unlikely(ret)) { if (unlikely(ret)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment