From: Chunming Zhou <David1.Zhou-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Chunming Zhou <David1.Zhou-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 02/10] drm/amdgpu: sync bo and shadow V2
Date: Mon, 15 Aug 2016 14:06:34 +0800 [thread overview]
Message-ID: <1471241202-11463-3-git-send-email-David1.Zhou@amd.com> (raw)
In-Reply-To: <1471241202-11463-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
Use shadow flag to judge which direction to sync.
V2:
Don't need bo pin, so remove it.
Change-Id: I9b540970d3a24c6aebeaa94c99f66a89134c663d
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 43 ++++++++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 5 ++++
2 files changed, 48 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 278017d..b517848 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -443,6 +443,49 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
return r;
}
+int amdgpu_bo_backup_shadow(struct amdgpu_device *adev,
+ struct amdgpu_ring *ring,
+ struct amdgpu_bo *bo,
+ struct reservation_object *resv,
+ struct fence **fence,
+ bool direct)
+
+{
+ struct amdgpu_bo *shadow = bo->shadow;
+ uint64_t bo_addr, shadow_addr;
+ int r;
+
+ if (!shadow)
+ return -EINVAL;
+
+ if (bo->backup_shadow == AMDGPU_BO_SHADOW_TO_NONE) {
+ DRM_INFO("No need to backup bo and shadow\n");
+ return 0;
+ }
+ bo_addr = amdgpu_bo_gpu_offset(bo);
+ shadow_addr = amdgpu_bo_gpu_offset(bo->shadow);
+
+ r = reservation_object_reserve_shared(bo->tbo.resv);
+ if (r)
+ goto err;
+
+ if (bo->backup_shadow & AMDGPU_BO_SHADOW_TO_PARENT)
+ r = amdgpu_copy_buffer(ring, shadow_addr, bo_addr,
+ amdgpu_bo_size(bo), resv, fence,
+ direct);
+ else
+ r = amdgpu_copy_buffer(ring, bo_addr, shadow_addr,
+ amdgpu_bo_size(bo), resv, fence,
+ direct);
+ if (!r) {
+ amdgpu_bo_fence(bo, *fence, true);
+ bo->backup_shadow = AMDGPU_BO_SHADOW_TO_NONE;
+ }
+err:
+
+ return r;
+}
+
int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr)
{
bool is_iomem;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index d650b42..bb076d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -155,6 +155,11 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence,
bool shared);
u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo);
+int amdgpu_bo_backup_shadow(struct amdgpu_device *adev,
+ struct amdgpu_ring *ring,
+ struct amdgpu_bo *bo,
+ struct reservation_object *resv,
+ struct fence **fence, bool direct);
/*
* sub allocation
--
1.9.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-08-15 6:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 6:06 [PATCH 00/10] shadow page table support V4 Chunming Zhou
[not found] ` <1471241202-11463-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-15 6:06 ` [PATCH 01/10] drm/amdgpu: add direct submision option for copy_buffer Chunming Zhou
2016-08-15 6:06 ` Chunming Zhou [this message]
2016-08-15 6:06 ` [PATCH 03/10] drm/amdgpu: implement vm recovery function from shadow V2 Chunming Zhou
2016-08-15 6:06 ` [PATCH 04/10] drm/amdgpu: update pd shadow while updating pd Chunming Zhou
2016-08-15 6:06 ` [PATCH 05/10] drm/amdgpu: update pt shadow while updating pt Chunming Zhou
2016-08-15 6:06 ` [PATCH 06/10] drm/amdgpu: link all vm clients Chunming Zhou
2016-08-15 6:06 ` [PATCH 07/10] drm/amdgpu: add vm_list_lock Chunming Zhou
2016-08-15 6:06 ` [PATCH 08/10] drm/amdgpu: recover page tables after gpu reset Chunming Zhou
2016-08-15 6:06 ` [PATCH 09/10] drm/amdgpu: add need backup function Chunming Zhou
2016-08-15 6:06 ` [PATCH 10/10] drm/amdgpu: add backup condition for vm Chunming Zhou
2016-08-16 6:12 ` [PATCH 00/10] shadow page table support V4 Zhou, David(ChunMing)
[not found] ` <BY2PR12MB0632F1E417D92B9A50CD4A80B4130-K//h7OWB4q7Oa05ISQ/vsQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-16 9:23 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471241202-11463-3-git-send-email-David1.Zhou@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.