<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 2018-09-11 10:44 AM, Alex Deucher
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CADnq5_P5Oj_Fdxhv2n8ZxDTm1mV_NQo6M1kmgGzLV0fHhhR8sA@mail.gmail.com">
<pre wrap="">On Mon, Sep 10, 2018 at 4:34 PM James Zhu <a class="moz-txt-link-rfc2396E" href="mailto:jzhums@gmail.com"><jzhums@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
Signed-off-by: James Zhu <a class="moz-txt-link-rfc2396E" href="mailto:James.Zhu@amd.com"><James.Zhu@amd.com></a>
When VCN PG state is unchanged, it is unnecessary to reset
power gate state again.
</pre>
</blockquote>
<pre wrap="">
Don't you need to initialize and store the PG state somewhere? You
are just using a local variable here.
Alex
</pre>
</blockquote>
Hi Alex,<br>
<br>
I used <b><i>static</i></b> for this local state variable(<b>cur_state</b>)
with initialization state AMD_PG_STATE_GATE.<br>
this variable's scope is only inside this function, but it's
initialization is done <br>
once at compile time and it's lifetime will last until the driver
exit.<br>
<br>
Since it is only used inside this function, I didn't put it into
struct amdgpu_vcn.<br>
<br>
Best Regards!<br>
James Zhu<br>
<blockquote type="cite"
cite="mid:CADnq5_P5Oj_Fdxhv2n8ZxDTm1mV_NQo6M1kmgGzLV0fHhhR8sA@mail.gmail.com">
<blockquote type="cite">
<pre wrap="">---
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 2664bb2..86d98d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -1633,12 +1633,21 @@ static int vcn_v1_0_set_powergating_state(void *handle,
* revisit this when there is a cleaner line between
* the smc and the hw blocks
*/
+ int ret;
+ static enum amd_powergating_state cur_state = AMD_PG_STATE_GATE;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+ if (state == cur_state)
+ return 0;
+
if (state == AMD_PG_STATE_GATE)
- return vcn_v1_0_stop(adev);
+ ret = vcn_v1_0_stop(adev);
else
- return vcn_v1_0_start(adev);
+ ret = vcn_v1_0_start(adev);
+
+ if (!ret)
+ cur_state = state;
+ return ret;
}
static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
--
2.7.4
_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
</blockquote>
</blockquote>
<br>
</body>
</html>