drm: rcar-du: Replace plane crtc and enabled fields by plane state
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sun, 22 Feb 2015 17:24:59 +0000 (19:24 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 3 Mar 2015 14:16:25 +0000 (16:16 +0200)
The crtc and enabled fields duplicates information stored in the plane
state. Use the plane state instead and remove the fields.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_crtc.c
drivers/gpu/drm/rcar-du/rcar_du_plane.c
drivers/gpu/drm/rcar-du/rcar_du_plane.h

index faa46ed23a62329a2900f6329fdb753ca4075b17..3f64707412e6fd27733029bb46f14153a40988e2 100644 (file)
@@ -212,7 +212,7 @@ static void rcar_du_crtc_update_planes(struct drm_crtc *crtc)
                struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i];
                unsigned int j;
 
-               if (plane->crtc != &rcrtc->crtc || !plane->enabled)
+               if (plane->plane.state->crtc != &rcrtc->crtc)
                        continue;
 
                /* Insert the plane in the sorted planes array. */
@@ -379,7 +379,7 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc)
        for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) {
                struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i];
 
-               if (plane->crtc != crtc || !plane->enabled)
+               if (plane->plane.state->crtc != crtc)
                        continue;
 
                rcar_du_plane_setup(plane);
@@ -608,8 +608,6 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
        rcrtc->enabled = false;
        rcrtc->plane = &rgrp->planes.planes[index % 2];
 
-       rcrtc->plane->crtc = crtc;
-
        ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, &rcrtc->plane->plane,
                                        NULL, &crtc_funcs);
        if (ret < 0)
index f28d13dc6fc924a56ff3d7d15a3afb4c252084a8..c5cb2ade2722e9b876f636df4b70288b0093b6d4 100644 (file)
@@ -140,7 +140,8 @@ static void rcar_du_plane_setup_fb(struct rcar_du_plane *plane)
        bool interlaced;
        u32 mwr;
 
-       interlaced = plane->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE;
+       interlaced = plane->plane.state->crtc->state->adjusted_mode.flags
+                  & DRM_MODE_FLAG_INTERLACE;
 
        /* Memory pitch (expressed in pixels). Must be doubled for interlaced
         * operation with 32bpp formats.
@@ -354,16 +355,11 @@ static int rcar_du_plane_atomic_check(struct drm_plane *plane,
 
 static void rcar_du_plane_disable(struct rcar_du_plane *rplane)
 {
-       if (!rplane->enabled)
+       if (!rplane->plane.state->crtc)
                return;
 
-       mutex_lock(&rplane->group->planes.lock);
-       rplane->enabled = false;
-       mutex_unlock(&rplane->group->planes.lock);
-
        rcar_du_plane_release(rplane);
 
-       rplane->crtc = NULL;
        rplane->format = NULL;
 }
 
@@ -391,14 +387,9 @@ static void rcar_du_plane_atomic_update(struct drm_plane *plane,
                rcar_du_plane_reserve(rplane, format);
        }
 
-       rplane->crtc = state->crtc;
        rplane->format = format;
 
        rcar_du_plane_setup(rplane);
-
-       mutex_lock(&rplane->group->planes.lock);
-       rplane->enabled = true;
-       mutex_unlock(&rplane->group->planes.lock);
 }
 
 static const struct drm_plane_helper_funcs rcar_du_plane_helper_funcs = {
index 012f2185ca1f5d10b8696ccc8d778b70b56c8339..7050fc1e11ecba03faf6b9f1be427056ab57b84d 100644 (file)
@@ -34,9 +34,6 @@ struct rcar_du_plane {
        struct drm_plane plane;
 
        struct rcar_du_group *group;
-       struct drm_crtc *crtc;
-
-       bool enabled;
 
        int hwindex;            /* 0-based, -1 means unused */