Skip to content

Commit d0c2980

Browse files
Wenjing Liugregkh
authored andcommitted
drm/amd/display: fix image corruption with ODM 2:1 DSC 2 slice
[ Upstream commit df8e34a ] [why] When combining two or more pipes in DSC mode, there will always be more than 1 slice per line. In this case, as per DSC rules, the sink device is expecting that the ICH is reset at the end of each slice line (i.e. ICH_RESET_AT_END_OF_LINE must be configured based on the number of slices at the output of ODM). It is recommended that software set ICH_RESET_AT_END_OF_LINE = 0xF for each DSC in the ODM combine. However the current code only set ICH_RESET_AT_END_OF_LINE = 0xF when number of slice per DSC engine is greater than 1 instead of number of slice per output after ODM combine. [how] Add is_odm in dsc config. Set ICH_RESET_AT_END_OF_LINE = 0xF if either is_odm or number of slice per DSC engine is greater than 1. Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com> Reviewed-by: Nikola Cornij <Nikola.Cornij@amd.com> Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f211830 commit d0c2980

4 files changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ void dp_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
400400
dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom;
401401
dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
402402
dsc_cfg.color_depth = stream->timing.display_color_depth;
403+
dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
403404
dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
404405
ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
405406
dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
@@ -504,6 +505,7 @@ bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool enable)
504505
dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom;
505506
dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
506507
dsc_cfg.color_depth = stream->timing.display_color_depth;
508+
dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
507509
dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
508510

509511
DC_LOG_DSC(" ");

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ static bool dsc_prepare_config(const struct dsc_config *dsc_cfg, struct dsc_reg_
351351
dsc_reg_vals->pps.block_pred_enable = dsc_cfg->dc_dsc_cfg.block_pred_enable;
352352
dsc_reg_vals->pps.line_buf_depth = dsc_cfg->dc_dsc_cfg.linebuf_depth;
353353
dsc_reg_vals->alternate_ich_encoding_en = dsc_reg_vals->pps.dsc_version_minor == 1 ? 0 : 1;
354+
dsc_reg_vals->ich_reset_at_eol = (dsc_cfg->is_odm || dsc_reg_vals->num_slices_h > 1) ? 0xF : 0;
354355

355356
// TODO: in addition to validating slice height (pic height must be divisible by slice height),
356357
// see what happens when the same condition doesn't apply for slice_width/pic_width.
@@ -513,7 +514,6 @@ static void dsc_update_from_dsc_parameters(struct dsc_reg_values *reg_vals, cons
513514
reg_vals->pps.rc_buf_thresh[i] = reg_vals->pps.rc_buf_thresh[i] >> 6;
514515

515516
reg_vals->rc_buffer_model_size = dsc_params->rc_buffer_model_size;
516-
reg_vals->ich_reset_at_eol = reg_vals->num_slices_h == 1 ? 0 : 0xf;
517517
}
518518

519519
static void dsc_write_to_registers(struct display_stream_compressor *dsc, const struct dsc_reg_values *reg_vals)

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,7 @@ static bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx)
22752275
+ stream->timing.v_border_bottom;
22762276
dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
22772277
dsc_cfg.color_depth = stream->timing.display_color_depth;
2278+
dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
22782279
dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
22792280
dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
22802281

drivers/gpu/drm/amd/display/dc/inc/hw/dsc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct dsc_config {
3636
uint32_t pic_height;
3737
enum dc_pixel_encoding pixel_encoding;
3838
enum dc_color_depth color_depth; /* Bits per component */
39+
bool is_odm;
3940
struct dc_dsc_config dc_dsc_cfg;
4041
};
4142

0 commit comments

Comments
 (0)