Skip to content

Commit

Permalink
drm/msm/dsi: Use DIV_ROUND_UP instead of conditional increment on modulo
Browse files Browse the repository at this point in the history
[ Upstream commit 1e81961 ]

This exact same math is used to compute bytes_in_slice above in
dsi_update_dsc_timing(), also used to fill slice_chunk_size.

Fixes: b908032 ("drm/msm/dsi: add support for dsc data")
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Patchwork: https://patchwork.freedesktop.org/patch/508935/
Link: https://lore.kernel.org/r/20221026182824.876933-4-marijn.suijten@somainline.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
MarijnS95 authored and gregkh committed Dec 31, 2022
1 parent f0282e1 commit f5bf0e5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/drm/msm/dsi/dsi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1807,9 +1807,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
* params are calculated
*/
groups_per_line = DIV_ROUND_UP(dsc->slice_width, 3);
dsc->slice_chunk_size = dsc->slice_width * dsc->bits_per_pixel / 8;
if ((dsc->slice_width * dsc->bits_per_pixel) % 8)
dsc->slice_chunk_size++;
dsc->slice_chunk_size = DIV_ROUND_UP(dsc->slice_width * dsc->bits_per_pixel, 8);

/* rbs-min */
min_rate_buffer_size = dsc->rc_model_size - dsc->initial_offset +
Expand Down

0 comments on commit f5bf0e5

Please sign in to comment.