From: James Zhu <James.Zhu@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: jamesz@amd.com
Subject: [PATCH 3/4] drm/amdgpu/vcn2.0: stall DPG when WPTR/RPTR reset
Date: Tue, 3 Mar 2020 13:16:30 -0500 [thread overview]
Message-ID: <1583259391-21834-3-git-send-email-James.Zhu@amd.com> (raw)
In-Reply-To: <1583259391-21834-1-git-send-email-James.Zhu@amd.com>
Add vcn dpg harware and firmware synchronization to fix race condition
issue among vcn driver, hardware and firmware
Signed-off-by: James Zhu <James.Zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index c387c81..7719f56 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -1158,8 +1158,12 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,
UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK,
UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK, ret_code);
+
+ /* Stall DPG before WPTR/RPTR reset */
+ WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_POWER_STATUS), UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
/* Restore */
ring = &adev->vcn.inst->ring_enc[0];
+ ring->wptr = 0;
WREG32_SOC15(UVD, 0, mmUVD_RB_BASE_LO, ring->gpu_addr);
WREG32_SOC15(UVD, 0, mmUVD_RB_BASE_HI, upper_32_bits(ring->gpu_addr));
WREG32_SOC15(UVD, 0, mmUVD_RB_SIZE, ring->ring_size / 4);
@@ -1167,6 +1171,7 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,
WREG32_SOC15(UVD, 0, mmUVD_RB_WPTR, lower_32_bits(ring->wptr));
ring = &adev->vcn.inst->ring_enc[1];
+ ring->wptr = 0;
WREG32_SOC15(UVD, 0, mmUVD_RB_BASE_LO2, ring->gpu_addr);
WREG32_SOC15(UVD, 0, mmUVD_RB_BASE_HI2, upper_32_bits(ring->gpu_addr));
WREG32_SOC15(UVD, 0, mmUVD_RB_SIZE2, ring->ring_size / 4);
@@ -1175,6 +1180,8 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,
WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2) & 0x7FFFFFFF);
+ /* Unstall DPG */
+ WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_POWER_STATUS), 0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON,
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-03-03 18:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 18:16 [PATCH 1/4] drm/amdgpu/vcn: fix race condition issue for vcn start James Zhu
2020-03-03 18:16 ` [PATCH 2/4] drm/amdgpu/vcn: fix race condition issue for dpg unpause mode switch James Zhu
2020-03-09 16:58 ` [PATCH v3 " James Zhu
2020-03-11 14:16 ` [PATCH v4 " James Zhu
2020-03-03 18:16 ` James Zhu [this message]
2020-03-03 18:16 ` [PATCH 4/4] drm/amdgpu/vcn2.5: stall DPG when WPTR/RPTR reset James Zhu
2020-03-10 19:58 ` [PATCH v2 4/4] drm/amdgpu/vcn2.5: add sync " James Zhu
2020-03-10 20:03 ` Leo Liu
2020-03-03 18:44 ` [PATCH 1/4] drm/amdgpu/vcn: fix race condition issue for vcn start Christian König
2020-03-03 19:03 ` James Zhu
2020-03-03 22:48 ` James Zhu
2020-03-04 8:53 ` Christian König
2020-03-04 14:57 ` James Zhu
2020-03-04 15:03 ` Christian König
2020-03-04 15:09 ` James Zhu
2020-03-04 16:34 ` [PATCH v2 " James Zhu
2020-03-05 11:25 ` Christian König
2020-03-05 11:27 ` Christian König
2020-03-05 14:34 ` James Zhu
2020-03-09 16:57 ` [PATCH v3 " James Zhu
2020-03-11 11:30 ` Zhu, James
2020-03-11 11:38 ` Christian König
2020-03-11 14:15 ` James Zhu
2020-03-11 14:15 ` [PATCH v4 " James Zhu
2020-03-11 14:39 ` Christian König
2020-03-11 15:04 ` [PATCH v5 " James Zhu
2020-03-11 15:13 ` 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=1583259391-21834-3-git-send-email-James.Zhu@amd.com \
--to=james.zhu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=jamesz@amd.com \
/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