Skip to content

Commit d74bcf4

Browse files
Timur Kristófgregkh
authored andcommitted
drm/amd/display: Properly disable scaling on DCE6
[ Upstream commit a7dc87f ] 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: b70aaf5 ("drm/amd/display: dce_transform: add DCE6 specific macros,functions") Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Timur Kristóf <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 00f1bd5 commit d74bcf4

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

drivers/gpu/drm/amd/display/dc/dce/dce_transform.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,21 @@ static bool dce60_setup_scaling_configuration(
154154
REG_SET(SCL_BYPASS_CONTROL, 0, SCL_BYPASS_MODE, 0);
155155

156156
if (data->taps.h_taps + data->taps.v_taps <= 2) {
157-
/* Set bypass */
158-
159-
/* DCE6 has no SCL_MODE register, skip scale mode programming */
157+
/* Disable scaler functionality */
158+
REG_WRITE(SCL_SCALER_ENABLE, 0);
160159

160+
/* Clear registers that can cause glitches even when the scaler is off */
161+
REG_WRITE(SCL_TAP_CONTROL, 0);
162+
REG_WRITE(SCL_AUTOMATIC_MODE_CONTROL, 0);
163+
REG_WRITE(SCL_F_SHARP_CONTROL, 0);
161164
return false;
162165
}
163166

164167
REG_SET_2(SCL_TAP_CONTROL, 0,
165168
SCL_H_NUM_OF_TAPS, data->taps.h_taps - 1,
166169
SCL_V_NUM_OF_TAPS, data->taps.v_taps - 1);
167170

168-
/* DCE6 has no SCL_MODE register, skip scale mode programming */
171+
REG_WRITE(SCL_SCALER_ENABLE, 1);
169172

170173
/* DCE6 has no SCL_BOUNDARY_MODE bit, skip replace out of bound pixels */
171174

@@ -502,6 +505,8 @@ static void dce60_transform_set_scaler(
502505
REG_SET(DC_LB_MEM_SIZE, 0,
503506
DC_LB_MEM_SIZE, xfm_dce->lb_memory_size);
504507

508+
REG_WRITE(SCL_UPDATE, 0x00010000);
509+
505510
/* Clear SCL_F_SHARP_CONTROL value to 0 */
506511
REG_WRITE(SCL_F_SHARP_CONTROL, 0);
507512

@@ -564,6 +569,8 @@ static void dce60_transform_set_scaler(
564569
/* DCE6 has no SCL_COEF_UPDATE_COMPLETE bit to flip to new coefficient memory */
565570

566571
/* DCE6 DATA_FORMAT register does not support ALPHA_EN */
572+
573+
REG_WRITE(SCL_UPDATE, 0);
567574
}
568575
#endif
569576

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
SRI(SCL_COEF_RAM_TAP_DATA, SCL, id), \
156156
SRI(VIEWPORT_START, SCL, id), \
157157
SRI(VIEWPORT_SIZE, SCL, id), \
158+
SRI(SCL_SCALER_ENABLE, SCL, id), \
158159
SRI(SCL_HORZ_FILTER_INIT_RGB_LUMA, SCL, id), \
159160
SRI(SCL_HORZ_FILTER_INIT_CHROMA, SCL, id), \
160161
SRI(SCL_HORZ_FILTER_SCALE_RATIO, SCL, id), \
@@ -592,6 +593,7 @@ struct dce_transform_registers {
592593
uint32_t SCL_VERT_FILTER_SCALE_RATIO;
593594
uint32_t SCL_HORZ_FILTER_INIT;
594595
#if defined(CONFIG_DRM_AMD_DC_SI)
596+
uint32_t SCL_SCALER_ENABLE;
595597
uint32_t SCL_HORZ_FILTER_INIT_RGB_LUMA;
596598
uint32_t SCL_HORZ_FILTER_INIT_CHROMA;
597599
#endif

0 commit comments

Comments
 (0)