mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
drm/ttm: add lru notify to bo driver v2
allow driver do somethings when lru changed. v2: address Michel's comments. Signed-off-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
466bcb75b0
commit
ae6d343541
2 changed files with 16 additions and 4 deletions
|
@ -198,19 +198,22 @@ static void ttm_bo_ref_bug(struct kref *list_kref)
|
||||||
|
|
||||||
void ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
|
void ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
|
||||||
{
|
{
|
||||||
|
struct ttm_bo_device *bdev = bo->bdev;
|
||||||
|
bool notify = false;
|
||||||
|
|
||||||
if (!list_empty(&bo->swap)) {
|
if (!list_empty(&bo->swap)) {
|
||||||
list_del_init(&bo->swap);
|
list_del_init(&bo->swap);
|
||||||
kref_put(&bo->list_kref, ttm_bo_ref_bug);
|
kref_put(&bo->list_kref, ttm_bo_ref_bug);
|
||||||
|
notify = true;
|
||||||
}
|
}
|
||||||
if (!list_empty(&bo->lru)) {
|
if (!list_empty(&bo->lru)) {
|
||||||
list_del_init(&bo->lru);
|
list_del_init(&bo->lru);
|
||||||
kref_put(&bo->list_kref, ttm_bo_ref_bug);
|
kref_put(&bo->list_kref, ttm_bo_ref_bug);
|
||||||
|
notify = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (notify && bdev->driver->del_from_lru_notify)
|
||||||
* TODO: Add a driver hook to delete from
|
bdev->driver->del_from_lru_notify(bo);
|
||||||
* driver-specific LRU's here.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo)
|
void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo)
|
||||||
|
|
|
@ -381,6 +381,15 @@ struct ttm_bo_driver {
|
||||||
*/
|
*/
|
||||||
int (*access_memory)(struct ttm_buffer_object *bo, unsigned long offset,
|
int (*access_memory)(struct ttm_buffer_object *bo, unsigned long offset,
|
||||||
void *buf, int len, int write);
|
void *buf, int len, int write);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct ttm_bo_driver member del_from_lru_notify
|
||||||
|
*
|
||||||
|
* @bo: the buffer object deleted from lru
|
||||||
|
*
|
||||||
|
* notify driver that a BO was deleted from LRU.
|
||||||
|
*/
|
||||||
|
void (*del_from_lru_notify)(struct ttm_buffer_object *bo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue