[PATCH] drm/ttm: remove default caching

Dave Airlie airlied at gmail.com
Mon Sep 14 21:52:47 UTC 2020


Reviewed-by: Dave Airlie <airlied at redhat.com>

On Fri, 11 Sep 2020 at 23:10, Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> As far as I can tell this was never used either and we just
> always fallback to the order cached > wc > uncached anyway.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c   |  1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c  |  1 -
>  drivers/gpu/drm/drm_gem_vram_helper.c         |  3 +--
>  drivers/gpu/drm/nouveau/nouveau_ttm.c         | 21 +++++++------------
>  drivers/gpu/drm/qxl/qxl_ttm.c                 |  2 +-
>  drivers/gpu/drm/radeon/radeon_ttm.c           |  6 ++----
>  drivers/gpu/drm/ttm/ttm_bo.c                  |  3 ---
>  drivers/gpu/drm/ttm/ttm_range_manager.c       |  2 --
>  drivers/gpu/drm/ttm/ttm_resource.c            |  1 -
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c           |  4 ++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c |  1 -
>  drivers/gpu/drm/vmwgfx/vmwgfx_thp.c           |  1 -
>  include/drm/ttm/ttm_bo_driver.h               |  2 --
>  include/drm/ttm/ttm_resource.h                |  3 ---
>  15 files changed, 14 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> index 697bc2c6fdb2..b2ca693b8285 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> @@ -94,7 +94,6 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size)
>         man->use_tt = true;
>         man->func = &amdgpu_gtt_mgr_func;
>         man->available_caching = TTM_PL_MASK_CACHING;
> -       man->default_caching = TTM_PL_FLAG_CACHED;
>
>         ttm_resource_manager_init(man, gtt_size >> PAGE_SHIFT);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 651365183e75..96aa8fcb9115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -68,7 +68,7 @@ static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
>                                     uint64_t size)
>  {
>         return ttm_range_man_init(&adev->mman.bdev, type,
> -                                 TTM_PL_FLAG_UNCACHED, TTM_PL_FLAG_UNCACHED,
> +                                 TTM_PL_FLAG_UNCACHED,
>                                   false, size >> PAGE_SHIFT);
>  }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 7574be6cd7a0..8b4a9ab66586 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -178,7 +178,6 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
>         int ret;
>
>         man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
> -       man->default_caching = TTM_PL_FLAG_WC;
>
>         ttm_resource_manager_init(man, adev->gmc.real_vram_size >> PAGE_SHIFT);
>
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> index 5f10aa7aa099..34dc665eb891 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -1106,8 +1106,7 @@ static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
>
>         ret = ttm_range_man_init(&vmm->bdev, TTM_PL_VRAM,
>                                  TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
> -                                TTM_PL_FLAG_WC, false,
> -                                vram_size >> PAGE_SHIFT);
> +                                false, vram_size >> PAGE_SHIFT);
>         if (ret)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
> index a62f37b1131c..cf18f75cd0f1 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
> @@ -203,12 +203,9 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm)
>                         return -ENOMEM;
>
>                 man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
> -               man->default_caching = TTM_PL_FLAG_WC;
>
> -               if (type & NVIF_MEM_UNCACHED) {
> +               if (type & NVIF_MEM_UNCACHED)
>                         man->available_caching = TTM_PL_FLAG_UNCACHED;
> -                       man->default_caching = TTM_PL_FLAG_UNCACHED;
> -               }
>
>                 man->func = &nouveau_vram_manager;
>
> @@ -220,7 +217,7 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm)
>         } else {
>                 return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_VRAM,
>                                           TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
> -                                         TTM_PL_FLAG_WC, false,
> +                                         false,
>                                           drm->gem.vram_available >> PAGE_SHIFT);
>         }
>  }
> @@ -245,16 +242,14 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
>  {
>         struct ttm_resource_manager *man;
>         unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT;
> -       unsigned available_caching, default_caching;
>         const struct ttm_resource_manager_func *func = NULL;
> -       if (drm->agp.bridge) {
> +       unsigned available_caching;
> +
> +       if (drm->agp.bridge)
>                 available_caching = TTM_PL_FLAG_UNCACHED |
>                         TTM_PL_FLAG_WC;
> -               default_caching = TTM_PL_FLAG_WC;
> -       } else {
> +       else
>                 available_caching = TTM_PL_MASK_CACHING;
> -               default_caching = TTM_PL_FLAG_CACHED;
> -       }
>
>         if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
>                 func = &nouveau_gart_manager;
> @@ -262,8 +257,7 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
>                 func = &nv04_gart_manager;
>         else
>                 return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_TT,
> -                                         available_caching, default_caching,
> -                                         true,
> +                                         available_caching, true,
>                                           size_pages);
>
>         man = kzalloc(sizeof(*man), GFP_KERNEL);
> @@ -272,7 +266,6 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
>
>         man->func = func;
>         man->available_caching = available_caching;
> -       man->default_caching = default_caching;
>         man->use_tt = true;
>         ttm_resource_manager_init(man, size_pages);
>         ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, man);
> diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
> index 5ffc8b752f01..d39d7994ea34 100644
> --- a/drivers/gpu/drm/qxl/qxl_ttm.c
> +++ b/drivers/gpu/drm/qxl/qxl_ttm.c
> @@ -203,7 +203,7 @@ static int qxl_ttm_init_mem_type(struct qxl_device *qdev,
>                                  uint64_t size)
>  {
>         return ttm_range_man_init(&qdev->mman.bdev, type, TTM_PL_MASK_CACHING,
> -                                 TTM_PL_FLAG_CACHED, false, size);
> +                                 false, size);
>  }
>
>  int qxl_ttm_init(struct qxl_device *qdev)
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 602a591a53dc..b8e60b3630d7 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -70,16 +70,14 @@ static int radeon_ttm_init_vram(struct radeon_device *rdev)
>  {
>         return ttm_range_man_init(&rdev->mman.bdev, TTM_PL_VRAM,
>                                   TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
> -                                 TTM_PL_FLAG_WC, false,
> -                                 rdev->mc.real_vram_size >> PAGE_SHIFT);
> +                                 false, rdev->mc.real_vram_size >> PAGE_SHIFT);
>  }
>
>  static int radeon_ttm_init_gtt(struct radeon_device *rdev)
>  {
>         return ttm_range_man_init(&rdev->mman.bdev, TTM_PL_TT,
>                                   TTM_PL_MASK_CACHING,
> -                                 TTM_PL_FLAG_CACHED, true,
> -                                 rdev->mc.gtt_size >> PAGE_SHIFT);
> +                                 true, rdev->mc.gtt_size >> PAGE_SHIFT);
>  }
>
>  static void radeon_evict_flags(struct ttm_buffer_object *bo,
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index e2bfe3a13c63..43c0a5f09d67 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -876,8 +876,6 @@ static uint32_t ttm_bo_select_caching(struct ttm_resource_manager *man,
>
>         if ((cur_placement & caching) != 0)
>                 result |= (cur_placement & caching);
> -       else if ((man->default_caching & caching) != 0)
> -               result |= man->default_caching;
>         else if ((TTM_PL_FLAG_CACHED & caching) != 0)
>                 result |= TTM_PL_FLAG_CACHED;
>         else if ((TTM_PL_FLAG_WC & caching) != 0)
> @@ -1435,7 +1433,6 @@ static void ttm_bo_init_sysman(struct ttm_bo_device *bdev)
>          */
>         man->use_tt = true;
>         man->available_caching = TTM_PL_MASK_CACHING;
> -       man->default_caching = TTM_PL_FLAG_CACHED;
>
>         ttm_resource_manager_init(man, 0);
>         ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, man);
> diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
> index 770c8988c139..c80d9fa022f7 100644
> --- a/drivers/gpu/drm/ttm/ttm_range_manager.c
> +++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
> @@ -115,7 +115,6 @@ static const struct ttm_resource_manager_func ttm_range_manager_func;
>  int ttm_range_man_init(struct ttm_bo_device *bdev,
>                        unsigned type,
>                        uint32_t available_caching,
> -                      uint32_t default_caching,
>                        bool use_tt,
>                        unsigned long p_size)
>  {
> @@ -128,7 +127,6 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,
>
>         man = &rman->manager;
>         man->available_caching = available_caching;
> -       man->default_caching = default_caching;
>         man->use_tt = use_tt;
>
>         man->func = &ttm_range_manager_func;
> diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c
> index 3a4602f9a03b..80e10c28f3e8 100644
> --- a/drivers/gpu/drm/ttm/ttm_resource.c
> +++ b/drivers/gpu/drm/ttm/ttm_resource.c
> @@ -141,7 +141,6 @@ void ttm_resource_manager_debug(struct ttm_resource_manager *man,
>         drm_printf(p, "  use_tt: %d\n", man->use_tt);
>         drm_printf(p, "  size: %llu\n", man->size);
>         drm_printf(p, "  available_caching: 0x%08X\n", man->available_caching);
> -       drm_printf(p, "  default_caching: 0x%08X\n", man->default_caching);
>         if (man->func && man->func->debug)
>                 (*man->func->debug)(man, p);
>  }
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index e60012886065..1020c991fd9b 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -627,8 +627,8 @@ static int vmw_vram_manager_init(struct vmw_private *dev_priv)
>         ret = vmw_thp_init(dev_priv);
>  #else
>         ret = ttm_range_man_init(&dev_priv->bdev, TTM_PL_VRAM,
> -                                TTM_PL_FLAG_CACHED, TTM_PL_FLAG_CACHED,
> -                                false, dev_priv->vram_size >> PAGE_SHIFT);
> +                                TTM_PL_FLAG_CACHED, false,
> +                                dev_priv->vram_size >> PAGE_SHIFT);
>  #endif
>         ttm_resource_manager_set_used(ttm_manager_type(&dev_priv->bdev, TTM_PL_VRAM), false);
>         return ret;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
> index bb76acb5b0fc..2d81a276b301 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
> @@ -113,7 +113,6 @@ int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type)
>
>         man->func = &vmw_gmrid_manager_func;
>         man->available_caching = TTM_PL_FLAG_CACHED;
> -       man->default_caching = TTM_PL_FLAG_CACHED;
>         /* TODO: This is most likely not correct */
>         man->use_tt = true;
>         ttm_resource_manager_init(man, 0);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c b/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
> index 3c00a9e7cfcc..b6cf5763c937 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
> @@ -132,7 +132,6 @@ int vmw_thp_init(struct vmw_private *dev_priv)
>
>         man = &rman->manager;
>         man->available_caching = TTM_PL_FLAG_CACHED;
> -       man->default_caching = TTM_PL_FLAG_CACHED;
>
>         ttm_resource_manager_init(man,
>                                   dev_priv->vram_size >> PAGE_SHIFT);
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index 303a89d1066d..bf000d69e533 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -690,7 +690,6 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
>   * @bdev: ttm device
>   * @type: memory manager type
>   * @available_caching: TTM_PL_FLAG_* for allowed caching modes
> - * @default_caching: default caching mode
>   * @use_tt: if the memory manager uses tt
>   * @p_size: size of area to be managed in pages.
>   *
> @@ -700,7 +699,6 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
>  int ttm_range_man_init(struct ttm_bo_device *bdev,
>                        unsigned type,
>                        uint32_t available_caching,
> -                      uint32_t default_caching,
>                        bool use_tt,
>                        unsigned long p_size);
>
> diff --git a/include/drm/ttm/ttm_resource.h b/include/drm/ttm/ttm_resource.h
> index 7b8a3157fbb3..a6ae4bf9c3e1 100644
> --- a/include/drm/ttm/ttm_resource.h
> +++ b/include/drm/ttm/ttm_resource.h
> @@ -110,8 +110,6 @@ struct ttm_resource_manager_func {
>   * @size: Size of the managed region.
>   * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
>   * as defined in ttm_placement_common.h
> - * @default_caching: The default caching policy used for a buffer object
> - * placed in this memory type if the user doesn't provide one.
>   * @func: structure pointer implementing the range manager. See above
>   * @move_lock: lock for move fence
>   * static information. bdev::driver::io_mem_free is never used.
> @@ -128,7 +126,6 @@ struct ttm_resource_manager {
>         bool use_tt;
>         uint64_t size;
>         uint32_t available_caching;
> -       uint32_t default_caching;
>         const struct ttm_resource_manager_func *func;
>         spinlock_t move_lock;
>
> --
> 2.17.1
>


More information about the dri-devel mailing list