AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@amd.com>,
	Rodrigo Siqueira <rodrigo.siqueira@amd.com>,
	Hamza Mahfooz <hamza.mahfooz@amd.com>,
	Aurabindo Pillai <aurabindo.pillai@amd.com>,
	"Roman Li" <roman.li@amd.com>, Wayne Lin <wayne.lin@amd.com>,
	Tom Chung <chiahsuan.chung@amd.com>,
	Fangzhi Zuo <jerry.zuo@amd.com>,
	Zaeem Mohamed <zaeem.mohamed@amd.com>,
	Solomon Chiu <solomon.chiu@amd.com>,
	Daniel Wheeler <daniel.wheeler@amd.com>,
	Dillon Varone <dillon.varone@amd.com>, <stable@vger.kernel.org>,
	Austin Zheng <austin.zheng@amd.com>
Subject: [PATCH 12/16] drm/amd/display: Require minimum VBlank size for stutter optimization
Date: Tue, 5 Nov 2024 15:22:13 -0500	[thread overview]
Message-ID: <20241105202341.154036-13-hamza.mahfooz@amd.com> (raw)
In-Reply-To: <20241105202341.154036-1-hamza.mahfooz@amd.com>

From: Dillon Varone <dillon.varone@amd.com>

If the nominal VBlank is too small, optimizing for stutter can cause
the prefetch bandwidth to increase drasticaly, resulting in higher
clock and power requirements. Only optimize if it is >3x the stutter
latency.

Cc: stable@vger.kernel.org
Reviewed-by: Austin Zheng <austin.zheng@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
---
 .../dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c
index 5a09dd298e6f..92269f0e50ed 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c
@@ -8,6 +8,7 @@
 #include "dml2_pmo_dcn4_fams2.h"
 
 static const double MIN_VACTIVE_MARGIN_PCT = 0.25; // We need more than non-zero margin because DET buffer granularity can alter vactive latency hiding
+static const double MIN_BLANK_STUTTER_FACTOR = 3.0;
 
 static const struct dml2_pmo_pstate_strategy base_strategy_list_1_display[] = {
 	// VActive Preferred
@@ -2140,6 +2141,7 @@ bool pmo_dcn4_fams2_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in
 	struct dml2_pmo_instance *pmo = in_out->instance;
 	bool stutter_period_meets_z8_eco = true;
 	bool z8_stutter_optimization_too_expensive = false;
+	bool stutter_optimization_too_expensive = false;
 	double line_time_us, vblank_nom_time_us;
 
 	unsigned int i;
@@ -2161,10 +2163,15 @@ bool pmo_dcn4_fams2_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in
 		line_time_us = (double)in_out->base_display_config->display_config.stream_descriptors[i].timing.h_total / (in_out->base_display_config->display_config.stream_descriptors[i].timing.pixel_clock_khz * 1000) * 1000000;
 		vblank_nom_time_us = line_time_us * in_out->base_display_config->display_config.stream_descriptors[i].timing.vblank_nom;
 
-		if (vblank_nom_time_us < pmo->soc_bb->power_management_parameters.z8_stutter_exit_latency_us) {
+		if (vblank_nom_time_us < pmo->soc_bb->power_management_parameters.z8_stutter_exit_latency_us * MIN_BLANK_STUTTER_FACTOR) {
 			z8_stutter_optimization_too_expensive = true;
 			break;
 		}
+
+		if (vblank_nom_time_us < pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us * MIN_BLANK_STUTTER_FACTOR) {
+			stutter_optimization_too_expensive = true;
+			break;
+		}
 	}
 
 	pmo->scratch.pmo_dcn4.num_stutter_candidates = 0;
@@ -2180,7 +2187,7 @@ bool pmo_dcn4_fams2_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in
 		pmo->scratch.pmo_dcn4.z8_vblank_optimizable = false;
 	}
 
-	if (pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us > 0) {
+	if (!stutter_optimization_too_expensive && pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us > 0) {
 		pmo->scratch.pmo_dcn4.optimal_vblank_reserved_time_for_stutter_us[pmo->scratch.pmo_dcn4.num_stutter_candidates] = (unsigned int)pmo->soc_bb->power_management_parameters.stutter_enter_plus_exit_latency_us;
 		pmo->scratch.pmo_dcn4.num_stutter_candidates++;
 	}
-- 
2.46.1


  parent reply	other threads:[~2024-11-05 20:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 20:22 [PATCH 00/16] DC Patches November 5, 2024 Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 01/16] drm/amd/display: Refactor HPD IRQ error checking flow Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 02/16] drm/amd/display: Change parameters to fix certain compiler errors Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 03/16] drm/amd/display: Change some variable name of psr Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 04/16] drm/amd/display: Fix Panel Replay not update screen correctly Hamza Mahfooz
2024-11-06 20:25   ` Mario Limonciello
2024-11-07 14:15     ` Mario Limonciello
2024-11-07 15:03       ` Mario Limonciello
2024-11-05 20:22 ` [PATCH 05/16] drm/amd/display: Adding flag for forced MST blocked discovery Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 06/16] drm/amd/display: Read DP tunneling support only for DPIA endpoints Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 07/16] drm/amd/display: always blank stream before disable crtc Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 08/16] drm/amd/display: disabling p-state checks for DCN31 and DCN314 Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 09/16] drm/amd/display: Update SPL Taps Required For Integer Scaling Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 10/16] drm/amd/display: Use region6 size in fw_meta_info Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 11/16] drm/amd/display: Handle dml allocation failure to avoid crash Hamza Mahfooz
2024-11-05 20:22 ` Hamza Mahfooz [this message]
2024-11-05 20:22 ` [PATCH 13/16] drm/amd/display: update pipe selection policy to check head pipe Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 14/16] drm/amd/display: Remove unused code Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 15/16] drm/amd/display: Adjust VSDB parser for replay feature Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 16/16] drm/amd/display: 3.2.309 Hamza Mahfooz

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=20241105202341.154036-13-hamza.mahfooz@amd.com \
    --to=hamza.mahfooz@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=austin.zheng@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=dillon.varone@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=rodrigo.siqueira@amd.com \
    --cc=roman.li@amd.com \
    --cc=solomon.chiu@amd.com \
    --cc=stable@vger.kernel.org \
    --cc=sunpeng.li@amd.com \
    --cc=wayne.lin@amd.com \
    --cc=zaeem.mohamed@amd.com \
    /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