[PATCH 15/19] drm/amdgpu: add shadow fence owner

Chunming Zhou David1.Zhou at amd.com
Fri Aug 5 09:38:42 UTC 2016


Normal cs doesn't need to care shadow jobs.

Change-Id: I63f0a802438cafff336500656c5a367074e4182d
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>

Conflicts:
	drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h      |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c   | 22 ++++++++++++++++------
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index bd74bd0..7e96a4c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -378,6 +378,8 @@ struct amdgpu_fence_driver {
 /* some special values for the owner field */
 #define AMDGPU_FENCE_OWNER_UNDEFINED	((void*)0ul)
 #define AMDGPU_FENCE_OWNER_VM		((void*)1ul)
+/* don't need to care vm shadow fence, except eviction */
+#define AMDGPU_FENCE_OWNER_VM_SHADOW	((void*)2ul)
 
 #define AMDGPU_FENCE_FLAG_64BIT         (1 << 0)
 #define AMDGPU_FENCE_FLAG_INT           (1 << 1)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index 5c8d302..b7e0f3d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -213,6 +213,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 			if (owner != AMDGPU_FENCE_OWNER_UNDEFINED &&
 			    fence_owner == owner)
 				continue;
+
+			if (fence_owner == AMDGPU_FENCE_OWNER_VM_SHADOW)
+				continue;
 		}
 
 		r = amdgpu_sync_fence(adev, sync, f);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 6386918..664f055 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -679,9 +679,14 @@ int amdgpu_vm_update_page_directory_or_shadow(struct amdgpu_device *adev,
 			amdgpu_sync_resv(adev, &job->sync, pd->tbo.resv,
 					 AMDGPU_FENCE_OWNER_VM);
 		WARN_ON(vm_update_params.ib->length_dw > ndw);
-		r = amdgpu_job_submit(job, ring,
-				      shadow ? &vm->shadow_entity : &vm->entity,
-				      AMDGPU_FENCE_OWNER_VM, &fence);
+		if (shadow)
+			r = amdgpu_job_submit(job, ring,
+					      &vm->shadow_entity,
+					      AMDGPU_FENCE_OWNER_VM_SHADOW, &fence);
+		else
+			r = amdgpu_job_submit(job, ring, &vm->entity,
+					      AMDGPU_FENCE_OWNER_VM, &fence);
+
 		if (r)
 			goto error_free;
 
@@ -1022,9 +1027,14 @@ static int amdgpu_vm_bo_update_mapping_or_shadow(struct amdgpu_device *adev,
 
 	amdgpu_ring_pad_ib(ring, vm_update_params.ib);
 	WARN_ON(vm_update_params.ib->length_dw > ndw);
-	r = amdgpu_job_submit(job, ring,
-			      shadow ? &vm->shadow_entity : &vm->entity,
-			      AMDGPU_FENCE_OWNER_VM, &f);
+	if (shadow)
+		r = amdgpu_job_submit(job, ring,
+				      &vm->shadow_entity,
+				      AMDGPU_FENCE_OWNER_VM_SHADOW, &f);
+	else
+		r = amdgpu_job_submit(job, ring, &vm->entity,
+				      AMDGPU_FENCE_OWNER_VM, &f);
+
 	if (r)
 		goto error_free;
 	amdgpu_bo_fence(vm->page_directory, f, true);
-- 
1.9.1



More information about the amd-gfx mailing list