drm/ttm: initialize the system domain with defaults
Subsystems (7)
PATCH 1/9 drm/ttm: initialize the system domain with defaults
Instead of repeating that in each driver.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 3 --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 --- drivers/gpu/drm/qxl/qxl_ttm.c | 3 --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 7 files changed, 2 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -3
@@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :/* GTT memory */
drivers/gpu/drm/drm_gem_vram_helper.c +0 -3
@@ -1009,9 +1009,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, {switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func;
drivers/gpu/drm/nouveau/nouveau_bo.c +0 -3
@@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->flags =TTM_MEMTYPE_FLAG_FIXED ;
drivers/gpu/drm/qxl/qxl_ttm.c +0 -3
@@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :case TTM_PL_PRIV :
drivers/gpu/drm/radeon/radeon_ttm.c +0 -3
@@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT : man->func = &ttm_bo_manager_func;
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
@@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; + bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );if (unlikely (ret !=0 )) goto out_no_sys;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0 -2
@@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->available_caching =TTM_PL_FLAG_CACHED ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :/* "On-card" video ram */
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/9 drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED
Instead use a boolean field in the memory manager structure.
Also invert the meaning of the field since the use of a TT structure is the special case here.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +--- drivers/gpu/drm/drm_gem_vram_helper.c | 1 - drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +--- drivers/gpu/drm/qxl/qxl_ttm.c | 1 - drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- drivers/gpu/drm/ttm/ttm_bo.c | 14 +++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 12 ++++++------ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 3 ++- include/drm/ttm/ttm_bo_driver.h | 4 +--- 9 files changed, 19 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -3
@@ -87,15 +87,14 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_TT :/* GTT memory */ + man->use_tt = true; man->func = &amdgpu_gtt_mgr_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ;break ;case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &amdgpu_vram_mgr_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;
@@ -104,7 +103,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case AMDGPU_PL_OA :/* On-chip GDS memory*/ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED ; man->default_caching =TTM_PL_FLAG_UNCACHED ;break ;
drivers/gpu/drm/drm_gem_vram_helper.c +0 -1
@@ -1012,7 +1012,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -3
@@ -657,7 +657,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_SYSTEM :break ;case TTM_PL_VRAM : - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;
@@ -685,13 +684,12 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,else man->func = &ttm_bo_manager_func; + man->use_tt = true;if (drm->agp.bridge) { - man->flags =0 ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; }else { - man->flags =0 ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; }
drivers/gpu/drm/qxl/qxl_ttm.c +0 -1
@@ -59,7 +59,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_PRIV :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;
drivers/gpu/drm/radeon/radeon_ttm.c +1 -2
@@ -81,7 +81,7 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->func = &ttm_bo_manager_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) {if (!rdev->ddev->agp) {
@@ -98,7 +98,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;
drivers/gpu/drm/ttm/ttm_bo.c +7 -7
@@ -84,7 +84,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *pdrm_printf (p," has_type: %d\n" , man->has_type);drm_printf (p," use_type: %d\n" , man->use_type); -drm_printf (p," flags: 0x%08X\n" , man->flags); +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);
@@ -159,7 +159,7 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, man = &bdev->man[mem->mem_type];list_add_tail (&bo->lru, &man->lru[bo->priority]); -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED ) && bo->ttm && +if (man->use_tt && bo->ttm && !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |TTM_PAGE_FLAG_SWAPPED ))) {list_add_tail (&bo->swap, &ttm_bo_glob.swap_lru[bo->priority]);
@@ -286,8 +286,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,* Create and bind a ttm if required. */ -if (!(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) { -bool zero = !(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ); +if (new_man->use_tt) { +bool zero = old_man->use_tt; ret =ttm_tt_create (bo, zero);if (ret)
@@ -314,8 +314,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,if (bdev->driver->move_notify) bdev->driver->move_notify (bo, evict, mem); -if (!(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ) && - !(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (old_man->use_tt && new_man->use_tt) ret =ttm_bo_move_ttm (bo, ctx, mem);else if (bdev->driver->move) ret = bdev->driver->move (bo, evict, ctx, mem);
@@ -340,7 +339,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, out_err: new_man = &bdev->man[bo->mem.mem_type]; -if (new_man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!new_man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }
@@ -1677,6 +1676,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].use_tt = true; bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );
drivers/gpu/drm/ttm/ttm_bo_util.c +6 -6
@@ -384,7 +384,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node =NULL ; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (ttm); bo->ttm =NULL ; }
@@ -645,7 +645,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,if (ret)return ret; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }
@@ -674,7 +674,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (man->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;
@@ -730,7 +730,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(to->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (to->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;
@@ -738,7 +738,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,dma_resv_unlock (&ghost_obj->base._resv);ttm_bo_put (ghost_obj); - }else if (from->flags &TTM_MEMTYPE_FLAG_FIXED ) { + }else if (!from->use_tt) {/** * BO doesn't have a TTM we need to bind/unbind. Just remember
@@ -768,7 +768,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,if (ret)return ret; -if (to->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!to->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +2 -1
@@ -746,7 +746,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &vmw_thp_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_CACHED ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;
@@ -760,6 +759,8 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t 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;break ;default :DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type);
include/drm/ttm/ttm_bo_driver.h +1 -3
@@ -45,8 +45,6 @@#define TTM_MAX_BO_PRIORITY 4U -#define TTM_MEMTYPE_FLAG_FIXED (1 << 0)/* Fixed (on-card) PCI memory */ -struct ttm_mem_type_manager ;struct ttm_mem_type_manager_func {
@@ -173,7 +171,7 @@ struct ttm_mem_type_manager {bool has_type;bool use_type; -uint32_t flags; +bool use_tt;uint64_t size;uint32_t available_caching;uint32_t default_caching;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/9] drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED
Quoted 250 lines · Christian König
Instead use a boolean field in the memory manager structure.
Also invert the meaning of the field since the use of a TT structure is the special case here.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +--- drivers/gpu/drm/drm_gem_vram_helper.c | 1 - drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +--- drivers/gpu/drm/qxl/qxl_ttm.c | 1 - drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- drivers/gpu/drm/ttm/ttm_bo.c | 14 +++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 12 ++++++------ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 3 ++- include/drm/ttm/ttm_bo_driver.h | 4 +--- 9 files changed, 19 insertions(+), 27 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3@@ -87,15 +87,14 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_TT :/* GTT memory */ + man->use_tt = true; man->func = &amdgpu_gtt_mgr_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ;break ;case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &amdgpu_vram_mgr_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;@@ -104,7 +103,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case AMDGPU_PL_OA :/* On-chip GDS memory*/ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED ; man->default_caching =TTM_PL_FLAG_UNCACHED ;break ;drivers/gpu/drm/drm_gem_vram_helper.c +0
-1@@ -1012,7 +1012,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-3@@ -657,7 +657,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_SYSTEM :break ;case TTM_PL_VRAM : - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;@@ -685,13 +684,12 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,else man->func = &ttm_bo_manager_func; + man->use_tt = true;if (drm->agp.bridge) { - man->flags =0 ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; }else { - man->flags =0 ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; }drivers/gpu/drm/qxl/qxl_ttm.c +0
-1@@ -59,7 +59,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_PRIV :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;drivers/gpu/drm/radeon/radeon_ttm.c +1
-2@@ -81,7 +81,7 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->func = &ttm_bo_manager_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) {if (!rdev->ddev->agp) {@@ -98,7 +98,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;drivers/gpu/drm/ttm/ttm_bo.c +7
-7@@ -84,7 +84,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *pdrm_printf (p," has_type: %d\n" , man->has_type);drm_printf (p," use_type: %d\n" , man->use_type); -drm_printf (p," flags: 0x%08X\n" , man->flags); +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);@@ -159,7 +159,7 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, man = &bdev->man[mem->mem_type];list_add_tail (&bo->lru, &man->lru[bo->priority]); -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED ) && bo->ttm && +if (man->use_tt && bo->ttm && !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |TTM_PAGE_FLAG_SWAPPED ))) {list_add_tail (&bo->swap, &ttm_bo_glob.swap_lru[bo->priority]);@@ -286,8 +286,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,* Create and bind a ttm if required. */ -if (!(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) { -bool zero = !(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ); +if (new_man->use_tt) { +bool zero = old_man->use_tt; ret =ttm_tt_create (bo, zero);if (ret)@@ -314,8 +314,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,if (bdev->driver->move_notify) bdev->driver->move_notify (bo, evict, mem); -if (!(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ) && - !(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (old_man->use_tt && new_man->use_tt) ret =ttm_bo_move_ttm (bo, ctx, mem);else if (bdev->driver->move) ret = bdev->driver->move (bo, evict, ctx, mem);@@ -340,7 +339,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, out_err: new_man = &bdev->man[bo->mem.mem_type]; -if (new_man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!new_man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }@@ -1677,6 +1676,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].use_tt = true; bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );drivers/gpu/drm/ttm/ttm_bo_util.c +6
-6@@ -384,7 +384,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node =NULL ; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (ttm); bo->ttm =NULL ; }@@ -645,7 +645,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,if (ret)return ret; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }@@ -674,7 +674,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (man->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;@@ -730,7 +730,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(to->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (to->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;@@ -738,7 +738,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,dma_resv_unlock (&ghost_obj->base._resv);ttm_bo_put (ghost_obj); - }else if (from->flags &TTM_MEMTYPE_FLAG_FIXED ) { + }else if (!from->use_tt) {/** * BO doesn't have a TTM we need to bind/unbind. Just remember @@ -768,7 +768,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,if (ret)return ret; -if (to->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!to->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -746,7 +746,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &vmw_thp_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_CACHED ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, · line 762
Quoted 4 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0@@ -760,6 +759,8 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t 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 */
Comment suggests it's a remapping thing, and I've seen some idr allocator thing in vmwgfx before, i.e. it allocates remapping ids for bo, instead of remapping space. So I think this is all ok, and no need for the TODO here.
With that:
Quoted 33 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0+ man->use_tt = true;break ;default :DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type);include/drm/ttm/ttm_bo_driver.h +1
-3@@ -45,8 +45,6 @@#define TTM_MAX_BO_PRIORITY 4U -#define TTM_MEMTYPE_FLAG_FIXED (1 << 0)/* Fixed (on-card) PCI memory */ -struct ttm_mem_type_manager ;struct ttm_mem_type_manager_func {@@ -173,7 +171,7 @@ struct ttm_mem_type_manager {bool has_type;bool use_type; -uint32_t flags; +bool use_tt;uint64_t size;uint32_t available_caching;uint32_t default_caching;Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/9] drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED
Am 27.07.20 um 11:48 schrieb [email protected]:
Quoted 250 lines · Christian König
Quoted 249 lines
Instead use a boolean field in the memory manager structure.
Also invert the meaning of the field since the use of a TT structure is the special case here.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +--- drivers/gpu/drm/drm_gem_vram_helper.c | 1 - drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +--- drivers/gpu/drm/qxl/qxl_ttm.c | 1 - drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- drivers/gpu/drm/ttm/ttm_bo.c | 14 +++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 12 ++++++------ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 3 ++- include/drm/ttm/ttm_bo_driver.h | 4 +--- 9 files changed, 19 insertions(+), 27 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3@@ -87,15 +87,14 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_TT :/* GTT memory */ + man->use_tt = true; man->func = &amdgpu_gtt_mgr_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ;break ;case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &amdgpu_vram_mgr_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;@@ -104,7 +103,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case AMDGPU_PL_OA :/* On-chip GDS memory*/ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED ; man->default_caching =TTM_PL_FLAG_UNCACHED ;break ;drivers/gpu/drm/drm_gem_vram_helper.c +0
-1@@ -1012,7 +1012,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-3@@ -657,7 +657,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_SYSTEM :break ;case TTM_PL_VRAM : - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;@@ -685,13 +684,12 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,else man->func = &ttm_bo_manager_func; + man->use_tt = true;if (drm->agp.bridge) { - man->flags =0 ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; }else { - man->flags =0 ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; }drivers/gpu/drm/qxl/qxl_ttm.c +0
-1@@ -59,7 +59,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_PRIV :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;drivers/gpu/drm/radeon/radeon_ttm.c +1
-2@@ -81,7 +81,7 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->func = &ttm_bo_manager_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) {if (!rdev->ddev->agp) {@@ -98,7 +98,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;drivers/gpu/drm/ttm/ttm_bo.c +7
-7@@ -84,7 +84,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *pdrm_printf (p," has_type: %d\n" , man->has_type);drm_printf (p," use_type: %d\n" , man->use_type); -drm_printf (p," flags: 0x%08X\n" , man->flags); +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);@@ -159,7 +159,7 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, man = &bdev->man[mem->mem_type];list_add_tail (&bo->lru, &man->lru[bo->priority]); -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED ) && bo->ttm && +if (man->use_tt && bo->ttm && !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |TTM_PAGE_FLAG_SWAPPED ))) {list_add_tail (&bo->swap, &ttm_bo_glob.swap_lru[bo->priority]);@@ -286,8 +286,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,* Create and bind a ttm if required. */ -if (!(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) { -bool zero = !(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ); +if (new_man->use_tt) { +bool zero = old_man->use_tt; ret =ttm_tt_create (bo, zero);if (ret)@@ -314,8 +314,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,if (bdev->driver->move_notify) bdev->driver->move_notify (bo, evict, mem); -if (!(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ) && - !(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (old_man->use_tt && new_man->use_tt) ret =ttm_bo_move_ttm (bo, ctx, mem);else if (bdev->driver->move) ret = bdev->driver->move (bo, evict, ctx, mem);@@ -340,7 +339,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, out_err: new_man = &bdev->man[bo->mem.mem_type]; -if (new_man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!new_man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }@@ -1677,6 +1676,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].use_tt = true; bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );drivers/gpu/drm/ttm/ttm_bo_util.c +6
-6@@ -384,7 +384,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node =NULL ; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (ttm); bo->ttm =NULL ; }@@ -645,7 +645,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,if (ret)return ret; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }@@ -674,7 +674,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (man->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;@@ -730,7 +730,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(to->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (to->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;@@ -738,7 +738,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,dma_resv_unlock (&ghost_obj->base._resv);ttm_bo_put (ghost_obj); - }else if (from->flags &TTM_MEMTYPE_FLAG_FIXED ) { + }else if (!from->use_tt) {/** * BO doesn't have a TTM we need to bind/unbind. Just remember @@ -768,7 +768,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,if (ret)return ret; -if (to->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!to->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -746,7 +746,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &vmw_thp_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_CACHED ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;
Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, · line 762
Quoted 5 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0@@ -760,6 +759,8 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t 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 */ Comment suggests it's a remapping thing, and I've seen some idr allocator thing in vmwgfx before, i.e. it allocates remapping ids for bo, instead of remapping space. So I think this is all ok, and no need for the TODO here.
Yeah and exactly because of this I think that allocating a TT structure doesn't make much sense.
Why should I need an pages array and backing page if I just want to allocate a number from an idr?
My best guess is that we don't leak memory and because of this nobody has ever noticed this.
Christian.
Quoted 34 lines
With that:
Reviewed-by Daniel Vetter <[email protected]>Quoted 29 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0+ man->use_tt = true;break ;default :DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type);include/drm/ttm/ttm_bo_driver.h +1
-3@@ -45,8 +45,6 @@#define TTM_MAX_BO_PRIORITY 4U -#define TTM_MEMTYPE_FLAG_FIXED (1 << 0)/* Fixed (on-card) PCI memory */ -struct ttm_mem_type_manager ;struct ttm_mem_type_manager_func {@@ -173,7 +171,7 @@ struct ttm_mem_type_manager {bool has_type;bool use_type; -uint32_t flags; +bool use_tt;uint64_t size;uint32_t available_caching;uint32_t default_caching;Signature · 1 line
2.17.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/9] drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED
Quoted 246 lines · Christian König
Am 27.07.20 um 11:48 schrieb [email protected]:
Quoted 236 lines · Christian König
Quoted 235 lines
Instead use a boolean field in the memory manager structure.
Also invert the meaning of the field since the use of a TT structure is the special case here.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +--- drivers/gpu/drm/drm_gem_vram_helper.c | 1 - drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +--- drivers/gpu/drm/qxl/qxl_ttm.c | 1 - drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- drivers/gpu/drm/ttm/ttm_bo.c | 14 +++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 12 ++++++------ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 3 ++- include/drm/ttm/ttm_bo_driver.h | 4 +--- 9 files changed, 19 insertions(+), 27 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3@@ -87,15 +87,14 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_TT :/* GTT memory */ + man->use_tt = true; man->func = &amdgpu_gtt_mgr_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ;break ;case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &amdgpu_vram_mgr_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;@@ -104,7 +103,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case AMDGPU_PL_OA :/* On-chip GDS memory*/ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED ; man->default_caching =TTM_PL_FLAG_UNCACHED ;break ;drivers/gpu/drm/drm_gem_vram_helper.c +0
-1@@ -1012,7 +1012,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-3@@ -657,7 +657,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_SYSTEM :break ;case TTM_PL_VRAM : - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;@@ -685,13 +684,12 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,else man->func = &ttm_bo_manager_func; + man->use_tt = true;if (drm->agp.bridge) { - man->flags =0 ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; }else { - man->flags =0 ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; }drivers/gpu/drm/qxl/qxl_ttm.c +0
-1@@ -59,7 +59,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_PRIV :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;drivers/gpu/drm/radeon/radeon_ttm.c +1
-2@@ -81,7 +81,7 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->func = &ttm_bo_manager_func; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_CACHED ; - man->flags =0 ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) {if (!rdev->ddev->agp) {@@ -98,7 +98,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ;drivers/gpu/drm/ttm/ttm_bo.c +7
-7@@ -84,7 +84,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *pdrm_printf (p," has_type: %d\n" , man->has_type);drm_printf (p," use_type: %d\n" , man->use_type); -drm_printf (p," flags: 0x%08X\n" , man->flags); +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);@@ -159,7 +159,7 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, man = &bdev->man[mem->mem_type];list_add_tail (&bo->lru, &man->lru[bo->priority]); -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED ) && bo->ttm && +if (man->use_tt && bo->ttm && !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |TTM_PAGE_FLAG_SWAPPED ))) {list_add_tail (&bo->swap, &ttm_bo_glob.swap_lru[bo->priority]);@@ -286,8 +286,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,* Create and bind a ttm if required. */ -if (!(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) { -bool zero = !(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ); +if (new_man->use_tt) { +bool zero = old_man->use_tt; ret =ttm_tt_create (bo, zero);if (ret)@@ -314,8 +314,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,if (bdev->driver->move_notify) bdev->driver->move_notify (bo, evict, mem); -if (!(old_man->flags &TTM_MEMTYPE_FLAG_FIXED ) && - !(new_man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (old_man->use_tt && new_man->use_tt) ret =ttm_bo_move_ttm (bo, ctx, mem);else if (bdev->driver->move) ret = bdev->driver->move (bo, evict, ctx, mem);@@ -340,7 +339,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, out_err: new_man = &bdev->man[bo->mem.mem_type]; -if (new_man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!new_man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }@@ -1677,6 +1676,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].use_tt = true; bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );drivers/gpu/drm/ttm/ttm_bo_util.c +6
-6@@ -384,7 +384,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node =NULL ; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (ttm); bo->ttm =NULL ; }@@ -645,7 +645,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,if (ret)return ret; -if (man->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!man->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }@@ -674,7 +674,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (man->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;@@ -730,7 +730,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,* bo to be unbound and destroyed. */ -if (!(to->flags &TTM_MEMTYPE_FLAG_FIXED )) +if (to->use_tt) ghost_obj->ttm =NULL ;else bo->ttm =NULL ;@@ -738,7 +738,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,dma_resv_unlock (&ghost_obj->base._resv);ttm_bo_put (ghost_obj); - }else if (from->flags &TTM_MEMTYPE_FLAG_FIXED ) { + }else if (!from->use_tt) {/** * BO doesn't have a TTM we need to bind/unbind. Just remember @@ -768,7 +768,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,if (ret)return ret; -if (to->flags &TTM_MEMTYPE_FLAG_FIXED ) { +if (!to->use_tt) {ttm_tt_destroy (bo->ttm); bo->ttm =NULL ; }drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -746,7 +746,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->func = &vmw_thp_func; - man->flags =TTM_MEMTYPE_FLAG_FIXED ; man->available_caching =TTM_PL_FLAG_CACHED ; man->default_caching =TTM_PL_FLAG_CACHED ;break ;Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, · line 762
Quoted 5 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0@@ -760,6 +759,8 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t 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 */ Comment suggests it's a remapping thing, and I've seen some idr allocator thing in vmwgfx before, i.e. it allocates remapping ids for bo, instead of remapping space. So I think this is all ok, and no need for the TODO here.
Quoted 8 lines
Yeah and exactly because of this I think that allocating a TT structure doesn't make much sense.
Why should I need an pages array and backing page if I just want to allocate a number from an idr?
My best guess is that we don't leak memory and because of this nobody has ever noticed this.
Hm yeah, I guess that's a question for vmwgfx folks to answer then. Feel free to leave the todo in there.
-Daniel
Quoted 38 lines
Christian.
Quoted 34 lines
With that:
Reviewed-by Daniel Vetter <[email protected]>Quoted 29 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0+ man->use_tt = true;break ;default :DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type);include/drm/ttm/ttm_bo_driver.h +1
-3@@ -45,8 +45,6 @@#define TTM_MAX_BO_PRIORITY 4U -#define TTM_MEMTYPE_FLAG_FIXED (1 << 0)/* Fixed (on-card) PCI memory */ -struct ttm_mem_type_manager ;struct ttm_mem_type_manager_func {@@ -173,7 +171,7 @@ struct ttm_mem_type_manager {bool has_type;bool use_type; -uint32_t flags; +bool use_tt;uint64_t size;uint32_t available_caching;uint32_t default_caching;Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/9 drm/radeon: stop implementing init_mem_type
In reply to Christian KönigInstead just initialize the memory type parameters before calling ttm_bo_init_mm.
--- drivers/gpu/drm/radeon/radeon_ttm.c | 70 ++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +35 -35
@@ -69,43 +69,43 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -struct radeon_device *rdev; +return 0 ; +} - rdev =radeon_get_rdev (bdev); +static int radeon_ttm_init_vram (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ]; -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -break ; -case TTM_PL_TT : - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; - man->use_tt = true; + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , + rdev->mc.real_vram_size >>PAGE_SHIFT ); +} + +static int radeon_ttm_init_gtt (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_TT ]; + + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_MASK_CACHING ; + man->default_caching =TTM_PL_FLAG_CACHED ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP ) -if (rdev->flags &RADEON_IS_AGP ) { -if (!rdev->ddev->agp) { -DRM_ERROR ("AGP is not enabled for memory type %u\n" , - (unsigned )type); -return -EINVAL ; - } - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; +if (rdev->flags &RADEON_IS_AGP ) { +if (!rdev->ddev->agp) { +DRM_ERROR ("AGP is not enabled\n" ); +return -EINVAL ; } -#endif -break ; -case TTM_PL_VRAM : -/* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->available_caching =TTM_PL_FLAG_UNCACHED | +TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; -break ; -default : -DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type); -return -EINVAL ; } -return 0 ; +#endif + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , + rdev->mc.gtt_size >>PAGE_SHIFT ); } static void radeon_evict_flags(struct ttm_buffer_object *bo,
@@ -778,8 +778,8 @@ int radeon_ttm_init(struct radeon_device *rdev)return r; } rdev->mman.initialized = true; - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , - rdev->mc.real_vram_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_vram (rdev);if (r) {DRM_ERROR ("Failed initializing VRAM heap.\n" );return r;
@@ -804,8 +804,8 @@ int radeon_ttm_init(struct radeon_device *rdev) }DRM_INFO ("radeon: %uM of VRAM memory ready\n" , (unsigned ) (rdev->mc.real_vram_size / (1024 *1024 ))); - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , - rdev->mc.gtt_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_gtt (rdev);if (r) {DRM_ERROR ("Failed initializing GTT heap.\n" );return r;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/9] drm/radeon: stop implementing init_mem_type
Quoted 4 lines · Christian König
Instead just initialize the memory type parameters before calling
ttm_bo_init_mm.Signed-off-by Christian König <[email protected]>
Hm what's the motivation here? I do agree that the init_mem_type callback is rather midlayer-y (having a per-type cast in a callback is a very clear signal something with the layering is all busted). So removing this sounds like a good idea, but not really following why just for radeon? Or simply wip?
-Daniel
Quoted 112 lines
--- drivers/gpu/drm/radeon/radeon_ttm.c | 70 ++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +35
-35@@ -69,43 +69,43 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -struct radeon_device *rdev; +return 0 ; +} - rdev =radeon_get_rdev (bdev); +static int radeon_ttm_init_vram (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ]; -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -break ; -case TTM_PL_TT : - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; - man->use_tt = true; + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , + rdev->mc.real_vram_size >>PAGE_SHIFT ); +} + +static int radeon_ttm_init_gtt (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_TT ]; + + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_MASK_CACHING ; + man->default_caching =TTM_PL_FLAG_CACHED ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP ) -if (rdev->flags &RADEON_IS_AGP ) { -if (!rdev->ddev->agp) { -DRM_ERROR ("AGP is not enabled for memory type %u\n" , - (unsigned )type); -return -EINVAL ; - } - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; +if (rdev->flags &RADEON_IS_AGP ) { +if (!rdev->ddev->agp) { +DRM_ERROR ("AGP is not enabled\n" ); +return -EINVAL ; } -#endif -break ; -case TTM_PL_VRAM : -/* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->available_caching =TTM_PL_FLAG_UNCACHED | +TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; -break ; -default : -DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type); -return -EINVAL ; } -return 0 ; +#endif + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , + rdev->mc.gtt_size >>PAGE_SHIFT ); } static void radeon_evict_flags(struct ttm_buffer_object *bo,@@ -778,8 +778,8 @@ int radeon_ttm_init(struct radeon_device *rdev)return r; } rdev->mman.initialized = true; - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , - rdev->mc.real_vram_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_vram (rdev);if (r) {DRM_ERROR ("Failed initializing VRAM heap.\n" );return r;@@ -804,8 +804,8 @@ int radeon_ttm_init(struct radeon_device *rdev) }DRM_INFO ("radeon: %uM of VRAM memory ready\n" , (unsigned ) (rdev->mc.real_vram_size / (1024 *1024 ))); - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , - rdev->mc.gtt_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_gtt (rdev);if (r) {DRM_ERROR ("Failed initializing GTT heap.\n" );return r;Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/9] drm/radeon: stop implementing init_mem_type
Quoted 11 lines · On Mon, Jul 27, 2020 at 12:30:00PM +0200, [email protected] wrote:
Quoted 4 lines · Christian König
Instead just initialize the memory type parameters before calling
ttm_bo_init_mm.Signed-off-by Christian König <[email protected]>Hm what's the motivation here? I do agree that the
init_mem_typecallback is rather midlayer-y (having a per-type cast in a callback is a very clear signal something with the layering is all busted). So removing this sounds like a good idea, but not really following why just for radeon? Or simply wip?
nvm, I've seen the next series :-) And Alex already r-b'ed it. -Daniel
Quoted 120 lines
Quoted 115 lines
--- drivers/gpu/drm/radeon/radeon_ttm.c | 70 ++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +35
-35@@ -69,43 +69,43 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -struct radeon_device *rdev; +return 0 ; +} - rdev =radeon_get_rdev (bdev); +static int radeon_ttm_init_vram (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ]; -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -break ; -case TTM_PL_TT : - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; - man->use_tt = true; + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , + rdev->mc.real_vram_size >>PAGE_SHIFT ); +} + +static int radeon_ttm_init_gtt (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_TT ]; + + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_MASK_CACHING ; + man->default_caching =TTM_PL_FLAG_CACHED ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP ) -if (rdev->flags &RADEON_IS_AGP ) { -if (!rdev->ddev->agp) { -DRM_ERROR ("AGP is not enabled for memory type %u\n" , - (unsigned )type); -return -EINVAL ; - } - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; +if (rdev->flags &RADEON_IS_AGP ) { +if (!rdev->ddev->agp) { +DRM_ERROR ("AGP is not enabled\n" ); +return -EINVAL ; } -#endif -break ; -case TTM_PL_VRAM : -/* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->available_caching =TTM_PL_FLAG_UNCACHED | +TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; -break ; -default : -DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type); -return -EINVAL ; } -return 0 ; +#endif + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , + rdev->mc.gtt_size >>PAGE_SHIFT ); } static void radeon_evict_flags(struct ttm_buffer_object *bo,@@ -778,8 +778,8 @@ int radeon_ttm_init(struct radeon_device *rdev)return r; } rdev->mman.initialized = true; - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , - rdev->mc.real_vram_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_vram (rdev);if (r) {DRM_ERROR ("Failed initializing VRAM heap.\n" );return r;@@ -804,8 +804,8 @@ int radeon_ttm_init(struct radeon_device *rdev) }DRM_INFO ("radeon: %uM of VRAM memory ready\n" , (unsigned ) (rdev->mc.real_vram_size / (1024 *1024 ))); - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , - rdev->mc.gtt_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_gtt (rdev);if (r) {DRM_ERROR ("Failed initializing GTT heap.\n" );return r;Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/9] drm/radeon: stop implementing init_mem_type
In reply to [email protected]Am 27.07.20 um 12:30 schrieb [email protected]:
Quoted 10 lines · Christian König
Quoted 4 lines
Instead just initialize the memory type parameters before calling
ttm_bo_init_mm.Signed-off-by Christian König <[email protected]>Hm what's the motivation here? I do agree that the
init_mem_typecallback is rather midlayer-y (having a per-type cast in a callback is a very clear signal something with the layering is all busted). So removing this sounds like a good idea, but not really following why just for radeon? Or simply wip?
On the first try only the first 3 mails made it to the list and then my internet connection crashed.
I've send out the full set a minute later once more.
Christian.
Quoted 112 lines
-Daniel
Quoted 108 lines
--- drivers/gpu/drm/radeon/radeon_ttm.c | 70 ++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +35
-35@@ -69,43 +69,43 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -struct radeon_device *rdev; +return 0 ; +} - rdev =radeon_get_rdev (bdev); +static int radeon_ttm_init_vram (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ]; -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -break ; -case TTM_PL_TT : - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; - man->use_tt = true; + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , + rdev->mc.real_vram_size >>PAGE_SHIFT ); +} + +static int radeon_ttm_init_gtt (struct radeon_device *rdev) +{ +struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_TT ]; + + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_MASK_CACHING ; + man->default_caching =TTM_PL_FLAG_CACHED ; + man->use_tt = true;#if IS_ENABLED (CONFIG_AGP ) -if (rdev->flags &RADEON_IS_AGP ) { -if (!rdev->ddev->agp) { -DRM_ERROR ("AGP is not enabled for memory type %u\n" , - (unsigned )type); -return -EINVAL ; - } - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; +if (rdev->flags &RADEON_IS_AGP ) { +if (!rdev->ddev->agp) { +DRM_ERROR ("AGP is not enabled\n" ); +return -EINVAL ; } -#endif -break ; -case TTM_PL_VRAM : -/* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->available_caching =TTM_PL_FLAG_UNCACHED | +TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; -break ; -default : -DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type); -return -EINVAL ; } -return 0 ; +#endif + +return ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , + rdev->mc.gtt_size >>PAGE_SHIFT ); } static void radeon_evict_flags(struct ttm_buffer_object *bo,@@ -778,8 +778,8 @@ int radeon_ttm_init(struct radeon_device *rdev)return r; } rdev->mman.initialized = true; - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_VRAM , - rdev->mc.real_vram_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_vram (rdev);if (r) {DRM_ERROR ("Failed initializing VRAM heap.\n" );return r;@@ -804,8 +804,8 @@ int radeon_ttm_init(struct radeon_device *rdev) }DRM_INFO ("radeon: %uM of VRAM memory ready\n" , (unsigned ) (rdev->mc.real_vram_size / (1024 *1024 ))); - r =ttm_bo_init_mm (&rdev->mman.bdev,TTM_PL_TT , - rdev->mc.gtt_size >>PAGE_SHIFT ); + + r =radeon_ttm_init_gtt (rdev);if (r) {DRM_ERROR ("Failed initializing GTT heap.\n" );return r;Signature · 1 line
2.17.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 101 lines · Christian König
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 3 --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 --- drivers/gpu/drm/qxl/qxl_ttm.c | 3 --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 7 files changed, 2 insertions(+), 17 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :/* GTT memory */ drivers/gpu/drm/drm_gem_vram_helper.c +0
-3@@ -1009,9 +1009,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, {switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3@@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->flags =TTM_MEMTYPE_FLAG_FIXED ;drivers/gpu/drm/qxl/qxl_ttm.c +0
-3@@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :case TTM_PL_PRIV :drivers/gpu/drm/radeon/radeon_ttm.c +0
-3@@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT : man->func = &ttm_bo_manager_func;drivers/gpu/drm/ttm/ttm_bo.c +2
-0@@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; + bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );if (unlikely (ret !=0 )) goto out_no_sys;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, · line 745
Quoted 4 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->available_caching =TTM_PL_FLAG_CACHED ;
Above is CACHED, not CACHING, so needs to stay to overwrite the default. With that fixed:
Quoted 11 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1- man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :/* "On-card" video ram */ Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 27.07.20 um 11:42 schrieb [email protected]:
Quoted 99 lines · Christian König
Quoted 98 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 3 --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 --- drivers/gpu/drm/qxl/qxl_ttm.c | 3 --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 7 files changed, 2 insertions(+), 17 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :/* GTT memory */ drivers/gpu/drm/drm_gem_vram_helper.c +0
-3@@ -1009,9 +1009,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, {switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3@@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->flags =TTM_MEMTYPE_FLAG_FIXED ;drivers/gpu/drm/qxl/qxl_ttm.c +0
-3@@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :case TTM_PL_PRIV :drivers/gpu/drm/radeon/radeon_ttm.c +0
-3@@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT : man->func = &ttm_bo_manager_func;drivers/gpu/drm/ttm/ttm_bo.c +2
-0@@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,* Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; + bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );if (unlikely (ret !=0 )) goto out_no_sys;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0
Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, · line 745
Quoted 7 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->available_caching =TTM_PL_FLAG_CACHED ;Above is CACHED, not CACHING, so needs to stay to overwrite the default.
Crap I missed that. Problem is that I wanted to remove the possibility to init the system domain with different caching attributes.
I don't see how vmwgfx is every going to use this? Thomas do you have any idea what this was good for?
Thanks,
Christian.
Quoted 11 lines
With that fixed:
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1- man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :/* "On-card" video ram */ Signature · 1 line
2.17.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 125 lines · Christian König
Am 27.07.20 um 11:42 schrieb [email protected]:
Quoted 115 lines · Christian König
Quoted 114 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 3 --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 --- drivers/gpu/drm/qxl/qxl_ttm.c | 3 --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 7 files changed, 2 insertions(+), 17 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :/* GTT memory */
drivers/gpu/drm/drm_gem_vram_helper.c +0
-3@@ -1009,9 +1009,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, { switch (type) { case TTM_PL_SYSTEM: - man->flags = 0; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; break;case TTM_PL_VRAM :man->func = &ttm_bo_manager_func;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3@@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :man->flags = TTM_MEMTYPE_FLAG_FIXED;drivers/gpu/drm/qxl/qxl_ttm.c +0
-3@@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :case
TTM_PL_PRIV:drivers/gpu/drm/radeon/radeon_ttm.c +0
-3@@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :man->func = &ttm_bo_manager_func;drivers/gpu/drm/ttm/ttm_bo.c +2
-0@@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct ttm_bo_device*bdev, * Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; + bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );if (unlikely(ret != 0))
gotoout_no_sys;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct · line 746
Quoted 6 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->available_caching =TTM_PL_FLAG_CACHED ;Above is CACHED, not CACHING, so needs to stay to overwrite the default.
Quoted 7 lines
Crap I missed that. Problem is that I wanted to remove the possibility
to init the system domain with different caching attributes.I don't see how vmwgfx is every going to use this? Thomas do you have
any idea what this was good for?
I interpret that like vmwgfx can't handle any other caching attribute than 'cached'. But I can't see anyone feeding vmwgfx system memory buffers with other caching attributes. In that case, those would be ignored.
/Thomas
Quoted 15 lines
Thanks,
Christian.Quoted 11 lines
With that fixed:
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1- man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :/* "On-card" video ram */
Signature · 1 line
2.17.1
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden Registration Number: 556189-6027
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerAm 27.07.20 um 12:50 schrieb Hellstrom, Thomas:
Quoted 129 lines · Christian König
Quoted 128 lines
Am 27.07.20 um 11:42 schrieb [email protected]:
Quoted 115 lines · Christian König
Quoted 114 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 3 --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 --- drivers/gpu/drm/qxl/qxl_ttm.c | 3 --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 7 files changed, 2 insertions(+), 17 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :/* GTT memory */drivers/gpu/drm/drm_gem_vram_helper.c +0
-3@@ -1009,9 +1009,6 @@ static int bo_driver_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, { switch (type) { case TTM_PL_SYSTEM: - man->flags = 0; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; break;case TTM_PL_VRAM :man->func = &ttm_bo_manager_func;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3@@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM : - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :man->flags = TTM_MEMTYPE_FLAG_FIXED;drivers/gpu/drm/qxl/qxl_ttm.c +0
-3@@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :case
TTM_PL_PRIV:drivers/gpu/drm/radeon/radeon_ttm.c +0
-3@@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :man->func = &ttm_bo_manager_func;drivers/gpu/drm/ttm/ttm_bo.c +2
-0@@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct ttm_bo_device*bdev, * Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. */ + bdev->man[TTM_PL_SYSTEM ].available_caching =TTM_PL_MASK_CACHING ; + bdev->man[TTM_PL_SYSTEM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (bdev,TTM_PL_SYSTEM ,0 );if (unlikely(ret != 0)) goto out_no_sys;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct · line 746
Quoted 6 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->available_caching =TTM_PL_FLAG_CACHED ;Above is CACHED, not CACHING, so needs to stay to overwrite the default.
Crap I missed that. Problem is that I wanted to remove the possibility
to init the system domain with different caching attributes.
Quoted 7 lines
Quoted 3 lines
I don't see how vmwgfx is every going to use this? Thomas do you have
any idea what this was good for?I interpret that like vmwgfx can't handle any other caching attribute than 'cached'. But I can't see anyone feeding vmwgfx system memory buffers with other caching attributes. In that case, those would be ignored.
Yeah, agree. So any objections to change that setting in vmwgfx?
This way we could have the same settings for all drivers in the kernel and I don't see why any driver should have something special here.
Christian.
Quoted 27 lines
/Thomas
Quoted 14 lines
Thanks,
Christian.Quoted 11 lines
With that fixed:
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1- man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :/* "On-card" video ram */Signature · 1 line
2.17.1Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7C66991383884c46a79f4608d8321ae136%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637314438323255193&sdata=Y86QJdnrTmhaG5Sx1NmKaeUbbOkrVvQQP%2BBB29SuA9I%3D&reserved=0----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden Registration Number: 556189-6027
Quoted 4 lines
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 144 lines · Christian König
Am 27.07.20 um 12:50 schrieb Hellstrom, Thomas:
Quoted 134 lines · Christian König
Quoted 133 lines
Am 27.07.20 um 11:42 schrieb [email protected]:
Quoted 120 lines
Quoted 118 lines · Christian König
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 3 --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 --- drivers/gpu/drm/qxl/qxl_ttm.c | 3 --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 7 files changed, 2 insertions(+), 17 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :/* GTT memory */drivers/gpu/drm/drm_gem_vram_helper.c +0
-0@@ -1009,9 +1009,6 @@ static intbo_driver_init_mem_type(struct
ttm_bo_device*bdev,uint32_ttype,{ switch (type) { case TTM_PL_SYSTEM:drivers/gpu/drm/drm_gem_vram_helper.c +0
-3- man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->func = &ttm_bo_manager_func;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-0@@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct
ttm_bo_device
*bdev,uint32_ttype,switch (type) { case TTM_PL_SYSTEM:drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3- man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM : man->flags =TTM_MEMTYPE_FLAG_FIXED ;drivers/gpu/drm/qxl/qxl_ttm.c +0
-3@@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_VRAM :case
TTM_PL_PRIV:drivers/gpu/drm/radeon/radeon_ttm.c +0
-3@@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->flags =0 ; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ;break ;case TTM_PL_TT :man->func = &ttm_bo_manager_func;drivers/gpu/drm/ttm/ttm_bo.c +0
-0@@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct
ttm_bo_device
*bdev,
* Initialize the system memory buffer type.
* Other types need to be driver / IOCTL initialized. */drivers/gpu/drm/ttm/ttm_bo.c +1
-0+ bdev->man[TTM_PL_SYSTEM].available_caching =
TTM_PL_MASK_CACHING;drivers/gpu/drm/ttm/ttm_bo.c +1
-0+ bdev->man[TTM_PL_SYSTEM].default_caching =TTM_PL_FLAG_CACHED; ret = ttm_bo_init_mm(bdev, TTM_PL_SYSTEM, 0); if (unlikely(ret != 0)) goto out_no_sys;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_init_mem_type(struct · line 746
Quoted 6 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, switch (type) {case TTM_PL_SYSTEM :/* System memory */ - man->available_caching =TTM_PL_FLAG_CACHED ;Above is CACHED, not CACHING, so needs to stay to overwrite the default.
Crap I missed that. Problem is that I wanted to remove the possibility
to init the system domain with different caching attributes.Quoted 8 lines
Quoted 3 lines
I don't see how vmwgfx is every going to use this? Thomas do you have
any idea what this was good for?I interpret that like vmwgfx can't handle any other caching attribute
than 'cached'. But I can't see anyone feeding vmwgfx system memory buffers with other caching attributes. In that case, those would be ignored.
Quoted 8 lines
Yeah, agree. So any objections to change that setting in vmwgfx?
This way we could have the same settings for all drivers in the kernel
and I don't see why any driver should have something special here.Christian.
No objections from my side, although I figure Roland has the last saying.
/Thomas
----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden Registration Number: 556189-6027
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel