<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Friday, October 11, 2019 11:29 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: enable Arcturus runtime VCN dpm on/off</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Enable runtime VCN DPM on/off on Arcturus.<br>
<br>
Change-Id: Ie7d94d67cb4c622c96acced1b5ef0f4e63db5aad<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 7 +++++<br>
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 30 ++++++++++++++++++++<br>
2 files changed, 37 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c<br>
index 2608c932a775..d270df892223 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c<br>
@@ -25,6 +25,7 @@<br>
#include <drm/drmP.h><br>
#include "amdgpu.h"<br>
#include "amdgpu_vcn.h"<br>
+#include "amdgpu_pm.h"<br>
#include "soc15.h"<br>
#include "soc15d.h"<br>
#include "vcn_v2_0.h"<br>
@@ -709,6 +710,9 @@ static int vcn_v2_5_start(struct amdgpu_device *adev)<br>
uint32_t rb_bufsz, tmp;<br>
int i, j, k, r;<br>
<br>
+ if (adev->pm.dpm_enabled)<br>
+ amdgpu_dpm_enable_uvd(adev, true);<br>
+<br>
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {<br>
if (adev->vcn.harvest_config & (1 << i))<br>
continue;<br>
@@ -939,6 +943,9 @@ static int vcn_v2_5_stop(struct amdgpu_device *adev)<br>
~UVD_POWER_STATUS__UVD_POWER_STATUS_MASK);<br>
}<br>
<br>
+ if (adev->pm.dpm_enabled)<br>
+ amdgpu_dpm_enable_uvd(adev, false);<br>
+<br>
return 0;<br>
}<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
index a00b60968909..6731fed5458e 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
@@ -1907,6 +1907,35 @@ static bool arcturus_is_dpm_running(struct smu_context *smu)<br>
return !!(feature_enabled & SMC_DPM_FEATURE);<br>
}<br>
<br>
+static int arcturus_dpm_set_uvd_enable(struct smu_context *smu, bool enable)<br>
+{<br>
+ struct smu_power_context *smu_power = &smu->smu_power;<br>
+ struct smu_power_gate *power_gate = &smu_power->power_gate;<br>
+ int ret = 0;<br>
+<br>
+ if (enable) {<br>
+ if (!smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {<br>
+ ret = smu_feature_set_enabled(smu, SMU_FEATURE_VCN_PG_BIT, 1);<br>
+ if (ret) {<br>
+ pr_err("[EnableVCNDPM] failed!\n");<br>
+ return ret;<br>
+ }<br>
+ }<br>
+ power_gate->vcn_gated = false;<br>
+ } else {<br>
+ if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {<br>
+ ret = smu_feature_set_enabled(smu, SMU_FEATURE_VCN_PG_BIT, 0);<br>
+ if (ret) {<br>
+ pr_err("[DisableVCNDPM] failed!\n");<br>
+ return ret;<br>
+ }<br>
+ }<br>
+ power_gate->vcn_gated = true;<br>
+ }<br>
+<br>
+ return ret;<br>
+}<br>
+<br>
static const struct pptable_funcs arcturus_ppt_funcs = {<br>
/* translate smu index into arcturus specific index */<br>
.get_smu_msg_index = arcturus_get_smu_msg_index,<br>
@@ -1945,6 +1974,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {<br>
.dump_pptable = arcturus_dump_pptable,<br>
.get_power_limit = arcturus_get_power_limit,<br>
.is_dpm_running = arcturus_is_dpm_running,<br>
+ .dpm_set_uvd_enable = arcturus_dpm_set_uvd_enable,<br>
};<br>
<br>
void arcturus_set_ppt_funcs(struct smu_context *smu)<br>
-- <br>
2.23.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>