[PATCH 8/9] drm/vram-helper: stop implementing init_mem_type

Thomas Zimmermann tzimmermann at suse.de
Fri Jul 24 06:51:21 UTC 2020



Am 23.07.20 um 17:17 schrieb Christian König:
> Instead just initialize the memory type parameters
> before calling ttm_bo_init_mm.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Thomas Zimmermann <tzimmermann at suse.de>

> ---
>  drivers/gpu/drm/drm_gem_vram_helper.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> index 801a14c6e9e0..f7f93a49cd7f 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -1007,18 +1007,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,
>  static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
>  				   struct ttm_mem_type_manager *man)
>  {
> -	switch (type) {
> -	case TTM_PL_SYSTEM:
> -		break;
> -	case TTM_PL_VRAM:
> -		man->func = &ttm_bo_manager_func;
> -		man->available_caching = TTM_PL_FLAG_UNCACHED |
> -					 TTM_PL_FLAG_WC;
> -		man->default_caching = TTM_PL_FLAG_WC;
> -		break;
> -	default:
> -		return -EINVAL;
> -	}
>  	return 0;
>  }
>  
> @@ -1126,6 +1114,7 @@ EXPORT_SYMBOL(drm_vram_mm_debugfs_init);
>  static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
>  			    uint64_t vram_base, size_t vram_size)
>  {
> +	struct ttm_mem_type_manager *man = &vmm->bdev.man[TTM_PL_VRAM];
>  	int ret;
>  
>  	vmm->vram_base = vram_base;
> @@ -1138,6 +1127,9 @@ static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> +	man->func = &ttm_bo_manager_func;
> +	man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
> +	man->default_caching = TTM_PL_FLAG_WC;
>  	ret = ttm_bo_init_mm(&vmm->bdev, TTM_PL_VRAM, vram_size >> PAGE_SHIFT);
>  	if (ret)
>  		return ret;
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 516 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200724/54d8cfcf/attachment-0001.sig>


More information about the dri-devel mailing list