b2e9f15647b04e40c5285798f756f1a98f2fe737
[openwrt/openwrt.git] /
1 From 5331cbb3d9cfb172ed134f08a35740e0a52d1107 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 6 Feb 2020 14:41:41 +0100
4 Subject: [PATCH] drm/vc4: plane: Move additional planes creation to
5 driver
6
7 So far the plane creation was done when each CRTC was bound, and those
8 planes were only tied to the CRTC that was registering them.
9
10 This causes two main issues:
11 - The planes in the vc4 hardware are actually not tied to any CRTC, but
12 can be used with every combination
13
14 - More importantly, so far, we allocate 10 planes per CRTC, with 3 CRTCs.
15 However, the next generation of hardware will have 5 CRTCs, putting us
16 well above the maximum of 32 planes currently allowed by DRM.
17
18 This patch is the first one in a series of patches that will take down both
19 of these issues so that we can support the next generation of hardware
20 while keeping a good amount of planes.
21
22 We start by changing the way the planes are registered to first registering
23 the primary planes for each CRTC in the CRTC bind function as we used to,
24 but moving the overlay and cursor creation to the main driver bind
25 function, after all the CRTCs have been bound.
26
27 This will slightly change the ID order of the planes, since the primary
28 planes of all CRTCs will be first, and then a pattern of 8 overlays, 1
29 cursor plane for each CRTC.
30
31 This shouldn't cause any trouble since the ordering between the planes is
32 preserved though.
33
34 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
35 ---
36 drivers/gpu/drm/vc4/vc4_crtc.c | 4 ----
37 drivers/gpu/drm/vc4/vc4_drv.c | 7 +++++++
38 2 files changed, 7 insertions(+), 4 deletions(-)
39
40 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
41 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
42 @@ -1190,10 +1190,6 @@ static int vc4_crtc_bind(struct device *
43 */
44 drm_crtc_enable_color_mgmt(crtc, 0, true, crtc->gamma_size);
45
46 - ret = vc4_plane_create_additional_planes(drm, crtc);
47 - if (ret)
48 - goto err_destroy_planes;
49 -
50 vc4_crtc_get_cob_allocation(vc4_crtc);
51
52 CRTC_WRITE(PV_INTEN, 0);
53 --- a/drivers/gpu/drm/vc4/vc4_drv.c
54 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
55 @@ -253,6 +253,7 @@ static int vc4_drm_bind(struct device *d
56 {
57 struct platform_device *pdev = to_platform_device(dev);
58 struct drm_device *drm;
59 + struct drm_crtc *crtc;
60 struct vc4_dev *vc4;
61 struct device_node *node;
62 int ret = 0;
63 @@ -291,6 +292,12 @@ static int vc4_drm_bind(struct device *d
64 if (ret)
65 goto gem_destroy;
66
67 + drm_for_each_crtc(crtc, drm) {
68 + ret = vc4_plane_create_additional_planes(drm, crtc);
69 + if (ret)
70 + continue;
71 + }
72 +
73 drm_fb_helper_remove_conflicting_framebuffers(NULL, "vc4drmfb", false);
74
75 ret = vc4_kms_load(drm);