drm/amdgpu: make non-NULL out fence mandatory
Subsystems (3)
PATCH 1/2 drm/amdgpu: make non-NULL out fence mandatory
amdgpu_ttm_copy_mem_to_mem has a single caller, make sure the out fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable __attribute__((nonnull))__.
While at it make the function static since it's only used from amdgpuu_ttm.c.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 17 ++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ------ 2 files changed, 8 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +8 -9
@@ -284,12 +284,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,* move and different for a BO to BO copy. * */ -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, -const struct amdgpu_copy_mem *src, -const struct amdgpu_copy_mem *dst, -uint64_t size,bool tmz, -struct dma_resv *resv, -struct dma_fence **f) +__attribute__((nonnull)) +static int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, +const struct amdgpu_copy_mem *src, +const struct amdgpu_copy_mem *dst, +uint64_t size,bool tmz, +struct dma_resv *resv, +struct dma_fence **f) {struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;struct amdgpu_res_cursor src_mm, dst_mm;
@@ -363,9 +364,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, } error:mutex_unlock (&adev->mman.gtt_window_lock); -if (f) - *f =dma_fence_get (fence); -dma_fence_put (fence); + *f = fence;return r; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +0 -6
@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,struct dma_resv *resv, struct dma_fence **fence, bool direct_submit, bool vm_needs_flush, uint32_t copy_flags); -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, -const struct amdgpu_copy_mem *src, -const struct amdgpu_copy_mem *dst, -uint64_t size,bool tmz, -struct dma_resv *resv, -struct dma_fence **f);int amdgpu_ttm_clear_buffer (struct amdgpu_bo *bo,struct dma_resv *resv,struct dma_fence **fence);
Signature · 1 line
2.43.0
PATCH 2/2 drm/amdgpu: remove gart_window_lock usage from gmc v12
This lock was part of the SDMA workaround originally implemented in gmc_v10_0_flush_gpu_tlb (a70cb2176f7ef6f moved it to amdgpu_gmc_flush_gpu_tlb).
This means this lock is useless and be safely dropped.
--- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +0 -2
@@ -312,9 +312,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,return ; } -mutex_lock (&adev->mman.gtt_window_lock);gmc_v12_0_flush_vm_hub (adev, vmid, vmhub,0 ); -mutex_unlock (&adev->mman.gtt_window_lock);return ; }
Signature · 1 line
2.43.0
Re: [PATCH v1 2/2] drm/amdgpu: remove gart_window_lock usage from gmc v12
Quoted 7 lines · Pierre-Eric Pelloux-Prayer
This lock was part of the SDMA workaround originally implemented in
gmc_v10_0_flush_gpu_tlb(a70cb2176f7ef6fmoved it toamdgpu_gmc_flush_gpu_tlb).This means this lock is useless and be safely dropped.
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +0
-2@@ -312,9 +312,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,return ; } -mutex_lock (&adev->mman.gtt_window_lock);gmc_v12_0_flush_vm_hub (adev, vmid, vmhub,0 ); -mutex_unlock (&adev->mman.gtt_window_lock);return ; }
Christian König
maintainerQuoted 19 lines · Pierre-Eric Pelloux-Prayer
amdgpu_ttm_copy_mem_to_memhas a single caller, make sure the out fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable __attribute__((nonnull))__.While at it make the function static since it's only used from
amdgpuu_ttm.c.Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 17 ++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ------ 2 files changed, 8 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 287
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-6@@ -284,12 +284,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,* move and different for a BO to BO copy. * */ -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, -const struct amdgpu_copy_mem *src, -const struct amdgpu_copy_mem *dst, -uint64_t size,bool tmz, -struct dma_resv *resv, -struct dma_fence **f) +__attribute__((nonnull))
That looks fishy.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 293
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-0+static int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, +const struct amdgpu_copy_mem *src, +const struct amdgpu_copy_mem *dst, +uint64_t size,bool tmz, +struct dma_resv *resv, +struct dma_fence **f)
I'm not an expert for those, but looking at other examples that should be here and look something like:
__attribute__((nonnull(7)))
But I think for this case here it is also not a must have to have that.
Regards,
Christian.
Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3{struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;struct amdgpu_res_cursor src_mm, dst_mm;@@ -363,9 +364,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, } error:mutex_unlock (&adev->mman.gtt_window_lock); -if (f) - *f =dma_fence_get (fence); -dma_fence_put (fence); + *f = fence;return r; }drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +0
-6@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,struct dma_resv *resv, struct dma_fence **fence, bool direct_submit, bool vm_needs_flush, uint32_t copy_flags); -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, -const struct amdgpu_copy_mem *src, -const struct amdgpu_copy_mem *dst, -uint64_t size,bool tmz, -struct dma_resv *resv, -struct dma_fence **f);int amdgpu_ttm_clear_buffer (struct amdgpu_bo *bo,struct dma_resv *resv,struct dma_fence **fence);
Le 16/09/2025 à 11:25, Christian König a écrit :
Quoted 42 lines · Pierre-Eric Pelloux-Prayer
Quoted 19 lines
amdgpu_ttm_copy_mem_to_memhas a single caller, make sure the out fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable __attribute__((nonnull))__.While at it make the function static since it's only used from
amdgpuu_ttm.c.Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 17 ++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ------ 2 files changed, 8 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 287
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-6@@ -284,12 +284,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,* move and different for a BO to BO copy. * */ -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, -const struct amdgpu_copy_mem *src, -const struct amdgpu_copy_mem *dst, -uint64_t size,bool tmz, -struct dma_resv *resv, -struct dma_fence **f) +__attribute__((nonnull))That looks fishy.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 293
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-0+static int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, +const struct amdgpu_copy_mem *src, +const struct amdgpu_copy_mem *dst, +uint64_t size,bool tmz, +struct dma_resv *resv, +struct dma_fence **f)I'm not an expert for those, but looking at other examples that should be here and look something like:
Quoted 1 line
__attribute__((nonnull(7)))
Both syntax are valid. The GCC docs says:
If no arg-index is given to the nonnull attribute, all pointer arguments are
marked as non-null
Quoted 2 lines
But I think for this case here it is also not a must have to have that.
I can remove it if you prefer, but it doesn't hurt to have the compiler validate usage of the functions.
Pierre-Eric
Quoted 35 lines
Regards,
Christian.Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3{struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;struct amdgpu_res_cursor src_mm, dst_mm;@@ -363,9 +364,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, } error:mutex_unlock (&adev->mman.gtt_window_lock); -if (f) - *f =dma_fence_get (fence); -dma_fence_put (fence); + *f = fence;return r; }drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +0
-6@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,struct dma_resv *resv, struct dma_fence **fence, bool direct_submit, bool vm_needs_flush, uint32_t copy_flags); -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, -const struct amdgpu_copy_mem *src, -const struct amdgpu_copy_mem *dst, -uint64_t size,bool tmz, -struct dma_resv *resv, -struct dma_fence **f);int amdgpu_ttm_clear_buffer (struct amdgpu_bo *bo,struct dma_resv *resv,struct dma_fence **fence);
Christian König
maintainerQuoted 43 lines · Pierre-Eric Pelloux-Prayer
Le 16/09/2025 à 11:25, Christian König a écrit :
Quoted 40 lines · Pierre-Eric Pelloux-Prayer
Quoted 19 lines
amdgpu_ttm_copy_mem_to_memhas a single caller, make sure the out fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable __attribute__((nonnull))__.While at it make the function static since it's only used from
amdgpuu_ttm.c.Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 17 ++++++++---------drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h| 6 ------2 files changed, 8 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 287
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-6@@ -284,12 +284,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,* move and different for a BO to BO copy. * */ -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, - const struct amdgpu_copy_mem *src, - const struct amdgpu_copy_mem *dst, - uint64_t size, bool tmz, - struct dma_resv *resv, - struct dma_fence **f) +__attribute__((nonnull))That looks fishy.
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-0+static int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, + const struct amdgpu_copy_mem *src, + const struct amdgpu_copy_mem *dst, + uint64_t size, bool tmz, + struct dma_resv *resv, + struct dma_fence **f)
Quoted 7 lines
Quoted 3 lines
I'm not an expert for those, but looking at other examples that should be here and look something like:
__attribute__((nonnull(7)))
Both syntax are valid. The GCC docs says:
If no arg-index is given to the nonnull attribute, all pointer arguments are marked as non-null
Never seen that before. Is that gcc specifc or standardized?
Quoted 6 lines
Quoted 4 lines
But I think for this case here it is also not a must have to have that.
I can remove it if you prefer, but it doesn't hurt to have the compiler validate usage of the functions.
Yeah it's clearly useful, but I'm worried that clang won't like it.
Christian.
Quoted 38 lines
Pierre-Eric
Quoted 34 lines
Regards,
Christian.Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0{ struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; struct amdgpu_res_cursor src_mm, dst_mm;@@ -363,9 +364,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, }error:
mutex_unlock(&adev->mman.gtt_window_lock);
- if (f)
- *f =dma_fence_get(fence);
-dma_fence_put(fence);
+ *f = fence;
return r;
}
diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.hindexbb17987f0447..07ae2853c77c100644drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +0
-6@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, struct dma_resv *resv, struct dma_fence **fence, bool direct_submit, bool vm_needs_flush, uint32_t copy_flags); -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, - const struct amdgpu_copy_mem *src, - const struct amdgpu_copy_mem *dst, - uint64_t size, bool tmz, - struct dma_resv *resv, - struct dma_fence **f); int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo, struct dma_resv *resv, struct dma_fence **fence);
Le 16/09/2025 à 12:52, Christian König a écrit :
Quoted 46 lines · Pierre-Eric Pelloux-Prayer
Quoted 45 lines
Le 16/09/2025 à 11:25, Christian König a écrit :
Quoted 42 lines · Pierre-Eric Pelloux-Prayer
Quoted 19 lines
amdgpu_ttm_copy_mem_to_memhas a single caller, make sure the out fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable __attribute__((nonnull))__.While at it make the function static since it's only used from
amdgpuu_ttm.c.Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 17 ++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ------ 2 files changed, 8 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 287
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-6@@ -284,12 +284,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,* move and different for a BO to BO copy. * */ -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, - const struct amdgpu_copy_mem *src, - const struct amdgpu_copy_mem *dst, - uint64_t size, bool tmz, - struct dma_resv *resv, - struct dma_fence **f) +__attribute__((nonnull))That looks fishy.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 293
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-0+static int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, + const struct amdgpu_copy_mem *src, + const struct amdgpu_copy_mem *dst, + uint64_t size, bool tmz, + struct dma_resv *resv, + struct dma_fence **f)I'm not an expert for those, but looking at other examples that should be here and look something like:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
__attribute__((nonnull(7)))
Both syntax are valid. The GCC docs says:
If no arg-index is given to the nonnull attribute, all pointer arguments are marked as non-null
Never seen that before. Is that gcc specifc or standardized?
clang supports it:
https://clang.llvm.org/docs/AttributeReference.html#id10
And both syntaxes are already used in the drm subtree by i915.
Pierre-Eric
Quoted 51 lines
Quoted 7 lines
Quoted 5 lines
But I think for this case here it is also not a must have to have that.
I can remove it if you prefer, but it doesn't hurt to have the compiler validate usage of the functions.
Yeah it's clearly useful, but I'm worried that clang won't like it.
Christian.
Quoted 38 lines
Pierre-Eric
Quoted 34 lines
Regards,
Christian.Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3{ struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; struct amdgpu_res_cursor src_mm, dst_mm;@@ -363,9 +364,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, } error: mutex_unlock(&adev->mman.gtt_window_lock); - if (f) - *f = dma_fence_get(fence); - dma_fence_put(fence); + *f = fence; return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.hindex
bb17987f0447..07ae2853c77c100644drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +0
-6@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, struct dma_resv *resv, struct dma_fence **fence, bool direct_submit, bool vm_needs_flush, uint32_t copy_flags); -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, - const struct amdgpu_copy_mem *src, - const struct amdgpu_copy_mem *dst, - uint64_t size, bool tmz, - struct dma_resv *resv, - struct dma_fence **f); int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo, struct dma_resv *resv, struct dma_fence **fence);
Christian König
maintainerQuoted 55 lines · Pierre-Eric Pelloux-Prayer
Le 16/09/2025 à 12:52, Christian König a écrit :
Quoted 52 lines · Pierre-Eric Pelloux-Prayer
Quoted 50 lines
Le 16/09/2025 à 11:25, Christian König a écrit :
Quoted 40 lines · Pierre-Eric Pelloux-Prayer
Quoted 19 lines
amdgpu_ttm_copy_mem_to_memhas a single caller, make sure the out fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable __attribute__((nonnull))__.While at it make the function static since it's only used from
amdgpuu_ttm.c.Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 17 ++++++++---------drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h| 6 ------2 files changed, 8 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 287
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-6@@ -284,12 +284,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,* move and different for a BO to BO copy. * */ -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, - const struct amdgpu_copy_mem *src, - const struct amdgpu_copy_mem *dst, - uint64_t size, bool tmz, - struct dma_resv *resv, - struct dma_fence **f) +__attribute__((nonnull))That looks fishy.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · line 293
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-0+static int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, + const struct amdgpu_copy_mem *src, + const struct amdgpu_copy_mem *dst, + uint64_t size, bool tmz, + struct dma_resv *resv, + struct dma_fence **f)Quoted 3 lines
I'm not an expert for those, but looking at other examples that should be here and look something like:
__attribute__((nonnull(7)))
Both syntax are valid. The GCC docs says:
If no arg-index is given to the nonnull attribute, all pointer arguments are marked as non-null
Quoted 7 lines
Quoted 1 line
Never seen that before. Is that gcc specifc or standardized?
clang supports it:
https://clang.llvm.org/docs/AttributeReference.html#id10
And both syntaxes are already used in the drm subtree by i915.
Ok in that case Reviewed-by: Christian König <[email protected]>.
Regards,
Christian.
Quoted 54 lines
Pierre-Eric
Quoted 51 lines
Quoted 7 lines
Quoted 5 lines
But I think for this case here it is also not a must have to have that.
I can remove it if you prefer, but it doesn't hurt to have the compiler validate usage of the functions.
Yeah it's clearly useful, but I'm worried that clang won't like it.
Christian.
Quoted 38 lines
Pierre-Eric
Quoted 34 lines
Regards,
Christian.Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0{ struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; struct amdgpu_res_cursor src_mm, dst_mm;@@ -363,9 +364,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, }error:
mutex_unlock(&adev->mman.gtt_window_lock);
- if (f)
- *f =dma_fence_get(fence);
-dma_fence_put(fence);
+ *f = fence;
return r;
}
diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.hindexbb17987f0447..07ae2853c77c100644drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +0
-6@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, struct dma_resv *resv, struct dma_fence **fence, bool direct_submit, bool vm_needs_flush, uint32_t copy_flags); -int amdgpu_ttm_copy_mem_to_mem (struct amdgpu_device *adev, - const struct amdgpu_copy_mem *src, - const struct amdgpu_copy_mem *dst, - uint64_t size, bool tmz, - struct dma_resv *resv, - struct dma_fence **f); int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo, struct dma_resv *resv, struct dma_fence **fence);