amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Dingchen (David)" <Dingchen.Zhang@amd.com>
To: "VURDIGERENATARAJ, CHANDAN" <CHANDAN.VURDIGERENATARAJ@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Wang, Chao-kai \(Stylon\)" <Stylon.Wang@amd.com>,
	"Li, Sun peng \(Leo\)" <Sunpeng.Li@amd.com>,
	"Lakha,  Bhawanpreet" <Bhawanpreet.Lakha@amd.com>,
	"Zhuo, Qingqing \(Lillian\)" <Qingqing.Zhuo@amd.com>,
	"Siqueira, Rodrigo" <Rodrigo.Siqueira@amd.com>,
	"Li, Roman" <Roman.Li@amd.com>,
	"Chiu, Solomon" <Solomon.Chiu@amd.com>,
	"Zuo, Jerry" <Jerry.Zuo@amd.com>,
	"Pillai, Aurabindo" <Aurabindo.Pillai@amd.com>,
	"Lin, Wayne" <Wayne.Lin@amd.com>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	"Gutierrez, Agustin" <Agustin.Gutierrez@amd.com>,
	"Kotarac, Pavle" <Pavle.Kotarac@amd.com>
Subject: Re: [PATCH 14/17] drm/amd/display: add shared helpers to update psr config fields to power module
Date: Mon, 9 May 2022 14:09:51 +0000	[thread overview]
Message-ID: <BN9PR12MB5145128060B999D3AAD82BC18DC69@BN9PR12MB5145.namprd12.prod.outlook.com> (raw)
In-Reply-To: <MW4PR12MB5668EABC524467528F40BD8A96C69@MW4PR12MB5668.namprd12.prod.outlook.com>

[AMD Official Use Only - General]

Hi Chandan,

Replied in-mail.

Thanks
DZ


From: VURDIGERENATARAJ, CHANDAN <CHANDAN.VURDIGERENATARAJ@amd.com>
Sent: Monday, May 9, 2022 4:42 AM
To: Zhang, Dingchen (David) <Dingchen.Zhang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Wang, Chao-kai (Stylon) <Stylon.Wang@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>; Zhuo, Qingqing (Lillian) <Qingqing.Zhuo@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Li, Roman <Roman.Li@amd.com>; Chiu, Solomon <Solomon.Chiu@amd.com>; Zuo, Jerry <Jerry.Zuo@amd.com>; Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Lin, Wayne <Wayne.Lin@amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Gutierrez, Agustin <Agustin.Gutierrez@amd.com>; Kotarac, Pavle <Pavle.Kotarac@amd.com>
Subject: RE: [PATCH 14/17] drm/amd/display: add shared helpers to update psr config fields to power module

Hi


>[why]
>Currently the amdgpu DM psr configuration parameters are hardcoded before feeding into the DC helper to setup PSR. We would define a helper >which is to calculate parts of the psr config fields to avoid hard-coding.
>
>[how]
>To make helper shareable, declare and define the helper in the module_helper, to set/update below fields:
>- psr remote buffer setup time
>- sdp tx line number deadline
>- line time in us
>- su_y_granularity
>- su_granularity_required
>- psr_frame_capture_indication_req
>- psr_exit_link_training_required
>
>add another helper to check given the stream context, if there is only one stream and the output is eDP panel connected.
>
>Signed-off-by: David Zhang <dingchen.zhang@amd.com>
>---
> .../amd/display/modules/power/power_helpers.c | 73 +++++++++++++++++++  .../amd/display/modules/power/power_helpers.h |  6 ++
> 2 files changed, 79 insertions(+)
>
>diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
>index 97928d4c3b9a..1be4fcfa578a 100644
>--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
>+++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
>@@ -822,3 +822,76 @@ bool is_psr_su_specific_panel(struct dc_link *link)
>
>        return false;
> }
>+
>+/**
>+ * mod_power_calc_psr_configs() - calculate/update generic psr configuration fields.
>+ * @psr_config: [output], psr configuration structure to be updated
>+ * @link: [input] dc link pointer
>+ * @stream: [input] dc stream state pointer
>+ *
>+ * calculate and update the psr configuration fields that are not DM
>+specific, i.e. such
>+ * fields which are based on DPCD caps or timing information. To setup
>+PSR in DMUB FW,
>+ * this helper is assumed to be called before the call of the DC helper dc_link_setup_psr().
>+ *
>+ * PSR config fields to be updated within the helper:
>+ * - psr_rfb_setup_time
>+ * - psr_sdp_transmit_line_num_deadline
>+ * - line_time_in_us
>+ * - su_y_granularity
>+ * - su_granularity_required
>+ * - psr_frame_capture_indication_req
>+ * - psr_exit_link_training_required
>+ *
>+ * PSR config fields that are DM specific and NOT updated within the helper:
>+ * - allow_smu_optimizations
>+ * - allow_multi_disp_optimizations
>+ */
>+void mod_power_calc_psr_configs(struct psr_config *psr_config,
>+              struct dc_link *link,
>+              const struct dc_stream_state *stream) {
>+      unsigned int num_vblank_lines = 0;
>+      unsigned int vblank_time_in_us = 0;
>+      unsigned int sdp_tx_deadline_in_us = 0;
>+      unsigned int line_time_in_us = 0;
>+      struct dpcd_caps *dpcd_caps = &link->dpcd_caps;
>+      const int psr_setup_time_step_in_us = 55;       /* refer to eDP spec DPCD 0x071h */
>+
>+      /* timing parameters */
>+      num_vblank_lines = stream->timing.v_total -
>+                       stream->timing.v_addressable -
>+                       stream->timing.v_border_top -
>+                       stream->timing.v_border_bottom;
>+
>+      vblank_time_in_us = (stream->timing.h_total * num_vblank_lines * 1000)
>+/ (stream->timing.pix_clk_100hz / 10);
>+
>+      line_time_in_us = ((stream->timing.h_total * 1000) /
>+(stream->timing.pix_clk_100hz / 10)) + 1;
>+
>+      /* psr configuration fields */
>+      psr_config->psr_rfb_setup_time =
>+              (6 - dpcd_caps->psr_info.psr_dpcd_caps.bits.PSR_SETUP_TIME) *

Is this " dpcd_caps->psr_info.psr_dpcd_caps.bits.PSR_SETUP_TIME" always expected to be less than '6'. What does this 6 indicate here?

***
This is as per the eDP 1.5 spec, DPCD reg at 0x00071h, i.e. the PSR Cap reg. (page 377 of 459)
the PSR_SETUP_TIME is represented by 3 bits and interpreted as
- 000b <--> 330 (us)
- 001b <--> 275 (us)
- 010b <--> 220 (us)
- 011b <--> 165 (us)
- 100b <--> 110 (us)
- 101b <--> 055 (us)
- 110b <--> 000 (us)

Since the base 0us interpreted by '6', so the actual psr setup time will be "(6 - psr_setup_time_in_binary) * 55 (us)". That's where the '6' coming from.
***

>+psr_setup_time_step_in_us;
>+
>+      if (psr_config->psr_rfb_setup_time > vblank_time_in_us) {
>+              link->psr_settings.psr_frame_capture_indication_req = true;
>+              link->psr_settings.psr_sdp_transmit_line_num_deadline = num_vblank_lines;
>+      } else {
>+              sdp_tx_deadline_in_us = vblank_time_in_us -
>+psr_config->psr_rfb_setup_time;
>+
>+              /* Set the last possible line SDP may be transmitted without violating the RFB setup time */
>+              link->psr_settings.psr_frame_capture_indication_req = false;
>+              link->psr_settings.psr_sdp_transmit_line_num_deadline = sdp_tx_deadline_in_us / line_time_in_us;
>+      }
>+
>+      psr_config->psr_sdp_transmit_line_num_deadline = link->psr_settings.psr_sdp_transmit_line_num_deadline;
>+      psr_config->line_time_in_us = line_time_in_us;
>+      psr_config->su_y_granularity = dpcd_caps->psr_info.psr2_su_y_granularity_cap;
>+      psr_config->su_granularity_required = dpcd_caps->psr_info.psr_dpcd_caps.bits.SU_GRANULARITY_REQUIRED;
>+      psr_config->psr_frame_capture_indication_req = link->psr_settings.psr_frame_capture_indication_req;
>+      psr_config->psr_exit_link_training_required =
>+
>+!link->dpcd_caps.psr_info.psr_dpcd_caps.bits.LINK_TRAINING_ON_EXIT_NOT_
>+REQUIRED;
>+}
>+
>+bool mod_power_only_edp(const struct dc_state *context, const struct
>+dc_stream_state *stream) {
>+      return context && context->stream_count == 1 &&
>+dc_is_embedded_signal(stream->signal);
>+}
>diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h
>index 1a634d8c78c5..316452e9dbc9 100644
>--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h
>+++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h
>@@ -27,6 +27,7 @@
>
> #include "dc/inc/hw/dmcu.h"
> #include "dc/inc/hw/abm.h"
>+#include "dc/inc/core_types.h"
>
> struct resource_pool;
>
>@@ -53,4 +54,9 @@ bool dmub_init_abm_config(struct resource_pool *res_pool,
>                unsigned int inst);
>
> bool is_psr_su_specific_panel(struct dc_link *link);
>+void mod_power_calc_psr_configs(struct psr_config *psr_config,
>+              struct dc_link *link,
>+              const struct dc_stream_state *stream); bool mod_power_only_edp(const
>+struct dc_state *context,
>+              const struct dc_stream_state *stream);
> #endif /* MODULES_POWER_POWER_HELPERS_H_ */
>--
>2.25.1
>

  reply	other threads:[~2022-05-09 14:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 14:23 [PATCH 00/17] enable PSR-SU MPO for amdpgu David Zhang
2022-05-05 14:23 ` [PATCH 01/17] drm/amd/display: align dmub cmd header to latest dmub FW to support PSR-SU David Zhang
2022-05-05 14:23 ` [PATCH 02/17] drm/amd/display: feed PSR-SU as psr version to dmub FW David Zhang
2022-05-05 14:23 ` [PATCH 03/17] drm/amd/display: combine dirty rectangles in DMUB FW David Zhang
2022-05-09  8:12   ` VURDIGERENATARAJ, CHANDAN
2022-05-09 13:41     ` Zhang, Dingchen (David)
2022-05-05 14:23 ` [PATCH 04/17] drm/amd/display: update GSP1 generic info packet for PSRSU David Zhang
2022-05-05 14:23 ` [PATCH 05/17] drm/amd/display: revise Start/End SDP data David Zhang
2022-05-09  8:26   ` VURDIGERENATARAJ, CHANDAN
2022-05-09 14:02     ` Zhang, Dingchen (David)
2022-05-05 14:23 ` [PATCH 06/17] drm/amd/display: program PSR2 DPCD Configuration David Zhang
2022-05-05 14:23 ` [PATCH 07/17] drm/amd/display: Passing Y-granularity to dmub fw David Zhang
2022-05-05 14:23 ` [PATCH 08/17] drm/amd/display: Set default value of line_capture_indication David Zhang
2022-05-05 14:23 ` [PATCH 09/17] drm/amd/display: add vline time in micro sec to PSR context David Zhang
2022-05-05 14:23 ` [PATCH 10/17] drm/amd/display: fix system hang when PSR exits David Zhang
2022-05-05 14:23 ` [PATCH 11/17] drm/amd/display: Set PSR level to enable ALPM by default David Zhang
2022-05-05 14:23 ` [PATCH 12/17] drm/amd/display: use HW lock mgr for PSR-SU David Zhang
2022-05-05 14:23 ` [PATCH 13/17] drm/amd/display: PSRSU+DSC WA for specific TCON David Zhang
2022-05-05 14:23 ` [PATCH 14/17] drm/amd/display: add shared helpers to update psr config fields to power module David Zhang
2022-05-09  8:42   ` VURDIGERENATARAJ, CHANDAN
2022-05-09 14:09     ` Zhang, Dingchen (David) [this message]
2022-05-05 14:23 ` [PATCH 15/17] drm/amd/display: calculate psr config settings in runtime in DM David Zhang
2022-05-05 14:23 ` [PATCH 16/17] drm/amd/display: update cursor position to DMUB FW David Zhang
2022-05-05 14:23 ` [PATCH 17/17] drm/amd/display: Implement MPO PSR SU David Zhang

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=BN9PR12MB5145128060B999D3AAD82BC18DC69@BN9PR12MB5145.namprd12.prod.outlook.com \
    --to=dingchen.zhang@amd.com \
    --cc=Agustin.Gutierrez@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=CHANDAN.VURDIGERENATARAJ@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=Pavle.Kotarac@amd.com \
    --cc=Qingqing.Zhuo@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Roman.Li@amd.com \
    --cc=Solomon.Chiu@amd.com \
    --cc=Stylon.Wang@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=Wayne.Lin@amd.com \
    --cc=amd-gfx@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).