[PATCH 3/4] drm/amdgpu: introduce is_amdgpu_dmabuf()

Nirmoy Das nirmoy.das at amd.com
Wed Mar 17 07:47:15 UTC 2021


Implement is_amdgpu_dmabuf() helper function.

Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index fa4686fe95c4..ad615eec1e8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -120,6 +120,11 @@ bool amdgpu_bo_is_amdgpu_bo(struct ttm_buffer_object *bo)
 	return false;
 }
 
+bool is_amdgpu_bo_dmabuf(struct amdgpu_bo *bo)
+{
+	return (bo->tbo.type == ttm_bo_type_sg);
+}
+
 /**
  * amdgpu_bo_placement_from_domain - set buffer's placement
  * @abo: &amdgpu_bo buffer object whose placement is to be set
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index 4b9339c3f3eb..3d23ad247b1b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -274,6 +274,7 @@ int amdgpu_bo_create_user(struct amdgpu_device *adev,
 int amdgpu_bo_create_dmabuf(struct amdgpu_device *adev,
 			    struct amdgpu_bo_param *bp,
 			    struct amdgpu_bo_dmabuf **dbo_ptr);
+bool is_amdgpu_bo_dmabuf(struct amdgpu_bo *bo);
 void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr,
 			   void **cpu_addr);
 int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr);
-- 
2.30.1



More information about the amd-gfx mailing list