Patch "drm/msm/dsi: Remove useless math in DSC calculations" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/msm/dsi: Remove useless math in DSC calculations

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-msm-dsi-remove-useless-math-in-dsc-calculations.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3348f21ae2cc5b4b94a0a5d1c856f69512f2eb13
Author: Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>
Date:   Wed Oct 26 20:28:15 2022 +0200

    drm/msm/dsi: Remove useless math in DSC calculations
    
    [ Upstream commit 01a907980e0be3310f18c7d4955968f3b28e7147 ]
    
    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: b9080324d6ca ("drm/msm/dsi: add support for dsc data")
    Reviewed-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/508932/
    Link: https://lore.kernel.org/r/20221026182824.876933-2-marijn.suijten@xxxxxxxxxxxxxx
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 15e108be1901..843521c9cdcf 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1849,7 +1849,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
 	int hrd_delay;
 	int pre_num_extra_mux_bits, num_extra_mux_bits;
 	int slice_bits;
-	int target_bpp_x16;
 	int data;
 	int final_value, final_scale;
 	int i;
@@ -1929,14 +1928,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
 	data = 2048 * (dsc->rc_model_size - dsc->initial_offset + num_extra_mux_bits);
 	dsc->slice_bpg_offset = DIV_ROUND_UP(data, groups_total);
 
-	/* bpp * 16 + 0.5 */
-	data = dsc->bits_per_pixel * 16;
-	data *= 2;
-	data++;
-	data /= 2;
-	target_bpp_x16 = data;
-
-	data = (dsc->initial_xmit_delay * target_bpp_x16) / 16;
+	data = dsc->initial_xmit_delay * dsc->bits_per_pixel;
 	final_value =  dsc->rc_model_size - data + num_extra_mux_bits;
 	dsc->final_offset = final_value;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux