[PATCH 47/49] drm/ttm: drop list of memory managers from device.

Christian König christian.koenig at amd.com
Fri Jul 31 14:57:05 UTC 2020


Am 31.07.20 um 06:05 schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
>
> The driver now controls these, the core just controls the system
> memory one.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c    | 2 --
>   include/drm/ttm/ttm_bo_driver.h | 6 ++++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index f2b41c4d7d51..f35548ff17e8 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1608,8 +1608,6 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
>   
>   	bdev->driver = driver;
>   
> -	memset(bdev->man_priv, 0, sizeof(bdev->man_priv));
> -
>   	ttm_bo_init_sysman(bdev);
>   
>   	bdev->vma_manager = vma_manager;
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index bfc549782775..b2ffeaed94e7 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -414,7 +414,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 sysman; /* move to global */
>   	struct ttm_mem_type_manager *man_drv[TTM_NUM_MEM_TYPES];
>   	/*
>   	 * Protected by internal locks.
> @@ -446,9 +446,11 @@ struct ttm_bo_device {
>   static inline struct ttm_mem_type_manager *ttm_manager_type(struct ttm_bo_device *bdev,
>   							    int mem_type)
>   {
> +	if (mem_type == TTM_PL_SYSTEM)
> +		return &bdev->sysman;
>   	if (bdev->man_drv[mem_type])
>   		return bdev->man_drv[mem_type];
> -	return &bdev->man_priv[mem_type];
> +	return NULL;

Could be simplified to "return bdev->man_drv[mem_type];" if we just 
assign bdev->man_drv[TTM_PL_SYSTEM] during driver init.

Christian.

>   }
>   
>   static inline void ttm_set_driver_manager(struct ttm_bo_device *bdev,



More information about the dri-devel mailing list