ttm tt refactoring.
Subsystems (8)
Dave Airlie
maintainercover ttm tt refactoring.
This is based on top of misc-next with Christians io rework for nouveau.
https://github.com/airlied/linux/tree/ttm-tt-cleanup (is a complete tree)
The idea is to move towards ttm_tt being just a backing store for system allocated pages + dma info, and not be anything to do with a global TT.
First is a couple of minor cleanups, then drops bdev from ttm_tt, and moves the func table into the bdev driver table instead, makes drivers deal with the agp differences, then cleans up the mess.
It tries to cleanup ttm_tt a bit more as well, in the end ttm_tt is getting to what I'd like it to represent, the next step is tackling the whole bind/unbind/move stuff I think.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 1/23 drm/amdgpu/ttm: remove unused parameter to move blit
From: Dave Airlie <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -4
@@ -455,7 +455,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,* help move buffers to and from VRAM. */ static int amdgpu_move_blit (struct ttm_buffer_object *bo, -bool evict,bool no_wait_gpu, +bool evict,struct ttm_resource *new_mem,struct ttm_resource *old_mem) {
@@ -553,7 +553,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, }/* blit VRAM to GTT */ - r =amdgpu_move_blit (bo, evict, ctx->no_wait_gpu, &tmp_mem, old_mem); + r =amdgpu_move_blit (bo, evict, &tmp_mem, old_mem);if (unlikely (r)) { goto out_cleanup; }
@@ -603,7 +603,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, }/* copy to VRAM */ - r =amdgpu_move_blit (bo, evict, ctx->no_wait_gpu, new_mem, old_mem); + r =amdgpu_move_blit (bo, evict, new_mem, old_mem);if (unlikely (r)) { goto out_cleanup; }
@@ -692,7 +692,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, new_mem->mem_type == TTM_PL_VRAM) { r = amdgpu_move_ram_vram(bo, evict, ctx, new_mem); } else { - r =amdgpu_move_blit (bo, evict, ctx->no_wait_gpu, + r =amdgpu_move_blit (bo, evict, new_mem, old_mem); }
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 2/23 drm/radeon/ttm: don't store driver copy of device pointer.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This can be gotten back from bdev.
--- drivers/gpu/drm/radeon/radeon_ttm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +4 -4
@@ -412,7 +412,6 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso*/ struct radeon_ttm_tt {struct ttm_dma_tt ttm; -struct radeon_device *rdev;u64 offset;uint64_t userptr;
@@ -515,6 +514,7 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem) {struct radeon_ttm_tt *gtt = (void *)ttm; +struct radeon_device *rdev =radeon_get_rdev (ttm->bdev);uint32_t flags =RADEON_GART_PAGE_VALID |RADEON_GART_PAGE_READ |RADEON_GART_PAGE_WRITE ;int r;
@@ -531,7 +531,7 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm, }if (ttm->caching_state == tt_cached) flags |=RADEON_GART_PAGE_SNOOP ; - r =radeon_gart_bind (gtt->rdev, gtt->offset, ttm->num_pages, + r =radeon_gart_bind (rdev, gtt->offset, ttm->num_pages, ttm->pages, gtt->ttm.dma_address, flags);if (r) { DRM_ERROR("failed to bind %lu pages at 0x%08X\n",
@@ -544,8 +544,9 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm,static void radeon_ttm_backend_unbind (struct ttm_tt *ttm) {struct radeon_ttm_tt *gtt = (void *)ttm; +struct radeon_device *rdev =radeon_get_rdev (ttm->bdev); -radeon_gart_unbind (gtt->rdev, gtt->offset, ttm->num_pages); +radeon_gart_unbind (rdev, gtt->offset, ttm->num_pages);if (gtt->userptr)radeon_ttm_tt_unpin_userptr (ttm);
@@ -584,7 +585,6 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } gtt->ttm.ttm.func = &radeon_backend_func; - gtt->rdev = rdev;if (ttm_dma_tt_init (>t->ttm, bo, page_flags)) {kfree (gtt);return NULL ;
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/23] drm/radeon/ttm: don't store driver copy of device pointer.
Quoted 14 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This can be gotten back from bdev.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/radeon/radeon_ttm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +0
-0
drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso · line 415
Quoted 4 lines
drivers/gpu/drm/radeon/radeon_ttm.c +0
-1@@ -412,7 +412,6 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso*/ struct radeon_ttm_tt {struct ttm_dma_tt ttm; -struct radeon_device *rdev;
At least for amdgpu the drm_device embedding stuff landed, so I think we can drop a lot more of these all over because upcasting from a struct drm_device * to tha adev is just a container_of.
Entirely separate bikeshed cleanup, but I think it'd help to make ttm feel a bit more like a helper for gpu drivers than it's entirely separate world :-)
Cheers, Daniel
Quoted 46 lines
drivers/gpu/drm/radeon/radeon_ttm.c +4
-3u64 offset;uint64_t userptr;@@ -515,6 +514,7 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem) {struct radeon_ttm_tt *gtt = (void *)ttm; +struct radeon_device *rdev =radeon_get_rdev (ttm->bdev);uint32_t flags =RADEON_GART_PAGE_VALID |RADEON_GART_PAGE_READ |RADEON_GART_PAGE_WRITE ;int r;@@ -531,7 +531,7 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm, }if (ttm->caching_state == tt_cached) flags |=RADEON_GART_PAGE_SNOOP ; - r =radeon_gart_bind (gtt->rdev, gtt->offset, ttm->num_pages, + r =radeon_gart_bind (rdev, gtt->offset, ttm->num_pages, ttm->pages, gtt->ttm.dma_address, flags);if (r) { DRM_ERROR("failed to bind %lu pages at 0x%08X\n",@@ -544,8 +544,9 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm,static void radeon_ttm_backend_unbind (struct ttm_tt *ttm) {struct radeon_ttm_tt *gtt = (void *)ttm; +struct radeon_device *rdev =radeon_get_rdev (ttm->bdev); -radeon_gart_unbind (gtt->rdev, gtt->offset, ttm->num_pages); +radeon_gart_unbind (rdev, gtt->offset, ttm->num_pages);if (gtt->userptr)radeon_ttm_tt_unpin_userptr (ttm);@@ -584,7 +585,6 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,return NULL ; } gtt->ttm.ttm.func = &radeon_backend_func; - gtt->rdev = rdev;if (ttm_dma_tt_init (>t->ttm, bo, page_flags)) {kfree (gtt);return NULL ;Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 3/23 drm/ttm: remove bdev from ttm_tt
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
I want to split this structure up and use it differently, step one remove bdev pointer from it and pass it explicitly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 40 +++++++++++-------- drivers/gpu/drm/drm_gem_vram_helper.c | 2 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 16 ++++---- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 8 ++-- drivers/gpu/drm/qxl/qxl_ttm.c | 9 +++-- drivers/gpu/drm/radeon/radeon_ttm.c | 40 ++++++++++--------- drivers/gpu/drm/ttm/ttm_agp_backend.c | 17 +++++--- drivers/gpu/drm/ttm/ttm_bo.c | 8 ++-- drivers/gpu/drm/ttm/ttm_bo_util.c | 14 +++---- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- drivers/gpu/drm/ttm/ttm_tt.c | 45 ++++++++++++---------- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 16 +++++--- include/drm/ttm/ttm_bo_driver.h | 7 ++-- include/drm/ttm/ttm_tt.h | 25 ++++++------ 15 files changed, 139 insertions(+), 114 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +23 -17
@@ -547,7 +547,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, }/* Bind the memory to the GTT space */ - r =ttm_tt_bind (bo->ttm, &tmp_mem, ctx); + r =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem, ctx);if (unlikely (r)) { goto out_cleanup; }
@@ -973,9 +973,10 @@ void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages)* * Called by amdgpu_ttm_backend_bind() **/ -static int amdgpu_ttm_tt_pin_userptr (struct ttm_tt *ttm) +static int amdgpu_ttm_tt_pin_userptr (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { -struct amdgpu_device *adev =amdgpu_ttm_adev (ttm->bdev); +struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm;int r;
@@ -1009,9 +1010,10 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)/** * amdgpu_ttm_tt_unpin_userptr - Unpin and unmap userptr pages */ -static void amdgpu_ttm_tt_unpin_userptr (struct ttm_tt *ttm) +static void amdgpu_ttm_tt_unpin_userptr (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { -struct amdgpu_device *adev =amdgpu_ttm_adev (ttm->bdev); +struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm;int write = !(gtt->userflags &AMDGPU_GEM_USERPTR_READONLY );
@@ -1092,16 +1094,17 @@ static int amdgpu_ttm_gart_bind(struct amdgpu_device *adev,* Called by ttm_tt_bind() on behalf of ttm_bo_handle_move_mem(). * This handles binding GTT memory to the device address space. */ -static int amdgpu_ttm_backend_bind (struct ttm_tt *ttm, +static int amdgpu_ttm_backend_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem) { -struct amdgpu_device *adev =amdgpu_ttm_adev (ttm->bdev); +struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm;uint64_t flags;int r =0 ;if (gtt->userptr) { - r =amdgpu_ttm_tt_pin_userptr (ttm); + r =amdgpu_ttm_tt_pin_userptr (bdev, ttm);if (r) {DRM_ERROR ("failed to pin userptr\n" );return r;
@@ -1219,15 +1222,16 @@ int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo)* Called by ttm_tt_unbind() on behalf of ttm_bo_move_ttm() and * ttm_tt_destroy(). */ -static void amdgpu_ttm_backend_unbind (struct ttm_tt *ttm) +static void amdgpu_ttm_backend_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { -struct amdgpu_device *adev =amdgpu_ttm_adev (ttm->bdev); +struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm;int r;/* if the pages have userptr pinning then clear that first */ if (gtt->userptr) -amdgpu_ttm_tt_unpin_userptr (ttm); +amdgpu_ttm_tt_unpin_userptr (bdev, ttm);if (gtt->offset ==AMDGPU_BO_INVALID_OFFSET )return ;
@@ -1239,7 +1243,8 @@ static void amdgpu_ttm_backend_unbind(struct ttm_tt *ttm) gtt->ttm.ttm.num_pages, gtt->offset); } -static void amdgpu_ttm_backend_destroy (struct ttm_tt *ttm) +static void amdgpu_ttm_backend_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) {struct amdgpu_ttm_tt *gtt = (void *)ttm;
@@ -1289,10 +1294,11 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo,* Map the pages of a ttm_tt object to an address space visible * to the underlying device. */ -static int amdgpu_ttm_tt_populate (struct ttm_tt *ttm, -struct ttm_operation_ctx *ctx) +static int amdgpu_ttm_tt_populate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm, +struct ttm_operation_ctx *ctx) { -struct amdgpu_device *adev =amdgpu_ttm_adev (ttm->bdev); +struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm;/* user pages are bound by amdgpu_ttm_tt_pin_userptr() */
@@ -1343,7 +1349,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm,* Unmaps pages of a ttm_tt object from the device address space and * unpopulates the page array backing it. */ -static void amdgpu_ttm_tt_unpopulate (struct ttm_tt *ttm) +static void amdgpu_ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct amdgpu_ttm_tt *gtt = (void *)ttm;struct amdgpu_device *adev;
@@ -1367,7 +1373,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)if (ttm->page_flags &TTM_PAGE_FLAG_SG )return ; - adev =amdgpu_ttm_adev (ttm->bdev); + adev =amdgpu_ttm_adev (bdev);#ifdef CONFIG_SWIOTLB if (adev->need_swiotlb &&swiotlb_nr_tbl ()) {
drivers/gpu/drm/drm_gem_vram_helper.c +1 -1
@@ -967,7 +967,7 @@ static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = {* TTM TT */ -static void backend_func_destroy (struct ttm_tt *tt) +static void backend_func_destroy (struct ttm_bo_device *bdev,struct ttm_tt *tt) {ttm_tt_fini (tt);kfree (tt);
drivers/gpu/drm/nouveau/nouveau_bo.c +9 -7
@@ -848,7 +848,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,if (ret)return ret; - ret =ttm_tt_bind (bo->ttm, &tmp_reg, &ctx); + ret =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_reg, &ctx);if (ret) goto out;
@@ -1228,7 +1228,8 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo) }static int -nouveau_ttm_tt_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) +nouveau_ttm_tt_populate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) {struct ttm_dma_tt *ttm_dma = (void *)ttm;struct nouveau_drm *drm;
@@ -1246,12 +1247,12 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)return 0 ; } - drm =nouveau_bdev (ttm->bdev); + drm =nouveau_bdev (bdev); dev = drm->dev->dev;#if IS_ENABLED (CONFIG_AGP )if (drm->agp.bridge) { -return ttm_agp_tt_populate (ttm, ctx); +return ttm_agp_tt_populate (bdev, ttm, ctx); }#endif
@@ -1264,7 +1265,8 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) }static void -nouveau_ttm_tt_unpopulate (struct ttm_tt *ttm) +nouveau_ttm_tt_unpopulate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) {struct ttm_dma_tt *ttm_dma = (void *)ttm;struct nouveau_drm *drm;
@@ -1274,12 +1276,12 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)if (slave)return ; - drm =nouveau_bdev (ttm->bdev); + drm =nouveau_bdev (bdev); dev = drm->dev->dev;#if IS_ENABLED (CONFIG_AGP )if (drm->agp.bridge) { -ttm_agp_tt_unpopulate (ttm); +ttm_agp_tt_unpopulate (bdev, ttm);return ; }#endif
drivers/gpu/drm/nouveau/nouveau_sgdma.c +4 -4
@@ -15,7 +15,7 @@ struct nouveau_sgdma_be { };static void -nouveau_sgdma_destroy (struct ttm_tt *ttm) +nouveau_sgdma_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
@@ -26,7 +26,7 @@ nouveau_sgdma_destroy(struct ttm_tt *ttm) }static int -nv04_sgdma_bind (struct ttm_tt *ttm,struct ttm_resource *reg) +nv04_sgdma_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *reg) {struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;struct nouveau_mem *mem =nouveau_mem (reg);
@@ -47,7 +47,7 @@ nv04_sgdma_bind(struct ttm_tt *ttm, struct ttm_resource *reg) }static void -nv04_sgdma_unbind (struct ttm_tt *ttm) +nv04_sgdma_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;nouveau_mem_fini (nvbe->mem);
@@ -60,7 +60,7 @@ static struct ttm_backend_func nv04_sgdma_backend = { };static int -nv50_sgdma_bind (struct ttm_tt *ttm,struct ttm_resource *reg) +nv50_sgdma_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *reg) {struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;struct nouveau_mem *mem =nouveau_mem (reg);
drivers/gpu/drm/qxl/qxl_ttm.c +6 -3
@@ -104,7 +104,8 @@ struct qxl_ttm_tt {u64 offset; }; -static int qxl_ttm_backend_bind (struct ttm_tt *ttm, +static int qxl_ttm_backend_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem) {struct qxl_ttm_tt *gtt = (void *)ttm;
@@ -118,12 +119,14 @@ static int qxl_ttm_backend_bind(struct ttm_tt *ttm,return -1 ; } -static void qxl_ttm_backend_unbind (struct ttm_tt *ttm) +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_tt *ttm) +static void qxl_ttm_backend_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) {struct qxl_ttm_tt *gtt = (void *)ttm;
drivers/gpu/drm/radeon/radeon_ttm.c +21 -19
@@ -234,7 +234,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, goto out_cleanup; } - r =ttm_tt_bind (bo->ttm, &tmp_mem, &ctx); + r =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem, &ctx);if (unlikely (r)) { goto out_cleanup; }
@@ -420,9 +420,9 @@ struct radeon_ttm_tt { };/* prepare the sg table with the user pages */ -static int radeon_ttm_tt_pin_userptr (struct ttm_tt *ttm) +static int radeon_ttm_tt_pin_userptr (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -struct radeon_device *rdev =radeon_get_rdev (ttm->bdev); +struct radeon_device *rdev =radeon_get_rdev (bdev);struct radeon_ttm_tt *gtt = (void *)ttm;unsigned pinned =0 ;int r;
@@ -481,9 +481,9 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm)return r; } -static void radeon_ttm_tt_unpin_userptr (struct ttm_tt *ttm) +static void radeon_ttm_tt_unpin_userptr (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -struct radeon_device *rdev =radeon_get_rdev (ttm->bdev); +struct radeon_device *rdev =radeon_get_rdev (bdev);struct radeon_ttm_tt *gtt = (void *)ttm;struct sg_page_iter sg_iter;
@@ -510,17 +510,18 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)sg_free_table (ttm->sg); } -static int radeon_ttm_backend_bind (struct ttm_tt *ttm, +static int radeon_ttm_backend_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem) {struct radeon_ttm_tt *gtt = (void *)ttm; -struct radeon_device *rdev =radeon_get_rdev (ttm->bdev); +struct radeon_device *rdev =radeon_get_rdev (bdev);uint32_t flags =RADEON_GART_PAGE_VALID |RADEON_GART_PAGE_READ |RADEON_GART_PAGE_WRITE ;int r;if (gtt->userptr) { -radeon_ttm_tt_pin_userptr (ttm); +radeon_ttm_tt_pin_userptr (bdev, ttm); flags &= ~RADEON_GART_PAGE_WRITE ; }
@@ -541,18 +542,18 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm,return 0 ; } -static void radeon_ttm_backend_unbind (struct ttm_tt *ttm) +static void radeon_ttm_backend_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct radeon_ttm_tt *gtt = (void *)ttm; -struct radeon_device *rdev =radeon_get_rdev (ttm->bdev); +struct radeon_device *rdev =radeon_get_rdev (bdev);radeon_gart_unbind (rdev, gtt->offset, ttm->num_pages);if (gtt->userptr) -radeon_ttm_tt_unpin_userptr (ttm); +radeon_ttm_tt_unpin_userptr (bdev, ttm); } -static void radeon_ttm_backend_destroy (struct ttm_tt *ttm) +static void radeon_ttm_backend_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct radeon_ttm_tt *gtt = (void *)ttm;
@@ -599,8 +600,9 @@ static struct radeon_ttm_tt *radeon_ttm_tt_to_gtt(struct ttm_tt *ttm)return (struct radeon_ttm_tt *)ttm; } -static int radeon_ttm_tt_populate (struct ttm_tt *ttm, -struct ttm_operation_ctx *ctx) +static int radeon_ttm_tt_populate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm, +struct ttm_operation_ctx *ctx) {struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (ttm);struct radeon_device *rdev;
@@ -623,10 +625,10 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm,return 0 ; } - rdev =radeon_get_rdev (ttm->bdev); + rdev =radeon_get_rdev (bdev);#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) { -return ttm_agp_tt_populate (ttm, ctx); +return ttm_agp_tt_populate (bdev, ttm, ctx); }#endif
@@ -639,7 +641,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm,return ttm_populate_and_map_pages (rdev->dev, >t->ttm, ctx); } -static void radeon_ttm_tt_unpopulate (struct ttm_tt *ttm) +static void radeon_ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct radeon_device *rdev;struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (ttm);
@@ -654,10 +656,10 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm)if (slave)return ; - rdev =radeon_get_rdev (ttm->bdev); + rdev =radeon_get_rdev (bdev);#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) { -ttm_agp_tt_unpopulate (ttm); +ttm_agp_tt_unpopulate (bdev, ttm);return ; }#endif
drivers/gpu/drm/ttm/ttm_agp_backend.c +11 -6
@@ -48,7 +48,8 @@ struct ttm_agp_backend {struct agp_bridge_data *bridge; }; -static int ttm_agp_bind (struct ttm_tt *ttm,struct ttm_resource *bo_mem) +static int ttm_agp_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;
@@ -82,7 +83,8 @@ static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)return ret; } -static void ttm_agp_unbind (struct ttm_tt *ttm) +static void ttm_agp_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
@@ -96,12 +98,13 @@ static void ttm_agp_unbind(struct ttm_tt *ttm) } } -static void ttm_agp_destroy (struct ttm_tt *ttm) +static void ttm_agp_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);if (agp_be->mem) -ttm_agp_unbind (ttm); +ttm_agp_unbind (bdev, ttm);ttm_tt_fini (ttm);kfree (agp_be); }
@@ -135,7 +138,8 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo, }EXPORT_SYMBOL (ttm_agp_tt_create); -int ttm_agp_tt_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) +int ttm_agp_tt_populate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) {if (ttm->state != tt_unpopulated)return 0 ;
@@ -144,7 +148,8 @@ int ttm_agp_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) }EXPORT_SYMBOL (ttm_agp_tt_populate); -void ttm_agp_tt_unpopulate (struct ttm_tt *ttm) +void ttm_agp_tt_unpopulate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) {ttm_pool_unpopulate (ttm); }
drivers/gpu/drm/ttm/ttm_bo.c +4 -4
@@ -282,7 +282,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, goto out_err;if (mem->mem_type !=TTM_PL_SYSTEM ) { - ret =ttm_tt_bind (bo->ttm, mem, ctx); + ret =ttm_tt_bind (bdev, bo->ttm, mem, ctx);if (ret) goto out_err; }
@@ -324,7 +324,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, out_err: new_man =ttm_manager_type (bdev, bo->mem.mem_type);if (!new_man->use_tt) { -ttm_tt_destroy (bo->ttm); +ttm_tt_destroy (bdev, bo->ttm); bo->ttm =NULL ; }
@@ -344,7 +344,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)if (bo->bdev->driver->move_notify) bo->bdev->driver->move_notify (bo, false,NULL ); -ttm_tt_destroy (bo->ttm); +ttm_tt_destroy (bo->bdev, bo->ttm); bo->ttm =NULL ;ttm_resource_free (bo, &bo->mem); }
@@ -1653,7 +1653,7 @@ int ttm_bo_swapout(struct ttm_bo_global *glob, struct ttm_operation_ctx *ctx)if (bo->bdev->driver->swap_notify) bo->bdev->driver->swap_notify (bo); - ret =ttm_tt_swapout (bo->ttm, bo->persistent_swap_storage); + ret =ttm_tt_swapout (bo->bdev, bo->ttm, bo->persistent_swap_storage); out:/**
drivers/gpu/drm/ttm/ttm_bo_util.c +7 -7
@@ -67,7 +67,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,return ret; } -ttm_tt_unbind (ttm); +ttm_tt_unbind (bo->bdev, ttm);ttm_bo_free_old_node (bo);ttm_flag_masked (&old_mem->placement,TTM_PL_FLAG_SYSTEM ,TTM_PL_MASK_MEM );
@@ -79,7 +79,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,return ret;if (new_mem->mem_type !=TTM_PL_SYSTEM ) { - ret =ttm_tt_bind (ttm, new_mem, ctx); + ret =ttm_tt_bind (bo->bdev, ttm, new_mem, ctx);if (unlikely (ret !=0 ))return ret; }
@@ -261,7 +261,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,* TTM might be null for moves within the same region. */ if (ttm) { - ret =ttm_tt_populate (ttm, ctx); + ret =ttm_tt_populate (bdev, ttm, ctx);if (ret) goto out1; }
@@ -300,7 +300,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, new_mem->mm_node =NULL ;if (!man->use_tt) { -ttm_tt_destroy (ttm); +ttm_tt_destroy (bdev, ttm); bo->ttm =NULL ; }
@@ -451,7 +451,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,BUG_ON (!ttm); - ret =ttm_tt_populate (ttm, &ctx); + ret =ttm_tt_populate (bo->bdev, ttm, &ctx);if (ret)return ret;
@@ -547,7 +547,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,return ret;if (!man->use_tt) { -ttm_tt_destroy (bo->ttm); +ttm_tt_destroy (bdev, bo->ttm); bo->ttm =NULL ; }ttm_bo_free_old_node (bo);
@@ -670,7 +670,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,return ret;if (!to->use_tt) { -ttm_tt_destroy (bo->ttm); +ttm_tt_destroy (bdev, bo->ttm); bo->ttm =NULL ; }ttm_bo_free_old_node (bo);
drivers/gpu/drm/ttm/ttm_bo_vm.c +1 -1
@@ -341,7 +341,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, }; ttm = bo->ttm; -if (ttm_tt_populate (bo->ttm, &ctx)) +if (ttm_tt_populate (bdev, bo->ttm, &ctx))return VM_FAULT_OOM ; }else {/* Iomem should not be marked encrypted */
drivers/gpu/drm/ttm/ttm_tt.c +24 -21
136 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2 -2
@@ -465,13 +465,13 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,dma_resv_assert_held (src->base.resv);if (dst->ttm->state == tt_unpopulated) { - ret = dst->ttm->bdev->driver->ttm_tt_populate (dst->ttm, &ctx); + ret = dst->bdev->driver->ttm_tt_populate (dst->bdev, dst->ttm, &ctx);if (ret)return ret; }if (src->ttm->state == tt_unpopulated) { - ret = src->ttm->bdev->driver->ttm_tt_populate (src->ttm, &ctx); + ret = src->bdev->driver->ttm_tt_populate (src->bdev, src->ttm, &ctx);if (ret)return ret; }
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +10 -6
@@ -539,7 +539,8 @@ const struct vmw_sg_table *vmw_bo_sg_table(struct ttm_buffer_object *bo) } -static int vmw_ttm_bind (struct ttm_tt *ttm,struct ttm_resource *bo_mem) +static int vmw_ttm_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem) {struct vmw_ttm_tt *vmw_be = container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
@@ -573,7 +574,8 @@ static int vmw_ttm_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)return 0 ; } -static void vmw_ttm_unbind (struct ttm_tt *ttm) +static void vmw_ttm_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) {struct vmw_ttm_tt *vmw_be = container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
@@ -594,7 +596,7 @@ static void vmw_ttm_unbind(struct ttm_tt *ttm) } -static void vmw_ttm_destroy (struct ttm_tt *ttm) +static void vmw_ttm_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {struct vmw_ttm_tt *vmw_be = container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
@@ -612,7 +614,8 @@ static void vmw_ttm_destroy(struct ttm_tt *ttm) } -static int vmw_ttm_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) +static int vmw_ttm_populate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) {struct vmw_ttm_tt *vmw_tt = container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
@@ -640,7 +643,8 @@ static int vmw_ttm_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)return ret; } -static void vmw_ttm_unpopulate (struct ttm_tt *ttm) +static void vmw_ttm_unpopulate (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { struct vmw_ttm_tt *vmw_tt = container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
@@ -796,7 +800,7 @@ int vmw_bo_create_and_populate(struct vmw_private *dev_priv, ret =ttm_bo_reserve (bo, false, true,NULL );BUG_ON (ret !=0 ); - ret =vmw_ttm_populate (bo->ttm, &ctx); + ret =vmw_ttm_populate (bo->bdev, bo->ttm, &ctx);if (likely (ret ==0 )) {struct vmw_ttm_tt *vmw_tt = container_of(bo->ttm, struct vmw_ttm_tt, dma_ttm.ttm);
include/drm/ttm/ttm_bo_driver.h +4 -3
@@ -77,8 +77,9 @@ struct ttm_bo_driver {* Returns: * -ENOMEM: Out of memory. */ -int (*ttm_tt_populate)(struct ttm_tt *ttm, -struct ttm_operation_ctx *ctx); +int (*ttm_tt_populate)(struct ttm_bo_device *bdev, +struct ttm_tt *ttm, +struct ttm_operation_ctx *ctx);/** * ttm_tt_unpopulate
@@ -87,7 +88,7 @@ struct ttm_bo_driver {* * Free all backing page */ -void (*ttm_tt_unpopulate)(struct ttm_tt *ttm); +void (*ttm_tt_unpopulate)(struct ttm_bo_device *bdev,struct ttm_tt *ttm);/** * struct ttm_bo_driver member eviction_valuable
include/drm/ttm/ttm_tt.h +12 -13
@@ -60,7 +60,7 @@ struct ttm_backend_func {* indicated by @bo_mem. This function should be able to handle * differences between aperture and system page sizes. */ -int (*bind) (struct ttm_tt *ttm,struct ttm_resource *bo_mem); +int (*bind) (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem);/** * struct ttm_backend_func member unbind
@@ -70,7 +70,7 @@ struct ttm_backend_func {* Unbind previously bound backend pages. This function should be * able to handle differences between aperture and system page sizes. */ -void (*unbind) (struct ttm_tt *ttm); +void (*unbind) (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/** * struct ttm_backend_func member destroy
@@ -80,13 +80,12 @@ struct ttm_backend_func {* Destroy the backend. This will be call back from ttm_tt_destroy so * don't call ttm_tt_destroy from the callback or infinite loop. */ -void (*destroy) (struct ttm_tt *ttm); +void (*destroy) (struct ttm_bo_device *bdev,struct ttm_tt *ttm); };/** * struct ttm_tt * -* @bdev: Pointer to a struct ttm_bo_device. * @func: Pointer to a struct ttm_backend_func that describes * the backend methods. * pointer.
@@ -103,7 +102,6 @@ struct ttm_backend_func {* memory. */ struct ttm_tt { -struct ttm_bo_device *bdev;struct ttm_backend_func *func;struct page **pages;uint32_t page_flags;
@@ -183,7 +181,8 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);* * Bind the pages of @ttm to an aperture location identified by @bo_mem */ -int ttm_tt_bind (struct ttm_tt *ttm,struct ttm_resource *bo_mem, +int ttm_tt_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem,struct ttm_operation_ctx *ctx);/**
@@ -193,7 +192,7 @@ int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem,* * Unbind, unpopulate and destroy common struct ttm_tt. */ -void ttm_tt_destroy (struct ttm_tt *ttm); +void ttm_tt_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/** * ttm_ttm_unbind:
@@ -202,7 +201,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm);* * Unbind a struct ttm_tt. */ -void ttm_tt_unbind (struct ttm_tt *ttm); +void ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/** * ttm_tt_swapin:
@@ -227,7 +226,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm);* and cache flushes and potential page splitting / combining. */ int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement); -int ttm_tt_swapout (struct ttm_tt *ttm,struct file *persistent_swap_storage); +int ttm_tt_swapout (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct file *persistent_swap_storage);/** * ttm_tt_populate - allocate pages for a ttm
@@ -236,7 +235,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage);* * Calls the driver method to allocate pages for a ttm */ -int ttm_tt_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx); +int ttm_tt_populate (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_operation_ctx *ctx);/** * ttm_tt_unpopulate - free pages from a ttm
@@ -245,7 +244,7 @@ int ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx);* * Calls the driver method to free all pages from a ttm */ -void ttm_tt_unpopulate (struct ttm_tt *ttm); +void ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm);#if IS_ENABLED (CONFIG_AGP )#include <linux/agp_backend.h>
@@ -265,8 +264,8 @@ void ttm_tt_unpopulate(struct ttm_tt *ttm);struct ttm_tt *ttm_agp_tt_create (struct ttm_buffer_object *bo,struct agp_bridge_data *bridge,uint32_t page_flags); -int ttm_agp_tt_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx); -void ttm_agp_tt_unpopulate (struct ttm_tt *ttm); +int ttm_agp_tt_populate (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_operation_ctx *ctx); +void ttm_agp_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm);#endif #endif
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 4/23 drm/ttm: add optional bind/unbind via driver.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
I want to remove the backend funcs
--- drivers/gpu/drm/ttm/ttm_tt.c | 15 +++++++++++--- include/drm/ttm/ttm_bo_driver.h | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_tt.c +12 -3
@@ -222,7 +222,10 @@ void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)fput (ttm->swap_storage); ttm->swap_storage =NULL ; - ttm->func->destroy (bdev, ttm); +if (bdev->driver->ttm_tt_destroy) + bdev->driver->ttm_tt_destroy (bdev, ttm); +else + ttm->func->destroy (bdev, ttm); } static void ttm_tt_init_fields(struct ttm_tt *ttm,
@@ -310,7 +313,10 @@ EXPORT_SYMBOL(ttm_dma_tt_fini);void ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {if (ttm->state == tt_bound) { - ttm->func->unbind (bdev, ttm); +if (bdev->driver->ttm_tt_unbind) + bdev->driver->ttm_tt_unbind (bdev, ttm); +else + ttm->func->unbind (bdev, ttm); ttm->state = tt_unbound; } }
@@ -331,7 +337,10 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (ret)return ret; - ret = ttm->func->bind (bdev, ttm, bo_mem); +if (bdev->driver->ttm_tt_bind) + ret = bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem); +else + ret = ttm->func->bind (bdev, ttm, bo_mem);if (unlikely (ret !=0 ))return ret;
include/drm/ttm/ttm_bo_driver.h +36 -0
@@ -90,6 +90,42 @@ 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_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 +* +* @bdev: Pointer to a ttm device +* @ttm: Pointer to a struct ttm_tt. +* +* Destroy the backend. This will be call back from ttm_tt_destroy so +* don't call ttm_tt_destroy from the callback or infinite loop. +*/ +void (*ttm_tt_destroy)(struct ttm_bo_device *bdev,struct ttm_tt *ttm); +/** * struct ttm_bo_driver member eviction_valuable *
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 5/23 drm/qxl: move bind/unbind/destroy to the driver function table.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/qxl/qxl_ttm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/qxl/qxl_ttm.c +3 -7
@@ -134,12 +134,6 @@ static void qxl_ttm_backend_destroy(struct ttm_bo_device *bdev,kfree (gtt); } -static struct ttm_backend_func qxl_backend_func = { - .bind = &qxl_ttm_backend_bind, - .unbind = &qxl_ttm_backend_unbind, - .destroy = &qxl_ttm_backend_destroy, -}; -static struct ttm_tt *qxl_ttm_tt_create (struct ttm_buffer_object *bo,uint32_t page_flags) {
@@ -150,7 +144,6 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo, gtt =kzalloc (sizeof (struct qxl_ttm_tt ),GFP_KERNEL );if (gtt ==NULL )return NULL ; - gtt->ttm.func = &qxl_backend_func; gtt->qdev = qdev;if (ttm_tt_init (>t->ttm, bo, page_flags)) {kfree (gtt);
@@ -195,6 +188,9 @@ 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, + .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,
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 6/23 drm/ttm/agp: export bind/unbind/destroy for drivers to use.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/ttm/ttm_agp_backend.c | 15 +++++++++------ include/drm/ttm/ttm_tt.h | 6 ++++++ 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/ttm/ttm_agp_backend.c +9 -6
@@ -48,8 +48,8 @@ struct ttm_agp_backend {struct agp_bridge_data *bridge; }; -static int ttm_agp_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm,struct ttm_resource *bo_mem) +int ttm_agp_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;
@@ -82,9 +82,10 @@ static int ttm_agp_bind(struct ttm_bo_device *bdev,return ret; } +EXPORT_SYMBOL (ttm_agp_bind); -static void ttm_agp_unbind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) +void ttm_agp_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
@@ -97,9 +98,10 @@ static void ttm_agp_unbind(struct ttm_bo_device *bdev, agp_be->mem =NULL ; } } +EXPORT_SYMBOL (ttm_agp_unbind); -static void ttm_agp_destroy (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) +void ttm_agp_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
@@ -108,6 +110,7 @@ static void ttm_agp_destroy(struct ttm_bo_device *bdev,ttm_tt_fini (ttm);kfree (agp_be); } +EXPORT_SYMBOL (ttm_agp_destroy);static struct ttm_backend_func ttm_agp_func = { .bind = ttm_agp_bind,
include/drm/ttm/ttm_tt.h +6 -0
@@ -266,6 +266,12 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo, uint32_t page_flags);int ttm_agp_tt_populate (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_operation_ctx *ctx);void ttm_agp_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm); +int ttm_agp_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm,struct ttm_resource *bo_mem); +void ttm_agp_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm); +void ttm_agp_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm);#endif #endif
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 7/23 drm/radeon/ttm: move to driver binding/destroy functions.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
Do agp decision in the driver, instead of special binding funcs
--- drivers/gpu/drm/radeon/radeon.h | 7 +- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_gem.c | 6 +- drivers/gpu/drm/radeon/radeon_object.c | 2 +- drivers/gpu/drm/radeon/radeon_prime.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 92 ++++++++++++++++++++------ drivers/gpu/drm/radeon/radeon_vm.c | 2 +- 7 files changed, 81 insertions(+), 32 deletions(-)
drivers/gpu/drm/radeon/radeon.h +4 -3
@@ -2815,10 +2815,11 @@ extern void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enablextern void radeon_atom_set_clock_gating (struct radeon_device *rdev,int enable);extern void radeon_ttm_placement_from_domain (struct radeon_bo *rbo,u32 domain);extern bool radeon_ttm_bo_is_radeon_bo (struct ttm_buffer_object *bo); -extern int radeon_ttm_tt_set_userptr (struct ttm_tt *ttm,uint64_t addr, +extern int radeon_ttm_tt_set_userptr (struct radeon_device *rdev, +struct ttm_tt *ttm,uint64_t addr,uint32_t flags); -extern bool radeon_ttm_tt_has_userptr (struct ttm_tt *ttm); -extern bool radeon_ttm_tt_is_readonly (struct ttm_tt *ttm); +extern bool radeon_ttm_tt_has_userptr (struct radeon_device *rdev,struct ttm_tt *ttm); +extern bool radeon_ttm_tt_is_readonly (struct radeon_device *rdev,struct ttm_tt *ttm);extern void radeon_vram_location (struct radeon_device *rdev,struct radeon_mc *mc,u64 base);extern void radeon_gtt_location (struct radeon_device *rdev,struct radeon_mc *mc);extern int radeon_resume_kms (struct drm_device *dev,bool resume,bool fbcon);
drivers/gpu/drm/radeon/radeon_cs.c +1 -1
@@ -160,7 +160,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) p->relocs[i].allowed_domains = domain; } -if (radeon_ttm_tt_has_userptr (p->relocs[i].robj->tbo.ttm)) { +if (radeon_ttm_tt_has_userptr (p->rdev, p->relocs[i].robj->tbo.ttm)) {uint32_t domain = p->relocs[i].preferred_domains;if (!(domain &RADEON_GEM_DOMAIN_GTT )) { DRM_ERROR("Only RADEON_GEM_DOMAIN_GTT is "
drivers/gpu/drm/radeon/radeon_gem.c +3 -3
@@ -331,7 +331,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, goto handle_lockup; bo =gem_to_radeon_bo (gobj); - r =radeon_ttm_tt_set_userptr (bo->tbo.ttm, args->addr, args->flags); + r =radeon_ttm_tt_set_userptr (rdev, bo->tbo.ttm, args->addr, args->flags);if (r) goto release_object;
@@ -420,7 +420,7 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,return -ENOENT ; } robj =gem_to_radeon_bo (gobj); -if (radeon_ttm_tt_has_userptr (robj->tbo.ttm)) { +if (radeon_ttm_tt_has_userptr (robj->rdev, robj->tbo.ttm)) {drm_gem_object_put (gobj);return -EPERM ; }
@@ -721,7 +721,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data, robj =gem_to_radeon_bo (gobj); r = -EPERM ; -if (radeon_ttm_tt_has_userptr (robj->tbo.ttm)) +if (radeon_ttm_tt_has_userptr (robj->rdev, robj->tbo.ttm)) goto out; r =radeon_bo_reserve (robj, false);
drivers/gpu/drm/radeon/radeon_object.c +1 -1
@@ -331,7 +331,7 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset,struct ttm_operation_ctx ctx = { false, false };int r, i; -if (radeon_ttm_tt_has_userptr (bo->tbo.ttm)) +if (radeon_ttm_tt_has_userptr (bo->rdev, bo->tbo.ttm))return -EPERM ;if (bo->pin_count) {
drivers/gpu/drm/radeon/radeon_prime.c +1 -1
@@ -121,7 +121,7 @@ struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj, int flags) {struct radeon_bo *bo =gem_to_radeon_bo (gobj); -if (radeon_ttm_tt_has_userptr (bo->tbo.ttm)) +if (radeon_ttm_tt_has_userptr (bo->rdev, bo->tbo.ttm))return ERR_PTR (-EPERM );return drm_gem_prime_export (gobj, flags); }
drivers/gpu/drm/radeon/radeon_ttm.c +70 -22
170 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_vm.c +1 -1
@@ -942,7 +942,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev, bo_va->flags &= ~RADEON_VM_PAGE_VALID ; bo_va->flags &= ~RADEON_VM_PAGE_SYSTEM ; bo_va->flags &= ~RADEON_VM_PAGE_SNOOPED ; -if (bo_va->bo &&radeon_ttm_tt_is_readonly (bo_va->bo->tbo.ttm)) +if (bo_va->bo &&radeon_ttm_tt_is_readonly (rdev, bo_va->bo->tbo.ttm)) bo_va->flags &= ~RADEON_VM_PAGE_WRITEABLE ;if (mem) {
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 07/23] drm/radeon/ttm: move to driver binding/destroy functions.
Am 26.08.20 um 03:44 schrieb Dave Airlie:
Quoted 143 lines
From: Dave Airlie <[email protected]>
Do agp decision in the driver, instead of special binding funcs
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/radeon/radeon.h | 7 +- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_gem.c | 6 +- drivers/gpu/drm/radeon/radeon_object.c | 2 +- drivers/gpu/drm/radeon/radeon_prime.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 92 ++++++++++++++++++++------ drivers/gpu/drm/radeon/radeon_vm.c | 2 +- 7 files changed, 81 insertions(+), 32 deletions(-)drivers/gpu/drm/radeon/radeon.h +4
-3@@ -2815,10 +2815,11 @@ extern void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enablextern void radeon_atom_set_clock_gating (struct radeon_device *rdev,int enable);extern void radeon_ttm_placement_from_domain (struct radeon_bo *rbo,u32 domain);extern bool radeon_ttm_bo_is_radeon_bo (struct ttm_buffer_object *bo); -extern int radeon_ttm_tt_set_userptr (struct ttm_tt *ttm,uint64_t addr, +extern int radeon_ttm_tt_set_userptr (struct radeon_device *rdev, +struct ttm_tt *ttm,uint64_t addr,uint32_t flags); -extern bool radeon_ttm_tt_has_userptr (struct ttm_tt *ttm); -extern bool radeon_ttm_tt_is_readonly (struct ttm_tt *ttm); +extern bool radeon_ttm_tt_has_userptr (struct radeon_device *rdev,struct ttm_tt *ttm); +extern bool radeon_ttm_tt_is_readonly (struct radeon_device *rdev,struct ttm_tt *ttm);extern void radeon_vram_location (struct radeon_device *rdev,struct radeon_mc *mc,u64 base);extern void radeon_gtt_location (struct radeon_device *rdev,struct radeon_mc *mc);extern int radeon_resume_kms (struct drm_device *dev,bool resume,bool fbcon);drivers/gpu/drm/radeon/radeon_cs.c +1
-1@@ -160,7 +160,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) p->relocs[i].allowed_domains = domain; } -if (radeon_ttm_tt_has_userptr (p->relocs[i].robj->tbo.ttm)) { +if (radeon_ttm_tt_has_userptr (p->rdev, p->relocs[i].robj->tbo.ttm)) {uint32_t domain = p->relocs[i].preferred_domains;if (!(domain &RADEON_GEM_DOMAIN_GTT )) { DRM_ERROR("Only RADEON_GEM_DOMAIN_GTT is "drivers/gpu/drm/radeon/radeon_gem.c +3
-3@@ -331,7 +331,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, goto handle_lockup; bo =gem_to_radeon_bo (gobj); - r =radeon_ttm_tt_set_userptr (bo->tbo.ttm, args->addr, args->flags); + r =radeon_ttm_tt_set_userptr (rdev, bo->tbo.ttm, args->addr, args->flags);if (r) goto release_object;@@ -420,7 +420,7 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,return -ENOENT ; } robj =gem_to_radeon_bo (gobj); -if (radeon_ttm_tt_has_userptr (robj->tbo.ttm)) { +if (radeon_ttm_tt_has_userptr (robj->rdev, robj->tbo.ttm)) {drm_gem_object_put (gobj);return -EPERM ; }@@ -721,7 +721,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data, robj =gem_to_radeon_bo (gobj); r = -EPERM ; -if (radeon_ttm_tt_has_userptr (robj->tbo.ttm)) +if (radeon_ttm_tt_has_userptr (robj->rdev, robj->tbo.ttm)) goto out; r =radeon_bo_reserve (robj, false);drivers/gpu/drm/radeon/radeon_object.c +1
-1@@ -331,7 +331,7 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset,struct ttm_operation_ctx ctx = { false, false };int r, i; -if (radeon_ttm_tt_has_userptr (bo->tbo.ttm)) +if (radeon_ttm_tt_has_userptr (bo->rdev, bo->tbo.ttm))return -EPERM ;if (bo->pin_count) {drivers/gpu/drm/radeon/radeon_prime.c +1
-1@@ -121,7 +121,7 @@ struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj, int flags) {struct radeon_bo *bo =gem_to_radeon_bo (gobj); -if (radeon_ttm_tt_has_userptr (bo->tbo.ttm)) +if (radeon_ttm_tt_has_userptr (bo->rdev, bo->tbo.ttm))return ERR_PTR (-EPERM );return drm_gem_prime_export (gobj, flags); }drivers/gpu/drm/radeon/radeon_ttm.c +2
-8@@ -141,8 +141,9 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo,static int radeon_verify_access (struct ttm_buffer_object *bo,struct file *filp) { struct radeon_bo *rbo = container_of(bo, struct radeon_bo, tbo); +struct radeon_device *rdev =radeon_get_rdev (bo->bdev); -if (radeon_ttm_tt_has_userptr (bo->ttm)) +if (radeon_ttm_tt_has_userptr (rdev, bo->ttm))return -EPERM ;return drm_vma_node_verify_access (&rbo->tbo.base.vma_node, filp->private_data);@@ -561,12 +562,6 @@ static void radeon_ttm_backend_destroy(struct ttm_bo_device *bdev, struct ttm_ttkfree (gtt); } -static struct ttm_backend_func radeon_backend_func = { - .bind = &radeon_ttm_backend_bind, - .unbind = &radeon_ttm_backend_unbind, - .destroy = &radeon_ttm_backend_destroy, -}; -static struct ttm_tt *radeon_ttm_tt_create (struct ttm_buffer_object *bo,uint32_t page_flags) {@@ -585,7 +580,6 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,if (gtt ==NULL ) {return NULL ; } - gtt->ttm.ttm.func = &radeon_backend_func;if (ttm_dma_tt_init (>t->ttm, bo, page_flags)) {kfree (gtt);return NULL ;@@ -593,9 +587,16 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,return >t->ttm.ttm; }
drivers/gpu/drm/radeon/radeon_ttm.c static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo, · line 596
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ttm.c +6
-2-static struct radeon_ttm_tt *radeon_ttm_tt_to_gtt (struct ttm_tt *ttm) +static struct radeon_ttm_tt *radeon_ttm_tt_to_gtt (struct radeon_device *rdev, +struct ttm_tt *ttm) { -if (!ttm || ttm->func != &radeon_backend_func) +#if IS_ENABLED (CONFIG_AGP ) +if (rdev->flags &RADEON_IS_AGP ) { +return NULL ; + }
Style nit: You can drop the {}.
drivers/gpu/drm/radeon/radeon_ttm.c static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo, · line 601
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_ttm.c +3
-0+#endif + +if (!ttm)return NULL ;return (struct radeon_ttm_tt *)ttm;
Maybe turn this into a container_of while at it.
Apart from that looks good to me,
Christian.
Quoted 137 lines
drivers/gpu/drm/radeon/radeon_ttm.c +59
-12}@@ -604,8 +605,8 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) { - struct radeon_ttm_tt *gtt = radeon_ttm_tt_to_gtt(ttm); -struct radeon_device *rdev; + struct radeon_device *rdev = radeon_get_rdev(bdev); +struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (rdev, ttm);bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG );if (gtt && gtt->userptr) {@@ -625,7 +626,6 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,return 0 ; } - rdev =radeon_get_rdev (bdev);#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) {return ttm_agp_tt_populate (bdev, ttm, ctx);@@ -643,8 +643,8 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,static void radeon_ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -struct radeon_device *rdev; -struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (ttm); +struct radeon_device *rdev =radeon_get_rdev (bdev); +struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (rdev, ttm);bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG );if (gtt && gtt->userptr) {@@ -656,7 +656,6 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *if (slave)return ; - rdev =radeon_get_rdev (bdev);#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) {ttm_agp_tt_unpopulate (bdev, ttm);@@ -674,10 +673,11 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *ttm_unmap_and_unpopulate_pages (rdev->dev, >t->ttm); } -int radeon_ttm_tt_set_userptr (struct ttm_tt *ttm,uint64_t addr, +int radeon_ttm_tt_set_userptr (struct radeon_device *rdev, +struct ttm_tt *ttm,uint64_t addr,uint32_t flags) { -struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (ttm); +struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (rdev, ttm);if (gtt ==NULL )return -EINVAL ;@@ -688,9 +688,53 @@ int radeon_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,return 0 ; } -bool radeon_ttm_tt_has_userptr (struct ttm_tt *ttm) +static int radeon_ttm_tt_bind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm, +struct ttm_resource *bo_mem) +{ +struct radeon_device *rdev =radeon_get_rdev (bdev); + +#if IS_ENABLED (CONFIG_AGP ) +if (rdev->flags &RADEON_IS_AGP ) { +return ttm_agp_bind (bdev, ttm, bo_mem); + } +#endif + +return radeon_ttm_backend_bind (bdev, ttm, bo_mem); +} + +static void radeon_ttm_tt_unbind (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) +{ +#if IS_ENABLED (CONFIG_AGP ) +struct radeon_device *rdev =radeon_get_rdev (bdev); + +if (rdev->flags &RADEON_IS_AGP ) { +ttm_agp_unbind (bdev, ttm); +return ; + } +#endif +radeon_ttm_backend_unbind (bdev, ttm); +} + +static void radeon_ttm_tt_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) +{ +#if IS_ENABLED (CONFIG_AGP ) +struct radeon_device *rdev =radeon_get_rdev (bdev); + +if (rdev->flags &RADEON_IS_AGP ) { +ttm_agp_destroy (bdev, ttm); +return ; + } +#endif +radeon_ttm_backend_destroy (bdev, ttm); +} + +bool radeon_ttm_tt_has_userptr (struct radeon_device *rdev, +struct ttm_tt *ttm) { -struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (ttm); +struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (rdev, ttm);if (gtt ==NULL )return false;@@ -698,9 +742,10 @@ bool radeon_ttm_tt_has_userptr(struct ttm_tt *ttm)return !!gtt->userptr; } -bool radeon_ttm_tt_is_readonly (struct ttm_tt *ttm) +bool radeon_ttm_tt_is_readonly (struct radeon_device *rdev, +struct ttm_tt *ttm) { -struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (ttm); +struct radeon_ttm_tt *gtt =radeon_ttm_tt_to_gtt (rdev, ttm);if (gtt ==NULL )return false;@@ -712,6 +757,9 @@ 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_unbind = &radeon_ttm_tt_unbind, + .ttm_tt_destroy = &radeon_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &radeon_evict_flags, .move = &radeon_bo_move,drivers/gpu/drm/radeon/radeon_vm.c +0
-0
drivers/gpu/drm/radeon/radeon_vm.c int radeon_vm_bo_update(struct radeon_device *rdev, · line 948
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_vm.c +1
-1@@ -942,7 +942,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev, bo_va->flags &= ~RADEON_VM_PAGE_VALID ; bo_va->flags &= ~RADEON_VM_PAGE_SYSTEM ; bo_va->flags &= ~RADEON_VM_PAGE_SNOOPED ; -if (bo_va->bo &&radeon_ttm_tt_is_readonly (bo_va->bo->tbo.ttm)) +if (bo_va->bo &&radeon_ttm_tt_is_readonly (rdev, bo_va->bo->tbo.ttm)) bo_va->flags &= ~RADEON_VM_PAGE_WRITEABLE ;if (mem) {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 8/23 drm/nouveau/ttm: use driver bind/unbind/destroy functions.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 45 +++++++++++++++++++++ drivers/gpu/drm/nouveau/nouveau_sgdma.c | 54 ++++++------------------- drivers/gpu/drm/nouveau/nouveau_ttm.h | 3 ++ 3 files changed, 60 insertions(+), 42 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +45 -0
@@ -668,6 +668,34 @@ nouveau_ttm_tt_create(struct ttm_buffer_object *bo, uint32_t page_flags)return nouveau_sgdma_create_ttm (bo, page_flags); } +static int +nouveau_ttm_tt_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm, +struct ttm_resource *reg) +{ +#if IS_ENABLED (CONFIG_AGP ) +struct nouveau_drm *drm =nouveau_bdev (bdev); + +if (drm->agp.bridge) { +return ttm_agp_bind (bdev, ttm, reg); + } +#endif +return nouveau_sgdma_bind (bdev, ttm, reg); +} + +static void +nouveau_ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) +{ +#if IS_ENABLED (CONFIG_AGP ) +struct nouveau_drm *drm =nouveau_bdev (bdev); + +if (drm->agp.bridge) { +ttm_agp_unbind (bdev, ttm); +return ; + } +#endif +nouveau_sgdma_unbind (bdev, ttm); +} +static void nouveau_bo_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *pl) {
@@ -1296,6 +1324,20 @@ nouveau_ttm_tt_unpopulate(struct ttm_bo_device *bdev,ttm_unmap_and_unpopulate_pages (dev, ttm_dma); } +static void +nouveau_ttm_tt_destroy (struct ttm_bo_device *bdev, +struct ttm_tt *ttm) +{ +#if IS_ENABLED (CONFIG_AGP ) +struct nouveau_drm *drm =nouveau_bdev (bdev); +if (drm->agp.bridge) { +ttm_agp_destroy (bdev, ttm); +return ; + } +#endif +nouveau_sgdma_destroy (bdev, ttm); +} +void nouveau_bo_fence (struct nouveau_bo *nvbo,struct nouveau_fence *fence,bool exclusive) {
@@ -1311,6 +1353,9 @@ 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_unbind = &nouveau_ttm_tt_unbind, + .ttm_tt_destroy = &nouveau_ttm_tt_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = nouveau_bo_evict_flags, .move_notify = nouveau_bo_move_ntfy,
drivers/gpu/drm/nouveau/nouveau_sgdma.c +12 -42
94 lines not on this page · raw message
drivers/gpu/drm/nouveau/nouveau_ttm.h +3 -0
@@ -22,4 +22,7 @@ int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);int nouveau_ttm_global_init (struct nouveau_drm *);void nouveau_ttm_global_release (struct nouveau_drm *); +int nouveau_sgdma_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *reg); +void nouveau_sgdma_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm); +void nouveau_sgdma_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm);#endif
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 9/23 drm/vmwgfx: move to driver binding functions
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +3 -7
@@ -668,12 +668,6 @@ static void vmw_ttm_unpopulate(struct ttm_bo_device *bdev,ttm_pool_unpopulate (ttm); } -static struct ttm_backend_func vmw_ttm_func = { - .bind = vmw_ttm_bind, - .unbind = vmw_ttm_unbind, - .destroy = vmw_ttm_destroy, -}; -static struct ttm_tt *vmw_ttm_tt_create (struct ttm_buffer_object *bo,uint32_t page_flags) {
@@ -684,7 +678,6 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo,if (!vmw_be)return NULL ; - vmw_be->dma_ttm.ttm.func = &vmw_ttm_func; vmw_be->dev_priv = container_of(bo->bdev, struct vmw_private, bdev); vmw_be->mob =NULL ;
@@ -770,6 +763,9 @@ 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_unbind = &vmw_ttm_unbind, + .ttm_tt_destroy = &vmw_ttm_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags, .move = NULL,
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 10/23 drm/amdgpu/ttm: move to driver backend binding funcs
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -7
@@ -1255,12 +1255,6 @@ static void amdgpu_ttm_backend_destroy(struct ttm_bo_device *bdev,kfree (gtt); } -static struct ttm_backend_func amdgpu_backend_func = { - .bind = &amdgpu_ttm_backend_bind, - .unbind = &amdgpu_ttm_backend_unbind, - .destroy = &amdgpu_ttm_backend_destroy, -}; -/** * amdgpu_ttm_tt_create - Create a ttm_tt object for a given BO *
@@ -1277,7 +1271,6 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo,if (gtt ==NULL ) {return NULL ; } - gtt->ttm.ttm.func = &amdgpu_backend_func; gtt->gobj = &bo->base;/* allocate space for the uninitialized page entries */
@@ -1679,6 +1672,9 @@ 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_unbind = &amdgpu_ttm_backend_unbind, + .ttm_tt_destroy = &amdgpu_ttm_backend_destroy, .eviction_valuable = amdgpu_ttm_bo_eviction_valuable, .evict_flags = &amdgpu_evict_flags, .move = &amdgpu_bo_move,
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 11/23 drm/gem_vram/ttm: move to driver backend destroy function.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/drm_gem_vram_helper.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/drm_gem_vram_helper.c +1 -6
@@ -973,10 +973,6 @@ static void backend_func_destroy(struct ttm_bo_device *bdev, struct ttm_tt *tt)kfree (tt); } -static struct ttm_backend_func backend_func = { - .destroy = backend_func_destroy -}; -/* * TTM BO device */
@@ -991,8 +987,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,if (!tt)return NULL ; - tt->func = &backend_func; - ret =ttm_tt_init (tt, bo, page_flags);if (ret <0 ) goto err_ttm_tt_init;
@@ -1055,6 +1049,7 @@ static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,static struct ttm_bo_driver bo_driver = { .ttm_tt_create = bo_driver_ttm_tt_create, + .ttm_tt_destroy = backend_func_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = bo_driver_evict_flags, .move_notify = bo_driver_move_notify,
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 11/23] drm/gem_vram/ttm: move to driver backend destroy function.
Hi
Am 26.08.20 um 03:44 schrieb Dave Airlie:
Quoted 32 lines
From: Dave Airlie <[email protected]>
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/drm_gem_vram_helper.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/gpu/drm/drm_gem_vram_helper.c +0
-6@@ -973,10 +973,6 @@ static void backend_func_destroy(struct ttm_bo_device *bdev, struct ttm_tt *tt)kfree (tt); } -static struct ttm_backend_func backend_func = { - .destroy = backend_func_destroy -}; -/* * TTM BO device */ @@ -991,8 +987,6 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,if (!tt)return NULL ; - tt->func = &backend_func; - ret =ttm_tt_init (tt, bo, page_flags);if (ret <0 ) goto err_ttm_tt_init;
drivers/gpu/drm/drm_gem_vram_helper.c static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev, · line 1052
Quoted 4 lines
drivers/gpu/drm/drm_gem_vram_helper.c +1
-0@@ -1055,6 +1049,7 @@ static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,static struct ttm_bo_driver bo_driver = { .ttm_tt_create = bo_driver_ttm_tt_create, + .ttm_tt_destroy = backend_func_destroy,
Please rename backend_func_destroy to bo_driver_ttm_tt_destroy. With this change
Best regards
Thomas
Quoted 4 lines
drivers/gpu/drm/drm_gem_vram_helper.c +0
-0.eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = bo_driver_evict_flags, .move_notify = bo_driver_move_notify,
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
maintainerPATCH 12/23 drm/ttm/agp: drop back end bindings from agp
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
These aren't used anymore.
--- drivers/gpu/drm/ttm/ttm_agp_backend.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/ttm/ttm_agp_backend.c +0 -7
@@ -112,12 +112,6 @@ void ttm_agp_destroy(struct ttm_bo_device *bdev, }EXPORT_SYMBOL (ttm_agp_destroy); -static struct ttm_backend_func ttm_agp_func = { - .bind = ttm_agp_bind, - .unbind = ttm_agp_unbind, - .destroy = ttm_agp_destroy, -}; -struct ttm_tt *ttm_agp_tt_create (struct ttm_buffer_object *bo,struct agp_bridge_data *bridge,uint32_t page_flags)
@@ -130,7 +124,6 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo, agp_be->mem =NULL ; agp_be->bridge = bridge; - agp_be->ttm.func = &ttm_agp_func;if (ttm_tt_init (&agp_be->ttm, bo, page_flags)) {kfree (agp_be);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 13/23 drm/ttm: get rid of agp specific populate/unpopulate paths.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_agp_backend.c | 17 ----------------- include/drm/ttm/ttm_tt.h | 2 -- 4 files changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -1280,7 +1280,7 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,#if IS_ENABLED (CONFIG_AGP )if (drm->agp.bridge) { -return ttm_agp_tt_populate (bdev, ttm, ctx); +return ttm_pool_populate (ttm, ctx); }#endif
@@ -1309,7 +1309,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_bo_device *bdev,#if IS_ENABLED (CONFIG_AGP )if (drm->agp.bridge) { -ttm_agp_tt_unpopulate (bdev, ttm); +ttm_pool_unpopulate (ttm);return ; }#endif
drivers/gpu/drm/radeon/radeon_ttm.c +2 -2
@@ -628,7 +628,7 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) { -return ttm_agp_tt_populate (bdev, ttm, ctx); +return ttm_pool_populate (ttm, ctx); }#endif
@@ -658,7 +658,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) { -ttm_agp_tt_unpopulate (bdev, ttm); +ttm_pool_unpopulate (ttm);return ; }#endif
drivers/gpu/drm/ttm/ttm_agp_backend.c +0 -17
@@ -133,20 +133,3 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo,return &agp_be->ttm; }EXPORT_SYMBOL (ttm_agp_tt_create); - -int ttm_agp_tt_populate (struct ttm_bo_device *bdev, -struct ttm_tt *ttm,struct ttm_operation_ctx *ctx) -{ -if (ttm->state != tt_unpopulated) -return 0 ; - -return ttm_pool_populate (ttm, ctx); -} -EXPORT_SYMBOL (ttm_agp_tt_populate); - -void ttm_agp_tt_unpopulate (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) -{ -ttm_pool_unpopulate (ttm); -} -EXPORT_SYMBOL (ttm_agp_tt_unpopulate);
include/drm/ttm/ttm_tt.h +0 -2
@@ -264,8 +264,6 @@ void ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *ttm);struct ttm_tt *ttm_agp_tt_create (struct ttm_buffer_object *bo,struct agp_bridge_data *bridge,uint32_t page_flags); -int ttm_agp_tt_populate (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_operation_ctx *ctx); -void ttm_agp_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm);int ttm_agp_bind (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); void ttm_agp_unbind(struct ttm_bo_device *bdev,
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 14/23 drm/ttm/agp: remove bdev from agp helpers
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
Since the agp bind/unbind/destroy are now getting called from drivers rather than via the func table, drop the bdev parameter.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 +++--- drivers/gpu/drm/radeon/radeon_ttm.c | 6 +++--- drivers/gpu/drm/ttm/ttm_agp_backend.c | 11 ++++------- include/drm/ttm/ttm_tt.h | 9 +++------ 4 files changed, 13 insertions(+), 19 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +3 -3
@@ -676,7 +676,7 @@ nouveau_ttm_tt_bind(struct ttm_bo_device *bdev, struct ttm_tt *ttm,struct nouveau_drm *drm =nouveau_bdev (bdev);if (drm->agp.bridge) { -return ttm_agp_bind (bdev, ttm, reg); +return ttm_agp_bind (ttm, reg); }#endif return nouveau_sgdma_bind (bdev, ttm, reg);
@@ -689,7 +689,7 @@ nouveau_ttm_tt_unbind(struct ttm_bo_device *bdev, struct ttm_tt *ttm)struct nouveau_drm *drm =nouveau_bdev (bdev);if (drm->agp.bridge) { -ttm_agp_unbind (bdev, ttm); +ttm_agp_unbind (ttm);return ; }#endif
@@ -1331,7 +1331,7 @@ nouveau_ttm_tt_destroy(struct ttm_bo_device *bdev,#if IS_ENABLED (CONFIG_AGP )struct nouveau_drm *drm =nouveau_bdev (bdev);if (drm->agp.bridge) { -ttm_agp_destroy (bdev, ttm); +ttm_agp_destroy (ttm);return ; }#endif
drivers/gpu/drm/radeon/radeon_ttm.c +3 -3
@@ -696,7 +696,7 @@ static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev,#if IS_ENABLED (CONFIG_AGP )if (rdev->flags &RADEON_IS_AGP ) { -return ttm_agp_bind (bdev, ttm, bo_mem); +return ttm_agp_bind (ttm, bo_mem); }#endif
@@ -710,7 +710,7 @@ static void radeon_ttm_tt_unbind(struct ttm_bo_device *bdev,struct radeon_device *rdev =radeon_get_rdev (bdev);if (rdev->flags &RADEON_IS_AGP ) { -ttm_agp_unbind (bdev, ttm); +ttm_agp_unbind (ttm);return ; }#endif
@@ -724,7 +724,7 @@ static void radeon_ttm_tt_destroy(struct ttm_bo_device *bdev,struct radeon_device *rdev =radeon_get_rdev (bdev);if (rdev->flags &RADEON_IS_AGP ) { -ttm_agp_destroy (bdev, ttm); +ttm_agp_destroy (ttm);return ; }#endif
drivers/gpu/drm/ttm/ttm_agp_backend.c +4 -7
@@ -48,8 +48,7 @@ struct ttm_agp_backend {struct agp_bridge_data *bridge; }; -int ttm_agp_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm,struct ttm_resource *bo_mem) +int ttm_agp_bind (struct ttm_tt *ttm,struct ttm_resource *bo_mem) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;
@@ -84,8 +83,7 @@ int ttm_agp_bind(struct ttm_bo_device *bdev, }EXPORT_SYMBOL (ttm_agp_bind); -void ttm_agp_unbind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) +void ttm_agp_unbind (struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
@@ -100,13 +98,12 @@ void ttm_agp_unbind(struct ttm_bo_device *bdev, }EXPORT_SYMBOL (ttm_agp_unbind); -void ttm_agp_destroy (struct ttm_bo_device *bdev, -struct ttm_tt *ttm) +void ttm_agp_destroy (struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);if (agp_be->mem) -ttm_agp_unbind (bdev, ttm); +ttm_agp_unbind (ttm);ttm_tt_fini (ttm);kfree (agp_be); }
include/drm/ttm/ttm_tt.h +3 -6
@@ -264,12 +264,9 @@ void ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *ttm);struct ttm_tt *ttm_agp_tt_create (struct ttm_buffer_object *bo,struct agp_bridge_data *bridge,uint32_t page_flags); -int ttm_agp_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm,struct ttm_resource *bo_mem); -void ttm_agp_unbind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm); -void ttm_agp_destroy (struct ttm_bo_device *bdev, -struct ttm_tt *ttm); +int ttm_agp_bind (struct ttm_tt *ttm,struct ttm_resource *bo_mem); +void ttm_agp_unbind (struct ttm_tt *ttm); +void ttm_agp_destroy (struct ttm_tt *ttm);#endif #endif
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 15/23 drm/ttm: drop the tt backend function paths.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
These are now driver side.
--- drivers/gpu/drm/ttm/ttm_tt.c | 15 +++----------- include/drm/ttm/ttm_tt.h | 39 ------------------------------------ 2 files changed, 3 insertions(+), 51 deletions(-)
drivers/gpu/drm/ttm/ttm_tt.c +3 -12
@@ -222,10 +222,7 @@ void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)fput (ttm->swap_storage); ttm->swap_storage =NULL ; -if (bdev->driver->ttm_tt_destroy) - bdev->driver->ttm_tt_destroy (bdev, ttm); -else - ttm->func->destroy (bdev, ttm); + bdev->driver->ttm_tt_destroy (bdev, ttm); } static void ttm_tt_init_fields(struct ttm_tt *ttm,
@@ -313,10 +310,7 @@ EXPORT_SYMBOL(ttm_dma_tt_fini);void ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {if (ttm->state == tt_bound) { -if (bdev->driver->ttm_tt_unbind) - bdev->driver->ttm_tt_unbind (bdev, ttm); -else - ttm->func->unbind (bdev, ttm); + bdev->driver->ttm_tt_unbind (bdev, ttm); ttm->state = tt_unbound; } }
@@ -337,10 +331,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (ret)return ret; -if (bdev->driver->ttm_tt_bind) - ret = bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem); -else - ret = ttm->func->bind (bdev, ttm, bo_mem); + ret = bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem);if (unlikely (ret !=0 ))return ret;
include/drm/ttm/ttm_tt.h +0 -39
@@ -48,47 +48,9 @@ enum ttm_caching_state { tt_cached }; -struct ttm_backend_func { -/** -* struct ttm_backend_func member bind -* -* @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 (*bind) (struct ttm_bo_device *bdev,struct ttm_tt *ttm,struct ttm_resource *bo_mem); - -/** -* struct ttm_backend_func member unbind -* -* @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 (*unbind) (struct ttm_bo_device *bdev,struct ttm_tt *ttm); - -/** -* struct ttm_backend_func member destroy -* -* @ttm: Pointer to a struct ttm_tt. -* -* Destroy the backend. This will be call back from ttm_tt_destroy so -* don't call ttm_tt_destroy from the callback or infinite loop. -*/ -void (*destroy) (struct ttm_bo_device *bdev,struct ttm_tt *ttm); -}; -/** * struct ttm_tt * -* @func: Pointer to a struct ttm_backend_func that describes -* the backend methods. -* pointer. * @pages: Array of pages backing the data. * @num_pages: Number of pages in the page array. * @bdev: Pointer to the current struct ttm_bo_device.
@@ -102,7 +64,6 @@ struct ttm_backend_func {* memory. */ struct ttm_tt { -struct ttm_backend_func *func;struct page **pages;uint32_t page_flags;unsigned long num_pages;
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 16/23 drm/ttm: move sg pointer into ttm_dma_tt
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This is only used by drivers that have a dma tt backing store.
--- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 32 +++++++++---------- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_mem.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 26 +++++++-------- drivers/gpu/drm/ttm/ttm_tt.c | 4 ++- include/drm/ttm/ttm_tt.h | 2 +- 7 files changed, 38 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2 -1
@@ -1231,8 +1231,9 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( goto err_bo_create; }if (bo_type == ttm_bo_type_sg) { +struct ttm_dma_tt *dma_ttm = (struct ttm_dma_tt *)bo->tbo.ttm; bo->tbo.sg = sg; - bo->tbo.ttm->sg = sg; + dma_ttm->sg = sg; } bo->kfd_bo = *mem; (*mem)->bo = bo;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +16 -16
@@ -985,25 +985,25 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;/* Allocate an SG array and squash pages into it */ - r =sg_alloc_table_from_pages (ttm->sg, ttm->pages, ttm->num_pages,0 , + r =sg_alloc_table_from_pages (gtt->ttm.sg, ttm->pages, ttm->num_pages,0 , ttm->num_pages <<PAGE_SHIFT ,GFP_KERNEL );if (r) goto release_sg;/* Map SG to device */ - r =dma_map_sgtable (adev->dev, ttm->sg, direction,0 ); + r =dma_map_sgtable (adev->dev, gtt->ttm.sg, direction,0 );if (r) goto release_sg;/* convert SG to linear array of pages and dma addresses */ -drm_prime_sg_to_page_addr_arrays (ttm->sg, ttm->pages, +drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages);return 0 ; release_sg: -kfree (ttm->sg); +kfree (gtt->ttm.sg);return r; }
@@ -1021,12 +1021,12 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_bo_device *bdev, DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;/* double check that we don't free the table twice */ -if (!ttm->sg->sgl) +if (!gtt->ttm.sg->sgl)return ;/* unmap the pages mapped to the device */ -dma_unmap_sgtable (adev->dev, ttm->sg, direction,0 ); -sg_free_table (ttm->sg); +dma_unmap_sgtable (adev->dev, gtt->ttm.sg, direction,0 ); +sg_free_table (gtt->ttm.sg);#if IS_ENABLED (CONFIG_DRM_AMDGPU_USERPTR )if (gtt->range) {
@@ -1296,8 +1296,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,/* user pages are bound by amdgpu_ttm_tt_pin_userptr() */ if (gtt && gtt->userptr) { - ttm->sg =kzalloc (sizeof (struct sg_table ),GFP_KERNEL ); -if (!ttm->sg) + gtt->ttm.sg =kzalloc (sizeof (struct sg_table ),GFP_KERNEL ); +if (!gtt->ttm.sg)return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ;
@@ -1306,7 +1306,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev, }if (ttm->page_flags &TTM_PAGE_FLAG_SG ) { -if (!ttm->sg) { +if (!gtt->ttm.sg) {struct dma_buf_attachment *attach;struct sg_table *sgt;
@@ -1315,10 +1315,10 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,if (IS_ERR (sgt))return PTR_ERR (sgt); - ttm->sg = sgt; + gtt->ttm.sg = sgt; } -drm_prime_sg_to_page_addr_arrays (ttm->sg, ttm->pages, +drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); ttm->state = tt_unbound;
@@ -1349,17 +1349,17 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *if (gtt && gtt->userptr) {amdgpu_ttm_tt_set_user_pages (ttm,NULL ); -kfree (ttm->sg); +kfree (gtt->ttm.sg); ttm->page_flags &= ~TTM_PAGE_FLAG_SG ;return ; } -if (ttm->sg && gtt->gobj->import_attach) { +if (gtt->ttm.sg && gtt->gobj->import_attach) {struct dma_buf_attachment *attach; attach = gtt->gobj->import_attach; -dma_buf_unmap_attachment (attach, ttm->sg,DMA_BIDIRECTIONAL ); - ttm->sg =NULL ; +dma_buf_unmap_attachment (attach, gtt->ttm.sg,DMA_BIDIRECTIONAL ); + gtt->ttm.sg =NULL ;return ; }
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -1267,9 +1267,9 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,if (ttm->state != tt_unpopulated)return 0 ; -if (slave && ttm->sg) { +if (slave && ttm_dma->sg) {/* make userspace faulting work */ -drm_prime_sg_to_page_addr_arrays (ttm->sg, ttm->pages, +drm_prime_sg_to_page_addr_arrays (ttm_dma->sg, ttm->pages, ttm_dma->dma_address, ttm->num_pages); ttm->state = tt_unbound;return 0 ;
drivers/gpu/drm/nouveau/nouveau_mem.c +1 -1
@@ -116,7 +116,7 @@ nouveau_mem_host(struct ttm_resource *reg, struct ttm_dma_tt *tt) mem->comp =0 ; } -if (tt->ttm.sg) args.sgl = tt->ttm.sg->sgl; +if (tt->sg) args.sgl = tt->sg->sgl;else args.dma = tt->dma_address;mutex_lock (&drm->master.lock);
drivers/gpu/drm/radeon/radeon_ttm.c +13 -13
@@ -459,23 +459,23 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt * }while (pinned < ttm->num_pages); - r =sg_alloc_table_from_pages (ttm->sg, ttm->pages, ttm->num_pages,0 , + r =sg_alloc_table_from_pages (gtt->ttm.sg, ttm->pages, ttm->num_pages,0 , ttm->num_pages <<PAGE_SHIFT ,GFP_KERNEL );if (r) goto release_sg; - r =dma_map_sgtable (rdev->dev, ttm->sg, direction,0 ); + r =dma_map_sgtable (rdev->dev, gtt->ttm.sg, direction,0 );if (r) goto release_sg; -drm_prime_sg_to_page_addr_arrays (ttm->sg, ttm->pages, +drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages);return 0 ; release_sg: -kfree (ttm->sg); +kfree (gtt->ttm.sg); release_pages:release_pages (ttm->pages, pinned);
@@ -493,13 +493,13 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_bo_device *bdev, struct ttm_t DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;/* double check that we don't free the table twice */ -if (!ttm->sg->sgl) +if (!gtt->ttm.sg->sgl)return ;/* free the sg table and pages again */ -dma_unmap_sgtable (rdev->dev, ttm->sg, direction,0 ); +dma_unmap_sgtable (rdev->dev, gtt->ttm.sg, direction,0 ); -for_each_sgtable_page (ttm->sg, &sg_iter,0 ) { +for_each_sgtable_page (gtt->ttm.sg, &sg_iter,0 ) {struct page *page =sg_page_iter_page (&sg_iter);if (!(gtt->userflags &RADEON_GEM_USERPTR_READONLY ))set_page_dirty (page);
@@ -508,7 +508,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_bo_device *bdev, struct ttm_tput_page (page); } -sg_free_table (ttm->sg); +sg_free_table (gtt->ttm.sg); } static int radeon_ttm_backend_bind(struct ttm_bo_device *bdev,
@@ -610,8 +610,8 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG );if (gtt && gtt->userptr) { - ttm->sg =kzalloc (sizeof (struct sg_table ),GFP_KERNEL ); -if (!ttm->sg) + gtt->ttm.sg =kzalloc (sizeof (struct sg_table ),GFP_KERNEL ); +if (!gtt->ttm.sg)return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ;
@@ -619,8 +619,8 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,return 0 ; } -if (slave && ttm->sg) { -drm_prime_sg_to_page_addr_arrays (ttm->sg, ttm->pages, +if (slave && gtt->ttm.sg) { +drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); ttm->state = tt_unbound;return 0 ;
@@ -648,7 +648,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG );if (gtt && gtt->userptr) { -kfree (ttm->sg); +kfree (gtt->ttm.sg); ttm->page_flags &= ~TTM_PAGE_FLAG_SG ;return ; }
drivers/gpu/drm/ttm/ttm_tt.c +3 -1
@@ -234,7 +234,6 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, ttm->page_flags = page_flags; ttm->state = tt_unpopulated; ttm->swap_storage =NULL ; - ttm->sg = bo->sg; } int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
@@ -263,6 +262,7 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo,struct ttm_tt *ttm = &ttm_dma->ttm;ttm_tt_init_fields (ttm, bo, page_flags); + ttm_dma->sg = bo->sg;INIT_LIST_HEAD (&ttm_dma->pages_list);if (ttm_dma_tt_alloc_page_directory (ttm_dma)) {
@@ -282,6 +282,8 @@ int ttm_sg_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo,ttm_tt_init_fields (ttm, bo, page_flags);INIT_LIST_HEAD (&ttm_dma->pages_list); + ttm_dma->sg = bo->sg; +if (page_flags &TTM_PAGE_FLAG_SG ) ret =ttm_sg_tt_alloc_page_directory (ttm_dma);else
include/drm/ttm/ttm_tt.h +1 -1
@@ -67,7 +67,6 @@ struct ttm_tt {struct page **pages;uint32_t page_flags;unsigned long num_pages; -struct sg_table *sg;/* for SG objects via dma-buf */ struct file *swap_storage;enum ttm_caching_state caching_state;enum {
@@ -90,6 +89,7 @@ struct ttm_tt {*/ struct ttm_dma_tt {struct ttm_tt ttm; +struct sg_table *sg;/* for SG objects via dma-buf */ dma_addr_t *dma_address;struct list_head pages_list; };
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 17/23 drm/ttm: split populated/bound state flags.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
Get bound out is the next step.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 +++--- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 6 +++--- drivers/gpu/drm/ttm/ttm_tt.c | 19 +++++++++---------- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 +- include/drm/ttm/ttm_tt.h | 10 ++++------ 11 files changed, 30 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
@@ -1301,7 +1301,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ; - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }
@@ -1321,7 +1321,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -1264,14 +1264,14 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,struct device *dev;bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG ); -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (slave && ttm_dma->sg) {/* make userspace faulting work */ drm_prime_sg_to_page_addr_arrays (ttm_dma->sg, ttm->pages, ttm_dma->dma_address, ttm->num_pages); - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }
drivers/gpu/drm/radeon/radeon_mn.c +1 -1
@@ -53,7 +53,7 @@ static bool radeon_mn_invalidate(struct mmu_interval_notifier *mn,struct ttm_operation_ctx ctx = { false, false };long r; -if (!bo->tbo.ttm || bo->tbo.ttm->state != tt_bound) +if (!bo->tbo.ttm || bo->tbo.ttm->bound == false)return true;if (!mmu_notifier_range_blockable (range))
drivers/gpu/drm/radeon/radeon_ttm.c +2 -2
@@ -615,14 +615,14 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ; - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }if (slave && gtt->ttm.sg) {drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -1
@@ -251,7 +251,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,* Don't move nonexistent data. Clear destination instead. */ if (old_iomap ==NULL && - (ttm ==NULL || (ttm->state == tt_unpopulated && + (ttm ==NULL || (!ttm->populated && !(ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )))) {memset_io (new_iomap,0 , new_mem->num_pages*PAGE_SIZE ); goto out2;
drivers/gpu/drm/ttm/ttm_page_alloc.c +3 -3
@@ -1044,7 +1044,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) put_pages:ttm_put_pages (ttm->pages, ttm->num_pages, ttm->page_flags, ttm->caching_state); - ttm->state = tt_unpopulated; + ttm->populated = false; }int ttm_pool_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx)
@@ -1053,7 +1053,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)unsigned i;int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (ttm_check_under_lowerlimit (mem_glob, ttm->num_pages, ctx))
@@ -1083,7 +1083,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) } } - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }EXPORT_SYMBOL (ttm_pool_populate);
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +3 -3
@@ -894,7 +894,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev,unsigned i;int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (ttm_check_under_lowerlimit (mem_glob, num_pages, ctx))
@@ -982,7 +982,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev, } } - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }EXPORT_SYMBOL_GPL (ttm_dma_populate);
@@ -1076,7 +1076,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)/* shrink pool if necessary (only on !is_cached pools)*/ if (npages)ttm_dma_page_pool_free (pool, npages, false); - ttm->state = tt_unpopulated; + ttm->populated = false; }EXPORT_SYMBOL_GPL (ttm_dma_unpopulate);
drivers/gpu/drm/ttm/ttm_tt.c +9 -10
@@ -156,7 +156,7 @@ static int ttm_tt_set_caching(struct ttm_tt *ttm,if (ttm->caching_state == c_state)return 0 ; -if (ttm->state == tt_unpopulated) { +if (!ttm->populated) {/* Change caching but don't populate */ ttm->caching_state = c_state;return 0 ;
@@ -214,7 +214,7 @@ void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)ttm_tt_unbind (bdev, ttm); -if (ttm->state == tt_unbound) +if (ttm->populated)ttm_tt_unpopulate (bdev, ttm); if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&
@@ -232,8 +232,8 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, ttm->num_pages = bo->num_pages; ttm->caching_state = tt_cached; ttm->page_flags = page_flags; - ttm->state = tt_unpopulated; ttm->swap_storage =NULL ; + ttm->populated = false; } int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
@@ -311,9 +311,9 @@ EXPORT_SYMBOL(ttm_dma_tt_fini);void ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (ttm->state == tt_bound) { +if (ttm->bound) { bdev->driver->ttm_tt_unbind (bdev, ttm); - ttm->state = tt_unbound; + ttm->bound = false; } }
@@ -326,7 +326,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (!ttm)return -EINVAL ; -if (ttm->state == tt_bound) +if (ttm->bound)return 0 ; ret =ttm_tt_populate (bdev, ttm, ctx);
@@ -337,7 +337,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (unlikely (ret !=0 ))return ret; - ttm->state = tt_bound; + ttm->bound = true;return 0 ; }
@@ -395,7 +395,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev,int i;int ret = -ENOMEM ; -BUG_ON (ttm->state != tt_unbound && ttm->state != tt_unpopulated);BUG_ON (ttm->caching_state != tt_cached);if (!persistent_swap_storage) {
@@ -462,7 +461,7 @@ int ttm_tt_populate(struct ttm_bo_device *bdev, {int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (bdev->driver->ttm_tt_populate)
@@ -491,7 +490,7 @@ static void ttm_tt_clear_mapping(struct ttm_tt *ttm)void ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (ttm->state == tt_unpopulated) +if (!ttm->populated)return ;ttm_tt_clear_mapping (ttm);
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2 -2
@@ -464,13 +464,13 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,if (!(src->mem.placement &TTM_PL_FLAG_NO_EVICT ))dma_resv_assert_held (src->base.resv); -if (dst->ttm->state == tt_unpopulated) { +if (dst->ttm->populated == false) { ret = dst->bdev->driver->ttm_tt_populate (dst->bdev, dst->ttm, &ctx);if (ret)return ret; } -if (src->ttm->state == tt_unpopulated) { +if (src->ttm->populated == false) { ret = src->bdev->driver->ttm_tt_populate (src->bdev, src->ttm, &ctx);if (ret)return ret;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1 -1
@@ -623,7 +623,7 @@ static int vmw_ttm_populate(struct ttm_bo_device *bdev,struct ttm_mem_global *glob =vmw_mem_glob (dev_priv);int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (dev_priv->map_mode == vmw_dma_alloc_coherent) {
include/drm/ttm/ttm_tt.h +4 -6
@@ -57,7 +57,8 @@ enum ttm_caching_state {* @be: Pointer to the ttm backend. * @swap_storage: Pointer to shmem struct file for swap storage. * @caching_state: The current caching state of the pages. -* @state: The current binding state of the pages. +* @populated: if the backing store is populated +* @bound: if this object has been bound to a global table. * * This is a structure holding the pages, caching- and aperture binding * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -69,11 +70,8 @@ struct ttm_tt {unsigned long num_pages;struct file *swap_storage;enum ttm_caching_state caching_state; -enum { - tt_bound, - tt_unbound, - tt_unpopulated, - } state; +bool populated; +bool bound; };/**
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 17/23] drm/ttm: split populated/bound state flags.
Am 26.08.20 um 03:44 schrieb Dave Airlie:
Quoted 67 lines
From: Dave Airlie <[email protected]>
Get bound out is the next step.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 +++--- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 6 +++--- drivers/gpu/drm/ttm/ttm_tt.c | 19 +++++++++---------- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 +- include/drm/ttm/ttm_tt.h | 10 ++++------ 11 files changed, 30 insertions(+), 33 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2
-2@@ -1301,7 +1301,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ; - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }@@ -1321,7 +1321,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }drivers/gpu/drm/nouveau/nouveau_bo.c +2
-2@@ -1264,14 +1264,14 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,struct device *dev;bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG ); -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (slave && ttm_dma->sg) {/* make userspace faulting work */ drm_prime_sg_to_page_addr_arrays (ttm_dma->sg, ttm->pages, ttm_dma->dma_address, ttm->num_pages); - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }drivers/gpu/drm/radeon/radeon_mn.c +0
-0
drivers/gpu/drm/radeon/radeon_mn.c static bool radeon_mn_invalidate(struct mmu_interval_notifier *mn, · line 56
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_mn.c +1
-1@@ -53,7 +53,7 @@ static bool radeon_mn_invalidate(struct mmu_interval_notifier *mn,struct ttm_operation_ctx ctx = { false, false };long r; -if (!bo->tbo.ttm || bo->tbo.ttm->state != tt_bound) +if (!bo->tbo.ttm || bo->tbo.ttm->bound == false)
I think using ! instead of "== false" would look better here.
Christian.
Quoted 238 lines
drivers/gpu/drm/radeon/radeon_mn.c +0
-0return true;if (!mmu_notifier_range_blockable (range))drivers/gpu/drm/radeon/radeon_ttm.c +2
-2@@ -615,14 +615,14 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ; - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }if (slave && gtt->ttm.sg) {drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -251,7 +251,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,* Don't move nonexistent data. Clear destination instead. */ if (old_iomap ==NULL && - (ttm ==NULL || (ttm->state == tt_unpopulated && + (ttm ==NULL || (!ttm->populated && !(ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )))) {memset_io (new_iomap,0 , new_mem->num_pages*PAGE_SIZE ); goto out2;drivers/gpu/drm/ttm/ttm_page_alloc.c +3
-3@@ -1044,7 +1044,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) put_pages:ttm_put_pages (ttm->pages, ttm->num_pages, ttm->page_flags, ttm->caching_state); - ttm->state = tt_unpopulated; + ttm->populated = false; }int ttm_pool_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx)@@ -1053,7 +1053,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)unsigned i;int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (ttm_check_under_lowerlimit (mem_glob, ttm->num_pages, ctx))@@ -1083,7 +1083,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) } } - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }EXPORT_SYMBOL (ttm_pool_populate);drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +3
-3@@ -894,7 +894,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev,unsigned i;int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (ttm_check_under_lowerlimit (mem_glob, num_pages, ctx))@@ -982,7 +982,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev, } } - ttm->state = tt_unbound; + ttm->populated = true;return 0 ; }EXPORT_SYMBOL_GPL (ttm_dma_populate);@@ -1076,7 +1076,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)/* shrink pool if necessary (only on !is_cached pools)*/ if (npages)ttm_dma_page_pool_free (pool, npages, false); - ttm->state = tt_unpopulated; + ttm->populated = false; }EXPORT_SYMBOL_GPL (ttm_dma_unpopulate);drivers/gpu/drm/ttm/ttm_tt.c +9
-10@@ -156,7 +156,7 @@ static int ttm_tt_set_caching(struct ttm_tt *ttm,if (ttm->caching_state == c_state)return 0 ; -if (ttm->state == tt_unpopulated) { +if (!ttm->populated) {/* Change caching but don't populate */ ttm->caching_state = c_state;return 0 ;@@ -214,7 +214,7 @@ void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)ttm_tt_unbind (bdev, ttm); -if (ttm->state == tt_unbound) +if (ttm->populated)ttm_tt_unpopulate (bdev, ttm); if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&@@ -232,8 +232,8 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, ttm->num_pages = bo->num_pages; ttm->caching_state = tt_cached; ttm->page_flags = page_flags; - ttm->state = tt_unpopulated; ttm->swap_storage =NULL ; + ttm->populated = false; } int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,@@ -311,9 +311,9 @@ EXPORT_SYMBOL(ttm_dma_tt_fini);void ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (ttm->state == tt_bound) { +if (ttm->bound) { bdev->driver->ttm_tt_unbind (bdev, ttm); - ttm->state = tt_unbound; + ttm->bound = false; } }@@ -326,7 +326,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (!ttm)return -EINVAL ; -if (ttm->state == tt_bound) +if (ttm->bound)return 0 ; ret =ttm_tt_populate (bdev, ttm, ctx);@@ -337,7 +337,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (unlikely (ret !=0 ))return ret; - ttm->state = tt_bound; + ttm->bound = true;return 0 ; }@@ -395,7 +395,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev,int i;int ret = -ENOMEM ; -BUG_ON (ttm->state != tt_unbound && ttm->state != tt_unpopulated);BUG_ON (ttm->caching_state != tt_cached);if (!persistent_swap_storage) {@@ -462,7 +461,7 @@ int ttm_tt_populate(struct ttm_bo_device *bdev, {int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (bdev->driver->ttm_tt_populate)@@ -491,7 +490,7 @@ static void ttm_tt_clear_mapping(struct ttm_tt *ttm)void ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (ttm->state == tt_unpopulated) +if (!ttm->populated)return ;ttm_tt_clear_mapping (ttm);drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2
-2@@ -464,13 +464,13 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,if (!(src->mem.placement &TTM_PL_FLAG_NO_EVICT ))dma_resv_assert_held (src->base.resv); -if (dst->ttm->state == tt_unpopulated) { +if (dst->ttm->populated == false) { ret = dst->bdev->driver->ttm_tt_populate (dst->bdev, dst->ttm, &ctx);if (ret)return ret; } -if (src->ttm->state == tt_unpopulated) { +if (src->ttm->populated == false) { ret = src->bdev->driver->ttm_tt_populate (src->bdev, src->ttm, &ctx);if (ret)return ret;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-1@@ -623,7 +623,7 @@ static int vmw_ttm_populate(struct ttm_bo_device *bdev,struct ttm_mem_global *glob =vmw_mem_glob (dev_priv);int ret; -if (ttm->state != tt_unpopulated) +if (ttm->populated)return 0 ;if (dev_priv->map_mode == vmw_dma_alloc_coherent) {include/drm/ttm/ttm_tt.h +2
-1@@ -57,7 +57,8 @@ enum ttm_caching_state {* @be: Pointer to the ttm backend. * @swap_storage: Pointer to shmem struct file for swap storage. * @caching_state: The current caching state of the pages. -* @state: The current binding state of the pages. +* @populated: if the backing store is populated +* @bound: if this object has been bound to a global table. * * This is a structure holding the pages, caching- and aperture binding * status for a buffer object that isn't backed by fixed (VRAM / AGP) @@ -69,11 +70,8 @@ struct ttm_tt {unsigned long num_pages;struct file *swap_storage;enum ttm_caching_state caching_state;
include/drm/ttm/ttm_tt.h struct ttm_tt { · line 77
Quoted 10 lines
include/drm/ttm/ttm_tt.h +2
-5-enum { - tt_bound, - tt_unbound, - tt_unpopulated, - } state; +bool populated; +bool bound; };/**
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 18/23 drm/ttm: move bound flag and use a utility wrapper
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
If we move the bound flag out then the tt destroy is much cleaner in a bo level wrapper, the code is in a few places, leave the ttm_tt_destroy just about destroying the backing store.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + drivers/gpu/drm/nouveau/nouveau_bo.c | 1 + drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 1 + drivers/gpu/drm/ttm/ttm_bo.c | 15 +++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 27 ++++++++++++++++++------- drivers/gpu/drm/ttm/ttm_tt.c | 19 +---------------- include/drm/ttm/ttm_bo_api.h | 1 + include/drm/ttm/ttm_bo_driver.h | 1 + include/drm/ttm/ttm_tt.h | 4 +--- 10 files changed, 36 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -551,6 +551,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,if (unlikely (r)) { goto out_cleanup; } + bo->ttm_bound = true;/* blit VRAM to GTT */ r =amdgpu_move_blit (bo, evict, &tmp_mem, old_mem);
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -0
@@ -879,6 +879,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, ret =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_reg, &ctx);if (ret) goto out; + bo->ttm_bound = true; ret =nouveau_bo_move_m2mf (bo, true, intr, no_wait_gpu, &tmp_reg);if (ret)
drivers/gpu/drm/radeon/radeon_mn.c +1 -1
@@ -53,7 +53,7 @@ static bool radeon_mn_invalidate(struct mmu_interval_notifier *mn,struct ttm_operation_ctx ctx = { false, false };long r; -if (!bo->tbo.ttm || bo->tbo.ttm->bound == false) +if (!bo->tbo.ttm || bo->tbo.ttm_bound == false)return true;if (!mmu_notifier_range_blockable (range))
drivers/gpu/drm/radeon/radeon_ttm.c +1 -0
@@ -239,6 +239,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,if (unlikely (r)) { goto out_cleanup; } + bo->ttm_bound = true; r =radeon_move_blit (bo, true, no_wait_gpu, &tmp_mem, old_mem);if (unlikely (r)) { goto out_cleanup;
drivers/gpu/drm/ttm/ttm_bo.c +8 -7
@@ -282,9 +282,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, goto out_err;if (mem->mem_type !=TTM_PL_SYSTEM ) { - ret =ttm_tt_bind (bdev, bo->ttm, mem, ctx); -if (ret) - goto out_err; +if (bo->ttm_bound == false) { + ret =ttm_tt_bind (bdev, bo->ttm, mem, ctx); +if (ret) + goto out_err; + bo->ttm_bound = true; + } }if (bo->mem.mem_type ==TTM_PL_SYSTEM ) {
@@ -324,8 +327,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, out_err: new_man =ttm_manager_type (bdev, bo->mem.mem_type);if (!new_man->use_tt) { -ttm_tt_destroy (bdev, bo->ttm); - bo->ttm =NULL ; +ttm_bo_tt_destroy (bo, bo->ttm); }return ret;
@@ -344,8 +346,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)if (bo->bdev->driver->move_notify) bo->bdev->driver->move_notify (bo, false,NULL ); -ttm_tt_destroy (bo->bdev, bo->ttm); - bo->ttm =NULL ; +ttm_bo_tt_destroy (bo, bo->ttm);ttm_resource_free (bo, &bo->mem); }
drivers/gpu/drm/ttm/ttm_bo_util.c +20 -7
@@ -51,7 +51,7 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo) }int ttm_bo_move_ttm (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx, +struct ttm_operation_ctx *ctx,struct ttm_resource *new_mem) {struct ttm_tt *ttm = bo->ttm;
@@ -68,6 +68,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, }ttm_tt_unbind (bo->bdev, ttm); + bo->ttm_bound = false;ttm_bo_free_old_node (bo);ttm_flag_masked (&old_mem->placement,TTM_PL_FLAG_SYSTEM ,TTM_PL_MASK_MEM );
@@ -82,6 +83,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, ret =ttm_tt_bind (bo->bdev, ttm, new_mem, ctx);if (unlikely (ret !=0 ))return ret; + bo->ttm_bound = true; } *old_mem = *new_mem;
@@ -300,8 +302,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, new_mem->mm_node =NULL ;if (!man->use_tt) { -ttm_tt_destroy (bdev, ttm); - bo->ttm =NULL ; +ttm_bo_tt_destroy (bo, ttm); } out1:
@@ -547,8 +548,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,return ret;if (!man->use_tt) { -ttm_tt_destroy (bdev, bo->ttm); - bo->ttm =NULL ; +ttm_bo_tt_destroy (bo, bo->ttm); }ttm_bo_free_old_node (bo); }else {
@@ -670,8 +670,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,return ret;if (!to->use_tt) { -ttm_tt_destroy (bdev, bo->ttm); - bo->ttm =NULL ; +ttm_bo_tt_destroy (bo, bo->ttm); }ttm_bo_free_old_node (bo); }
@@ -706,3 +705,17 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)return 0 ; } + +void ttm_bo_tt_destroy (struct ttm_buffer_object *bo,struct ttm_tt *ttm) +{ +if (ttm ==NULL ) +return ; + +if (bo->ttm_bound) +ttm_tt_unbind (bo->bdev, ttm); + +ttm_tt_unpopulate (bo->bdev, ttm); +ttm_tt_destroy (bo->bdev, ttm); + bo->ttm_bound = false; + bo->ttm =NULL ; +}
drivers/gpu/drm/ttm/ttm_tt.c +1 -18
@@ -209,14 +209,6 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);void ttm_tt_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (ttm ==NULL ) -return ; - -ttm_tt_unbind (bdev, ttm); - -if (ttm->populated) -ttm_tt_unpopulate (bdev, ttm); -if (!(ttm->page_flags &TTM_PAGE_FLAG_PERSISTENT_SWAP ) && ttm->swap_storage)fput (ttm->swap_storage);
@@ -311,10 +303,7 @@ EXPORT_SYMBOL(ttm_dma_tt_fini);void ttm_tt_unbind (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (ttm->bound) { - bdev->driver->ttm_tt_unbind (bdev, ttm); - ttm->bound = false; - } + bdev->driver->ttm_tt_unbind (bdev, ttm); } int ttm_tt_bind(struct ttm_bo_device *bdev,
@@ -326,9 +315,6 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (!ttm)return -EINVAL ; -if (ttm->bound) -return 0 ; - ret =ttm_tt_populate (bdev, ttm, ctx);if (ret)return ret;
@@ -336,9 +322,6 @@ int ttm_tt_bind(struct ttm_bo_device *bdev, ret = bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem);if (unlikely (ret !=0 ))return ret; - - ttm->bound = true; -return 0 ; }EXPORT_SYMBOL (ttm_tt_bind);
include/drm/ttm/ttm_bo_api.h +1 -0
@@ -141,6 +141,7 @@ struct ttm_buffer_object {struct ttm_resource mem;struct file *persistent_swap_storage;struct ttm_tt *ttm; +bool ttm_bound;bool evicted;bool deleted;
include/drm/ttm/ttm_bo_driver.h +1 -0
@@ -732,4 +732,5 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,int ttm_range_man_fini (struct ttm_bo_device *bdev,unsigned type); +void ttm_bo_tt_destroy (struct ttm_buffer_object *bo,struct ttm_tt *tt);#endif
include/drm/ttm/ttm_tt.h +1 -3
@@ -58,7 +58,6 @@ enum ttm_caching_state {* @swap_storage: Pointer to shmem struct file for swap storage. * @caching_state: The current caching state of the pages. * @populated: if the backing store is populated -* @bound: if this object has been bound to a global table. * * This is a structure holding the pages, caching- and aperture binding * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -71,7 +70,6 @@ struct ttm_tt {struct file *swap_storage;enum ttm_caching_state caching_state;bool populated; -bool bound; };/**
@@ -149,7 +147,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,* * @ttm: The struct ttm_tt. * -* Unbind, unpopulate and destroy common struct ttm_tt. +* Destroy common struct ttm_tt. */ void ttm_tt_destroy (struct ttm_bo_device *bdev,struct ttm_tt *ttm);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 19/23 drm/ttm: split bind and populate out.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
Make populating the backing store an explicit separate step
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 +++++- drivers/gpu/drm/radeon/radeon_ttm.c | 7 ++++++- drivers/gpu/drm/ttm/ttm_bo.c | 5 ++++- drivers/gpu/drm/ttm/ttm_bo_util.c | 6 +++++- drivers/gpu/drm/ttm/ttm_tt.c | 16 +++++----------- include/drm/ttm/ttm_tt.h | 3 +-- 7 files changed, 32 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 -1
@@ -546,8 +546,13 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, goto out_cleanup; } + r =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (unlikely (r)) { + goto out_cleanup; + } +/* Bind the memory to the GTT space */ - r =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem, ctx); + r =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem);if (unlikely (r)) { goto out_cleanup; }
drivers/gpu/drm/nouveau/nouveau_bo.c +5 -1
@@ -876,7 +876,11 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,if (ret)return ret; - ret =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_reg, &ctx); + ret =ttm_tt_populate (bo->bdev, bo->ttm, &ctx); +if (ret) + goto out; + + ret =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_reg);if (ret) goto out; bo->ttm_bound = true;
drivers/gpu/drm/radeon/radeon_ttm.c +6 -1
@@ -235,7 +235,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, goto out_cleanup; } - r =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem, &ctx); + r =ttm_tt_populate (bo->bdev, bo->ttm, &ctx); +if (unlikely (r)) { + goto out_cleanup; + } + + r =ttm_tt_bind (bo->bdev, bo->ttm, &tmp_mem);if (unlikely (r)) { goto out_cleanup; }
drivers/gpu/drm/ttm/ttm_bo.c +4 -1
@@ -282,8 +282,11 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, goto out_err;if (mem->mem_type !=TTM_PL_SYSTEM ) { + ret =ttm_tt_populate (bdev, bo->ttm, ctx); +if (ret) + goto out_err;if (bo->ttm_bound == false) { - ret =ttm_tt_bind (bdev, bo->ttm, mem, ctx); + ret =ttm_tt_bind (bdev, bo->ttm, mem);if (ret) goto out_err; bo->ttm_bound = true;
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -1
@@ -80,7 +80,11 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,return ret;if (new_mem->mem_type !=TTM_PL_SYSTEM ) { - ret =ttm_tt_bind (bo->bdev, ttm, new_mem, ctx); + ret =ttm_tt_populate (bo->bdev, ttm, ctx); +if (unlikely (ret !=0 )) +return ret; + + ret =ttm_tt_bind (bo->bdev, ttm, new_mem);if (unlikely (ret !=0 ))return ret; bo->ttm_bound = true;
drivers/gpu/drm/ttm/ttm_tt.c +5 -11
@@ -307,22 +307,15 @@ void ttm_tt_unbind(struct ttm_bo_device *bdev, struct ttm_tt *ttm) }int ttm_tt_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm,struct ttm_resource *bo_mem, -struct ttm_operation_ctx *ctx) +struct ttm_tt *ttm,struct ttm_resource *bo_mem) { -int ret =0 ; -if (!ttm)return -EINVAL ; - ret =ttm_tt_populate (bdev, ttm, ctx); -if (ret) -return ret; +if (WARN_ON (!ttm->populated)) +return -EINVAL ; - ret = bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem); -if (unlikely (ret !=0 )) -return ret; -return 0 ; +return bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem); }EXPORT_SYMBOL (ttm_tt_bind);
@@ -455,6 +448,7 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,ttm_tt_add_mapping (bdev, ttm);return ret; } +EXPORT_SYMBOL (ttm_tt_populate);static void ttm_tt_clear_mapping (struct ttm_tt *ttm) {
include/drm/ttm/ttm_tt.h +1 -2
@@ -139,8 +139,7 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);* Bind the pages of @ttm to an aperture location identified by @bo_mem */ int ttm_tt_bind (struct ttm_bo_device *bdev, -struct ttm_tt *ttm,struct ttm_resource *bo_mem, -struct ttm_operation_ctx *ctx); +struct ttm_tt *ttm,struct ttm_resource *bo_mem);/** * ttm_ttm_destroy:
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 20/23 drm/ttm: add populated accessors
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
next step move populated into upper page flag bits
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 +++--- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 6 +++--- drivers/gpu/drm/ttm/ttm_tt.c | 10 +++++----- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 +- include/drm/ttm/ttm_tt.h | 12 +++++++++++- 10 files changed, 32 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
@@ -1307,7 +1307,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ; - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }
@@ -1327,7 +1327,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -1269,14 +1269,14 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,struct device *dev;bool slave = !!(ttm->page_flags &TTM_PAGE_FLAG_SG ); -if (ttm->populated) +if (ttm_tt_is_populated (ttm))return 0 ;if (slave && ttm_dma->sg) {/* make userspace faulting work */ drm_prime_sg_to_page_addr_arrays (ttm_dma->sg, ttm->pages, ttm_dma->dma_address, ttm->num_pages); - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }
drivers/gpu/drm/radeon/radeon_ttm.c +2 -2
@@ -621,14 +621,14 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,return -ENOMEM ; ttm->page_flags |=TTM_PAGE_FLAG_SG ; - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }if (slave && gtt->ttm.sg) {drm_prime_sg_to_page_addr_arrays (gtt->ttm.sg, ttm->pages, gtt->ttm.dma_address, ttm->num_pages); - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -1
@@ -257,7 +257,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,* Don't move nonexistent data. Clear destination instead. */ if (old_iomap ==NULL && - (ttm ==NULL || (!ttm->populated && + (ttm ==NULL || (!ttm_tt_is_populated (ttm) && !(ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )))) {memset_io (new_iomap,0 , new_mem->num_pages*PAGE_SIZE ); goto out2;
drivers/gpu/drm/ttm/ttm_page_alloc.c +3 -3
@@ -1044,7 +1044,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) put_pages:ttm_put_pages (ttm->pages, ttm->num_pages, ttm->page_flags, ttm->caching_state); - ttm->populated = false; +ttm_tt_set_populated (ttm, false); }int ttm_pool_populate (struct ttm_tt *ttm,struct ttm_operation_ctx *ctx)
@@ -1053,7 +1053,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)unsigned i;int ret; -if (ttm->populated) +if (ttm_tt_is_populated (ttm))return 0 ;if (ttm_check_under_lowerlimit (mem_glob, ttm->num_pages, ctx))
@@ -1083,7 +1083,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) } } - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }EXPORT_SYMBOL (ttm_pool_populate);
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +3 -3
@@ -894,7 +894,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev,unsigned i;int ret; -if (ttm->populated) +if (ttm_tt_is_populated (ttm))return 0 ;if (ttm_check_under_lowerlimit (mem_glob, num_pages, ctx))
@@ -982,7 +982,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev, } } - ttm->populated = true; +ttm_tt_set_populated (ttm, true);return 0 ; }EXPORT_SYMBOL_GPL (ttm_dma_populate);
@@ -1076,7 +1076,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)/* shrink pool if necessary (only on !is_cached pools)*/ if (npages)ttm_dma_page_pool_free (pool, npages, false); - ttm->populated = false; +ttm_tt_set_populated (ttm, false); }EXPORT_SYMBOL_GPL (ttm_dma_unpopulate);
drivers/gpu/drm/ttm/ttm_tt.c +5 -5
@@ -156,7 +156,7 @@ static int ttm_tt_set_caching(struct ttm_tt *ttm,if (ttm->caching_state == c_state)return 0 ; -if (!ttm->populated) { +if (!ttm_tt_is_populated (ttm)) {/* Change caching but don't populate */ ttm->caching_state = c_state;return 0 ;
@@ -225,7 +225,7 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, ttm->caching_state = tt_cached; ttm->page_flags = page_flags; ttm->swap_storage =NULL ; - ttm->populated = false; +ttm_tt_set_populated (ttm, false); } int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
@@ -312,7 +312,7 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,if (!ttm)return -EINVAL ; -if (WARN_ON (!ttm->populated)) +if (WARN_ON (!ttm_tt_is_populated (ttm)))return -EINVAL ;return bdev->driver->ttm_tt_bind (bdev, ttm, bo_mem);
@@ -437,7 +437,7 @@ int ttm_tt_populate(struct ttm_bo_device *bdev, {int ret; -if (ttm->populated) +if (ttm_tt_is_populated (ttm))return 0 ;if (bdev->driver->ttm_tt_populate)
@@ -467,7 +467,7 @@ static void ttm_tt_clear_mapping(struct ttm_tt *ttm)void ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm) { -if (!ttm->populated) +if (!ttm_tt_is_populated (ttm))return ;ttm_tt_clear_mapping (ttm);
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2 -2
@@ -464,13 +464,13 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,if (!(src->mem.placement &TTM_PL_FLAG_NO_EVICT ))dma_resv_assert_held (src->base.resv); -if (dst->ttm->populated == false) { +if (ttm_tt_is_populated (dst->ttm) == false) { ret = dst->bdev->driver->ttm_tt_populate (dst->bdev, dst->ttm, &ctx);if (ret)return ret; } -if (src->ttm->populated == false) { +if (ttm_tt_is_populated (src->ttm) == false) { ret = src->bdev->driver->ttm_tt_populate (src->bdev, src->ttm, &ctx);if (ret)return ret;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1 -1
@@ -623,7 +623,7 @@ static int vmw_ttm_populate(struct ttm_bo_device *bdev,struct ttm_mem_global *glob =vmw_mem_glob (dev_priv);int ret; -if (ttm->populated) +if (ttm_tt_is_populated (ttm))return 0 ;if (dev_priv->map_mode == vmw_dma_alloc_coherent) {
include/drm/ttm/ttm_tt.h +11 -1
@@ -69,9 +69,19 @@ struct ttm_tt {unsigned long num_pages;struct file *swap_storage;enum ttm_caching_state caching_state; -bool populated; +bool _populated; }; +static inline bool ttm_tt_is_populated (struct ttm_tt *tt) +{ +return tt->_populated; +} + +static inline void ttm_tt_set_populated (struct ttm_tt *tt,bool flag) +{ + tt->_populated = flag; +} +/** * struct ttm_dma_tt *
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 21/23 drm/ttm: store populated status in upper page flag bits.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
--- include/drm/ttm/ttm_tt.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
include/drm/ttm/ttm_tt.h +7 -3
@@ -42,6 +42,8 @@ struct ttm_operation_ctx;#define TTM_PAGE_FLAG_SG (1 << 8)#define TTM_PAGE_FLAG_NO_RETRY (1 << 9) +#define TTM_PAGE_FLAG_PRIV_POPULATED (1 << 31) +enum ttm_caching_state { tt_uncached, tt_wc,
@@ -69,17 +71,19 @@ struct ttm_tt {unsigned long num_pages;struct file *swap_storage;enum ttm_caching_state caching_state; -bool _populated; };static inline bool ttm_tt_is_populated (struct ttm_tt *tt) { -return tt->_populated; +return tt->page_flags &TTM_PAGE_FLAG_PRIV_POPULATED ; }static inline void ttm_tt_set_populated (struct ttm_tt *tt,bool flag) { - tt->_populated = flag; +if (flag) + tt->page_flags |=TTM_PAGE_FLAG_PRIV_POPULATED ; +else + tt->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED ; }/**
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 22/23 drm/ttm: two minor struct reorgs to fill holes.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
These are just minor changes that fill some obvious holes.
--- include/drm/ttm/ttm_placement.h | 2 +- include/drm/ttm/ttm_tt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +1 -1
@@ -100,8 +100,8 @@ struct ttm_place {*/ struct ttm_placement {unsigned num_placement; -const struct ttm_place *placement;unsigned num_busy_placement; +const struct ttm_place *placement;const struct ttm_place *busy_placement; };
include/drm/ttm/ttm_tt.h +1 -1
@@ -68,9 +68,9 @@ enum ttm_caching_state {struct ttm_tt {struct page **pages;uint32_t page_flags; +enum ttm_caching_state caching_state;unsigned long num_pages;struct file *swap_storage; -enum ttm_caching_state caching_state; };static inline bool ttm_tt_is_populated (struct ttm_tt *tt)
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerPATCH 23/23 drm/ttm: change ordering of args to map/unmap helpers.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
These tooks the same args in a different order to the dma ones, just make things look nicer.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_page_alloc.c | 8 +++++--- include/drm/ttm/ttm_page_alloc.h | 8 +++++--- 5 files changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
@@ -1339,7 +1339,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,/* fall back to generic helper to populate the page array * and map them to the device */ -return ttm_populate_and_map_pages (adev->dev, >t->ttm, ctx); +return ttm_populate_and_map_pages (>t->ttm, adev->dev, ctx); }/**
@@ -1382,7 +1382,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *#endif /* fall back to generic helper to unmap and unpopulate array */ -ttm_unmap_and_unpopulate_pages (adev->dev, >t->ttm); +ttm_unmap_and_unpopulate_pages (>t->ttm, adev->dev); }/**
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -1294,7 +1294,7 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,return ttm_dma_populate ((void *)ttm, dev, ctx); }#endif -return ttm_populate_and_map_pages (dev, ttm_dma, ctx); +return ttm_populate_and_map_pages (ttm_dma, dev, ctx); } static void
@@ -1326,7 +1326,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_bo_device *bdev, }#endif -ttm_unmap_and_unpopulate_pages (dev, ttm_dma); +ttm_unmap_and_unpopulate_pages (ttm_dma, dev); } static void
drivers/gpu/drm/radeon/radeon_ttm.c +2 -2
@@ -644,7 +644,7 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev, }#endif -return ttm_populate_and_map_pages (rdev->dev, >t->ttm, ctx); +return ttm_populate_and_map_pages (>t->ttm, rdev->dev, ctx); }static void radeon_ttm_tt_unpopulate (struct ttm_bo_device *bdev,struct ttm_tt *ttm)
@@ -676,7 +676,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt * }#endif -ttm_unmap_and_unpopulate_pages (rdev->dev, >t->ttm); +ttm_unmap_and_unpopulate_pages (>t->ttm, rdev->dev); } int radeon_ttm_tt_set_userptr(struct radeon_device *rdev,
drivers/gpu/drm/ttm/ttm_page_alloc.c +5 -3
@@ -1094,8 +1094,9 @@ void ttm_pool_unpopulate(struct ttm_tt *ttm) }EXPORT_SYMBOL (ttm_pool_unpopulate); -int ttm_populate_and_map_pages (struct device *dev,struct ttm_dma_tt *tt, -struct ttm_operation_ctx *ctx) +int ttm_populate_and_map_pages (struct ttm_dma_tt *tt, +struct device *dev, +struct ttm_operation_ctx *ctx) {unsigned i, j;int r;
@@ -1137,7 +1138,8 @@ int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt, }EXPORT_SYMBOL (ttm_populate_and_map_pages); -void ttm_unmap_and_unpopulate_pages (struct device *dev,struct ttm_dma_tt *tt) +void ttm_unmap_and_unpopulate_pages (struct ttm_dma_tt *tt, +struct device *dev) {unsigned i, j;
include/drm/ttm/ttm_page_alloc.h +5 -3
@@ -61,13 +61,15 @@ void ttm_pool_unpopulate(struct ttm_tt *ttm);/** * Populates and DMA maps pages to fullfil a ttm_dma_populate() request */ -int ttm_populate_and_map_pages (struct device *dev,struct ttm_dma_tt *tt, -struct ttm_operation_ctx *ctx); +int ttm_populate_and_map_pages (struct ttm_dma_tt *tt, +struct device *dev, +struct ttm_operation_ctx *ctx);/** * Unpopulates and DMA unmaps pages as part of a * ttm_dma_unpopulate() request */ -void ttm_unmap_and_unpopulate_pages (struct device *dev,struct ttm_dma_tt *tt); +void ttm_unmap_and_unpopulate_pages (struct ttm_dma_tt *tt, +struct device *dev);/** * Output the state of pools to debugfs file
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerA repeating style nit pick that {} can be dropped on single line if and empty line between declaration and code.
Apart from that looks mostly good to me :)
Patches #1-#4, #6, #10, #12-#15 are Reviewed-by: Christian König <[email protected]>
Patch #5, #8, #9, #11 are Acked-by: Christian König <[email protected]>
A few nits on patch #7.
Regarding patch #16 I'm not sure if the sub-classing into ttm_tt and ttm_dma_tt is really worth it. I mean we can provide allocation helpers for drivers which don't need the DMA address array. But apart from that I'm pretty sure keeping the all fields in ttm_tt is the way to go.
Patch #17 has one little style comment.
I really need to take an in deep look at patches #18-#23, but the general approach sounds like the right thing to do.
Christian.
Am 26.08.20 um 03:44 schrieb Dave Airlie:
Quoted 11 lines
This is based on top of misc-next with Christians io rework for nouveau.
The idea is to move towards
ttm_ttbeing just a backing store for system allocated pages + dma info, and not be anything to do with a global TT.First is a couple of minor cleanups, then drops bdev from
ttm_tt, and moves the func table into the bdev driver table instead, makes drivers deal with the agp differences, then cleans up the mess.
Quoted 7 lines
It tries to cleanup
ttm_tta bit more as well, in the endttm_ttis getting to what I'd like it to represent, the next step is tackling the whole bind/unbind/move stuff I think.Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel