diff mbox

[04/11] drm/amdgpu: pass process to tbo

Message ID 20180412100940.25039-5-david1.zhou@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chunming Zhou April 12, 2018, 10:09 a.m. UTC
Change-Id: I4de8146567b858ae07a8a27cadf71d13d490e8ac
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +++-
 2 files changed, 8 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 28c2706e48d7..37b19ce97699 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -195,6 +195,7 @@  int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 	uint64_t size = args->in.bo_size;
 	struct reservation_object *resv = NULL;
 	struct drm_gem_object *gobj;
+	struct amdgpu_bo *abo;
 	uint32_t handle;
 	int r;
 
@@ -243,10 +244,12 @@  int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 	r = amdgpu_gem_object_create(adev, size, args->in.alignment,
 				     (u32)(0xffffffff & args->in.domains),
 				     flags, false, resv, &gobj);
+	if (!r) {
+		abo = gem_to_amdgpu_bo(gobj);
+		abo->tbo.process = &vm->ttm_vm;
+	}
 	if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
 		if (!r) {
-			struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
-
 			abo->parent = amdgpu_bo_ref(vm->root.base.bo);
 		}
 		amdgpu_bo_unreserve(vm->root.base.bo);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 9e23d6f6f3f3..e911db2d1945 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -447,8 +447,10 @@  static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size,
 	else
 		amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0);
 
-	if (type == ttm_bo_type_kernel)
+	if (type == ttm_bo_type_kernel) {
 		bo->tbo.priority = 1;
+		bo->tbo.process = &adev->kernel_process;
+	}
 
 	if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
 	    bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {