drm/ttm: get rid of bind/unbind
Subsystems (7)
Dave Airlie
maintainercover drm/ttm: get rid of bind/unbind
This series is a rebase/cleanup of previous patches.
The goal is to drop the bind/unbind callbacks from the ttm and have the driver handle it all in it's move function.
This also has the driver do it's own move notifys from within move as well (move notify is still used for cleanup_memtype_use0.
I've booted this on nouveau and vmwgfx.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 1/7 drm/ttm: move some move binds into the drivers
From: Dave Airlie <[email protected]>
This just gives the driver control over some of the bind paths.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 10 +++++++--- drivers/gpu/drm/radeon/radeon_ttm.c | 11 ++++++++--- drivers/gpu/drm/ttm/ttm_bo_util.c | 1 - 4 files changed, 21 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 -1
@@ -605,10 +605,15 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, }/* move/bind old memory to GTT space */ - r =ttm_bo_move_to_new_tt_mem (bo, ctx, &tmp_mem); + r =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (r)) +return r; + + r =amdgpu_ttm_backend_bind (bo->bdev, bo->ttm, &tmp_mem);if (unlikely (r)) { goto out_cleanup; } +ttm_bo_assign_mem (bo, &tmp_mem);/* copy to VRAM */ r =amdgpu_move_blit (bo, evict, new_mem, old_mem);
drivers/gpu/drm/nouveau/nouveau_bo.c +7 -3
@@ -931,9 +931,13 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict,if (ret)return ret; - ret =ttm_bo_move_to_new_tt_mem (bo, ctx, &tmp_reg); -if (ret) - goto out; + ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (ret !=0 )) +return ret; + + ret =nouveau_ttm_tt_bind (bo->bdev, bo->ttm, &tmp_reg); +if (unlikely (ret !=0 )) +return ret;ttm_bo_assign_mem (bo, &tmp_reg); ret =nouveau_bo_move_m2mf (bo, true, ctx, new_reg);
drivers/gpu/drm/radeon/radeon_ttm.c +8 -3
@@ -279,10 +279,15 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,if (unlikely (r)) {return r; } - r =ttm_bo_move_to_new_tt_mem (bo, ctx, &tmp_mem); -if (unlikely (r)) { + + r =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (r)) goto out_cleanup; - } + + r =radeon_ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem); +if (unlikely (r)) + goto out_cleanup; +ttm_bo_assign_mem (bo, &tmp_mem); r =radeon_move_blit (bo, true, new_mem, old_mem);if (unlikely (r)) {
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
@@ -64,7 +64,6 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,return 0 ; } -EXPORT_SYMBOL (ttm_bo_move_to_new_tt_mem);int ttm_bo_move_to_system (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx)
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/ttm: move some move binds into the drivers
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 5 lines
From: Dave Airlie <[email protected]>
This just gives the driver control over some of the bind paths.
Signed-off-by Dave Airlie <[email protected]>
Quoted 77 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 10 +++++++--- drivers/gpu/drm/radeon/radeon_ttm.c | 11 ++++++++--- drivers/gpu/drm/ttm/ttm_bo_util.c | 1 - 4 files changed, 21 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-1@@ -605,10 +605,15 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, }/* move/bind old memory to GTT space */ - r =ttm_bo_move_to_new_tt_mem (bo, ctx, &tmp_mem); + r =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (r)) +return r; + + r =amdgpu_ttm_backend_bind (bo->bdev, bo->ttm, &tmp_mem);if (unlikely (r)) { goto out_cleanup; } +ttm_bo_assign_mem (bo, &tmp_mem);/* copy to VRAM */ r =amdgpu_move_blit (bo, evict, new_mem, old_mem);drivers/gpu/drm/nouveau/nouveau_bo.c +7
-3@@ -931,9 +931,13 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict,if (ret)return ret; - ret =ttm_bo_move_to_new_tt_mem (bo, ctx, &tmp_reg); -if (ret) - goto out; + ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (ret !=0 )) +return ret; + + ret =nouveau_ttm_tt_bind (bo->bdev, bo->ttm, &tmp_reg); +if (unlikely (ret !=0 )) +return ret;ttm_bo_assign_mem (bo, &tmp_reg); ret =nouveau_bo_move_m2mf (bo, true, ctx, new_reg);drivers/gpu/drm/radeon/radeon_ttm.c +8
-3@@ -279,10 +279,15 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,if (unlikely (r)) {return r; } - r =ttm_bo_move_to_new_tt_mem (bo, ctx, &tmp_mem); -if (unlikely (r)) { + + r =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (r)) goto out_cleanup; - } + + r =radeon_ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem); +if (unlikely (r)) + goto out_cleanup; +ttm_bo_assign_mem (bo, &tmp_mem); r =radeon_move_blit (bo, true, new_mem, old_mem);if (unlikely (r)) {drivers/gpu/drm/ttm/ttm_bo_util.c +0
-0
drivers/gpu/drm/ttm/ttm_bo_util.c int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo, · line 69
Quoted 7 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +0
-1@@ -64,7 +64,6 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,return 0 ; } -EXPORT_SYMBOL (ttm_bo_move_to_new_tt_mem);int ttm_bo_move_to_system (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 2/7 drm/ttm: minor cleanup to move to system
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
resource free already sets the domain to system, and old_mem isn't really needed.
--- drivers/gpu/drm/ttm/ttm_bo_util.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -3
@@ -68,10 +68,9 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,int ttm_bo_move_to_system (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx) { -struct ttm_resource *old_mem = &bo->mem;int ret; -if (old_mem->mem_type ==TTM_PL_SYSTEM ) +if (bo->mem.mem_type ==TTM_PL_SYSTEM )return 0 ; ret =ttm_bo_wait_ctx (bo, ctx);
@@ -83,7 +82,6 @@ int ttm_bo_move_to_system(struct ttm_buffer_object *bo,ttm_bo_tt_unbind (bo);ttm_resource_free (bo, &bo->mem); - old_mem->mem_type =TTM_PL_SYSTEM ;return 0 ; }EXPORT_SYMBOL (ttm_bo_move_to_system);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/7] drm/ttm: minor cleanup to move to system
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 6 lines
From: Dave Airlie <[email protected]>
resource free already sets the domain to system, and
old_memisn't really needed.Signed-off-by Dave Airlie <[email protected]>
Quoted 21 lines
--- drivers/gpu/drm/ttm/ttm_bo_util.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/ttm/ttm_bo_util.c +1
-2@@ -68,10 +68,9 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,int ttm_bo_move_to_system (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx) { -struct ttm_resource *old_mem = &bo->mem;int ret; -if (old_mem->mem_type ==TTM_PL_SYSTEM ) +if (bo->mem.mem_type ==TTM_PL_SYSTEM )return 0 ; ret =ttm_bo_wait_ctx (bo, ctx);
drivers/gpu/drm/ttm/ttm_bo_util.c int ttm_bo_move_to_system(struct ttm_buffer_object *bo, · line 87
Quoted 7 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +0
-1@@ -83,7 +82,6 @@ int ttm_bo_move_to_system(struct ttm_buffer_object *bo,ttm_bo_tt_unbind (bo);ttm_resource_free (bo, &bo->mem); - old_mem->mem_type =TTM_PL_SYSTEM ;return 0 ; }EXPORT_SYMBOL (ttm_bo_move_to_system);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 3/7 drm/ttm: add move to system into drivers
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This moves the to system move into the drivers, and moves all the unbinds in the move path under driver control
Note: radeon/nouveau already wait so don't duplicate it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 12 +++++++++--- drivers/gpu/drm/nouveau/nouveau_bo.c | 10 ++++++---- drivers/gpu/drm/radeon/radeon_ttm.c | 12 +++++++----- drivers/gpu/drm/ttm/ttm_bo_util.c | 21 --------------------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 5 ++++- include/drm/ttm/ttm_bo_driver.h | 2 -- 6 files changed, 26 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +9 -3
@@ -66,6 +66,8 @@static int amdgpu_ttm_backend_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); +static void amdgpu_ttm_backend_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm); static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev, unsigned int type,
@@ -561,11 +563,12 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, goto out_cleanup; } -/* move BO (in tmp_mem) to new_mem */ - r =ttm_bo_move_to_system (bo, ctx); + r =ttm_bo_wait_ctx (bo, ctx);if (unlikely (r)) goto out_cleanup; +amdgpu_ttm_backend_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem); out_cleanup:ttm_resource_free (bo, &tmp_mem);
@@ -682,9 +685,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_SYSTEM ) { - r =ttm_bo_move_to_system (bo, ctx); + r =ttm_bo_wait_ctx (bo, ctx);if (r)return r; + +amdgpu_ttm_backend_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }
drivers/gpu/drm/nouveau/nouveau_bo.c +6 -4
@@ -46,6 +46,7 @@static int nouveau_ttm_tt_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *reg); +static void nouveau_ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/* * NV10-NV40 tiling helpers
@@ -897,10 +898,12 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict,if (ret) goto out; - ret =ttm_bo_move_to_system (bo, ctx); + ret =ttm_bo_wait_ctx (bo, ctx);if (ret) goto out; +nouveau_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, &tmp_reg); out:ttm_resource_free (bo, &tmp_reg);
@@ -1056,9 +1059,8 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,if (old_reg->mem_type ==TTM_PL_TT && new_reg->mem_type ==TTM_PL_SYSTEM ) { - ret =ttm_bo_move_to_system (bo, ctx); -if (ret) -return ret; +nouveau_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_reg); goto out; }
drivers/gpu/drm/radeon/radeon_ttm.c +7 -5
@@ -59,6 +59,8 @@ static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);static int radeon_ttm_tt_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); +static void radeon_ttm_tt_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm);struct radeon_device *radeon_get_rdev (struct ttm_bo_device *bdev) {
@@ -244,10 +246,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,if (unlikely (r)) { goto out_cleanup; } - r =ttm_bo_move_to_system (bo, ctx); + r =ttm_bo_wait_ctx (bo, ctx);if (unlikely (r)) goto out_cleanup; +radeon_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem); out_cleanup:ttm_resource_free (bo, &tmp_mem);
@@ -329,10 +333,8 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_SYSTEM ) { - r =ttm_bo_move_to_system (bo, ctx); -if (r) -return r; - +radeon_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -21
@@ -65,27 +65,6 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,return 0 ; } -int ttm_bo_move_to_system (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx) -{ -int ret; - -if (bo->mem.mem_type ==TTM_PL_SYSTEM ) -return 0 ; - - ret =ttm_bo_wait_ctx (bo, ctx); -if (unlikely (ret !=0 )) { -if (ret != -ERESTARTSYS ) -pr_err ("Failed to expire sync object before unbinding TTM\n" ); -return ret; - } - -ttm_bo_tt_unbind (bo); -ttm_resource_free (bo, &bo->mem); -return 0 ; -} -EXPORT_SYMBOL (ttm_bo_move_to_system); -int ttm_mem_io_reserve (struct ttm_bo_device *bdev,struct ttm_resource *mem) {
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +4 -1
@@ -742,9 +742,12 @@ static int vmw_move(struct ttm_buffer_object *bo,ttm_bo_assign_mem (bo, new_mem);return 0 ; } - ret =ttm_bo_move_to_system (bo, ctx); + ret =ttm_bo_wait_ctx (bo, ctx);if (ret)return ret; + +vmw_ttm_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }else {
include/drm/ttm/ttm_bo_driver.h +0 -2
@@ -574,8 +574,6 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev,int ttm_bo_move_to_new_tt_mem (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx,struct ttm_resource *new_mem); -int ttm_bo_move_to_system (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx);/** * ttm_bo_move_memcpy
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/7] drm/ttm: add move to system into drivers
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 8 lines
From: Dave Airlie <[email protected]>
This moves the to system move into the drivers, and moves all the unbinds in the move path under driver control
Note: radeon/nouveau already wait so don't duplicate it.
Signed-off-by Dave Airlie <[email protected]>
Quoted 184 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 12 +++++++++--- drivers/gpu/drm/nouveau/nouveau_bo.c | 10 ++++++---- drivers/gpu/drm/radeon/radeon_ttm.c | 12 +++++++----- drivers/gpu/drm/ttm/ttm_bo_util.c | 21 --------------------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 5 ++++- include/drm/ttm/ttm_bo_driver.h | 2 -- 6 files changed, 26 insertions(+), 36 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +9
-3@@ -66,6 +66,8 @@static int amdgpu_ttm_backend_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); +static void amdgpu_ttm_backend_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm); static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev, unsigned int type,@@ -561,11 +563,12 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, goto out_cleanup; } -/* move BO (in tmp_mem) to new_mem */ - r =ttm_bo_move_to_system (bo, ctx); + r =ttm_bo_wait_ctx (bo, ctx);if (unlikely (r)) goto out_cleanup; +amdgpu_ttm_backend_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem); out_cleanup:ttm_resource_free (bo, &tmp_mem);@@ -682,9 +685,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_SYSTEM ) { - r =ttm_bo_move_to_system (bo, ctx); + r =ttm_bo_wait_ctx (bo, ctx);if (r)return r; + +amdgpu_ttm_backend_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }drivers/gpu/drm/nouveau/nouveau_bo.c +6
-4@@ -46,6 +46,7 @@static int nouveau_ttm_tt_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *reg); +static void nouveau_ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/* * NV10-NV40 tiling helpers @@ -897,10 +898,12 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict,if (ret) goto out; - ret =ttm_bo_move_to_system (bo, ctx); + ret =ttm_bo_wait_ctx (bo, ctx);if (ret) goto out; +nouveau_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, &tmp_reg); out:ttm_resource_free (bo, &tmp_reg);@@ -1056,9 +1059,8 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,if (old_reg->mem_type ==TTM_PL_TT && new_reg->mem_type ==TTM_PL_SYSTEM ) { - ret =ttm_bo_move_to_system (bo, ctx); -if (ret) -return ret; +nouveau_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_reg); goto out; }drivers/gpu/drm/radeon/radeon_ttm.c +7
-5@@ -59,6 +59,8 @@ static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);static int radeon_ttm_tt_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); +static void radeon_ttm_tt_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm);struct radeon_device *radeon_get_rdev (struct ttm_bo_device *bdev) {@@ -244,10 +246,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,if (unlikely (r)) { goto out_cleanup; } - r =ttm_bo_move_to_system (bo, ctx); + r =ttm_bo_wait_ctx (bo, ctx);if (unlikely (r)) goto out_cleanup; +radeon_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem); out_cleanup:ttm_resource_free (bo, &tmp_mem);@@ -329,10 +333,8 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_SYSTEM ) { - r =ttm_bo_move_to_system (bo, ctx); -if (r) -return r; - +radeon_ttm_tt_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }drivers/gpu/drm/ttm/ttm_bo_util.c +0
-21@@ -65,27 +65,6 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,return 0 ; } -int ttm_bo_move_to_system (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx) -{ -int ret; - -if (bo->mem.mem_type ==TTM_PL_SYSTEM ) -return 0 ; - - ret =ttm_bo_wait_ctx (bo, ctx); -if (unlikely (ret !=0 )) { -if (ret != -ERESTARTSYS ) -pr_err ("Failed to expire sync object before unbinding TTM\n" ); -return ret; - } - -ttm_bo_tt_unbind (bo); -ttm_resource_free (bo, &bo->mem); -return 0 ; -} -EXPORT_SYMBOL (ttm_bo_move_to_system); -int ttm_mem_io_reserve (struct ttm_bo_device *bdev,struct ttm_resource *mem) {drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +4
-1@@ -742,9 +742,12 @@ static int vmw_move(struct ttm_buffer_object *bo,ttm_bo_assign_mem (bo, new_mem);return 0 ; } - ret =ttm_bo_move_to_system (bo, ctx); + ret =ttm_bo_wait_ctx (bo, ctx);if (ret)return ret; + +vmw_ttm_unbind (bo->bdev, bo->ttm); +ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }else {include/drm/ttm/ttm_bo_driver.h +0
-0
include/drm/ttm/ttm_bo_driver.h void ttm_mem_io_free(struct ttm_bo_device *bdev, · line 579
Quoted 8 lines
include/drm/ttm/ttm_bo_driver.h +0
-2@@ -574,8 +574,6 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev,int ttm_bo_move_to_new_tt_mem (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx,struct ttm_resource *new_mem); -int ttm_bo_move_to_system (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx);/** * ttm_bo_move_memcpy
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 4/7 drm/ttm: drop unbind callback.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
The drivers now control this, so drop unbinding.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 - drivers/gpu/drm/nouveau/nouveau_bo.c | 1 - drivers/gpu/drm/qxl/qxl_ttm.c | 7 ------- drivers/gpu/drm/radeon/radeon_ttm.c | 1 - drivers/gpu/drm/ttm/ttm_bo.c | 5 ----- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 1 - include/drm/ttm/ttm_bo_driver.h | 18 ------------------ 7 files changed, 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -1
@@ -1722,7 +1722,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = { .ttm_tt_populate = &amdgpu_ttm_tt_populate, .ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate, .ttm_tt_bind = &amdgpu_ttm_backend_bind, - .ttm_tt_unbind = &amdgpu_ttm_backend_unbind, .ttm_tt_destroy = &amdgpu_ttm_backend_destroy, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags,
drivers/gpu/drm/nouveau/nouveau_bo.c +0 -1
@@ -1394,7 +1394,6 @@ struct ttm_bo_driver nouveau_bo_driver = { .ttm_tt_populate = &nouveau_ttm_tt_populate, .ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate, .ttm_tt_bind = &nouveau_ttm_tt_bind, - .ttm_tt_unbind = &nouveau_ttm_tt_unbind, .ttm_tt_destroy = &nouveau_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags,
drivers/gpu/drm/qxl/qxl_ttm.c +0 -7
@@ -113,12 +113,6 @@ static int qxl_ttm_backend_bind(struct ttm_bo_device *bdev,return -1 ; } -static void qxl_ttm_backend_unbind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) -{ -/* Not implemented */ -} -static void qxl_ttm_backend_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {
@@ -180,7 +174,6 @@ static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, .ttm_tt_bind = &qxl_ttm_backend_bind, .ttm_tt_destroy = &qxl_ttm_backend_destroy, - .ttm_tt_unbind = &qxl_ttm_backend_unbind, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move,
drivers/gpu/drm/radeon/radeon_ttm.c +0 -1
@@ -817,7 +817,6 @@ static struct ttm_bo_driver radeon_bo_driver = { .ttm_tt_populate = &radeon_ttm_tt_populate, .ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate, .ttm_tt_bind = &radeon_ttm_tt_bind, - .ttm_tt_unbind = &radeon_ttm_tt_unbind, .ttm_tt_destroy = &radeon_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags,
drivers/gpu/drm/ttm/ttm_bo.c +0 -5
@@ -1493,8 +1493,3 @@ int ttm_bo_tt_bind(struct ttm_buffer_object *bo, struct ttm_resource *mem) {return bo->bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); } - -void ttm_bo_tt_unbind (struct ttm_buffer_object *bo) -{ - bo->bdev->driver->ttm_tt_unbind (bo->bdev, bo->ttm); -}
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0 -1
@@ -760,7 +760,6 @@ struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_populate = &vmw_ttm_populate, .ttm_tt_unpopulate = &vmw_ttm_unpopulate, .ttm_tt_bind = &vmw_ttm_bind, - .ttm_tt_unbind = &vmw_ttm_unbind, .ttm_tt_destroy = &vmw_ttm_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags,
include/drm/ttm/ttm_bo_driver.h +0 -18
@@ -104,17 +104,6 @@ struct ttm_bo_driver {*/ int (*ttm_tt_bind)(struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); -/** -* ttm_tt_unbind -* -* @bdev: Pointer to a ttm device -* @ttm: Pointer to a struct ttm_tt. -* -* Unbind previously bound backend pages. This function should be -* able to handle differences between aperture and system page sizes. -*/ -void (*ttm_tt_unbind)(struct ttm_bo_device *bdev,struct ttm_tt *ttm); -/** * ttm_tt_destroy *
@@ -647,13 +636,6 @@ pgprot_t ttm_io_prot(struct ttm_buffer_object *bo, struct ttm_resource *res,*/ int ttm_bo_tt_bind (struct ttm_buffer_object *bo,struct ttm_resource *mem); -/** -* ttm_bo_tt_bind -* -* Unbind the object tt from a memory resource. -*/ -void ttm_bo_tt_unbind (struct ttm_buffer_object *bo); -/** * ttm_bo_tt_destroy. */
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/7] drm/ttm: drop unbind callback.
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 5 lines
From: Dave Airlie <[email protected]>
The drivers now control this, so drop unbinding.
Signed-off-by Dave Airlie <[email protected]>
Quoted 122 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 - drivers/gpu/drm/nouveau/nouveau_bo.c | 1 - drivers/gpu/drm/qxl/qxl_ttm.c | 7 ------- drivers/gpu/drm/radeon/radeon_ttm.c | 1 - drivers/gpu/drm/ttm/ttm_bo.c | 5 ----- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 1 - include/drm/ttm/ttm_bo_driver.h | 18 ------------------ 7 files changed, 34 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-1@@ -1722,7 +1722,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = { .ttm_tt_populate = &amdgpu_ttm_tt_populate, .ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate, .ttm_tt_bind = &amdgpu_ttm_backend_bind, - .ttm_tt_unbind = &amdgpu_ttm_backend_unbind, .ttm_tt_destroy = &amdgpu_ttm_backend_destroy, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags,drivers/gpu/drm/nouveau/nouveau_bo.c +0
-1@@ -1394,7 +1394,6 @@ struct ttm_bo_driver nouveau_bo_driver = { .ttm_tt_populate = &nouveau_ttm_tt_populate, .ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate, .ttm_tt_bind = &nouveau_ttm_tt_bind, - .ttm_tt_unbind = &nouveau_ttm_tt_unbind, .ttm_tt_destroy = &nouveau_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags,drivers/gpu/drm/qxl/qxl_ttm.c +0
-7@@ -113,12 +113,6 @@ static int qxl_ttm_backend_bind(struct ttm_bo_device *bdev,return -1 ; } -static void qxl_ttm_backend_unbind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) -{ -/* Not implemented */ -} -static void qxl_ttm_backend_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {@@ -180,7 +174,6 @@ static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, .ttm_tt_bind = &qxl_ttm_backend_bind, .ttm_tt_destroy = &qxl_ttm_backend_destroy, - .ttm_tt_unbind = &qxl_ttm_backend_unbind, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move,drivers/gpu/drm/radeon/radeon_ttm.c +0
-1@@ -817,7 +817,6 @@ static struct ttm_bo_driver radeon_bo_driver = { .ttm_tt_populate = &radeon_ttm_tt_populate, .ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate, .ttm_tt_bind = &radeon_ttm_tt_bind, - .ttm_tt_unbind = &radeon_ttm_tt_unbind, .ttm_tt_destroy = &radeon_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags,drivers/gpu/drm/ttm/ttm_bo.c +0
-5@@ -1493,8 +1493,3 @@ int ttm_bo_tt_bind(struct ttm_buffer_object *bo, struct ttm_resource *mem) {return bo->bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); } - -void ttm_bo_tt_unbind (struct ttm_buffer_object *bo) -{ - bo->bdev->driver->ttm_tt_unbind (bo->bdev, bo->ttm); -}drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-1@@ -760,7 +760,6 @@ struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_populate = &vmw_ttm_populate, .ttm_tt_unpopulate = &vmw_ttm_unpopulate, .ttm_tt_bind = &vmw_ttm_bind, - .ttm_tt_unbind = &vmw_ttm_unbind, .ttm_tt_destroy = &vmw_ttm_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags,include/drm/ttm/ttm_bo_driver.h +0
-11@@ -104,17 +104,6 @@ struct ttm_bo_driver {*/ int (*ttm_tt_bind)(struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); -/** -* ttm_tt_unbind -* -* @bdev: Pointer to a ttm device -* @ttm: Pointer to a struct ttm_tt. -* -* Unbind previously bound backend pages. This function should be -* able to handle differences between aperture and system page sizes. -*/ -void (*ttm_tt_unbind)(struct ttm_bo_device *bdev,struct ttm_tt *ttm); -/** * ttm_tt_destroy * @@ -647,13 +636,6 @@ pgprot_t ttm_io_prot(struct ttm_buffer_object *bo, struct ttm_resource *res,*/ int ttm_bo_tt_bind (struct ttm_buffer_object *bo,struct ttm_resource *mem);
include/drm/ttm/ttm_bo_driver.h pgprot_t ttm_io_prot(struct ttm_buffer_object *bo, struct ttm_resource *res, · line 641
Quoted 10 lines
include/drm/ttm/ttm_bo_driver.h +0
-7-/** -* ttm_bo_tt_bind -* -* Unbind the object tt from a memory resource. -*/ -void ttm_bo_tt_unbind (struct ttm_buffer_object *bo); -/** * ttm_bo_tt_destroy. */
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 5/7 drm/ttm: remove move to new and inline into remainging place.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This show the remaining bind callback, which my next series of patches will aim to remove.
--- drivers/gpu/drm/ttm/ttm_bo.c | 16 +++++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 20 -------------------- include/drm/ttm/ttm_bo_driver.h | 4 ---- 3 files changed, 9 insertions(+), 31 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +9 -7
@@ -252,9 +252,15 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,if (ret) goto out_err; - ret =ttm_bo_move_to_new_tt_mem (bo, ctx, mem); -if (ret) - goto out_err; +if (mem->mem_type !=TTM_PL_SYSTEM ) { + ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (ret) + goto out_err; + + ret = bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); +if (ret) + goto out_err; + } }if (bdev->driver->move_notify)
@@ -1489,7 +1495,3 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo) bo->ttm =NULL ; } -int ttm_bo_tt_bind (struct ttm_buffer_object *bo,struct ttm_resource *mem) -{ -return bo->bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); -}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -20
@@ -45,26 +45,6 @@ struct ttm_transfer_obj {struct ttm_buffer_object *bo; }; -int ttm_bo_move_to_new_tt_mem (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx, -struct ttm_resource *new_mem) -{ -int ret; - -if (new_mem->mem_type ==TTM_PL_SYSTEM ) -return 0 ; - - ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); -if (unlikely (ret !=0 )) -return ret; - - ret =ttm_bo_tt_bind (bo, new_mem); -if (unlikely (ret !=0 )) -return ret; - -return 0 ; -} -int ttm_mem_io_reserve (struct ttm_bo_device *bdev,struct ttm_resource *mem) {
include/drm/ttm/ttm_bo_driver.h +0 -4
@@ -560,10 +560,6 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,void ttm_mem_io_free (struct ttm_bo_device *bdev,struct ttm_resource *mem); -int ttm_bo_move_to_new_tt_mem (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx, -struct ttm_resource *new_mem); -/** * ttm_bo_move_memcpy *
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/7] drm/ttm: remove move to new and inline into remainging place.
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 6 lines
From: Dave Airlie <[email protected]>
This show the remaining bind callback, which my next series of patches will aim to remove.
Signed-off-by Dave Airlie <[email protected]>
Quoted 73 lines
--- drivers/gpu/drm/ttm/ttm_bo.c | 16 +++++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 20 -------------------- include/drm/ttm/ttm_bo_driver.h | 4 ---- 3 files changed, 9 insertions(+), 31 deletions(-)drivers/gpu/drm/ttm/ttm_bo.c +9
-7@@ -252,9 +252,15 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,if (ret) goto out_err; - ret =ttm_bo_move_to_new_tt_mem (bo, ctx, mem); -if (ret) - goto out_err; +if (mem->mem_type !=TTM_PL_SYSTEM ) { + ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (ret) + goto out_err; + + ret = bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); +if (ret) + goto out_err; + } }if (bdev->driver->move_notify)@@ -1489,7 +1495,3 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo) bo->ttm =NULL ; } -int ttm_bo_tt_bind (struct ttm_buffer_object *bo,struct ttm_resource *mem) -{ -return bo->bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); -}drivers/gpu/drm/ttm/ttm_bo_util.c +0
-20@@ -45,26 +45,6 @@ struct ttm_transfer_obj {struct ttm_buffer_object *bo; }; -int ttm_bo_move_to_new_tt_mem (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx, -struct ttm_resource *new_mem) -{ -int ret; - -if (new_mem->mem_type ==TTM_PL_SYSTEM ) -return 0 ; - - ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); -if (unlikely (ret !=0 )) -return ret; - - ret =ttm_bo_tt_bind (bo, new_mem); -if (unlikely (ret !=0 )) -return ret; - -return 0 ; -} -int ttm_mem_io_reserve (struct ttm_bo_device *bdev,struct ttm_resource *mem) {include/drm/ttm/ttm_bo_driver.h +0
-0
include/drm/ttm/ttm_bo_driver.h int ttm_mem_io_reserve(struct ttm_bo_device *bdev, · line 565
Quoted 10 lines
include/drm/ttm/ttm_bo_driver.h +0
-4@@ -560,10 +560,6 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,void ttm_mem_io_free (struct ttm_bo_device *bdev,struct ttm_resource *mem); -int ttm_bo_move_to_new_tt_mem (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx, -struct ttm_resource *new_mem); -/** * ttm_bo_move_memcpy *
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 6/7 drm/ttm: drop move notify around move.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
The drivers now do this in the move callback.
move_notify is still needed in the destroy path.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 +++++-- drivers/gpu/drm/drm_gem_vram_helper.c | 11 +++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 12 ++++-- drivers/gpu/drm/qxl/qxl_ttm.c | 45 +++++++++++++--------- drivers/gpu/drm/radeon/radeon_ttm.c | 11 +++++- drivers/gpu/drm/ttm/ttm_bo.c | 12 +----- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 14 ++++++- 7 files changed, 78 insertions(+), 40 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10 -3
@@ -666,6 +666,8 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +amdgpu_bo_move_notify (bo, evict, new_mem); +/* Can't move a pinned BO */ abo =ttm_to_amdgpu_bo (bo);if (WARN_ON_ONCE (abo->tbo.pin_count >0 ))
@@ -687,7 +689,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, new_mem->mem_type == TTM_PL_SYSTEM) { r =ttm_bo_wait_ctx (bo, ctx);if (r) -return r; + goto fail;amdgpu_ttm_backend_unbind (bo->bdev, bo->ttm);ttm_resource_free (bo, &bo->mem);
@@ -728,12 +730,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,if (!amdgpu_mem_visible (adev, old_mem) || !amdgpu_mem_visible (adev, new_mem)) {pr_err ("Move buffer fallback to memcpy unavailable\n" ); -return r; + goto fail; } r =ttm_bo_move_memcpy (bo, ctx, new_mem);if (r) -return r; + goto fail; } if (bo->type == ttm_bo_type_device &&
@@ -748,6 +750,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,/* update statistics */ atomic64_add ((u64 )bo->mem.num_pages <<PAGE_SHIFT , &adev->num_bytes_moved);return 0 ; +fail: +swap (*new_mem, bo->mem); +amdgpu_bo_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); +return r; }/**
drivers/gpu/drm/drm_gem_vram_helper.c +10 -1
@@ -590,7 +590,16 @@ static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo,struct ttm_operation_ctx *ctx, struct ttm_resource *new_mem) { - return ttm_bo_move_memcpy(&gbo->bo, ctx, new_mem); + int ret; + +drm_gem_vram_bo_driver_move_notify (gbo, evict, new_mem); + ret =ttm_bo_move_memcpy (&gbo->bo, ctx, new_mem); +if (ret) { +swap (*new_mem, gbo->bo.mem); +drm_gem_vram_bo_driver_move_notify (gbo, false, new_mem); +swap (*new_mem, gbo->bo.mem); + } +return ret; }/*
drivers/gpu/drm/nouveau/nouveau_bo.c +9 -3
@@ -1032,9 +1032,10 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,struct nouveau_drm_tile *new_tile =NULL ;int ret =0 ; +nouveau_bo_move_ntfy (bo, evict, new_reg); ret =ttm_bo_wait_ctx (bo, ctx);if (ret) -return ret; + goto out_ntfy;if (nvbo->bo.pin_count)NV_WARN (drm,"Moving pinned object %p!\n" , nvbo);
@@ -1042,7 +1043,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,if (drm->client.device.info.family <NV_DEVICE_INFO_V0_TESLA ) { ret =nouveau_bo_vm_bind (bo, new_reg, &new_tile);if (ret) -return ret; + goto out_ntfy; }/* Fake bo copy. */
@@ -1090,7 +1091,12 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,else nouveau_bo_vm_cleanup (bo, new_tile, &nvbo->tile); } - +out_ntfy: +if (ret) { +swap (*new_reg, bo->mem); +nouveau_bo_move_ntfy (bo, false, new_reg); +swap (*new_reg, bo->mem); + }return ret; }
drivers/gpu/drm/qxl/qxl_ttm.c +27 -18
57 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_ttm.c +9 -2
@@ -311,9 +311,11 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +radeon_bo_move_notify (bo, evict, new_mem); + r =ttm_bo_wait_ctx (bo, ctx);if (r) -return r; + goto fail;/* Can't move a pinned BO */ rbo = container_of(bo, struct radeon_bo, tbo);
@@ -359,13 +361,18 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, memcpy: r =ttm_bo_move_memcpy (bo, ctx, new_mem);if (r) { -return r; + goto fail; } }/* update statistics */ atomic64_add ((u64 )bo->mem.num_pages <<PAGE_SHIFT , &rdev->num_bytes_moved);return 0 ; +fail: +swap (*new_mem, bo->mem); +radeon_bo_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); +return r; }static int radeon_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_resource *mem)
drivers/gpu/drm/ttm/ttm_bo.c +1 -11
@@ -263,19 +263,9 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, } } -if (bdev->driver->move_notify) - bdev->driver->move_notify (bo, evict, mem); - ret = bdev->driver->move (bo, evict, ctx, mem); -if (ret) { -if (bdev->driver->move_notify) { -swap (*mem, bo->mem); - bdev->driver->move_notify (bo, false, mem); -swap (*mem, bo->mem); - } - +if (ret) goto out_err; - } ctx->bytes_moved += bo->mem.num_pages <<PAGE_SHIFT ;return 0 ;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +12 -2
@@ -737,6 +737,8 @@ static int vmw_move(struct ttm_buffer_object *bo,struct ttm_resource_manager *new_man =ttm_manager_type (bo->bdev, new_mem->mem_type);int ret; +vmw_move_notify (bo, evict, new_mem); +if (old_man->use_tt && new_man->use_tt) {if (bo->mem.mem_type ==TTM_PL_SYSTEM ) {ttm_bo_assign_mem (bo, new_mem);
@@ -744,15 +746,23 @@ static int vmw_move(struct ttm_buffer_object *bo, } ret =ttm_bo_wait_ctx (bo, ctx);if (ret) -return ret; + goto fail;vmw_ttm_unbind (bo->bdev, bo->ttm);ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }else { -return ttm_bo_move_memcpy (bo, ctx, new_mem); + ret =ttm_bo_move_memcpy (bo, ctx, new_mem); +if (ret) + goto fail; } +return 0 ; +fail: +swap (*new_mem, bo->mem); +vmw_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); +return ret; }struct ttm_bo_driver vmw_bo_driver = {
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 6/7] drm/ttm: drop move notify around move.
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 7 lines
From: Dave Airlie <[email protected]>
The drivers now do this in the move callback.
move_notifyis still needed in the destroy path.Signed-off-by Dave Airlie <[email protected]>
Quoted 274 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 +++++-- drivers/gpu/drm/drm_gem_vram_helper.c | 11 +++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 12 ++++-- drivers/gpu/drm/qxl/qxl_ttm.c | 45 +++++++++++++--------- drivers/gpu/drm/radeon/radeon_ttm.c | 11 +++++- drivers/gpu/drm/ttm/ttm_bo.c | 12 +----- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 14 ++++++- 7 files changed, 78 insertions(+), 40 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10
-3@@ -666,6 +666,8 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +amdgpu_bo_move_notify (bo, evict, new_mem); +/* Can't move a pinned BO */ abo =ttm_to_amdgpu_bo (bo);if (WARN_ON_ONCE (abo->tbo.pin_count >0 ))@@ -687,7 +689,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, new_mem->mem_type == TTM_PL_SYSTEM) { r =ttm_bo_wait_ctx (bo, ctx);if (r) -return r; + goto fail;amdgpu_ttm_backend_unbind (bo->bdev, bo->ttm);ttm_resource_free (bo, &bo->mem);@@ -728,12 +730,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,if (!amdgpu_mem_visible (adev, old_mem) || !amdgpu_mem_visible (adev, new_mem)) {pr_err ("Move buffer fallback to memcpy unavailable\n" ); -return r; + goto fail; } r =ttm_bo_move_memcpy (bo, ctx, new_mem);if (r) -return r; + goto fail; } if (bo->type == ttm_bo_type_device &&@@ -748,6 +750,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,/* update statistics */ atomic64_add ((u64 )bo->mem.num_pages <<PAGE_SHIFT , &adev->num_bytes_moved);return 0 ; +fail: +swap (*new_mem, bo->mem); +amdgpu_bo_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); +return r; }/** drivers/gpu/drm/drm_gem_vram_helper.c +10
-1@@ -590,7 +590,16 @@ static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo,struct ttm_operation_ctx *ctx, struct ttm_resource *new_mem) { - return ttm_bo_move_memcpy(&gbo->bo, ctx, new_mem); + int ret; + +drm_gem_vram_bo_driver_move_notify (gbo, evict, new_mem); + ret =ttm_bo_move_memcpy (&gbo->bo, ctx, new_mem); +if (ret) { +swap (*new_mem, gbo->bo.mem); +drm_gem_vram_bo_driver_move_notify (gbo, false, new_mem); +swap (*new_mem, gbo->bo.mem); + } +return ret; }/* drivers/gpu/drm/nouveau/nouveau_bo.c +9
-3@@ -1032,9 +1032,10 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,struct nouveau_drm_tile *new_tile =NULL ;int ret =0 ; +nouveau_bo_move_ntfy (bo, evict, new_reg); ret =ttm_bo_wait_ctx (bo, ctx);if (ret) -return ret; + goto out_ntfy;if (nvbo->bo.pin_count)NV_WARN (drm,"Moving pinned object %p!\n" , nvbo);@@ -1042,7 +1043,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,if (drm->client.device.info.family <NV_DEVICE_INFO_V0_TESLA ) { ret =nouveau_bo_vm_bind (bo, new_reg, &new_tile);if (ret) -return ret; + goto out_ntfy; }/* Fake bo copy. */ @@ -1090,7 +1091,12 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,else nouveau_bo_vm_cleanup (bo, new_tile, &nvbo->tile); } - +out_ntfy: +if (ret) { +swap (*new_reg, bo->mem); +nouveau_bo_move_ntfy (bo, false, new_reg); +swap (*new_reg, bo->mem); + }return ret; }drivers/gpu/drm/qxl/qxl_ttm.c +27
-18@@ -136,24 +136,6 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo,return ttm; } -static int qxl_bo_move (struct ttm_buffer_object *bo,bool evict, -struct ttm_operation_ctx *ctx, -struct ttm_resource *new_mem) -{ -struct ttm_resource *old_mem = &bo->mem; -int ret; - - ret =ttm_bo_wait_ctx (bo, ctx); -if (ret) -return ret; - -if (old_mem->mem_type ==TTM_PL_SYSTEM && bo->ttm ==NULL ) { -ttm_bo_move_null (bo, new_mem); -return 0 ; - } -return ttm_bo_move_memcpy (bo, ctx, new_mem); -} -static void qxl_bo_move_notify (struct ttm_buffer_object *bo,bool evict,struct ttm_resource *new_mem)@@ -170,6 +152,33 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,qxl_surface_evict (qdev, qbo, new_mem ? true : false); } +static int qxl_bo_move (struct ttm_buffer_object *bo,bool evict, +struct ttm_operation_ctx *ctx, +struct ttm_resource *new_mem) +{ +struct ttm_resource *old_mem = &bo->mem; +int ret; + +qxl_bo_move_notify (bo, evict, new_mem); + + ret =ttm_bo_wait_ctx (bo, ctx); +if (ret) + goto out; + +if (old_mem->mem_type ==TTM_PL_SYSTEM && bo->ttm ==NULL ) { +ttm_bo_move_null (bo, new_mem); +return 0 ; + } + ret =ttm_bo_move_memcpy (bo, ctx, new_mem); +out: +if (ret) { +swap (*new_mem, bo->mem); +qxl_bo_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); + } +return ret; +} +static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, .ttm_tt_bind = &qxl_ttm_backend_bind,drivers/gpu/drm/radeon/radeon_ttm.c +9
-2@@ -311,9 +311,11 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +radeon_bo_move_notify (bo, evict, new_mem); + r =ttm_bo_wait_ctx (bo, ctx);if (r) -return r; + goto fail;/* Can't move a pinned BO */ rbo = container_of(bo, struct radeon_bo, tbo);@@ -359,13 +361,18 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, memcpy: r =ttm_bo_move_memcpy (bo, ctx, new_mem);if (r) { -return r; + goto fail; } }/* update statistics */ atomic64_add ((u64 )bo->mem.num_pages <<PAGE_SHIFT , &rdev->num_bytes_moved);return 0 ; +fail: +swap (*new_mem, bo->mem); +radeon_bo_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); +return r; }static int radeon_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_resource *mem)drivers/gpu/drm/ttm/ttm_bo.c +1
-11@@ -263,19 +263,9 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, } } -if (bdev->driver->move_notify) - bdev->driver->move_notify (bo, evict, mem); - ret = bdev->driver->move (bo, evict, ctx, mem); -if (ret) { -if (bdev->driver->move_notify) { -swap (*mem, bo->mem); - bdev->driver->move_notify (bo, false, mem); -swap (*mem, bo->mem); - } - +if (ret) goto out_err; - } ctx->bytes_moved += bo->mem.num_pages <<PAGE_SHIFT ;return 0 ;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +6
-2@@ -737,6 +737,8 @@ static int vmw_move(struct ttm_buffer_object *bo,struct ttm_resource_manager *new_man =ttm_manager_type (bo->bdev, new_mem->mem_type);int ret; +vmw_move_notify (bo, evict, new_mem); +if (old_man->use_tt && new_man->use_tt) {if (bo->mem.mem_type ==TTM_PL_SYSTEM ) {ttm_bo_assign_mem (bo, new_mem);@@ -744,15 +746,23 @@ static int vmw_move(struct ttm_buffer_object *bo, } ret =ttm_bo_wait_ctx (bo, ctx);if (ret) -return ret; + goto fail;vmw_ttm_unbind (bo->bdev, bo->ttm);ttm_resource_free (bo, &bo->mem);ttm_bo_assign_mem (bo, new_mem);return 0 ; }else { -return ttm_bo_move_memcpy (bo, ctx, new_mem); + ret =ttm_bo_move_memcpy (bo, ctx, new_mem); +if (ret) + goto fail;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c static int vmw_move(struct ttm_buffer_object *bo, · line 768
Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +6
-0} +return 0 ; +fail: +swap (*new_mem, bo->mem); +vmw_move_notify (bo, false, new_mem); +swap (*new_mem, bo->mem); +return ret; }struct ttm_bo_driver vmw_bo_driver = {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 7/7 drm/ttm: move last binding into the drivers.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This moves the call to tt binding into the driver move, and drops the driver callback.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 7 ++++++- drivers/gpu/drm/qxl/qxl_ttm.c | 14 -------------- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +++++- drivers/gpu/drm/ttm/ttm_bo.c | 4 ---- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 7 ++++++- include/drm/ttm/ttm_bo_driver.h | 14 -------------- 7 files changed, 23 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 -1
@@ -666,6 +666,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +if (new_mem->mem_type ==TTM_PL_TT ) { + r =amdgpu_ttm_backend_bind (bo->bdev, bo->ttm, new_mem); +if (r) +return r; + } +amdgpu_bo_move_notify (bo, evict, new_mem);/* Can't move a pinned BO */
@@ -1728,7 +1734,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, - .ttm_tt_bind = &amdgpu_ttm_backend_bind, .ttm_tt_destroy = &amdgpu_ttm_backend_destroy, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags,
drivers/gpu/drm/nouveau/nouveau_bo.c +6 -1
@@ -1032,6 +1032,12 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,struct nouveau_drm_tile *new_tile =NULL ;int ret =0 ; +if (new_reg->mem_type ==TTM_PL_TT ) { + ret =nouveau_ttm_tt_bind (bo->bdev, bo->ttm, new_reg); +if (ret) +return ret; + } +nouveau_bo_move_ntfy (bo, evict, new_reg); ret =ttm_bo_wait_ctx (bo, ctx);if (ret)
@@ -1399,7 +1405,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, - .ttm_tt_bind = &nouveau_ttm_tt_bind, .ttm_tt_destroy = &nouveau_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags,
drivers/gpu/drm/qxl/qxl_ttm.c +0 -14
@@ -100,19 +100,6 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,/* * TTM backend functions. */ - -static int qxl_ttm_backend_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm, -struct ttm_resource *bo_mem) -{ -if (!ttm->num_pages) { -WARN (1 ,"nothing to bind %lu pages for mreg %p back %p!\n" , - ttm->num_pages, bo_mem, ttm); - } -/* Not implemented */ -return -1 ; -} -static void qxl_ttm_backend_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {
@@ -181,7 +168,6 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, - .ttm_tt_bind = &qxl_ttm_backend_bind, .ttm_tt_destroy = &qxl_ttm_backend_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags,
drivers/gpu/drm/radeon/radeon_ttm.c +5 -1
@@ -311,6 +311,11 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +if (new_mem->mem_type ==TTM_PL_TT ) { + r =radeon_ttm_tt_bind (bo->bdev, bo->ttm, new_mem); +if (r) +return r; + }radeon_bo_move_notify (bo, evict, new_mem); r =ttm_bo_wait_ctx (bo, ctx);
@@ -823,7 +828,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, - .ttm_tt_bind = &radeon_ttm_tt_bind, .ttm_tt_destroy = &radeon_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags,
drivers/gpu/drm/ttm/ttm_bo.c +0 -4
@@ -256,10 +256,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (ret) goto out_err; - - ret = bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); -if (ret) - goto out_err; } }
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +6 -1
@@ -737,6 +737,12 @@ static int vmw_move(struct ttm_buffer_object *bo,struct ttm_resource_manager *new_man =ttm_manager_type (bo->bdev, new_mem->mem_type);int ret; +if (new_man->use_tt && new_mem->mem_type !=TTM_PL_SYSTEM ) { + ret =vmw_ttm_bind (bo->bdev, bo->ttm, new_mem); +if (ret) +return ret; + } +vmw_move_notify (bo, evict, new_mem);if (old_man->use_tt && new_man->use_tt) {
@@ -769,7 +775,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, - .ttm_tt_bind = &vmw_ttm_bind, .ttm_tt_destroy = &vmw_ttm_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags,
include/drm/ttm/ttm_bo_driver.h +0 -14
@@ -90,20 +90,6 @@ struct ttm_bo_driver {*/ void (*ttm_tt_unpopulate)(struct ttm_bo_device *bdev,struct ttm_tt *ttm); -/** -* ttm_tt_bind -* -* @bdev: Pointer to a ttm device -* @ttm: Pointer to a struct ttm_tt. -* @bo_mem: Pointer to a struct ttm_resource describing the -* memory type and location for binding. -* -* Bind the backend pages into the aperture in the location -* indicated by @bo_mem. This function should be able to handle -* differences between aperture and system page sizes. -*/ -int (*ttm_tt_bind)(struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); -/** * ttm_tt_destroy *
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerRe: [PATCH 7/7] drm/ttm: move last binding into the drivers.
Am 20.10.20 um 03:03 schrieb Dave Airlie:
Quoted 6 lines
From: Dave Airlie <[email protected]>
This moves the call to tt binding into the driver move, and drops the driver callback.
Signed-off-by Dave Airlie <[email protected]>
amdgpu should now get some cleanup, but that is certainly not topic of this patch.
Really nice work, patch is Reviewed-by: Christian König <[email protected]>
Quoted 171 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 7 ++++++- drivers/gpu/drm/qxl/qxl_ttm.c | 14 -------------- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +++++- drivers/gpu/drm/ttm/ttm_bo.c | 4 ---- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 7 ++++++- include/drm/ttm/ttm_bo_driver.h | 14 -------------- 7 files changed, 23 insertions(+), 36 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-1@@ -666,6 +666,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +if (new_mem->mem_type ==TTM_PL_TT ) { + r =amdgpu_ttm_backend_bind (bo->bdev, bo->ttm, new_mem); +if (r) +return r; + } +amdgpu_bo_move_notify (bo, evict, new_mem);/* Can't move a pinned BO */ @@ -1728,7 +1734,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, - .ttm_tt_bind = &amdgpu_ttm_backend_bind, .ttm_tt_destroy = &amdgpu_ttm_backend_destroy, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags,drivers/gpu/drm/nouveau/nouveau_bo.c +6
-1@@ -1032,6 +1032,12 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,struct nouveau_drm_tile *new_tile =NULL ;int ret =0 ; +if (new_reg->mem_type ==TTM_PL_TT ) { + ret =nouveau_ttm_tt_bind (bo->bdev, bo->ttm, new_reg); +if (ret) +return ret; + } +nouveau_bo_move_ntfy (bo, evict, new_reg); ret =ttm_bo_wait_ctx (bo, ctx);if (ret)@@ -1399,7 +1405,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, - .ttm_tt_bind = &nouveau_ttm_tt_bind, .ttm_tt_destroy = &nouveau_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags,drivers/gpu/drm/qxl/qxl_ttm.c +0
-14@@ -100,19 +100,6 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,/* * TTM backend functions. */ - -static int qxl_ttm_backend_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm, -struct ttm_resource *bo_mem) -{ -if (!ttm->num_pages) { -WARN (1 ,"nothing to bind %lu pages for mreg %p back %p!\n" , - ttm->num_pages, bo_mem, ttm); - } -/* Not implemented */ -return -1 ; -} -static void qxl_ttm_backend_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {@@ -181,7 +168,6 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, - .ttm_tt_bind = &qxl_ttm_backend_bind, .ttm_tt_destroy = &qxl_ttm_backend_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags,drivers/gpu/drm/radeon/radeon_ttm.c +5
-1@@ -311,6 +311,11 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,struct ttm_resource *old_mem = &bo->mem;int r; +if (new_mem->mem_type ==TTM_PL_TT ) { + r =radeon_ttm_tt_bind (bo->bdev, bo->ttm, new_mem); +if (r) +return r; + }radeon_bo_move_notify (bo, evict, new_mem); r =ttm_bo_wait_ctx (bo, ctx);@@ -823,7 +828,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, - .ttm_tt_bind = &radeon_ttm_tt_bind, .ttm_tt_destroy = &radeon_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags,drivers/gpu/drm/ttm/ttm_bo.c +0
-4@@ -256,10 +256,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (ret) goto out_err; - - ret = bdev->driver->ttm_tt_bind (bo->bdev, bo->ttm, mem); -if (ret) - goto out_err; } }drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +6
-1@@ -737,6 +737,12 @@ static int vmw_move(struct ttm_buffer_object *bo,struct ttm_resource_manager *new_man =ttm_manager_type (bo->bdev, new_mem->mem_type);int ret; +if (new_man->use_tt && new_mem->mem_type !=TTM_PL_SYSTEM ) { + ret =vmw_ttm_bind (bo->bdev, bo->ttm, new_mem); +if (ret) +return ret; + } +vmw_move_notify (bo, evict, new_mem);if (old_man->use_tt && new_man->use_tt) {@@ -769,7 +775,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, - .ttm_tt_bind = &vmw_ttm_bind, .ttm_tt_destroy = &vmw_ttm_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags,include/drm/ttm/ttm_bo_driver.h +0
-7@@ -90,20 +90,6 @@ struct ttm_bo_driver {*/ void (*ttm_tt_unpopulate)(struct ttm_bo_device *bdev,struct ttm_tt *ttm); -/** -* ttm_tt_bind -* -* @bdev: Pointer to a ttm device -* @ttm: Pointer to a struct ttm_tt. -* @bo_mem: Pointer to a struct ttm_resource describing the -* memory type and location for binding.
include/drm/ttm/ttm_bo_driver.h struct ttm_bo_driver { · line 95
Quoted 10 lines
include/drm/ttm/ttm_bo_driver.h +0
-7-* -* Bind the backend pages into the aperture in the location -* indicated by @bo_mem. This function should be able to handle -* differences between aperture and system page sizes. -*/ -int (*ttm_tt_bind)(struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); -/** * ttm_tt_destroy *
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel