bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0902-drm-vc4-kms-Register-a-different-drm_mode_config_fun.patch
1 From 407b0fcd8becc2c948bbe3337db0cf2a45f19949 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 21 Apr 2022 11:13:00 +0200
4 Subject: [PATCH] drm/vc4: kms: Register a different
5 drm_mode_config_funcs on BCM2711
6
7 On the BCM2711, our current definition of drm_mode_config_funcs uses the
8 custom vc4_fb_create().
9
10 However, that function relies on the buffer allocation path that was
11 relying on the GPU, and is no longer relevant.
12
13 Let's create another drm_mode_config_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_kms.c | 8 +++++++-
19 1 file changed, 7 insertions(+), 1 deletion(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_kms.c
22 +++ b/drivers/gpu/drm/vc4/vc4_kms.c
23 @@ -992,6 +992,12 @@ static const struct drm_mode_config_func
24 .fb_create = vc4_fb_create,
25 };
26
27 +static const struct drm_mode_config_funcs vc5_mode_funcs = {
28 + .atomic_check = vc4_atomic_check,
29 + .atomic_commit = drm_atomic_helper_commit,
30 + .fb_create = drm_gem_fb_create,
31 +};
32 +
33 int vc4_kms_load(struct drm_device *dev)
34 {
35 struct vc4_dev *vc4 = to_vc4_dev(dev);
36 @@ -1026,7 +1032,7 @@ int vc4_kms_load(struct drm_device *dev)
37 dev->mode_config.max_height = 2048;
38 }
39
40 - dev->mode_config.funcs = &vc4_mode_funcs;
41 + dev->mode_config.funcs = vc4->is_vc5 ? &vc5_mode_funcs : &vc4_mode_funcs;
42 dev->mode_config.helper_private = &vc4_mode_config_helpers;
43 dev->mode_config.preferred_depth = 24;
44 dev->mode_config.async_page_flip = true;