[PATCH 5/6] drm/amdgpu/powerplay: add an implementation for get_vce_clock_table

Zhu, Rex Rex.Zhu at amd.com
Wed Oct 12 08:34:38 UTC 2016


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.
> +                               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;


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 [mailto:alexdeucher at gmail.com] 
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 <alexdeucher at gmail.com> wrote:
> Used by the powerplay dpm code.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-drm-amdgpu-use-same-vce-state-definition-in-dpm-and-.patch
Type: application/octet-stream
Size: 11210 bytes
Desc: 0001-drm-amdgpu-use-same-vce-state-definition-in-dpm-and-.patch
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20161012/73f5b1ed/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-drm-amdgpu-save-number-of-vce-states-in-dpm-struct.patch
Type: application/octet-stream
Size: 3717 bytes
Desc: 0002-drm-amdgpu-save-number-of-vce-states-in-dpm-struct.patch
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20161012/73f5b1ed/attachment-0003.obj>


More information about the amd-gfx mailing list