Merge tag 'drm-misc-next-2023-07-13' of git://anongit.freedesktop.org/drm/drm-misc...
[sfrench/cifs-2.6.git] / drivers / gpu / drm / ttm / ttm_bo.c
index 7139a522b2f3bd0774e3a497ada097f7467fae9a..aa8ab1a418afd02992d91a4a9aeff0e4734c356e 100644 (file)
@@ -345,6 +345,7 @@ static void ttm_bo_release(struct kref *kref)
 
                if (!dma_resv_test_signaled(bo->base.resv,
                                            DMA_RESV_USAGE_BOOKKEEP) ||
+                   (want_init_on_free() && (bo->ttm != NULL)) ||
                    !dma_resv_trylock(bo->base.resv)) {
                        /* The BO is not idle, resurrect it for delayed destroy */
                        ttm_bo_flush_all_fences(bo);
@@ -1160,7 +1161,6 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
         * Move to system cached
         */
        if (bo->resource->mem_type != TTM_PL_SYSTEM) {
-               struct ttm_operation_ctx ctx = { false, false };
                struct ttm_resource *evict_mem;
                struct ttm_place hop;
 
@@ -1170,7 +1170,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
                if (unlikely(ret))
                        goto out;
 
-               ret = ttm_bo_handle_move_mem(bo, evict_mem, true, &ctx, &hop);
+               ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop);
                if (unlikely(ret != 0)) {
                        WARN(ret == -EMULTIHOP, "Unexpected multihop in swaput - likely driver bug.\n");
                        ttm_resource_free(bo, &evict_mem);