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

daniel at ffwll.ch daniel at ffwll.ch
Fri Jul 31 09:55:28 UTC 2020


On Fri, Jul 31, 2020 at 02:05:18PM +1000, Dave Airlie wrote:
> 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 */

Not sure we want to move this to global. With the shrinker rework ideas I
discussed with Christian somewhere (I think) we could easily do a
per-device shrinker. And then global kinda completely disappears (minus
maybe a drm-global limit on how much crap you can permanently pin in
system memory for scanout, but that's a different thing I think).
-Daniel

>  	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;
>  }
>  
>  static inline void ttm_set_driver_manager(struct ttm_bo_device *bdev,
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list