[PATCH 2/7] drm/amdgpu: add a new identifier for amdgpu_bo

Nirmoy Das nirmoy.das at amd.com
Fri May 21 12:45:28 UTC 2021


Add has_shadow to identify if a BO is shadowed.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 61b1edcb490a..eb3ce33cbfff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -619,6 +619,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
 	}
 	if (!bp->resv)
 		amdgpu_bo_unreserve(bo);
+	bo->has_shadow = false;
 	*bo_ptr = bo;
 
 	trace_amdgpu_bo_create(bo);
@@ -657,6 +658,7 @@ int amdgpu_bo_create_shadow(struct amdgpu_device *adev,
 	r = amdgpu_bo_create(adev, &bp, &bo->shadow);
 	if (!r) {
 		bo->shadow->parent = amdgpu_bo_ref(bo);
+		bo->has_shadow = true;
 		mutex_lock(&adev->shadow_list_lock);
 		list_add_tail(&bo->shadow->shadow_list, &adev->shadow_list);
 		mutex_unlock(&adev->shadow_list_lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index a7fbf5f7051e..3a0e6ca88563 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -104,9 +104,8 @@ struct amdgpu_bo {
 	struct amdgpu_vm_bo_base	*vm_bo;
 	/* Constant after initialization */
 	struct amdgpu_bo		*parent;
-	struct amdgpu_bo		*shadow;
-
-
+	struct amdgpu_bo                *shadow;
+	bool				has_shadow;
 
 #ifdef CONFIG_MMU_NOTIFIER
 	struct mmu_interval_notifier	notifier;
-- 
2.31.1



More information about the amd-gfx mailing list