drm/vc4: plane: Take possible_crtcs as an argument
authorMaxime Ripard <maxime@cerno.tech>
Wed, 25 May 2022 09:03:10 +0000 (11:03 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 7 Sep 2022 08:53:01 +0000 (10:53 +0200)
vc4_plane_init() currently initialises the plane with no possible CRTCs,
and will expect the caller to set it up by itself.

Let's change that logic a bit to follow the syntax of
drm_universal_plane_init() and pass the possible CRTCs bitmask as an
argument to the function instead.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_crtc.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_plane.c

index 4c45bae..7bdac44 100644 (file)
@@ -1273,7 +1273,7 @@ int vc4_crtc_init(struct drm_device *drm, struct vc4_crtc *vc4_crtc,
         * requirement of the plane configuration, and reject ones
         * that will take too much.
         */
-       primary_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_PRIMARY);
+       primary_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_PRIMARY, 0);
        if (IS_ERR(primary_plane)) {
                dev_err(drm->dev, "failed to construct primary plane\n");
                return PTR_ERR(primary_plane);
index 138b36b..6280475 100644 (file)
@@ -1000,7 +1000,8 @@ int vc4_kms_load(struct drm_device *dev);
 
 /* vc4_plane.c */
 struct drm_plane *vc4_plane_init(struct drm_device *dev,
-                                enum drm_plane_type type);
+                                enum drm_plane_type type,
+                                uint32_t possible_crtcs);
 int vc4_plane_create_additional_planes(struct drm_device *dev);
 u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
 u32 vc4_plane_dlist_size(const struct drm_plane_state *state);
index 849385f..16427d8 100644 (file)
@@ -1650,7 +1650,8 @@ static const struct drm_plane_funcs vc4_plane_funcs = {
 };
 
 struct drm_plane *vc4_plane_init(struct drm_device *dev,
-                                enum drm_plane_type type)
+                                enum drm_plane_type type,
+                                uint32_t possible_crtcs)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
        struct drm_plane *plane = NULL;
@@ -1681,7 +1682,7 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
        }
 
        plane = &vc4_plane->base;
-       ret = drm_universal_plane_init(dev, plane, 0,
+       ret = drm_universal_plane_init(dev, plane, possible_crtcs,
                                       &vc4_plane_funcs,
                                       formats, num_formats,
                                       modifiers, type, NULL);
@@ -1740,14 +1741,12 @@ int vc4_plane_create_additional_planes(struct drm_device *drm)
         */
        for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) {
                struct drm_plane *plane =
-                       vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY);
+                       vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
+                                      GENMASK(drm->mode_config.num_crtc - 1, 0));
 
                if (IS_ERR(plane))
                        continue;
 
-               plane->possible_crtcs =
-                       GENMASK(drm->mode_config.num_crtc - 1, 0);
-
                /* Create zpos property. Max of all the overlays + 1 primary +
                 * 1 cursor plane on a crtc.
                 */
@@ -1760,9 +1759,9 @@ int vc4_plane_create_additional_planes(struct drm_device *drm)
                 * since the zpos fallback is that planes are rendered by plane
                 * ID order, and that then puts the cursor on top.
                 */
-               cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
+               cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR,
+                                             drm_crtc_mask(crtc));
                if (!IS_ERR(cursor_plane)) {
-                       cursor_plane->possible_crtcs = drm_crtc_mask(crtc);
                        crtc->cursor = cursor_plane;
 
                        drm_plane_create_zpos_property(cursor_plane,