diff options
author | Dave Airlie <airlied@redhat.com> | 2020-08-04 12:56:17 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-08-06 13:12:21 +1000 |
commit | d398811ebfa80329269932803a6e78dc01c79bf1 (patch) | |
tree | ded78d11c134148e2c4ce8f600abad0f0c1a7c37 /include/drm/ttm | |
parent | 01057278bc68610389e32ffe3a8335aff38a84ce (diff) |
drm/ttm: allow drivers to provide their own manager subclasses
This will get removed eventually and all drivers will use this.
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-45-airlied@gmail.com
Diffstat (limited to 'include/drm/ttm')
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index f97c047b6a3a..ce15eb075241 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -419,7 +419,7 @@ struct ttm_bo_device { * access via ttm_manager_type. */ struct ttm_mem_type_manager man_priv[TTM_NUM_MEM_TYPES]; - + struct ttm_mem_type_manager *man_drv[TTM_NUM_MEM_TYPES]; /* * Protected by internal locks. */ @@ -450,9 +450,18 @@ struct ttm_bo_device { static inline struct ttm_mem_type_manager *ttm_manager_type(struct ttm_bo_device *bdev, int mem_type) { + if (bdev->man_drv[mem_type]) + return bdev->man_drv[mem_type]; return &bdev->man_priv[mem_type]; } +static inline void ttm_set_driver_manager(struct ttm_bo_device *bdev, + int type, + struct ttm_mem_type_manager *manager) +{ + bdev->man_drv[type] = manager; +} + /** * struct ttm_lru_bulk_move_pos * |