AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhu, James" <James.Zhu-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Zhu, James" <James.Zhu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 2/3] drm/amdgpu/uvd:Allocate enc session bo for uvd6.0 ring IB test
Date: Tue, 15 Oct 2019 22:08:08 +0000	[thread overview]
Message-ID: <1571177279-9435-3-git-send-email-James.Zhu@amd.com> (raw)
In-Reply-To: <1571177279-9435-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>

Allocate 256K enc session bo for uvd6.0 ring IB test to fix S3 resume
corruption issue.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 670784a..c79ce73 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -220,7 +220,7 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ring->adev->vcn.enc_session_gpu_addr;
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -282,7 +282,7 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ring->adev->vcn.enc_session_gpu_addr + 128 * PAGE_SIZE;
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -326,9 +326,16 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
  */
 static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 {
+	struct amdgpu_device *adev = ring->adev;
 	struct dma_fence *fence = NULL;
 	long r;
 
+	r = amdgpu_bo_create_kernel(adev, 2 * 128, PAGE_SIZE,
+			AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.enc_session_bo,
+			&adev->vcn.enc_session_gpu_addr, &adev->vcn.enc_session_cpu_addr);
+	if (r)
+		return r;
+
 	r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL);
 	if (r)
 		goto error;
@@ -345,6 +352,11 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 
 error:
 	dma_fence_put(fence);
+
+	amdgpu_bo_free_kernel(&adev->vcn.enc_session_bo,
+				  &adev->vcn.enc_session_gpu_addr,
+				  (void **)&adev->vcn.enc_session_cpu_addr);
+
 	return r;
 }
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-10-15 22:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 22:08 [PATCH 0/3] Fixed amdgpu resume failure from suspend Zhu, James
     [not found] ` <1571177279-9435-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-15 22:08   ` [PATCH 1/3] drm/amdgpu/uvd:Add uvd enc session bo Zhu, James
     [not found]     ` <1571177279-9435-2-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-16  8:59       ` Christian König
     [not found]         ` <3198889b-9df5-dd90-0457-79a1a886ec4d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-16 13:01           ` James Zhu
2019-10-15 22:08   ` [PATCH 3/3] drm/amdgpu/uvd:Allocate enc session bo for uvd7.0 ring IB test Zhu, James
     [not found]     ` <1571177279-9435-4-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-16  9:01       ` Christian König
2019-10-15 22:08   ` Zhu, James [this message]
     [not found]     ` <1571177279-9435-3-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-15 22:32       ` [PATCH 2/3] drm/amdgpu/uvd:Allocate enc session bo for uvd6.0 " Alex Deucher

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=1571177279-9435-3-git-send-email-James.Zhu@amd.com \
    --to=james.zhu-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox