More TTM cleanups
Subsystems (7)
Just another round of random TTM cleanups.
Please review and/or comment.
Thanks,
Christian.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
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
Re: [PATCH 1/9] drm/ttm: initialize the system domain with defaults
Am 23.07.20 um 17:17 schrieb Christian König:
Quoted 3 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>
Quoted 107 lines
--- 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
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerRe: [PATCH 1/9] drm/ttm: initialize the system domain with defaults
Quoted 9 lines · Thomas Zimmermann
Am 23.07.20 um 17:17 schrieb Christian König:
Quoted 3 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>
I'm not sure what happened but the patchwork copies of this series are mangled badly, I expect AMD email with the crappy headers or something got in there somewhere.
Can we get them in drm-misc-next at some point so I can cleanly look at them.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerRe: [PATCH 1/9] drm/ttm: initialize the system domain with defaults
Quoted 10 lines · Dave Airlie
Quoted 8 lines · Thomas Zimmermann
Am 23.07.20 um 17:17 schrieb Christian König:
Quoted 3 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>
Quoted 7 lines
Quoted 1 line
Reviewed-by Thomas Zimmermann <[email protected]>I'm not sure what happened but the patchwork copies of this series are mangled badly, I expect AMD email with the crappy headers or something got in there somewhere.
Can we get them in drm-misc-next at some point so I can cleanly look at them.
Oh it looks like they are there already, I'm not sure why I'm having trouble applying the next set. will dig a bit more.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/9] drm/ttm: initialize the system domain with defaults
Am 29.07.20 um 08:23 schrieb Dave Airlie:
Quoted 8 lines · Dave Airlie
Quoted 7 lines · Thomas Zimmermann
Quoted 6 lines
Am 23.07.20 um 17:17 schrieb Christian König:
Quoted 3 lines
Instead of repeating that in each driver.
Signed-off-by Christian König <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Reviewed-by Thomas Zimmermann <[email protected]>I'm not sure what happened but the patchwork copies of this series are mangled badly, I expect AMD email with the crappy headers or something got in there somewhere.
Can we get them in drm-misc-next at some point so I can cleanly look at them.
Oh it looks like they are there already, I'm not sure why I'm having trouble applying the next set. will dig a bit more.
Wanted to send that one out once more today anyway since I would like to keep the special VMWGFX bits Daniel pointed for now.
Give me a few hours to clean that up,
Christian.
Quoted 2 lines
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/9 drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED
In reply to Christian KönigInstead 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
Am 23.07.20 um 17:17 schrieb Christian König:
Quoted 6 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]>
There's a comment further below. In any case
Quoted 136 lines
--- 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 +2
-2@@ -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]);
drivers/gpu/drm/ttm/ttm_bo.c static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, · line 290
Quoted 7 lines
drivers/gpu/drm/ttm/ttm_bo.c +2
-2@@ -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;
There's little use in copying to zero.
drivers/gpu/drm/ttm/ttm_bo.c static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, · line 292
Quoted 2 lines
drivers/gpu/drm/ttm/ttm_bo.c +0
-0ret =ttm_tt_create (bo, zero);
Maybe rather pass old_man->use_tt directly and leave a comment why that makes sense.
Best regards
Thomas
Quoted 130 lines
drivers/gpu/drm/ttm/ttm_bo.c +3
-3if (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
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
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 24.07.20 um 08:50 schrieb Thomas Zimmermann:
Quoted 159 lines
Am 23.07.20 um 17:17 schrieb Christian König:
Quoted 6 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]>There's a comment further below. In any case
Reviewed-by Thomas Zimmermann <[email protected]>Quoted 136 lines
--- 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 +2
-2@@ -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]);drivers/gpu/drm/ttm/ttm_bo.c static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, · line 290
Quoted 7 lines
drivers/gpu/drm/ttm/ttm_bo.c +2
-2@@ -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;There's little use in copying to zero.
Quoted 1 line
Quoted 3 lines
Quoted 1 line
ret = ttm_tt_create(bo, zero);Maybe rather pass
old_man->use_ttdirectly and leave a comment why that makes sense.
Good point, going to fix that.
Thanks,
Christian.
Quoted 126 lines
Best regards
ThomasQuoted 122 lines
if (ret)
drivers/gpu/drm/ttm/ttm_bo.c +3
-3@@ -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 +0
-2@@ -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 {
Quoted 8 lines
include/drm/ttm/ttm_bo_driver.h struct ttm_mem_type_manager { · line 177
Quoted 8 lines
include/drm/ttm/ttm_bo_driver.h +1
-1bool has_type;bool use_type; -uint32_t flags; +bool use_tt;uint64_t size;uint32_t available_caching;uint32_t default_caching;
_______________________________________________
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
PATCH 4/9 drm/amdgpu: 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/amd/amdgpu/amdgpu_ttm.c | 96 +++++++++++-------------- 1 file changed, 43 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +43 -53
@@ -62,55 +62,49 @@#define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128 - -/** -* amdgpu_init_mem_type - Initialize a memory manager for a specific type of -* memory request. -* -* @bdev: The TTM BO device object (contains a reference to amdgpu_device) -* @type: The type of memory requested -* @man: The memory type manager for each domain -* -* This is called by ttm_bo_init_mm() when a buffer object is being -* initialized. -*/ static int amdgpu_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -struct amdgpu_device *adev; +return 0 ; +} - adev =amdgpu_ttm_adev (bdev); +static int amdgpu_ttm_init_vram (struct amdgpu_device *adev) +{ -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -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 ; -break ; -case TTM_PL_VRAM : -/* "On-card" video ram */ - man->func = &amdgpu_vram_mgr_func; - man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; -break ; -case AMDGPU_PL_GDS : -case AMDGPU_PL_GWS : -case AMDGPU_PL_OA : -/* On-chip GDS memory*/ - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED ; - man->default_caching =TTM_PL_FLAG_UNCACHED ; -break ; -default : -DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type); -return -EINVAL ; - } -return 0 ; +struct ttm_mem_type_manager *man = &adev->mman.bdev.man[TTM_PL_VRAM ]; + + man->func = &amdgpu_vram_mgr_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; + +return ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_VRAM , + adev->gmc.real_vram_size >>PAGE_SHIFT ); +} + +static int amdgpu_ttm_init_gtt (struct amdgpu_device *adev,uint64_t gtt_size) +{ +struct ttm_mem_type_manager *man = &adev->mman.bdev.man[TTM_PL_TT ]; + + man->use_tt = true; + man->func = &amdgpu_gtt_mgr_func; + man->available_caching =TTM_PL_MASK_CACHING ; + man->default_caching =TTM_PL_FLAG_CACHED ; + +return ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , + gtt_size >>PAGE_SHIFT ); +} + +static int amdgpu_ttm_init_on_chip (struct amdgpu_device *adev, +unsigned int type, +uint64_t size) +{ +struct ttm_mem_type_manager *man = &adev->mman.bdev.man[type]; + + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED ; + man->default_caching =TTM_PL_FLAG_UNCACHED ; + +return ttm_bo_init_mm (&adev->mman.bdev, type, size); }/**
@@ -1896,8 +1890,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) adev->mman.bdev.no_retry = true;/* Initialize VRAM pool with all of VRAM divided into pages */ - r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_VRAM , - adev->gmc.real_vram_size >>PAGE_SHIFT ); + r =amdgpu_ttm_init_vram (adev);if (r) {DRM_ERROR ("Failed initializing VRAM heap.\n" );return r;
@@ -1978,7 +1971,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) gtt_size = (uint64_t )amdgpu_gtt_size <<20 ;/* Initialize GTT memory pool */ - r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , gtt_size >>PAGE_SHIFT ); + r =amdgpu_ttm_init_gtt (adev, gtt_size);if (r) {DRM_ERROR ("Failed initializing GTT heap.\n" );return r;
@@ -1987,22 +1980,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) (unsigned)(gtt_size / (1024 * 1024)));/* Initialize various on-chip memory pools */ - r =ttm_bo_init_mm (&adev->mman.bdev,AMDGPU_PL_GDS , - adev->gds.gds_size); + r =amdgpu_ttm_init_on_chip (adev,AMDGPU_PL_GDS , adev->gds.gds_size);if (r) {DRM_ERROR ("Failed initializing GDS heap.\n" );return r; } - r =ttm_bo_init_mm (&adev->mman.bdev,AMDGPU_PL_GWS , - adev->gds.gws_size); + r =amdgpu_ttm_init_on_chip (adev,AMDGPU_PL_GWS , adev->gds.gws_size);if (r) {DRM_ERROR ("Failed initializing gws heap.\n" );return r; } - r =ttm_bo_init_mm (&adev->mman.bdev,AMDGPU_PL_OA , - adev->gds.oa_size); + r =amdgpu_ttm_init_on_chip (adev,AMDGPU_PL_OA , adev->gds.oa_size);if (r) {DRM_ERROR ("Failed initializing oa heap.\n" );return r;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/9 drm/vmwgfx: 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/vmwgfx/vmwgfx_drv.c | 18 +++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 27 ---------------------- 2 files changed, 18 insertions(+), 27 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +18 -0
@@ -864,6 +864,9 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)* Enable VRAM, but initially don't use it until SVGA is enabled and * unhidden. */ + dev_priv->bdev.man[TTM_PL_VRAM ].func = &vmw_thp_func; + dev_priv->bdev.man[TTM_PL_VRAM ].available_caching =TTM_PL_FLAG_CACHED ; + dev_priv->bdev.man[TTM_PL_VRAM ].default_caching =TTM_PL_FLAG_CACHED ; ret =ttm_bo_init_mm (&dev_priv->bdev,TTM_PL_VRAM , (dev_priv->vram_size >>PAGE_SHIFT ));if (unlikely (ret !=0 )) {
@@ -872,7 +875,17 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) } dev_priv->bdev.man[TTM_PL_VRAM ].use_type = false; +/* +* "Guest Memory Regions" is an aperture like feature with +* one slot per bo. There is an upper limit of the number of +* slots as well as the bo size. +*/ dev_priv->has_gmr = true; + dev_priv->bdev.man[VMW_PL_GMR ].func = &vmw_gmrid_manager_func; + dev_priv->bdev.man[VMW_PL_GMR ].available_caching =TTM_PL_FLAG_CACHED ; + dev_priv->bdev.man[VMW_PL_GMR ].default_caching =TTM_PL_FLAG_CACHED ; +/* TODO: This is most likely not correct */ + dev_priv->bdev.man[VMW_PL_GMR ].use_tt = true;if (((dev_priv->capabilities & (SVGA_CAP_GMR |SVGA_CAP_GMR2 )) ==0 ) || refuse_dma ||ttm_bo_init_mm (&dev_priv->bdev,VMW_PL_GMR ,VMW_PL_GMR ) !=0 ) {
@@ -883,6 +896,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)if (dev_priv->capabilities &SVGA_CAP_GBOBJECTS && !refuse_dma) { dev_priv->has_mob = true; + dev_priv->bdev.man[VMW_PL_MOB ].func = &vmw_gmrid_manager_func; + dev_priv->bdev.man[VMW_PL_MOB ].available_caching =TTM_PL_FLAG_CACHED ; + dev_priv->bdev.man[VMW_PL_MOB ].default_caching =TTM_PL_FLAG_CACHED ; +/* TODO: This is most likely not correct */ + dev_priv->bdev.man[VMW_PL_MOB ].use_tt = true;if (ttm_bo_init_mm (&dev_priv->bdev,VMW_PL_MOB ,VMW_PL_MOB ) !=0 ) { DRM_INFO("No MOB memory available. "
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0 -27
@@ -739,33 +739,6 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo,static int vmw_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -break ; -case TTM_PL_VRAM : -/* "On-card" video ram */ - man->func = &vmw_thp_func; - man->available_caching =TTM_PL_FLAG_CACHED ; - man->default_caching =TTM_PL_FLAG_CACHED ; -break ; -case VMW_PL_GMR : -case VMW_PL_MOB : -/* -* "Guest Memory Regions" is an aperture like feature with -* one slot per bo. There is an upper limit of the number of -* slots as well as the bo size. -*/ - 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); -return -EINVAL ; - }return 0 ; }
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/9 drm/nouveau: 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/nouveau/nouveau_bo.c | 48 --------------------- drivers/gpu/drm/nouveau/nouveau_ttm.c | 61 +++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 52 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +0 -48
@@ -650,54 +650,6 @@ static int nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, struct ttm_mem_type_manager *man) { - struct nouveau_drm *drm = nouveau_bdev(bdev); -struct nvif_mmu *mmu = &drm->client.mmu; - -switch (type) { -case TTM_PL_SYSTEM : -break ; -case TTM_PL_VRAM : - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; - -if (drm->client.device.info.family >=NV_DEVICE_INFO_V0_TESLA ) { -/* Some BARs do not support being ioremapped WC */ -const u8 type = mmu->type[drm->ttm.type_vram].type; -if (type &NVIF_MEM_UNCACHED ) { - man->available_caching =TTM_PL_FLAG_UNCACHED ; - man->default_caching =TTM_PL_FLAG_UNCACHED ; - } - - man->func = &nouveau_vram_manager; - man->use_io_reserve_lru = true; - }else { - man->func = &ttm_bo_manager_func; - } -break ; -case TTM_PL_TT : -if (drm->client.device.info.family >=NV_DEVICE_INFO_V0_TESLA ) - man->func = &nouveau_gart_manager; -else -if (!drm->agp.bridge) - man->func = &nv04_gart_manager; -else - man->func = &ttm_bo_manager_func; - - man->use_tt = true; -if (drm->agp.bridge) { - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; - }else { - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; - } - -break ; -default : -return -EINVAL ; - } return 0; }
drivers/gpu/drm/nouveau/nouveau_ttm.c +57 -4
79 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/9 drm/qxl: 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/qxl/qxl_ttm.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/gpu/drm/qxl/qxl_ttm.c +16 -19
@@ -51,21 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)static int qxl_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -switch (type) { -case TTM_PL_SYSTEM : -/* System memory */ -break ; -case TTM_PL_VRAM : -case TTM_PL_PRIV : -/* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_MASK_CACHING ; - man->default_caching =TTM_PL_FLAG_CACHED ; -break ; -default : -DRM_ERROR ("Unsupported memory type %u\n" , (unsigned int )type); -return -EINVAL ; - }return 0 ; }
@@ -238,6 +223,19 @@ static struct ttm_bo_driver qxl_bo_driver = { .move_notify = &qxl_bo_move_notify, }; +static int qxl_ttm_init_mem_type (struct qxl_device *qdev, +unsigned int type, +uint64_t size) +{ +struct ttm_mem_type_manager *man = &qdev->mman.bdev.man[type]; + + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_MASK_CACHING ; + man->default_caching =TTM_PL_FLAG_CACHED ; + +return ttm_bo_init_mm (&qdev->mman.bdev, type, size); +} +int qxl_ttm_init (struct qxl_device *qdev) {int r;
@@ -255,14 +253,13 @@ int qxl_ttm_init(struct qxl_device *qdev) }/* NOTE: this includes the framebuffer (aka surface 0) */ num_io_pages = qdev->rom->ram_header_offset /PAGE_SIZE ; - r =ttm_bo_init_mm (&qdev->mman.bdev,TTM_PL_VRAM , - num_io_pages); + r =qxl_ttm_init_mem_type (qdev,TTM_PL_VRAM , num_io_pages);if (r) {DRM_ERROR ("Failed initializing VRAM heap.\n" );return r; } - r =ttm_bo_init_mm (&qdev->mman.bdev,TTM_PL_PRIV , - qdev->surfaceram_size /PAGE_SIZE ); + r =qxl_ttm_init_mem_type (qdev,TTM_PL_PRIV , + qdev->surfaceram_size /PAGE_SIZE );if (r) {DRM_ERROR ("Failed initializing Surfaces heap.\n" );return r;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/9 drm/vram-helper: 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/drm_gem_vram_helper.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_gem_vram_helper.c +4 -12
@@ -1007,18 +1007,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,static int bo_driver_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -switch (type) { -case TTM_PL_SYSTEM : -break ; -case TTM_PL_VRAM : - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; -break ; -default : -return -EINVAL ; - }return 0 ; }
@@ -1126,6 +1114,7 @@ EXPORT_SYMBOL(drm_vram_mm_debugfs_init);static int drm_vram_mm_init (struct drm_vram_mm *vmm,struct drm_device *dev,uint64_t vram_base,size_t vram_size) { +struct ttm_mem_type_manager *man = &vmm->bdev.man[TTM_PL_VRAM ];int ret; vmm->vram_base = vram_base;
@@ -1138,6 +1127,9 @@ static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,if (ret)return ret; + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; ret =ttm_bo_init_mm (&vmm->bdev,TTM_PL_VRAM , vram_size >>PAGE_SHIFT );if (ret)return ret;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 8/9] drm/vram-helper: stop implementing init_mem_type
Am 23.07.20 um 17:17 schrieb 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]>
Quoted 46 lines
--- drivers/gpu/drm/drm_gem_vram_helper.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)drivers/gpu/drm/drm_gem_vram_helper.c +4
-12@@ -1007,18 +1007,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,static int bo_driver_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -switch (type) { -case TTM_PL_SYSTEM : -break ; -case TTM_PL_VRAM : - man->func = &ttm_bo_manager_func; - man->available_caching =TTM_PL_FLAG_UNCACHED | -TTM_PL_FLAG_WC ; - man->default_caching =TTM_PL_FLAG_WC ; -break ; -default : -return -EINVAL ; - }return 0 ; }@@ -1126,6 +1114,7 @@ EXPORT_SYMBOL(drm_vram_mm_debugfs_init);static int drm_vram_mm_init (struct drm_vram_mm *vmm,struct drm_device *dev,uint64_t vram_base,size_t vram_size) { +struct ttm_mem_type_manager *man = &vmm->bdev.man[TTM_PL_VRAM ];int ret; vmm->vram_base = vram_base;@@ -1138,6 +1127,9 @@ static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,if (ret)return ret; + man->func = &ttm_bo_manager_func; + man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; + man->default_caching =TTM_PL_FLAG_WC ; ret =ttm_bo_init_mm (&vmm->bdev,TTM_PL_VRAM , vram_size >>PAGE_SHIFT );if (ret)return ret;
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/9 drm/ttm: remove the init_mem_type callback
In reply to Christian KönigIt is a very strange concept to call a function which just calls back the caller for the functions parameters.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ------- drivers/gpu/drm/drm_gem_vram_helper.c | 7 ------- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 -------- drivers/gpu/drm/qxl/qxl_ttm.c | 7 ------- drivers/gpu/drm/radeon/radeon_ttm.c | 7 ------- drivers/gpu/drm/ttm/ttm_bo.c | 4 ---- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 7 ------- include/drm/ttm/ttm_bo_driver.h | 6 ------ 8 files changed, 53 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -7
@@ -62,12 +62,6 @@#define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128 -static int amdgpu_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static int amdgpu_ttm_init_vram (struct amdgpu_device *adev) {
@@ -1727,7 +1721,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = { .ttm_tt_create = &amdgpu_ttm_tt_create, .ttm_tt_populate = &amdgpu_ttm_tt_populate, .ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate, - .init_mem_type = &amdgpu_init_mem_type, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags, .move = &amdgpu_bo_move,
drivers/gpu/drm/drm_gem_vram_helper.c +0 -7
@@ -1004,12 +1004,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } -static int bo_driver_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void bo_driver_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {
@@ -1069,7 +1063,6 @@ static struct ttm_bo_driver bo_driver = { .ttm_tt_create = bo_driver_ttm_tt_create, .ttm_tt_populate = ttm_pool_populate, .ttm_tt_unpopulate = ttm_pool_unpopulate, - .init_mem_type = bo_driver_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = bo_driver_evict_flags, .move_notify = bo_driver_move_notify,
drivers/gpu/drm/nouveau/nouveau_bo.c +0 -8
@@ -646,13 +646,6 @@ nouveau_ttm_tt_create(struct ttm_buffer_object *bo, uint32_t page_flags)return nouveau_sgdma_create_ttm (bo, page_flags); } -static int -nouveau_bo_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void nouveau_bo_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *pl) {
@@ -1643,7 +1636,6 @@ struct ttm_bo_driver nouveau_bo_driver = { .ttm_tt_create = &nouveau_ttm_tt_create, .ttm_tt_populate = &nouveau_ttm_tt_populate, .ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate, - .init_mem_type = nouveau_bo_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags, .move_notify = nouveau_bo_move_ntfy,
drivers/gpu/drm/qxl/qxl_ttm.c +0 -7
@@ -48,12 +48,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)return qdev; } -static int qxl_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void qxl_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {
@@ -215,7 +209,6 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, - .init_mem_type = &qxl_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move,
drivers/gpu/drm/radeon/radeon_ttm.c +0 -7
@@ -66,12 +66,6 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)return rdev; } -static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static int radeon_ttm_init_vram (struct radeon_device *rdev) {struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ];
@@ -753,7 +747,6 @@ static struct ttm_bo_driver radeon_bo_driver = { .ttm_tt_create = &radeon_ttm_tt_create, .ttm_tt_populate = &radeon_ttm_tt_populate, .ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate, - .init_mem_type = &radeon_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags, .move = &radeon_bo_move,
drivers/gpu/drm/ttm/ttm_bo.c +0 -4
@@ -1527,10 +1527,6 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,mutex_init (&man->io_reserve_mutex);spin_lock_init (&man->move_lock);INIT_LIST_HEAD (&man->io_reserve_lru); - - ret = bdev->driver->init_mem_type (bdev, type, man); -if (ret) -return ret; man->bdev = bdev;if (type !=TTM_PL_SYSTEM ) {
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0 -7
@@ -736,12 +736,6 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } -static int vmw_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void vmw_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {
@@ -817,7 +811,6 @@ struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_create = &vmw_ttm_tt_create, .ttm_tt_populate = &vmw_ttm_populate, .ttm_tt_unpopulate = &vmw_ttm_unpopulate, - .init_mem_type = vmw_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags, .move = NULL,
include/drm/ttm/ttm_bo_driver.h +0 -6
@@ -157,7 +157,6 @@ struct ttm_mem_type_manager_func {* @move: The fence of the last pipelined move operation. * * This structure is used to identify and manage memory types for a device. -* It's set up by the ttm_bo_driver::init_mem_type method. */
@@ -203,8 +202,6 @@ struct ttm_mem_type_manager {* struct ttm_bo_driver * * @create_ttm_backend_entry: Callback to create a struct ttm_backend. -* @init_mem_type: Callback to initialize a struct ttm_mem_type_manager -* structure. * @evict_flags: Callback to obtain placement flags when a buffer is evicted. * @move: Callback for a driver to hook in accelerated functions to * move a buffer.
@@ -247,9 +244,6 @@ struct ttm_bo_driver {*/ void (*ttm_tt_unpopulate)(struct ttm_tt *ttm); -int (*init_mem_type)(struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man); -/** * struct ttm_bo_driver member eviction_valuable *
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 9/9] drm/ttm: remove the init_mem_type callback
Quoted 5 lines · Christian König
It is a very strange concept to call a function which just calls back the caller for the functions parameters.
Signed-off-by Christian König <[email protected]>
Series is:
Quoted 211 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ------- drivers/gpu/drm/drm_gem_vram_helper.c | 7 ------- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 -------- drivers/gpu/drm/qxl/qxl_ttm.c | 7 ------- drivers/gpu/drm/radeon/radeon_ttm.c | 7 ------- drivers/gpu/drm/ttm/ttm_bo.c | 4 ---- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 7 ------- include/drm/ttm/ttm_bo_driver.h | 6 ------ 8 files changed, 53 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-7@@ -62,12 +62,6 @@#define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128 -static int amdgpu_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static int amdgpu_ttm_init_vram (struct amdgpu_device *adev) {@@ -1727,7 +1721,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = { .ttm_tt_create = &amdgpu_ttm_tt_create, .ttm_tt_populate = &amdgpu_ttm_tt_populate, .ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate, - .init_mem_type = &amdgpu_init_mem_type, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags, .move = &amdgpu_bo_move,drivers/gpu/drm/drm_gem_vram_helper.c +0
-7@@ -1004,12 +1004,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } -static int bo_driver_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void bo_driver_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {@@ -1069,7 +1063,6 @@ static struct ttm_bo_driver bo_driver = { .ttm_tt_create = bo_driver_ttm_tt_create, .ttm_tt_populate = ttm_pool_populate, .ttm_tt_unpopulate = ttm_pool_unpopulate, - .init_mem_type = bo_driver_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = bo_driver_evict_flags, .move_notify = bo_driver_move_notify,drivers/gpu/drm/nouveau/nouveau_bo.c +0
-8@@ -646,13 +646,6 @@ nouveau_ttm_tt_create(struct ttm_buffer_object *bo, uint32_t page_flags)return nouveau_sgdma_create_ttm (bo, page_flags); } -static int -nouveau_bo_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void nouveau_bo_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *pl) {@@ -1643,7 +1636,6 @@ struct ttm_bo_driver nouveau_bo_driver = { .ttm_tt_create = &nouveau_ttm_tt_create, .ttm_tt_populate = &nouveau_ttm_tt_populate, .ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate, - .init_mem_type = nouveau_bo_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags, .move_notify = nouveau_bo_move_ntfy,drivers/gpu/drm/qxl/qxl_ttm.c +0
-7@@ -48,12 +48,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)return qdev; } -static int qxl_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void qxl_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {@@ -215,7 +209,6 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, - .init_mem_type = &qxl_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move,drivers/gpu/drm/radeon/radeon_ttm.c +0
-7@@ -66,12 +66,6 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)return rdev; } -static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static int radeon_ttm_init_vram (struct radeon_device *rdev) {struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ];@@ -753,7 +747,6 @@ static struct ttm_bo_driver radeon_bo_driver = { .ttm_tt_create = &radeon_ttm_tt_create, .ttm_tt_populate = &radeon_ttm_tt_populate, .ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate, - .init_mem_type = &radeon_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags, .move = &radeon_bo_move,drivers/gpu/drm/ttm/ttm_bo.c +0
-4@@ -1527,10 +1527,6 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,mutex_init (&man->io_reserve_mutex);spin_lock_init (&man->move_lock);INIT_LIST_HEAD (&man->io_reserve_lru); - - ret = bdev->driver->init_mem_type (bdev, type, man); -if (ret) -return ret; man->bdev = bdev;if (type !=TTM_PL_SYSTEM ) {drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-7@@ -736,12 +736,6 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } -static int vmw_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void vmw_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {@@ -817,7 +811,6 @@ struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_create = &vmw_ttm_tt_create, .ttm_tt_populate = &vmw_ttm_populate, .ttm_tt_unpopulate = &vmw_ttm_unpopulate, - .init_mem_type = vmw_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags, .move = NULL,include/drm/ttm/ttm_bo_driver.h +0
-7@@ -157,7 +157,6 @@ struct ttm_mem_type_manager_func {* @move: The fence of the last pipelined move operation. * * This structure is used to identify and manage memory types for a device. -* It's set up by the ttm_bo_driver::init_mem_type method. */ @@ -203,8 +202,6 @@ struct ttm_mem_type_manager {* struct ttm_bo_driver * * @create_ttm_backend_entry: Callback to create a struct ttm_backend. -* @init_mem_type: Callback to initialize a struct ttm_mem_type_manager -* structure. * @evict_flags: Callback to obtain placement flags when a buffer is evicted. * @move: Callback for a driver to hook in accelerated functions to * move a buffer. @@ -247,9 +244,6 @@ struct ttm_bo_driver {*/ void (*ttm_tt_unpopulate)(struct ttm_tt *ttm); -int (*init_mem_type)(struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man); -/** * struct ttm_bo_driver member eviction_valuable * -- 2.17.1
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 9/9] drm/ttm: remove the init_mem_type callback
In reply to Christian KönigAm 23.07.20 um 17:17 schrieb Christian König:
Quoted 4 lines
It is a very strange concept to call a function which just calls back the caller for the functions parameters.
Signed-off-by Christian König <[email protected]>
Quoted 209 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ------- drivers/gpu/drm/drm_gem_vram_helper.c | 7 ------- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 -------- drivers/gpu/drm/qxl/qxl_ttm.c | 7 ------- drivers/gpu/drm/radeon/radeon_ttm.c | 7 ------- drivers/gpu/drm/ttm/ttm_bo.c | 4 ---- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 7 ------- include/drm/ttm/ttm_bo_driver.h | 6 ------ 8 files changed, 53 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-7@@ -62,12 +62,6 @@#define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128 -static int amdgpu_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static int amdgpu_ttm_init_vram (struct amdgpu_device *adev) {@@ -1727,7 +1721,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = { .ttm_tt_create = &amdgpu_ttm_tt_create, .ttm_tt_populate = &amdgpu_ttm_tt_populate, .ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate, - .init_mem_type = &amdgpu_init_mem_type, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags, .move = &amdgpu_bo_move,drivers/gpu/drm/drm_gem_vram_helper.c +0
-7@@ -1004,12 +1004,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } -static int bo_driver_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void bo_driver_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {@@ -1069,7 +1063,6 @@ static struct ttm_bo_driver bo_driver = { .ttm_tt_create = bo_driver_ttm_tt_create, .ttm_tt_populate = ttm_pool_populate, .ttm_tt_unpopulate = ttm_pool_unpopulate, - .init_mem_type = bo_driver_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = bo_driver_evict_flags, .move_notify = bo_driver_move_notify,drivers/gpu/drm/nouveau/nouveau_bo.c +0
-8@@ -646,13 +646,6 @@ nouveau_ttm_tt_create(struct ttm_buffer_object *bo, uint32_t page_flags)return nouveau_sgdma_create_ttm (bo, page_flags); } -static int -nouveau_bo_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void nouveau_bo_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *pl) {@@ -1643,7 +1636,6 @@ struct ttm_bo_driver nouveau_bo_driver = { .ttm_tt_create = &nouveau_ttm_tt_create, .ttm_tt_populate = &nouveau_ttm_tt_populate, .ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate, - .init_mem_type = nouveau_bo_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags, .move_notify = nouveau_bo_move_ntfy,drivers/gpu/drm/qxl/qxl_ttm.c +0
-7@@ -48,12 +48,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)return qdev; } -static int qxl_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void qxl_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {@@ -215,7 +209,6 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, - .init_mem_type = &qxl_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move,drivers/gpu/drm/radeon/radeon_ttm.c +0
-7@@ -66,12 +66,6 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)return rdev; } -static int radeon_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static int radeon_ttm_init_vram (struct radeon_device *rdev) {struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM ];@@ -753,7 +747,6 @@ static struct ttm_bo_driver radeon_bo_driver = { .ttm_tt_create = &radeon_ttm_tt_create, .ttm_tt_populate = &radeon_ttm_tt_populate, .ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate, - .init_mem_type = &radeon_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags, .move = &radeon_bo_move,drivers/gpu/drm/ttm/ttm_bo.c +0
-4@@ -1527,10 +1527,6 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,mutex_init (&man->io_reserve_mutex);spin_lock_init (&man->move_lock);INIT_LIST_HEAD (&man->io_reserve_lru); - - ret = bdev->driver->init_mem_type (bdev, type, man); -if (ret) -return ret; man->bdev = bdev;if (type !=TTM_PL_SYSTEM ) {drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-7@@ -736,12 +736,6 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } -static int vmw_init_mem_type (struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man) -{ -return 0 ; -} -static void vmw_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *placement) {@@ -817,7 +811,6 @@ struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_create = &vmw_ttm_tt_create, .ttm_tt_populate = &vmw_ttm_populate, .ttm_tt_unpopulate = &vmw_ttm_unpopulate, - .init_mem_type = vmw_init_mem_type, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags, .move = NULL,include/drm/ttm/ttm_bo_driver.h +0
-6@@ -157,7 +157,6 @@ struct ttm_mem_type_manager_func {* @move: The fence of the last pipelined move operation. * * This structure is used to identify and manage memory types for a device. -* It's set up by the ttm_bo_driver::init_mem_type method. */ @@ -203,8 +202,6 @@ struct ttm_mem_type_manager {* struct ttm_bo_driver * * @create_ttm_backend_entry: Callback to create a struct ttm_backend. -* @init_mem_type: Callback to initialize a struct ttm_mem_type_manager -* structure. * @evict_flags: Callback to obtain placement flags when a buffer is evicted. * @move: Callback for a driver to hook in accelerated functions to * move a buffer. @@ -247,9 +244,6 @@ struct ttm_bo_driver {*/ void (*ttm_tt_unpopulate)(struct ttm_tt *ttm); -int (*init_mem_type)(struct ttm_bo_device *bdev,uint32_t type, -struct ttm_mem_type_manager *man); -/** * struct ttm_bo_driver member eviction_valuable *
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel