Skip to contentSkip to conversation

DC: Properly disable scaling on DCE6

PATCH In review Timur Kristóf 2 participants 9 messages Sep 25, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover DC: Properly disable scaling on DCE6

This series fixes visual glitches on systems with SI GPUs where the BIOS sets up a default mode with scaling. Alex was kind enough to give me an extra register definition that can actually bypass the scaler on DCE6.

Additionally, while testing the scaler under KDE, I noticed that it doesn't work with fractional scaling at high resolutions with the current register programming. It causes serious visual distortion when enabling the vertical filter. So, let's disable the scaler on DCE6 until we figure out how to properly program it.

Alex Deucher (1):
drm/amdgpu: Add additional DCE6 SCL registers

Timur Kristóf (4):
drm/amd/display: Add missing DCE6 SCL_HORZ_FILTER_INIT* SRIs drm/amd/display: Properly clear SCL_*_FILTER_CONTROL on DCE6 drm/amd/display: Properly disable scaling on DCE6 drm/amd/display: Disable scaling on DCE6 for now

 .../drm/amd/display/dc/dce/dce_transform.c    | 21 ++++++++++++-------
 .../drm/amd/display/dc/dce/dce_transform.h    |  4 ++++
 .../dc/resource/dce60/dce60_resource.c        |  4 ++--
 .../drm/amd/include/asic_reg/dce/dce_6_0_d.h  |  7 +++++++
 .../include/asic_reg/dce/dce_6_0_sh_mask.h    |  2 ++
 5 files changed, 28 insertions(+), 10 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/5 drm/amdgpu: Add additional DCE6 SCL registers

From: Alex Deucher <[email protected]>

Fixes 102b2f587ac8 ("drm/amd/display: dce_transform: DCE6 Scaling Horizontal Filter Init (v2)")
---
 drivers/gpu/drm/amd/include/asic_reg/dce/dce_6_0_d.h       | 7 +++++++
 drivers/gpu/drm/amd/include/asic_reg/dce/dce_6_0_sh_mask.h | 2 ++
 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/dce/dce_6_0_d.h +7 -0
index 9de01ae574c0..067eddd9c62d 100644
@@ -4115,6 +4115,7 @@
 #define mmSCL0_SCL_COEF_RAM_CONFLICT_STATUS 0x1B55
 #define mmSCL0_SCL_COEF_RAM_SELECT 0x1B40
 #define mmSCL0_SCL_COEF_RAM_TAP_DATA 0x1B41
+#define mmSCL0_SCL_SCALER_ENABLE 0x1B42
 #define mmSCL0_SCL_CONTROL 0x1B44
 #define mmSCL0_SCL_DEBUG 0x1B6A
 #define mmSCL0_SCL_DEBUG2 0x1B69
@@ -4144,6 +4145,7 @@
 #define mmSCL1_SCL_COEF_RAM_CONFLICT_STATUS 0x1E55
 #define mmSCL1_SCL_COEF_RAM_SELECT 0x1E40
 #define mmSCL1_SCL_COEF_RAM_TAP_DATA 0x1E41
+#define mmSCL1_SCL_SCALER_ENABLE 0x1E42
 #define mmSCL1_SCL_CONTROL 0x1E44
 #define mmSCL1_SCL_DEBUG 0x1E6A
 #define mmSCL1_SCL_DEBUG2 0x1E69
@@ -4173,6 +4175,7 @@
 #define mmSCL2_SCL_COEF_RAM_CONFLICT_STATUS 0x4155
 #define mmSCL2_SCL_COEF_RAM_SELECT 0x4140
 #define mmSCL2_SCL_COEF_RAM_TAP_DATA 0x4141
+#define mmSCL2_SCL_SCALER_ENABLE 0x4142
 #define mmSCL2_SCL_CONTROL 0x4144
 #define mmSCL2_SCL_DEBUG 0x416A
 #define mmSCL2_SCL_DEBUG2 0x4169
@@ -4202,6 +4205,7 @@
 #define mmSCL3_SCL_COEF_RAM_CONFLICT_STATUS 0x4455
 #define mmSCL3_SCL_COEF_RAM_SELECT 0x4440
 #define mmSCL3_SCL_COEF_RAM_TAP_DATA 0x4441
+#define mmSCL3_SCL_SCALER_ENABLE 0x4442
 #define mmSCL3_SCL_CONTROL 0x4444
 #define mmSCL3_SCL_DEBUG 0x446A
 #define mmSCL3_SCL_DEBUG2 0x4469
@@ -4231,6 +4235,7 @@
 #define mmSCL4_SCL_COEF_RAM_CONFLICT_STATUS 0x4755
 #define mmSCL4_SCL_COEF_RAM_SELECT 0x4740
 #define mmSCL4_SCL_COEF_RAM_TAP_DATA 0x4741
+#define mmSCL4_SCL_SCALER_ENABLE 0x4742
 #define mmSCL4_SCL_CONTROL 0x4744
 #define mmSCL4_SCL_DEBUG 0x476A
 #define mmSCL4_SCL_DEBUG2 0x4769
@@ -4260,6 +4265,7 @@
 #define mmSCL5_SCL_COEF_RAM_CONFLICT_STATUS 0x4A55
 #define mmSCL5_SCL_COEF_RAM_SELECT 0x4A40
 #define mmSCL5_SCL_COEF_RAM_TAP_DATA 0x4A41
+#define mmSCL5_SCL_SCALER_ENABLE 0x4A42
 #define mmSCL5_SCL_CONTROL 0x4A44
 #define mmSCL5_SCL_DEBUG 0x4A6A
 #define mmSCL5_SCL_DEBUG2 0x4A69
@@ -4287,6 +4293,7 @@
 #define mmSCL_COEF_RAM_CONFLICT_STATUS 0x1B55
 #define mmSCL_COEF_RAM_SELECT 0x1B40
 #define mmSCL_COEF_RAM_TAP_DATA 0x1B41
+#define mmSCL_SCALER_ENABLE 0x1B42
 #define mmSCL_CONTROL 0x1B44
 #define mmSCL_DEBUG 0x1B6A
 #define mmSCL_DEBUG2 0x1B69
drivers/gpu/drm/amd/include/asic_reg/dce/dce_6_0_sh_mask.h +2 -0
index 2d6a598a6c25..9317a7afa621 100644
@@ -8650,6 +8650,8 @@
 #define REGAMMA_LUT_INDEX__REGAMMA_LUT_INDEX__SHIFT 0x00000000
 #define REGAMMA_LUT_WRITE_EN_MASK__REGAMMA_LUT_WRITE_EN_MASK_MASK 0x00000007L
 #define REGAMMA_LUT_WRITE_EN_MASK__REGAMMA_LUT_WRITE_EN_MASK__SHIFT 0x00000000
+#define SCL_SCALER_ENABLE__SCL_SCALE_EN_MASK 0x00000001L
+#define SCL_SCALER_ENABLE__SCL_SCALE_EN__SHIFT 0x00000000
 #define SCL_ALU_CONTROL__SCL_ALU_DISABLE_MASK 0x00000001L
 #define SCL_ALU_CONTROL__SCL_ALU_DISABLE__SHIFT 0x00000000
 #define SCL_BYPASS_CONTROL__SCL_BYPASS_MODE_MASK 0x00000003L
Signature · 1 line
2.51.0
#2 lore raw

PATCH 2/5 drm/amd/display: Add missing DCE6 SCL_HORZ_FILTER_INIT* SRIs

In reply to Timur Kristóf

Without these, it's impossible to program these registers.

Fixes 102b2f587ac8 ("drm/amd/display: dce_transform: DCE6 Scaling Horizontal Filter Init (v2)")
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +2 -0
index cbce194ec7b8..ff746fba850b 100644
@@ -155,6 +155,8 @@
 	SRI(SCL_COEF_RAM_TAP_DATA, SCL, id), \
 	SRI(VIEWPORT_START, SCL, id), \
 	SRI(VIEWPORT_SIZE, SCL, id), \
+	SRI(SCL_HORZ_FILTER_INIT_RGB_LUMA, SCL, id), \
+	SRI(SCL_HORZ_FILTER_INIT_CHROMA, SCL, id), \
 	SRI(SCL_HORZ_FILTER_SCALE_RATIO, SCL, id), \
 	SRI(SCL_VERT_FILTER_SCALE_RATIO, SCL, id), \
 	SRI(SCL_VERT_FILTER_INIT, SCL, id), \
Signature · 1 line
2.51.0
#3 lore raw

Re: [PATCH 2/5] drm/amd/display: Add missing DCE6 SCL_HORZ_FILTER_INIT* SRIs

Quoted 5 lines · Timur Kristóf

Without these, it's impossible to program these registers.

Fixes 102b2f587ac8 ("drm/amd/display: dce_transform: DCE6 Scaling Horizontal Filter Init (v2)")

I think it would make sense to just squash patches 2-4 together. Other than that, these look good to me.

Alex

Quoted 20 lines
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +2 -1
index cbce194ec7b8..ff746fba850b 100644
@@ -155,6 +155,8 @@
        SRI(SCL_COEF_RAM_TAP_DATA, SCL, id), \
        SRI(VIEWPORT_START, SCL, id), \
        SRI(VIEWPORT_SIZE, SCL, id), \
+       SRI(SCL_HORZ_FILTER_INIT_RGB_LUMA, SCL, id), \
+       SRI(SCL_HORZ_FILTER_INIT_CHROMA, SCL, id), \
        SRI(SCL_HORZ_FILTER_SCALE_RATIO, SCL, id), \
        SRI(SCL_VERT_FILTER_SCALE_RATIO, SCL, id), \
        SRI(SCL_VERT_FILTER_INIT, SCL, id), \
--

2.51.0

#4 lore raw

Re: [PATCH 2/5] drm/amd/display: Add missing DCE6 SCL_HORZ_FILTER_INIT* SRIs

Alex Deucher <[email protected]> ezt írta (időpont: 2025. szept. 25., Csü 23:28):

Quoted 5 lines
Quoted 3 lines · Timur Kristóf

Without these, it's impossible to program these registers.

Quoted 9 lines
Quoted 1 line
Fixes 102b2f587ac8 ("drm/amd/display: dce_transform: DCE6 Scaling

Horizontal Filter Init (v2)")

Quoted 1 line

I think it would make sense to just squash patches 2-4 together. Other than that, these look good to me.

Alex

They make more sense to me individually but we can squash them too. Do you prefer that I send another series with these squashed or will you squash them when applying them?

Quoted 22 lines

Review

Quoted 5 lines
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.h

Quoted 15 lines

index cbce194ec7b8..ff746fba850b 100644

drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +2 -1
@@ -155,6 +155,8 @@
        SRI(SCL_COEF_RAM_TAP_DATA, SCL, id), \
        SRI(VIEWPORT_START, SCL, id), \
        SRI(VIEWPORT_SIZE, SCL, id), \
+       SRI(SCL_HORZ_FILTER_INIT_RGB_LUMA, SCL, id), \
+       SRI(SCL_HORZ_FILTER_INIT_CHROMA, SCL, id), \
        SRI(SCL_HORZ_FILTER_SCALE_RATIO, SCL, id), \
        SRI(SCL_VERT_FILTER_SCALE_RATIO, SCL, id), \
        SRI(SCL_VERT_FILTER_INIT, SCL, id), \
--

2.51.0

Reviewed-by
#5 lore raw

Re: [PATCH 2/5] drm/amd/display: Add missing DCE6 SCL_HORZ_FILTER_INIT* SRIs

Quoted 12 lines · Timur Kristóf

Alex Deucher <[email protected]> ezt írta (időpont: 2025. szept. 25., Csü 23:28):

Quoted 8 lines · Timur Kristóf
Quoted 5 lines

Without these, it's impossible to program these registers.

Fixes 102b2f587ac8 ("drm/amd/display: dce_transform: DCE6 Scaling Horizontal Filter Init (v2)")
Quoted 7 lines
Quoted 4 lines

I think it would make sense to just squash patches 2-4 together. Other than that, these look good to me.

Alex

They make more sense to me individually but we can squash them too. Do you prefer that I send another series with these squashed or will you squash them when applying them?

I guess they make sense as is from a Fixes tag perspective, but from an overall functional perspective it's easier to just have one patch. I'll just apply them as is.
Series is:

Alex

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines


---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +2 -1
index cbce194ec7b8..ff746fba850b 100644
@@ -155,6 +155,8 @@
        SRI(SCL_COEF_RAM_TAP_DATA, SCL, id), \
        SRI(VIEWPORT_START, SCL, id), \
        SRI(VIEWPORT_SIZE, SCL, id), \
+       SRI(SCL_HORZ_FILTER_INIT_RGB_LUMA, SCL, id), \
+       SRI(SCL_HORZ_FILTER_INIT_CHROMA, SCL, id), \
        SRI(SCL_HORZ_FILTER_SCALE_RATIO, SCL, id), \
        SRI(SCL_VERT_FILTER_SCALE_RATIO, SCL, id), \
        SRI(SCL_VERT_FILTER_INIT, SCL, id), \
--

2.51.0

#6 lore raw

PATCH 3/5 drm/amd/display: Properly clear SCL_*_FILTER_CONTROL on DCE6

In reply to Timur Kristóf

Previously, the code would set a bit field which didn't exist on DCE6 so it would be effectively a no-op.

Fixes b70aaf5586f2 ("drm/amd/display: dce_transform: add DCE6 specific macros,functions")
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +2 -4
index 2b1673d69ea8..e5c2fb134d14 100644
@@ -527,8 +527,7 @@ static void dce60_transform_set_scaler(
 		if (coeffs_v != xfm_dce->filter_v || coeffs_h != xfm_dce->filter_h) {
 			/* 4. Program vertical filters */
 			if (xfm_dce->filter_v == NULL)
-				REG_SET(SCL_VERT_FILTER_CONTROL, 0,
-						SCL_V_2TAP_HARDCODE_COEF_EN, 0);
+				REG_WRITE(SCL_VERT_FILTER_CONTROL, 0);
 			program_multi_taps_filter(
 					xfm_dce,
 					data->taps.v_taps,
@@ -542,8 +541,7 @@ static void dce60_transform_set_scaler(
 
 			/* 5. Program horizontal filters */
 			if (xfm_dce->filter_h == NULL)
-				REG_SET(SCL_HORZ_FILTER_CONTROL, 0,
-						SCL_H_2TAP_HARDCODE_COEF_EN, 0);
+				REG_WRITE(SCL_HORZ_FILTER_CONTROL, 0);
 			program_multi_taps_filter(
 					xfm_dce,
 					data->taps.h_taps,
Signature · 1 line
2.51.0
#7 lore raw

PATCH 4/5 drm/amd/display: Properly disable scaling on DCE6

In reply to Timur Kristóf

SCL_SCALER_ENABLE can be used to enable/disable the scaler on DCE6. Program it to 0 when scaling isn't used, 1 when used. Additionally, clear some other registers when scaling is disabled and program the SCL_UPDATE register as recommended.

This fixes visible glitches for users whose BIOS sets up a mode with scaling at boot, which DC was unable to clean up.

Fixes b70aaf5586f2 ("drm/amd/display: dce_transform: add DCE6 specific macros,functions")
---
 .../gpu/drm/amd/display/dc/dce/dce_transform.c    | 15 +++++++++++----
 .../gpu/drm/amd/display/dc/dce/dce_transform.h    |  2 ++
 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +11 -4
index e5c2fb134d14..1ab5ae9b5ea5 100644
@@ -154,10 +154,13 @@ static bool dce60_setup_scaling_configuration(
 	REG_SET(SCL_BYPASS_CONTROL, 0, SCL_BYPASS_MODE, 0);
 
 	if (data->taps.h_taps + data->taps.v_taps <= 2) {
-		/* Set bypass */
-
-		/* DCE6 has no SCL_MODE register, skip scale mode programming */
+		/* Disable scaler functionality */
+		REG_WRITE(SCL_SCALER_ENABLE, 0);
 
+		/* Clear registers that can cause glitches even when the scaler is off */
+		REG_WRITE(SCL_TAP_CONTROL, 0);
+		REG_WRITE(SCL_AUTOMATIC_MODE_CONTROL, 0);
+		REG_WRITE(SCL_F_SHARP_CONTROL, 0);
 		return false;
 	}
 
@@ -165,7 +168,7 @@ static bool dce60_setup_scaling_configuration(
 			SCL_H_NUM_OF_TAPS, data->taps.h_taps - 1,
 			SCL_V_NUM_OF_TAPS, data->taps.v_taps - 1);
 
-	/* DCE6 has no SCL_MODE register, skip scale mode programming */
+	REG_WRITE(SCL_SCALER_ENABLE, 1);
 
 	/* DCE6 has no SCL_BOUNDARY_MODE bit, skip replace out of bound pixels */
 
@@ -502,6 +505,8 @@ static void dce60_transform_set_scaler(
 	REG_SET(DC_LB_MEM_SIZE, 0,
 		DC_LB_MEM_SIZE, xfm_dce->lb_memory_size);
 
+	REG_WRITE(SCL_UPDATE, 0x00010000);
+
 	/* Clear SCL_F_SHARP_CONTROL value to 0 */
 	REG_WRITE(SCL_F_SHARP_CONTROL, 0);
 
@@ -564,6 +569,8 @@ static void dce60_transform_set_scaler(
 	/* DCE6 has no SCL_COEF_UPDATE_COMPLETE bit to flip to new coefficient memory */
 
 	/* DCE6 DATA_FORMAT register does not support ALPHA_EN */
+
+	REG_WRITE(SCL_UPDATE, 0);
 }
 #endif
 
drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +2 -0
index ff746fba850b..eb716e8337e2 100644
@@ -155,6 +155,7 @@
 	SRI(SCL_COEF_RAM_TAP_DATA, SCL, id), \
 	SRI(VIEWPORT_START, SCL, id), \
 	SRI(VIEWPORT_SIZE, SCL, id), \
+	SRI(SCL_SCALER_ENABLE, SCL, id), \
 	SRI(SCL_HORZ_FILTER_INIT_RGB_LUMA, SCL, id), \
 	SRI(SCL_HORZ_FILTER_INIT_CHROMA, SCL, id), \
 	SRI(SCL_HORZ_FILTER_SCALE_RATIO, SCL, id), \
@@ -592,6 +593,7 @@ struct dce_transform_registers {
 	uint32_t SCL_VERT_FILTER_SCALE_RATIO;
 	uint32_t SCL_HORZ_FILTER_INIT;
 #if defined(CONFIG_DRM_AMD_DC_SI)
+	uint32_t SCL_SCALER_ENABLE;
 	uint32_t SCL_HORZ_FILTER_INIT_RGB_LUMA;
 	uint32_t SCL_HORZ_FILTER_INIT_CHROMA;
 #endif
Signature · 1 line
2.51.0
#8 lore raw

PATCH 5/5 drm/amd/display: Disable scaling on DCE6 for now

In reply to Timur Kristóf

Scaling doesn't work on DCE6 at the moment, the current register programming produces incorrect output when using fractional scaling (between 100-200%) on resolutions higher than 1080p.

Disable it until we figure out how to program it properly.

Fixes 7c15fd86aaec ("drm/amd/display: dc/dce: add initial DCE6 support (v10)")
---
 .../gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +2 -2
index 53c67ebe779f..b75be6ad64f6 100644
@@ -404,13 +404,13 @@ static const struct dc_plane_cap plane_cap = {
 	},
 
 	.max_upscale_factor = {
-			.argb8888 = 16000,
+			.argb8888 = 1,
 			.nv12 = 1,
 			.fp16 = 1
 	},
 
 	.max_downscale_factor = {
-			.argb8888 = 250,
+			.argb8888 = 1,
 			.nv12 = 1,
 			.fp16 = 1
 	}
Signature · 1 line
2.51.0