drm/ttm: add BO priorities for the LRUs

This way the driver can specify a priority for a BO which has the effect that
a BO is only evicted when all other BOs with a lower priority are evicted
first.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger.He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Christian König
2017-01-10 14:08:28 +01:00
committed by Alex Deucher
parent 2ee7fc92cf
commit cf6c467d67
4 changed files with 52 additions and 27 deletions

View File

@@ -42,6 +42,8 @@
#include <linux/spinlock.h>
#include <linux/reservation.h>
#define TTM_MAX_BO_PRIORITY 16
struct ttm_backend_func {
/**
* struct ttm_backend_func member bind
@@ -298,7 +300,7 @@ struct ttm_mem_type_manager {
* Protected by the global->lru_lock.
*/
struct list_head lru;
struct list_head lru[TTM_MAX_BO_PRIORITY];
/*
* Protected by @move_lock.
@@ -518,7 +520,7 @@ struct ttm_bo_global {
/**
* Protected by the lru_lock.
*/
struct list_head swap_lru;
struct list_head swap_lru[TTM_MAX_BO_PRIORITY];
/**
* Internal protection.