bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-0937-drm-vc4-crtc-Move-assigned_channel-to-a-variable.patch
1 From f3c6acc345113c57011f2b1c8421e6cf78f0bc30 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 17 Feb 2023 13:39:13 +0100
4 Subject: [PATCH] drm/vc4: crtc: Move assigned_channel to a variable
5
6 We access multiple times the vc4_crtc_state->assigned_channel variable
7 in the vc4_crtc_get_scanout_position() function, so let's store it in a
8 local variable.
9
10 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
11 ---
12 drivers/gpu/drm/vc4/vc4_crtc.c | 7 ++++---
13 1 file changed, 4 insertions(+), 3 deletions(-)
14
15 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
16 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
17 @@ -104,6 +104,7 @@ static bool vc4_crtc_get_scanout_positio
18 struct vc4_hvs *hvs = vc4->hvs;
19 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
20 struct vc4_crtc_state *vc4_crtc_state = to_vc4_crtc_state(crtc->state);
21 + unsigned int channel = vc4_crtc_state->assigned_channel;
22 unsigned int cob_size;
23 u32 val;
24 int fifo_lines;
25 @@ -120,7 +121,7 @@ static bool vc4_crtc_get_scanout_positio
26 * Read vertical scanline which is currently composed for our
27 * pixelvalve by the HVS, and also the scaler status.
28 */
29 - val = HVS_READ(SCALER_DISPSTATX(vc4_crtc_state->assigned_channel));
30 + val = HVS_READ(SCALER_DISPSTATX(channel));
31
32 /* Get optional system timestamp after query. */
33 if (etime)
34 @@ -136,11 +137,11 @@ static bool vc4_crtc_get_scanout_positio
35 *vpos /= 2;
36
37 /* Use hpos to correct for field offset in interlaced mode. */
38 - if (vc4_hvs_get_fifo_frame_count(hvs, vc4_crtc_state->assigned_channel) % 2)
39 + if (vc4_hvs_get_fifo_frame_count(hvs, channel) % 2)
40 *hpos += mode->crtc_htotal / 2;
41 }
42
43 - cob_size = vc4_crtc_get_cob_allocation(vc4, vc4_crtc_state->assigned_channel);
44 + cob_size = vc4_crtc_get_cob_allocation(vc4, channel);
45 /* This is the offset we need for translating hvs -> pv scanout pos. */
46 fifo_lines = cob_size / mode->crtc_hdisplay;
47