Re: [PATCH 1/3] drm/amdgpu: parameterize ttm BO destroy callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/14/2021 4:32 PM, Nirmoy Das wrote:
Make provision to pass different ttm BO destroy callback
while creating a amdgpu_bo.

Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 28 ++++++++++++++++++----
  1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 9092ac12a270..71a65525eac4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -522,15 +522,17 @@ bool amdgpu_bo_support_uswc(u64 bo_flags)


copy-paste typo : Need to replace function header amdgpu_bo_create ->  amdgpu_bo_do_create.


   * @adev: amdgpu device object
   * @bp: parameters to be used for the buffer object
   * @bo_ptr: pointer to the buffer object pointer
+ * @destroy: ttm bo destroy callback
   *
- * Creates an &amdgpu_bo buffer object.
+ * Creates an &amdgpu_bo buffer object with a specified ttm bo destroy callback.
   *
   * Returns:
   * 0 for success or a negative error code on failure.
   */
-int amdgpu_bo_create(struct amdgpu_device *adev,
+static int amdgpu_bo_do_create(struct amdgpu_device *adev,
  			       struct amdgpu_bo_param *bp,
-			       struct amdgpu_bo **bo_ptr)
+			       struct amdgpu_bo **bo_ptr,
+			       void (*destroy)(struct ttm_buffer_object *))
  {
  	struct ttm_operation_ctx ctx = {
  		.interruptible = (bp->type != ttm_bo_type_kernel),
@@ -594,7 +596,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, bp->type,
  				 &bo->placement, page_align, &ctx,  NULL,
-				 bp->resv, &amdgpu_bo_destroy);
+				 bp->resv, destroy);
  	if (unlikely(r != 0))
  		return r;
@@ -638,6 +640,24 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
  	return r;
  }
+/**
+ * amdgpu_bo_create - create an &amdgpu_bo buffer object
+ * @adev: amdgpu device object
+ * @bp: parameters to be used for the buffer object
+ * @bo_ptr: pointer to the buffer object pointer
+ *
+ * Creates an &amdgpu_bo buffer object.
+ *
+ * Returns:
+ * 0 for success or a negative error code on failure.
+ */
+int amdgpu_bo_create(struct amdgpu_device *adev,
+			       struct amdgpu_bo_param *bp,
+			       struct amdgpu_bo **bo_ptr)
+{
+	return amdgpu_bo_do_create(adev, bp, bo_ptr, &amdgpu_bo_destroy);
+}
+
  /**
   * amdgpu_bo_create_user - create an &amdgpu_bo_user buffer object
   * @adev: amdgpu device object
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux