Skip to content

Commit 01a9079

Browse files
MarijnS95lumag
authored andcommitted
drm/msm/dsi: Remove useless math in DSC calculations
Multiplying a value by 2 and adding 1 to it always results in a value that is uneven, and that 1 gets truncated immediately when performing integer division by 2 again. There is no "rounding" possible here. After that target_bpp_x16 is used to store a multiplication of bits_per_pixel by 16 which is only ever read to immediately be divided by 16 again, and is elided in much the same way. Fixes: b908032 ("drm/msm/dsi: add support for dsc data") Reviewed-by: Abhinav Kumar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Marijn Suijten <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/508932/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 572e9fd commit 01a9079

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

drivers/gpu/drm/msm/dsi/dsi_host.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
17621762
int hrd_delay;
17631763
int pre_num_extra_mux_bits, num_extra_mux_bits;
17641764
int slice_bits;
1765-
int target_bpp_x16;
17661765
int data;
17671766
int final_value, final_scale;
17681767
int i;
@@ -1842,14 +1841,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
18421841
data = 2048 * (dsc->rc_model_size - dsc->initial_offset + num_extra_mux_bits);
18431842
dsc->slice_bpg_offset = DIV_ROUND_UP(data, groups_total);
18441843

1845-
/* bpp * 16 + 0.5 */
1846-
data = dsc->bits_per_pixel * 16;
1847-
data *= 2;
1848-
data++;
1849-
data /= 2;
1850-
target_bpp_x16 = data;
1851-
1852-
data = (dsc->initial_xmit_delay * target_bpp_x16) / 16;
1844+
data = dsc->initial_xmit_delay * dsc->bits_per_pixel;
18531845
final_value = dsc->rc_model_size - data + num_extra_mux_bits;
18541846
dsc->final_offset = final_value;
18551847

0 commit comments

Comments
 (0)