From: Michel Dänzer <michel.daen...@amd.com> For placing a BO strictly from the bottom up, i.e. in the lowest hole which can hold it.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- drivers/gpu/drm/ttm/ttm_bo_manager.c | 5 +++++ include/drm/ttm/ttm_placement.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c index aa0bd05..a64397b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_manager.c +++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c @@ -73,6 +73,11 @@ static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man, aflags = DRM_MM_CREATE_TOP; } + if (place->flags & TTM_PL_FLAG_BOTTOMUP) { + sflags = DRM_MM_SEARCH_DEFAULT; + aflags = DRM_MM_CREATE_DEFAULT; + } + spin_lock(&rman->lock); ret = drm_mm_insert_node_in_range_generic(mm, node, mem->num_pages, mem->page_alignment, 0, diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index 8ed44f9..c9ae86a 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -66,7 +66,9 @@ * TTM_PL_FLAG_NO_EVICT means that the buffer may never * be evicted to make room for other buffers. * TTM_PL_FLAG_TOPDOWN requests to be placed from the - * top of the memory area, instead of the bottom. + * top of the memory area. + * TTM_PL_FLAG_BOTTOMUP requests to be placed from the + * bottom of the memory area. */ #define TTM_PL_FLAG_CACHED (1 << 16) @@ -75,6 +77,7 @@ #define TTM_PL_FLAG_SHARED (1 << 20) #define TTM_PL_FLAG_NO_EVICT (1 << 21) #define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_BOTTOMUP (1 << 23) #define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ TTM_PL_FLAG_UNCACHED | \ -- 2.1.1