bcm27xx: update 6.1 patches to latest version
[openwrt/staging/svanheule.git] / target / linux / bcm27xx / patches-6.1 / 950-0947-drm-vc4-hvs-Rework-LBM-alignment.patch
1 From 2834b58a3b58198e551d8461a0786b75d3d76823 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 13 Apr 2023 10:12:19 +0200
4 Subject: [PATCH] drm/vc4: hvs: Rework LBM alignment
5
6 With the introduction of the support for BCM2712, the check of whether
7 we're running on vc5 or not to compute the LBM alignment requirement
8 doesn't work anymore.
9
10 Moreover, the LBM size will need to be computed in words for the
11 BCM2712, while we've had sizes in bytes so far.
12
13 Aligning on either 64 or 32 words is thus fairly harmful on BCM2712, so
14 let's just explicitly align the size when needed, and then call
15 drm_mm_insert_node_generic() with an alignment of 1.
16
17 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
18 ---
19 drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++++--
20 1 file changed, 6 insertions(+), 2 deletions(-)
21
22 --- a/drivers/gpu/drm/vc4/vc4_plane.c
23 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
24 @@ -744,6 +744,11 @@ static int vc4_plane_allocate_lbm(struct
25 if (!lbm_size)
26 return 0;
27
28 + if (vc4->gen == VC4_GEN_5)
29 + lbm_size = ALIGN(lbm_size, 64);
30 + else if (vc4->gen == VC4_GEN_4)
31 + lbm_size = ALIGN(lbm_size, 32);
32 +
33 drm_dbg_driver(drm, "[PLANE:%d:%s] LBM Allocation Size: %u\n",
34 plane->base.id, plane->name, lbm_size);
35
36 @@ -759,8 +764,7 @@ static int vc4_plane_allocate_lbm(struct
37 spin_lock_irqsave(&vc4->hvs->mm_lock, irqflags);
38 ret = drm_mm_insert_node_generic(&vc4->hvs->lbm_mm,
39 &vc4_state->lbm,
40 - lbm_size,
41 - vc4->gen == VC4_GEN_5 ? 64 : 32,
42 + lbm_size, 1,
43 0, 0);
44 spin_unlock_irqrestore(&vc4->hvs->mm_lock, irqflags);
45