diff options
author | Dave Airlie <airlied@redhat.com> | 2020-09-17 09:36:14 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-09-17 23:23:06 +0300 |
commit | e46f468fef953dea30e7a7c69ad7e0370af26855 (patch) | |
tree | 582a5780c7a656f72ce34fba72b50118f961a0c0 /drivers/gpu/drm/ttm | |
parent | 92afce9095300cb652ea74a617c6679c4c4d4429 (diff) | |
download | linux-e46f468fef953dea30e7a7c69ad7e0370af26855.tar.xz |
drm/ttm: drop special pipeline accel cleanup function.
The two accel cleanup paths were mostly the same once refactored.
Just pass a bool to say if the evictions are to be pipelined.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917064132.148521-2-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_util.c | 89 |
1 files changed, 32 insertions, 57 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index ee4484ccbd1e..fb2a25f8408f 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -580,81 +580,56 @@ static int ttm_bo_move_to_ghost(struct ttm_buffer_object *bo, return 0; } -int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, - struct dma_fence *fence, - bool evict, - struct ttm_resource *new_mem) +static void ttm_bo_move_pipeline_evict(struct ttm_buffer_object *bo, + struct dma_fence *fence) { struct ttm_bo_device *bdev = bo->bdev; - struct ttm_resource_manager *man = ttm_manager_type(bdev, new_mem->mem_type); - int ret; + struct ttm_resource_manager *from = ttm_manager_type(bdev, bo->mem.mem_type); - dma_resv_add_excl_fence(bo->base.resv, fence); - if (evict) - ret = ttm_bo_wait_free_node(bo, man->use_tt); - else - ret = ttm_bo_move_to_ghost(bo, fence, man->use_tt); - if (ret) - return ret; + /** + * BO doesn't have a TTM we need to bind/unbind. Just remember + * this eviction and free up the allocation + */ + spin_lock(&from->move_lock); + if (!from->move || dma_fence_is_later(fence, from->move)) { + dma_fence_put(from->move); + from->move = dma_fence_get(fence); + } + spin_unlock(&from->move_lock); - ttm_bo_assign_mem(bo, new_mem); + ttm_bo_free_old_node(bo); - return 0; + dma_fence_put(bo->moving); + bo->moving = dma_fence_get(fence); } -EXPORT_SYMBOL(ttm_bo_move_accel_cleanup); -int ttm_bo_pipeline_move(struct ttm_buffer_object *bo, - struct dma_fence *fence, bool evict, - struct ttm_resource *new_mem) +int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, + struct dma_fence *fence, + bool evict, + bool pipeline, + struct ttm_resource *new_mem) { struct ttm_bo_device *bdev = bo->bdev; - struct ttm_resource_manager *from = ttm_manager_type(bdev, bo->mem.mem_type); - struct ttm_resource_manager *to = ttm_manager_type(bdev, new_mem->mem_type); - - int ret; + struct ttm_resource_manager *man = ttm_manager_type(bdev, new_mem->mem_type); + int ret = 0; dma_resv_add_excl_fence(bo->base.resv, fence); + if (!evict) + ret = ttm_bo_move_to_ghost(bo, fence, man->use_tt); + else if (!from->use_tt && pipeline) + ttm_bo_move_pipeline_evict(bo, fence); + else + ret = ttm_bo_wait_free_node(bo, man->use_tt); - if (!evict) { - ret = ttm_bo_move_to_ghost(bo, fence, to->use_tt); - if (ret) - return ret; - } else if (!from->use_tt) { - - /** - * BO doesn't have a TTM we need to bind/unbind. Just remember - * this eviction and free up the allocation - */ - - spin_lock(&from->move_lock); - if (!from->move || dma_fence_is_later(fence, from->move)) { - dma_fence_put(from->move); - from->move = dma_fence_get(fence); - } - spin_unlock(&from->move_lock); - - ttm_bo_free_old_node(bo); - - dma_fence_put(bo->moving); - bo->moving = dma_fence_get(fence); - - } else { - /** - * Last resort, wait for the move to be completed. - * - * Should never happen in pratice. - */ - ret = ttm_bo_wait_free_node(bo, to->use_tt); - if (ret) - return ret; - } + if (ret) + return ret; ttm_bo_assign_mem(bo, new_mem); return 0; } -EXPORT_SYMBOL(ttm_bo_pipeline_move); +EXPORT_SYMBOL(ttm_bo_move_accel_cleanup); int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) { |