[PATCH 1/2] drm/amd/pp: Add profiling mode setting on RV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 18, 2018 at 5:33 AM, Rex Zhu <Rex.Zhu at amd.com> wrote:
> For power saving, default profiling mode was setted
> to power saving mode.
>
> Currently, not support CUSTOM mode and not display
> detailed profiling mode parameters in sysfs.
>
> Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 42 +++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
> index 0882ecf..409a46b 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
> @@ -450,6 +450,10 @@ static int smu10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
>
>         hwmgr->backend = data;
>
> +       hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING];
> +       hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_POWERSAVING;
> +       hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_POWERSAVING;
> +
>         result = smu10_initialize_dpm_defaults(hwmgr);
>         if (result != 0) {
>                 pr_err("smu10_initialize_dpm_defaults failed\n");
> @@ -1163,6 +1167,42 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate)
>         }
>  }
>
> +static int smu10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
> +{
> +       uint32_t i, size = 0;
> +
> +       static const char *profile_name[6] = {"3D_FULL_SCREEN",
> +                                       "POWER_SAVING",
> +                                       "VIDEO",
> +                                       "VR",
> +                                       "COMPUTE"};
> +       static const char *title[2] = {"NUM", "MODE_NAME"};
> +
> +       if (!buf)
> +               return -EINVAL;
> +
> +       size += sprintf(buf + size, "%s %10s\n", title[0], title[1]);
> +
> +       for (i = 0; i < PP_SMC_POWER_PROFILE_CUSTOM; i++)
> +               size += sprintf(buf + size, "%3d %14s%s\n",
> +                               i, profile_name[i],
> +                               (i == hwmgr->power_profile_mode) ? "*" : " ");
> +       return size;
> +}
> +
> +static int smu10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint32_t size)
> +{
> +       if (input[size] >= PP_SMC_POWER_PROFILE_CUSTOM)
> +               return -EINVAL;
> +
> +       hwmgr->power_profile_mode = input[size];
> +
> +       smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ActiveProcessNotify,
> +                                               1<<hwmgr->power_profile_mode);
> +
> +       return 0;
> +}
> +
>  static const struct pp_hwmgr_func smu10_hwmgr_funcs = {
>         .backend_init = smu10_hwmgr_backend_init,
>         .backend_fini = smu10_hwmgr_backend_fini,
> @@ -1200,6 +1240,8 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate)
>         .set_mmhub_powergating_by_smu = smu10_set_mmhub_powergating_by_smu,
>         .smus_notify_pwe = smu10_smus_notify_pwe,
>         .gfx_off_control = smu10_gfx_off_control,
> +       .get_power_profile_mode = smu10_get_power_profile_mode,
> +       .set_power_profile_mode = smu10_set_power_profile_mode,
>  };
>
>  int smu10_init_function_pointers(struct pp_hwmgr *hwmgr)
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux