All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@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>,
	Daniel Wheeler <daniel.wheeler@amd.com>, Ray Wu <Ray.Wu@amd.com>,
	Alex Hung <alex.hung@amd.com>,
	Navid Assadian <Navid.Assadian@amd.com>,
	Samson Tam <samson.tam@amd.com>
Subject: [PATCH 13/24] drm/amd/display: Do not bypass chroma scaling in 1:1 case
Date: Wed, 28 May 2025 10:49:08 +0800	[thread overview]
Message-ID: <20250528025204.79578-14-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20250528025204.79578-1-Wayne.Lin@amd.com>

From: Navid Assadian <Navid.Assadian@amd.com>

[Why]
When doing 2:1 downscaling on a YUV sub-sampled format, the chroma
scaling ratio is 1:1. Since chroma has cositing, it is needed to do
scaling on the chroma plane(s) and not to bypass chroma scaling.

[How]
Do not set the chroma taps to one when the chroma ratio is identity
and the input format is a sub-sampled YUV format.

Reviewed-by: Samson Tam <samson.tam@amd.com>
Signed-off-by: Navid Assadian <Navid.Assadian@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
---
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c | 28 +++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c
index e0008c5f08ad..d5f3bcb68d53 100644
--- a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c
+++ b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c
@@ -884,7 +884,9 @@ static bool spl_get_isharp_en(struct spl_in *spl_in,
 
 /* Calculate number of tap with adaptive scaling off */
 static void spl_get_taps_non_adaptive_scaler(
-	  struct spl_scratch *spl_scratch, const struct spl_taps *in_taps, bool always_scale)
+		struct spl_scratch *spl_scratch,
+		const struct spl_taps *in_taps,
+		bool is_subsampled)
 {
 	bool check_max_downscale = false;
 
@@ -945,14 +947,15 @@ static void spl_get_taps_non_adaptive_scaler(
 	SPL_ASSERT(check_max_downscale);
 
 
-	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz) && !always_scale)
+	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz))
 		spl_scratch->scl_data.taps.h_taps = 1;
-	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert) && !always_scale)
+	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert))
 		spl_scratch->scl_data.taps.v_taps = 1;
-	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c) && !always_scale)
+	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c) && !is_subsampled)
 		spl_scratch->scl_data.taps.h_taps_c = 1;
-	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c) && !always_scale)
+	if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c) && !is_subsampled)
 		spl_scratch->scl_data.taps.v_taps_c = 1;
+
 }
 
 /* Calculate optimal number of taps */
@@ -965,15 +968,13 @@ static bool spl_get_optimal_number_of_taps(
 	unsigned int max_taps_y, max_taps_c;
 	unsigned int min_taps_y, min_taps_c;
 	enum lb_memory_config lb_config;
-	bool skip_easf     = false;
-	bool always_scale  = spl_in->basic_out.always_scale;
+	bool skip_easf          = false;
 	bool is_subsampled = spl_is_subsampled_format(spl_in->basic_in.format);
 
-
 	if (spl_scratch->scl_data.viewport.width > spl_scratch->scl_data.h_active &&
 		max_downscale_src_width != 0 &&
 		spl_scratch->scl_data.viewport.width > max_downscale_src_width) {
-		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, always_scale);
+		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, is_subsampled);
 		*enable_easf_v = false;
 		*enable_easf_h = false;
 		*enable_isharp = false;
@@ -982,7 +983,7 @@ static bool spl_get_optimal_number_of_taps(
 
 	/* Disable adaptive scaler and sharpener when integer scaling is enabled */
 	if (spl_in->scaling_quality.integer_scaling) {
-		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, always_scale);
+		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, is_subsampled);
 		*enable_easf_v = false;
 		*enable_easf_h = false;
 		*enable_isharp = false;
@@ -997,8 +998,9 @@ static bool spl_get_optimal_number_of_taps(
 	 * From programming guide: taps = min{ ceil(2*H_RATIO,1), 8} for downscaling
 	 * taps = 4 for upscaling
 	 */
-	if (skip_easf)
-		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, always_scale);
+	if (skip_easf) {
+		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, is_subsampled);
+	}
 	else {
 		if (spl_is_video_format(spl_in->basic_in.format)) {
 			spl_scratch->scl_data.taps.h_taps = 6;
@@ -1124,7 +1126,6 @@ static bool spl_get_optimal_number_of_taps(
 			(IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert))) {
 			spl_scratch->scl_data.taps.h_taps = 1;
 			spl_scratch->scl_data.taps.v_taps = 1;
-
 			if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c) && !is_subsampled)
 				spl_scratch->scl_data.taps.h_taps_c = 1;
 
@@ -1149,6 +1150,7 @@ static bool spl_get_optimal_number_of_taps(
 			if ((!*enable_easf_v) && !is_subsampled &&
 				(IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c)))
 				spl_scratch->scl_data.taps.v_taps_c = 1;
+
 		}
 	}
 	return true;
-- 
2.43.0


  parent reply	other threads:[~2025-05-28  2:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28  2:48 [PATCH 00/24] DC Patches June 2nd, 2025 Wayne Lin
2025-05-28  2:48 ` [PATCH 01/24] drm/amd/display: [FW Promotion] Release 0.1.11.0 Wayne Lin
2025-05-28  2:48 ` [PATCH 02/24] drm/amd/display: Re-order FAMS2 sub commands Wayne Lin
2025-05-28  2:48 ` [PATCH 03/24] drm/amd/display: DML21 Fixes Wayne Lin
2025-05-28  2:48 ` [PATCH 04/24] drm/amd/display: Support OLED SDR with AMD ABC Wayne Lin
2025-05-28  2:49 ` [PATCH 05/24] drm/amd/display: move RMCM programming Wayne Lin
2025-05-28  2:49 ` [PATCH 06/24] drm/amd/display: Indirect buffer transport for FAMS2 commands Wayne Lin
2025-05-28  2:49 ` [PATCH 07/24] drm/amd/display: Drop unnecessary `amdgpu` prefix Wayne Lin
2025-05-28  2:49 ` [PATCH 08/24] drm/amd/display: Call setup_stream_attribute after stream enc clk is ungated Wayne Lin
2025-05-28  2:49 ` [PATCH 09/24] drm/amd/display: Correct non-OLED pre_T11_delay Wayne Lin
2025-05-28  2:49 ` [PATCH 10/24] drm/amd/display: Avoid trying AUX transactions on disconnected ports Wayne Lin
2025-05-28  2:49 ` [PATCH 11/24] drm/amd/display: Add disconnect case on dongle check Wayne Lin
2025-05-28  2:49 ` [PATCH 12/24] drm/amd/display: Add DML path for FAMS methods Wayne Lin
2025-05-28  2:49 ` Wayne Lin [this message]
2025-05-28  2:49 ` [PATCH 14/24] drm/amd/display: Add support for 2nd sharpening range Wayne Lin
2025-05-28  2:49 ` [PATCH 15/24] drm/amd/display: Move vmalloc include to header file Wayne Lin
2025-05-28  2:49 ` [PATCH 16/24] drm/amd/display: [FW Promotion] Release 0.1.12.0 Wayne Lin
2025-05-28  2:49 ` [PATCH 17/24] drm/amd/display: Promote DAL to 3.2.335 Wayne Lin
2025-05-28  2:49 ` [PATCH 18/24] drm/amd/display: Update DMCUB loading sequence for DCN3.5 Wayne Lin
2025-05-28  2:49 ` [PATCH 19/24] drm/amd/display: replace fast_validate with enum dc_validate_mode Wayne Lin
2025-05-28  2:49 ` [PATCH 20/24] drm/amd/display: Avoid calling blank_stream() twice Wayne Lin
2025-05-28  2:49 ` [PATCH 21/24] drm/amd/display: Use DC log instead of using DM error msg Wayne Lin
2025-05-28  2:49 ` [PATCH 22/24] drm/amd/display: Add debugging message for brightness caps Wayne Lin
2025-05-28  2:49 ` [PATCH 23/24] drm/amd/display: Fix default DC and AC levels Wayne Lin
2025-05-28  2:49 ` [PATCH 24/24] drm/amd/display: Promote DAL to 3.2.336 Wayne Lin
2025-06-02 13:24 ` [PATCH 00/24] DC Patches June 2nd, 2025 Wheeler, Daniel

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=20250528025204.79578-14-Wayne.Lin@amd.com \
    --to=wayne.lin@amd.com \
    --cc=Navid.Assadian@amd.com \
    --cc=Ray.Wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=samson.tam@amd.com \
    --cc=sunpeng.li@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.