drm/rockchip: vop: fix bandwidth data overflow

Change-Id: I89df60f92f30452c1ff265ba380f6f8029d02163
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
This commit is contained in:
Mark Yao
2017-09-25 16:31:44 +08:00
committed by Huang, Tao
parent 59ad2045cb
commit ef13fd40c5

View File

@@ -1810,8 +1810,7 @@ static size_t vop_crtc_bandwidth(struct drm_crtc *crtc,
struct drm_plane_state *pstate;
struct vop_bandwidth *pbandwidth;
struct drm_plane *plane;
size_t bandwidth;
size_t max_bandwidth;
u64 bandwidth;
int i, cnt = 0;
if (!htotal || !vdisplay)
@@ -1834,13 +1833,14 @@ static size_t vop_crtc_bandwidth(struct drm_crtc *crtc,
sort(pbandwidth, cnt, sizeof(pbandwidth[0]), vop_bandwidth_cmp, NULL);
max_bandwidth = vop_calc_max_bandwidth(pbandwidth, 0, cnt, vdisplay);
bandwidth = vop_calc_max_bandwidth(pbandwidth, 0, cnt, vdisplay);
/*
* bandwidth(MB/s)
* = line_bandwidth / line_time
* = line_bandwidth(Byte) * clock(KHZ) / 1000 / htotal
*/
bandwidth = max_bandwidth * clock / 1000 / htotal;
bandwidth *= clock;
do_div(bandwidth, htotal * 1000);
return bandwidth;
}