bcm27xx: switch to kernel v6.1
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0871-drm-vc4-kms-Use-maximum-FIFO-load-for-the-HVS-clock-.patch
1 From 70887a91ef710cada7d43ac2ec93280bb53d540f Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 13 Apr 2022 16:22:49 +0200
4 Subject: [PATCH] drm/vc4: kms: Use maximum FIFO load for the HVS clock
5 rate
6
7 The core clock computation takes into account both the load due to the
8 input (ie, planes) and its output (ie, encoders).
9
10 However, while the input load needs to consider all the planes, and thus
11 sum all of their associated loads, the output happens mostly in
12 parallel.
13
14 Therefore, we need to consider only the maximum of all the output loads,
15 and not the sum like we were doing. This resulted in a clock rate way
16 too high which could be discarded for being too high by the clock
17 framework.
18
19 Since recent changes, the clock framework will even downright reject it,
20 leading to a core clock being too low for its current needs.
21
22 Fixes: 16e101051f32 ("drm/vc4: Increase the core clock based on HVS load")
23 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
24 ---
25 drivers/gpu/drm/vc4/vc4_kms.c | 4 +++-
26 1 file changed, 3 insertions(+), 1 deletion(-)
27
28 --- a/drivers/gpu/drm/vc4/vc4_kms.c
29 +++ b/drivers/gpu/drm/vc4/vc4_kms.c
30 @@ -939,7 +939,9 @@ vc4_core_clock_atomic_check(struct drm_a
31 continue;
32
33 num_outputs++;
34 - cob_rate += hvs_new_state->fifo_state[i].fifo_load;
35 + cob_rate = max_t(unsigned long,
36 + hvs_new_state->fifo_state[i].fifo_load,
37 + cob_rate);
38 }
39
40 pixel_rate = load_state->hvs_load;