Patch "drm/msm/dpu: change _dpu_plane_calc_bw() to use u64 to avoid overflow" has been added to the 5.10-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/dpu: change _dpu_plane_calc_bw() to use u64 to avoid overflow

to the 5.10-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-dpu-change-_dpu_plane_calc_bw-to-use-u64-to-.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 97ec638293b453dc11317abca14c0d8b6054b563
Author: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
Date:   Thu Sep 7 18:26:16 2023 -0700

    drm/msm/dpu: change _dpu_plane_calc_bw() to use u64 to avoid overflow
    
    [ Upstream commit 95e681ca3b65e4ce3d2537b47672d787b7d30375 ]
    
    _dpu_plane_calc_bw() uses integer variables to calculate the bandwidth
    used during plane bandwidth calculations. However for high resolution
    displays this overflows easily and leads to below errors
    
    [dpu error]crtc83 failed performance check -7
    
    Promote the intermediate variables to u64 to avoid overflow.
    
    changes in v2:
            - change to u64 where actually needed in the math
    
    Fixes: c33b7c0389e1 ("drm/msm/dpu: add support for clk and bw scaling for display")
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Reported-by: Nia Espera <nespera@xxxxxxxxxx>
    Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/32
    Tested-by: Nia Espera <nespera@xxxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/556288/
    Link: https://lore.kernel.org/r/20230908012616.20654-1-quic_abhinavk@xxxxxxxxxxx
    Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 7ea90d25a3b69..8aa9f2335f57a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -147,6 +147,7 @@ static void _dpu_plane_calc_bw(struct drm_plane *plane,
 	const struct dpu_format *fmt = NULL;
 	struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
 	int src_width, src_height, dst_height, fps;
+	u64 plane_pixel_rate, plane_bit_rate;
 	u64 plane_prefill_bw;
 	u64 plane_bw;
 	u32 hw_latency_lines;
@@ -168,13 +169,12 @@ static void _dpu_plane_calc_bw(struct drm_plane *plane,
 	scale_factor = src_height > dst_height ?
 		mult_frac(src_height, 1, dst_height) : 1;
 
-	plane_bw =
-		src_width * mode->vtotal * fps * fmt->bpp *
-		scale_factor;
+	plane_pixel_rate = src_width * mode->vtotal * fps;
+	plane_bit_rate = plane_pixel_rate * fmt->bpp;
 
-	plane_prefill_bw =
-		src_width * hw_latency_lines * fps * fmt->bpp *
-		scale_factor * mode->vtotal;
+	plane_bw = plane_bit_rate * scale_factor;
+
+	plane_prefill_bw = plane_bw * hw_latency_lines;
 
 	do_div(plane_prefill_bw, (vbp+vpw));
 



[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