<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
Hi Evan,<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
did we need to check the following flags on vega12?will driver set those flags when user select the umd_pstate?<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
PHM_PlatformCaps_UMDPState/PHM_PlatformCaps_PState.<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
Best Regards<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
Rex<br>
<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
获取 <a href="https://aka.ms/ghei36">Outlook for Android</a></div>
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Tuesday, June 19, 2018 11:16:44 PM<br>
<b>To:</b> Quan, Evan<br>
<b>Cc:</b> amd-gfx list<br>
<b>Subject:</b> Re: [PATCH 10/13] drm/amd/powerplay: apply clocks adjust rules on power state change</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Tue, Jun 19, 2018 at 3:39 AM, Evan Quan <evan.quan@amd.com> wrote:<br>
> The clocks hard/soft min/max clock levels will be adjusted<br>
> correspondingly.<br>
<br>
<br>
Also note that this add the apply_clocks_adjust_rules callback which<br>
is used to validate the clock settings on a power state change.  One<br>
other comment below.<br>
<br>
><br>
> Change-Id: I2c4b6cd6756d40a28933f0c26b9e1a3d5078bab8<br>
> Signed-off-by: Evan Quan <evan.quan@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 162 +++++++++++++++++++++<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h |   2 +<br>
>  2 files changed, 164 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
> index a227ace..26bdfff 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
> @@ -1950,6 +1950,166 @@ static int vega12_print_clock_levels(struct pp_hwmgr *hwmgr,<br>
>         return size;<br>
>  }<br>
><br>
> +static int vega12_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)<br>
> +{<br>
> +       struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
> +       struct vega12_single_dpm_table *dpm_table;<br>
> +       bool vblank_too_short = false;<br>
> +       bool disable_mclk_switching;<br>
> +       uint32_t i, latency;<br>
> +<br>
> +       disable_mclk_switching = ((1 < hwmgr->display_config->num_display) &&<br>
> +                                 !hwmgr->display_config->multi_monitor_in_sync) ||<br>
> +                                 vblank_too_short;<br>
> +       latency = hwmgr->display_config->dce_tolerable_mclk_in_active_latency;<br>
> +<br>
> +       /* gfxclk */<br>
> +       dpm_table = &(data->dpm_table.gfx_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_GFXCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[0].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* memclk */<br>
> +       dpm_table = &(data->dpm_table.mem_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_MCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[0].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* honour DAL's UCLK Hardmin */<br>
> +       if (dpm_table->dpm_state.hard_min_level < (hwmgr->display_config->min_mem_set_clock / 100))<br>
> +               dpm_table->dpm_state.hard_min_level = hwmgr->display_config->min_mem_set_clock / 100;<br>
> +<br>
<br>
Didn't you just remove the uclk hard min setting in a previous patch?<br>
<br>
<br>
<br>
> +       /* Hardmin is dependent on displayconfig */<br>
> +       if (disable_mclk_switching) {<br>
> +               dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               for (i = 0; i < data->mclk_latency_table.count - 1; i++) {<br>
> +                       if (data->mclk_latency_table.entries[i].latency <= latency) {<br>
> +                               if (dpm_table->dpm_levels[i].value >= (hwmgr->display_config->min_mem_set_clock / 100)) {<br>
> +                                       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[i].value;<br>
> +                                       break;<br>
> +                               }<br>
> +                       }<br>
> +               }<br>
> +       }<br>
> +<br>
> +       if (hwmgr->display_config->nb_pstate_switch_disable)<br>
> +               dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       /* vclk */<br>
> +       dpm_table = &(data->dpm_table.vclk_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_UVDCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* dclk */<br>
> +       dpm_table = &(data->dpm_table.dclk_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_UVDCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* socclk */<br>
> +       dpm_table = &(data->dpm_table.soc_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_SOCCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_SOCCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_SOCCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* eclk */<br>
> +       dpm_table = &(data->dpm_table.eclk_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_VCEMCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_VCEMCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_VCEMCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       return 0;<br>
> +}<br>
> +<br>
>  static int vega12_display_configuration_changed_task(struct pp_hwmgr *hwmgr)<br>
>  {<br>
>         struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
> @@ -2196,6 +2356,8 @@ static const struct pp_hwmgr_func vega12_hwmgr_funcs = {<br>
>         .display_clock_voltage_request = vega12_display_clock_voltage_request,<br>
>         .force_clock_level = vega12_force_clock_level,<br>
>         .print_clock_levels = vega12_print_clock_levels,<br>
> +       .apply_clocks_adjust_rules =<br>
> +               vega12_apply_clocks_adjust_rules,<br>
>         .display_config_changed = vega12_display_configuration_changed_task,<br>
>         .powergate_uvd = vega12_power_gate_uvd,<br>
>         .powergate_vce = vega12_power_gate_vce,<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> index e18c083..e17237c 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> @@ -443,6 +443,8 @@ struct vega12_hwmgr {<br>
>  #define VEGA12_UMD_PSTATE_GFXCLK_LEVEL         0x3<br>
>  #define VEGA12_UMD_PSTATE_SOCCLK_LEVEL         0x3<br>
>  #define VEGA12_UMD_PSTATE_MCLK_LEVEL           0x2<br>
> +#define VEGA12_UMD_PSTATE_UVDCLK_LEVEL         0x3<br>
> +#define VEGA12_UMD_PSTATE_VCEMCLK_LEVEL        0x3<br>
><br>
>  int vega12_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);<br>
><br>
> --<br>
> 2.7.4<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><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><br>
</div>
</span></font>
</body>
</html>