c861170b426f83e28ebe5e0b490ee412a0db8780
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0903-drm-vc4-plane-Register-a-different-drm_plane_helper_.patch
1 From 597258e5effb6ab56a116823e8cb88ccc578ec06 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 21 Apr 2022 11:39:27 +0200
4 Subject: [PATCH] drm/vc4: plane: Register a different
5 drm_plane_helper_funcs on BCM2711
6
7 On the BCM2711, our current definition of drm_plane_helper_funcs uses
8 the custom vc4_prepare_fb() and vc4_cleanup_fb().
9
10 Those functions rely on the buffer allocation path that was relying on
11 the GPU, and is no longer relevant.
12
13 Let's create another drm_plane_helper_funcs structure that we will
14 register on the BCM2711.
15
16 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
17 ---
18 drivers/gpu/drm/vc4/vc4_plane.c | 12 +++++++++++-
19 1 file changed, 11 insertions(+), 1 deletion(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_plane.c
22 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
23 @@ -1502,6 +1502,13 @@ static const struct drm_plane_helper_fun
24 .atomic_async_update = vc4_plane_atomic_async_update,
25 };
26
27 +static const struct drm_plane_helper_funcs vc5_plane_helper_funcs = {
28 + .atomic_check = vc4_plane_atomic_check,
29 + .atomic_update = vc4_plane_atomic_update,
30 + .atomic_async_check = vc4_plane_atomic_async_check,
31 + .atomic_async_update = vc4_plane_atomic_async_update,
32 +};
33 +
34 static bool vc4_format_mod_supported(struct drm_plane *plane,
35 uint32_t format,
36 uint64_t modifier)
37 @@ -1606,7 +1613,10 @@ struct drm_plane *vc4_plane_init(struct
38 if (ret)
39 return ERR_PTR(ret);
40
41 - drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
42 + if (vc4->is_vc5)
43 + drm_plane_helper_add(plane, &vc5_plane_helper_funcs);
44 + else
45 + drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
46
47 drm_plane_create_alpha_property(plane);
48 drm_plane_create_blend_mode_property(plane,