dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lakha, Bhawanpreet" <Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org>
To: "Wu, Hersen" <hersenxs.wu-5C7GfCeVMHo@public.gmane.org>,
	"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Li, Sun peng (Leo)" <Sunpeng.Li-5C7GfCeVMHo@public.gmane.org>,
	"Wentland, Harry" <Harry.Wentland-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu/display: hook renoir dc to pplib funcs
Date: Tue, 15 Oct 2019 15:34:11 +0000	[thread overview]
Message-ID: <eb002983-846f-8b76-2b68-fe83a5316ffc@amd.com> (raw)
In-Reply-To: <20191015150443.11456-1-hersenxs.wu-5C7GfCeVMHo@public.gmane.org>

Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>

On 2019-10-15 11:04 a.m., Hersen Wu wrote:
> enable dc get dmp clock table and set dcn watermarks
> via pplib.
>
> Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
> ---
>   .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c  | 93 +++++++++++++++++++
>   drivers/gpu/drm/amd/display/dc/dm_pp_smu.h    |  2 +-
>   2 files changed, 94 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
> index 95564b8de3ce..7add40dea9b7 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
> @@ -891,6 +891,90 @@ enum pp_smu_status pp_nv_get_uclk_dpm_states(struct pp_smu *pp,
>   	return PP_SMU_RESULT_FAIL;
>   }
>   
> +#ifdef CONFIG_DRM_AMD_DC_DCN2_1
> +enum pp_smu_status pp_rn_get_dpm_clock_table(
> +		struct pp_smu *pp, struct dpm_clocks *clock_table)
> +{
> +	const struct dc_context *ctx = pp->dm;
> +	struct amdgpu_device *adev = ctx->driver_context;
> +	struct smu_context *smu = &adev->smu;
> +
> +	if (!smu->ppt_funcs)
> +		return PP_SMU_RESULT_UNSUPPORTED;
> +
> +	if (!smu->ppt_funcs->get_dpm_clock_table)
> +		return PP_SMU_RESULT_UNSUPPORTED;
> +
> +	if (!smu->ppt_funcs->get_dpm_clock_table(smu, clock_table))
> +		return PP_SMU_RESULT_OK;
> +
> +	return PP_SMU_RESULT_FAIL;
> +}
> +
> +enum pp_smu_status pp_rn_set_wm_ranges(struct pp_smu *pp,
> +		struct pp_smu_wm_range_sets *ranges)
> +{
> +	const struct dc_context *ctx = pp->dm;
> +	struct amdgpu_device *adev = ctx->driver_context;
> +	struct smu_context *smu = &adev->smu;
> +	struct dm_pp_wm_sets_with_clock_ranges_soc15 wm_with_clock_ranges;
> +	struct dm_pp_clock_range_for_dmif_wm_set_soc15 *wm_dce_clocks =
> +			wm_with_clock_ranges.wm_dmif_clocks_ranges;
> +	struct dm_pp_clock_range_for_mcif_wm_set_soc15 *wm_soc_clocks =
> +			wm_with_clock_ranges.wm_mcif_clocks_ranges;
> +	int32_t i;
> +
> +	if (!smu->funcs)
> +		return PP_SMU_RESULT_UNSUPPORTED;
> +
> +	wm_with_clock_ranges.num_wm_dmif_sets = ranges->num_reader_wm_sets;
> +	wm_with_clock_ranges.num_wm_mcif_sets = ranges->num_writer_wm_sets;
> +
> +	for (i = 0; i < wm_with_clock_ranges.num_wm_dmif_sets; i++) {
> +		if (ranges->reader_wm_sets[i].wm_inst > 3)
> +			wm_dce_clocks[i].wm_set_id = WM_SET_A;
> +		else
> +			wm_dce_clocks[i].wm_set_id =
> +					ranges->reader_wm_sets[i].wm_inst;
> +
> +		wm_dce_clocks[i].wm_min_dcfclk_clk_in_khz =
> +			ranges->reader_wm_sets[i].min_drain_clk_mhz;
> +
> +		wm_dce_clocks[i].wm_max_dcfclk_clk_in_khz =
> +			ranges->reader_wm_sets[i].max_drain_clk_mhz;
> +
> +		wm_dce_clocks[i].wm_min_mem_clk_in_khz =
> +			ranges->reader_wm_sets[i].min_fill_clk_mhz;
> +
> +		wm_dce_clocks[i].wm_max_mem_clk_in_khz =
> +			ranges->reader_wm_sets[i].max_fill_clk_mhz;
> +	}
> +
> +	for (i = 0; i < wm_with_clock_ranges.num_wm_mcif_sets; i++) {
> +		if (ranges->writer_wm_sets[i].wm_inst > 3)
> +			wm_soc_clocks[i].wm_set_id = WM_SET_A;
> +		else
> +			wm_soc_clocks[i].wm_set_id =
> +					ranges->writer_wm_sets[i].wm_inst;
> +		wm_soc_clocks[i].wm_min_socclk_clk_in_khz =
> +				ranges->writer_wm_sets[i].min_fill_clk_mhz;
> +
> +		wm_soc_clocks[i].wm_max_socclk_clk_in_khz =
> +			ranges->writer_wm_sets[i].max_fill_clk_mhz;
> +
> +		wm_soc_clocks[i].wm_min_mem_clk_in_khz =
> +			ranges->writer_wm_sets[i].min_drain_clk_mhz;
> +
> +		wm_soc_clocks[i].wm_max_mem_clk_in_khz =
> +			ranges->writer_wm_sets[i].max_drain_clk_mhz;
> +	}
> +
> +	smu_set_watermarks_for_clock_ranges(&adev->smu, &wm_with_clock_ranges);
> +
> +	return PP_SMU_RESULT_OK;
> +}
> +#endif
> +
>   void dm_pp_get_funcs(
>   		struct dc_context *ctx,
>   		struct pp_smu_funcs *funcs)
> @@ -935,6 +1019,15 @@ void dm_pp_get_funcs(
>   		funcs->nv_funcs.set_pstate_handshake_support = pp_nv_set_pstate_handshake_support;
>   		break;
>   #endif
> +
> +#ifdef CONFIG_DRM_AMD_DC_DCN2_1
> +	case DCN_VERSION_2_1:
> +		funcs->ctx.ver = PP_SMU_VER_RN;
> +		funcs->rn_funcs.pp_smu.dm = ctx;
> +		funcs->rn_funcs.set_wm_ranges = pp_rn_set_wm_ranges;
> +		funcs->rn_funcs.get_dpm_clock_table = pp_rn_get_dpm_clock_table;
> +		break;
> +#endif
>   	default:
>   		DRM_ERROR("smu version is not supported !\n");
>   		break;
> diff --git a/drivers/gpu/drm/amd/display/dc/dm_pp_smu.h b/drivers/gpu/drm/amd/display/dc/dm_pp_smu.h
> index c03a441ee638..24d65dbbd749 100644
> --- a/drivers/gpu/drm/amd/display/dc/dm_pp_smu.h
> +++ b/drivers/gpu/drm/amd/display/dc/dm_pp_smu.h
> @@ -252,7 +252,7 @@ struct pp_smu_funcs_nv {
>   #if defined(CONFIG_DRM_AMD_DC_DCN2_1)
>   
>   #define PP_SMU_NUM_SOCCLK_DPM_LEVELS  8
> -#define PP_SMU_NUM_DCFCLK_DPM_LEVELS  4
> +#define PP_SMU_NUM_DCFCLK_DPM_LEVELS  8
>   #define PP_SMU_NUM_FCLK_DPM_LEVELS    4
>   #define PP_SMU_NUM_MEMCLK_DPM_LEVELS  4
>   
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2019-10-15 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 15:04 [PATCH] drm/amdgpu/display: hook renoir dc to pplib funcs Hersen Wu
     [not found] ` <20191015150443.11456-1-hersenxs.wu-5C7GfCeVMHo@public.gmane.org>
2019-10-15 15:34   ` Lakha, Bhawanpreet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb002983-846f-8b76-2b68-fe83a5316ffc@amd.com \
    --to=bhawanpreet.lakha-5c7gfcevmho@public.gmane.org \
    --cc=Harry.Wentland-5C7GfCeVMHo@public.gmane.org \
    --cc=Sunpeng.Li-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hersenxs.wu-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox