<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Rex,<br>
<br>
the problem with this approach is that you need to copy the
entries from one structure to another, like we have below:<br>
<br>
> + vce_clk_table.entries[i].sclk
= hwmgr->vce_states[i].sclk;<br>
> + vce_clk_table.entries[i].mclk
= hwmgr->vce_states[i].mclk;<br>
> + vce_clk_table.entries[i].eclk
= hwmgr->vce_states[i].evclk;<br>
<br>
This is not seen as good coding practice and usually isn't allowed
upstream because it creates two representations in the kernel for
the same thing.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 12.10.2016 um 10:34 schrieb Zhu, Rex:<br>
</div>
<blockquote
cite="mid:CY4PR12MB16871A098341B047DBA0DEADFBDD0@CY4PR12MB1687.namprd12.prod.outlook.com"
type="cite">
<pre wrap="">Hi Alex,
In Patch1, I moved struct amdgpu_vce_states to amd_shared.h from amdgpu.h. So in powerplay, we used same vce state definition.
So the define of static struct drm_amdgpu_info_vce_clock_table pp_dpm_get_vce_clock_table(void *handle)
Can change to
static struct amd_vce_state pp_dpm_get_vce_clock_table(void *handle, int num);
and can move those codes to Patch6.
</pre>
<blockquote type="cite">
<pre wrap="">+ vce_clk_table.entries[i].sclk = hwmgr->vce_states[i].sclk;
+ vce_clk_table.entries[i].mclk = hwmgr->vce_states[i].mclk;
+ vce_clk_table.entries[i].eclk = hwmgr->vce_states[i].evclk;
</pre>
</blockquote>
<pre wrap="">
So in powerplay and dpm, we don't need to visit struct drm_amdgpu_info_vce_clock_table.
In Patch2, add numer of vce_states in struct dpm. If it is useful to UMD driver. We can notify UMD by add a member in struct drm_amdgpu_info_vce_clock_table.
Best Regards
Rex
-----Original Message-----
From: Alex Deucher [<a class="moz-txt-link-freetext" href="mailto:alexdeucher@gmail.com">mailto:alexdeucher@gmail.com</a>]
Sent: Wednesday, October 12, 2016 4:07 AM
To: amd-gfx list; Fang, Peter; Zhang, Boyuan; Zhu, Rex
Cc: Deucher, Alexander
Subject: Re: [PATCH 5/6] drm/amdgpu/powerplay: add an implementation for get_vce_clock_table
Rex what is your opinion on exposing the amdgpu drm structure through to powerplay? We could do an intermediate interface, but that just seems like extra hoops to jump through for pretty questionable gain.
Alex
On Fri, Oct 7, 2016 at 2:28 PM, Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexdeucher@gmail.com"><alexdeucher@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Used by the powerplay dpm code.
Signed-off-by: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
---
drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 24
++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index bb8a345..8eee390 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -30,6 +30,7 @@
#include "power_state.h"
#include "eventmanager.h"
#include "pp_debug.h"
+#include "drm/amdgpu_drm.h"
#define PP_CHECK(handle) \
@@ -821,6 +822,28 @@ static int pp_dpm_read_sensor(void *handle, int idx, int32_t *value)
return hwmgr->hwmgr_func->read_sensor(hwmgr, idx, value); }
+static struct drm_amdgpu_info_vce_clock_table
+pp_dpm_get_vce_clock_table(void *handle) {
+ struct drm_amdgpu_info_vce_clock_table vce_clk_table = {};
+ struct pp_hwmgr *hwmgr;
+ unsigned i;
+
+ if (handle) {
+ hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+ if (hwmgr) {
+ for (i = 0; i < AMDGPU_VCE_CLOCK_TABLE_ENTRIES; i++) {
+ vce_clk_table.entries[i].sclk = hwmgr->vce_states[i].sclk;
+ vce_clk_table.entries[i].mclk = hwmgr->vce_states[i].mclk;
+ vce_clk_table.entries[i].eclk = hwmgr->vce_states[i].evclk;
+ }
+ }
+ }
+
+ return vce_clk_table;
+}
+
const struct amd_powerplay_funcs pp_dpm_funcs = {
.get_temperature = pp_dpm_get_temperature,
.load_firmware = pp_dpm_load_fw, @@ -847,6 +870,7 @@ const
struct amd_powerplay_funcs pp_dpm_funcs = {
.get_mclk_od = pp_dpm_get_mclk_od,
.set_mclk_od = pp_dpm_set_mclk_od,
.read_sensor = pp_dpm_read_sensor,
+ .get_vce_clock_table = pp_dpm_get_vce_clock_table,
};
static int amd_pp_instance_init(struct amd_pp_init *pp_init,
--
2.5.5
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
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>
<p><br>
</p>
</body>
</html>