[PATCH 2/4] drm/amdgpu: use amdgpu_bo_create_dmabuf()

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

 



Modify amdgpu_gem_object_create() to allocate
amdgpu_bo_dmabuf BO for ttm_bo_type_sg.

Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 311bcdc59eda..5366a806be2b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -59,6 +59,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
 {
 	struct amdgpu_bo *bo;
 	struct amdgpu_bo_user *ubo;
+	struct amdgpu_bo_dmabuf *dbo;
 	struct amdgpu_bo_param bp;
 	int r;
 
@@ -74,11 +75,18 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
 	bp.domain = initial_domain;
 	bp.bo_ptr_size = sizeof(struct amdgpu_bo);
 
-	r = amdgpu_bo_create_user(adev, &bp, &ubo);
+	if (type != ttm_bo_type_sg)
+		r = amdgpu_bo_create_user(adev, &bp, &ubo);
+	else
+		r = amdgpu_bo_create_dmabuf(adev, &bp, &dbo);
 	if (r)
 		return r;
 
-	bo = &ubo->bo;
+	if (type != ttm_bo_type_sg)
+		bo = &ubo->bo;
+	else
+		bo = &dbo->bo;
+
 	*obj = &bo->tbo.base;
 	(*obj)->funcs = &amdgpu_gem_object_funcs;
 
-- 
2.30.1

_______________________________________________
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