drm/ttm: make eviction decision a driver callback v2
This way the driver can decide if it is valuable to evict a BO or not. The current implementation is added as default to all existing drivers. v2: fix some typos found during internal testing Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:

committed by
Alex Deucher

parent
585ffd6544
commit
a2ab19fed9
@@ -47,6 +47,8 @@ struct drm_mm_node;
|
||||
|
||||
struct ttm_placement;
|
||||
|
||||
struct ttm_place;
|
||||
|
||||
/**
|
||||
* struct ttm_bus_placement
|
||||
*
|
||||
@@ -395,6 +397,17 @@ extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev);
|
||||
extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
|
||||
int resched);
|
||||
|
||||
/**
|
||||
* ttm_bo_eviction_valuable
|
||||
*
|
||||
* @bo: The buffer object to evict
|
||||
* @place: the placement we need to make room for
|
||||
*
|
||||
* Check if it is valuable to evict the BO to make room for the given placement.
|
||||
*/
|
||||
bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
|
||||
const struct ttm_place *place);
|
||||
|
||||
/**
|
||||
* ttm_bo_synccpu_write_grab
|
||||
*
|
||||
|
@@ -374,6 +374,18 @@ struct ttm_bo_driver {
|
||||
int (*invalidate_caches)(struct ttm_bo_device *bdev, uint32_t flags);
|
||||
int (*init_mem_type)(struct ttm_bo_device *bdev, uint32_t type,
|
||||
struct ttm_mem_type_manager *man);
|
||||
|
||||
/**
|
||||
* struct ttm_bo_driver member eviction_valuable
|
||||
*
|
||||
* @bo: the buffer object to be evicted
|
||||
* @place: placement we need room for
|
||||
*
|
||||
* Check with the driver if it is valuable to evict a BO to make room
|
||||
* for a certain placement.
|
||||
*/
|
||||
bool (*eviction_valuable)(struct ttm_buffer_object *bo,
|
||||
const struct ttm_place *place);
|
||||
/**
|
||||
* struct ttm_bo_driver member evict_flags:
|
||||
*
|
||||
|
Reference in New Issue
Block a user