7b9ec02cf6049ec7b2cea8cf23c4c4efc4277bf0
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0544-drm-vc4-plane-Create-overlays-for-any-CRTC.patch
1 From b65167e0bcce67f2e7b7e813dba536f1cca3ef9f Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 6 Feb 2020 14:50:06 +0100
4 Subject: [PATCH] drm/vc4: plane: Create overlays for any CRTC
5
6 Now that we have everything in place, we can now register all the overlay
7 planes that can be assigned to all the CRTCs.
8
9 This has two side effects:
10
11 - The number of overlay planes is reduced from 24 to 8. This is temporary
12 and will be increased again in the next patch.
13
14 - The ID of the various planes is changed again, and we will now have all
15 the primary planes, then all the overlay planes and finally the cursor
16 planes. This shouldn't cause any issue since the ordering between
17 primary, overlay and cursor planes is preserved.
18
19 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
20 ---
21 drivers/gpu/drm/vc4/vc4_plane.c | 35 +++++++++++++++++----------------
22 1 file changed, 18 insertions(+), 17 deletions(-)
23
24 --- a/drivers/gpu/drm/vc4/vc4_plane.c
25 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
26 @@ -1454,26 +1454,27 @@ int vc4_plane_create_additional_planes(s
27 struct drm_crtc *crtc;
28 unsigned int i;
29
30 - drm_for_each_crtc(crtc, drm) {
31 - /* Set up some arbitrary number of planes. We're not limited
32 - * by a set number of physical registers, just the space in
33 - * the HVS (16k) and how small an plane can be (28 bytes).
34 - * However, each plane we set up takes up some memory, and
35 - * increases the cost of looping over planes, which atomic
36 - * modesetting does quite a bit. As a result, we pick a
37 - * modest number of planes to expose, that should hopefully
38 - * still cover any sane usecase.
39 - */
40 - for (i = 0; i < 8; i++) {
41 - struct drm_plane *plane =
42 - vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY);
43 + /* Set up some arbitrary number of planes. We're not limited
44 + * by a set number of physical registers, just the space in
45 + * the HVS (16k) and how small an plane can be (28 bytes).
46 + * However, each plane we set up takes up some memory, and
47 + * increases the cost of looping over planes, which atomic
48 + * modesetting does quite a bit. As a result, we pick a
49 + * modest number of planes to expose, that should hopefully
50 + * still cover any sane usecase.
51 + */
52 + for (i = 0; i < 8; i++) {
53 + struct drm_plane *plane =
54 + vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY);
55
56 - if (IS_ERR(plane))
57 - continue;
58 + if (IS_ERR(plane))
59 + continue;
60
61 - plane->possible_crtcs = drm_crtc_mask(crtc);
62 - }
63 + plane->possible_crtcs =
64 + GENMASK(drm->mode_config.num_crtc - 1, 0);
65 + }
66
67 + drm_for_each_crtc(crtc, drm) {
68 /* Set up the legacy cursor after overlay initialization,
69 * since we overlay planes on the CRTC in the order they were
70 * initialized.