drm/msm/dp: ensure dsc slice width does not exceed maximum width

A dp sink can support dsc slices up to a maximum
width specified by its capabilities register.
Ensure that the calculated dsc slice width does
not exceed this value.

Change-Id: I6b9a578ef5c763259f592d59638e1b7352064d7f
Signed-off-by: Fuad Hossain <fhossain@codeaurora.org>
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
This commit is contained in:
Fuad Hossain 2019-01-30 15:16:40 -05:00 committed by Tatenda Chipeperekwa
parent c4ac38b58e
commit 81fbc4cd20

View file

@ -1530,12 +1530,14 @@ static int dp_panel_dsc_prepare_basic_params(
struct dp_dsc_slices_per_line *rec;
int slice_width;
u32 ppr = dp_mode->timing.pixel_clk_khz/1000;
int max_slice_width;
comp_info->dsc_info.slice_per_pkt = 0;
for (i = 0; i < ARRAY_SIZE(slice_per_line_tbl); i++) {
rec = &slice_per_line_tbl[i];
if ((ppr > rec->min_ppr) && (ppr <= rec->max_ppr)) {
comp_info->dsc_info.slice_per_pkt = rec->num_slices;
i++;
break;
}
}
@ -1543,9 +1545,21 @@ static int dp_panel_dsc_prepare_basic_params(
if (comp_info->dsc_info.slice_per_pkt == 0)
return -EINVAL;
max_slice_width = dp_panel->dsc_dpcd[12] * 320;
slice_width = (dp_mode->timing.h_active /
comp_info->dsc_info.slice_per_pkt);
while (slice_width >= max_slice_width) {
if (i == ARRAY_SIZE(slice_per_line_tbl))
return -EINVAL;
rec = &slice_per_line_tbl[i];
comp_info->dsc_info.slice_per_pkt = rec->num_slices;
slice_width = (dp_mode->timing.h_active /
comp_info->dsc_info.slice_per_pkt);
i++;
}
comp_info->dsc_info.block_pred_enable =
dp_panel->sink_dsc_caps.block_pred_en;
comp_info->dsc_info.vbr_enable = 0;
@ -2932,6 +2946,8 @@ struct dp_panel *dp_panel_get(struct dp_panel_in *in)
if (in->base_panel) {
memcpy(dp_panel->dpcd, in->base_panel->dpcd,
DP_RECEIVER_CAP_SIZE + 1);
memcpy(dp_panel->dsc_dpcd, in->base_panel->dsc_dpcd,
DP_RECEIVER_DSC_CAP_SIZE + 1);
memcpy(&dp_panel->link_info, &in->base_panel->link_info,
sizeof(dp_panel->link_info));
dp_panel->mst_state = in->base_panel->mst_state;