[media] drm: rcar-du: Add Z-order support for VSP planes
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 24 Mar 2016 08:15:59 +0000 (05:15 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 17 Jun 2016 11:17:12 +0000 (08:17 -0300)
Make the Z-order of VSP planes configurable through the zpos property,
exactly as for the native DU planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/gpu/drm/rcar-du/rcar_du_vsp.c
drivers/gpu/drm/rcar-du/rcar_du_vsp.h

index f892cf14e71282469673208b5e211e4d22e747a3..6ac717f2056f1b63dc5e6949a5971fe51f2acffc 100644 (file)
@@ -152,7 +152,7 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
                .pixelformat = 0,
                .pitch = fb->pitches[0],
                .alpha = state->alpha,
-               .zpos = 0,
+               .zpos = state->zpos,
        };
        unsigned int i;
 
@@ -180,8 +180,6 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
                }
        }
 
-       WARN_ON(!cfg.pixelformat);
-
        vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
 }
 
@@ -269,6 +267,7 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane)
                return;
 
        state->alpha = 255;
+       state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
 
        plane->state = &state->state;
        plane->state->plane = plane;
@@ -283,6 +282,8 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
 
        if (property == rcdu->props.alpha)
                rstate->alpha = val;
+       else if (property == rcdu->props.zpos)
+               rstate->zpos = val;
        else
                return -EINVAL;
 
@@ -299,6 +300,8 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
 
        if (property == rcdu->props.alpha)
                *val = rstate->alpha;
+       else if (property == rcdu->props.zpos)
+               *val = rstate->zpos;
        else
                return -EINVAL;
 
@@ -378,6 +381,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp)
 
                drm_object_attach_property(&plane->plane.base,
                                           rcdu->props.alpha, 255);
+               drm_object_attach_property(&plane->plane.base,
+                                          rcdu->props.zpos, 1);
        }
 
        return 0;
index df3bf3805c697bf8a2f570d9f1dd4ccb37287c54..510dcc9c6816d046242805909bd796200096529b 100644 (file)
@@ -44,6 +44,7 @@ static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p)
  * @state: base DRM plane state
  * @format: information about the pixel format used by the plane
  * @alpha: value of the plane alpha property
+ * @zpos: value of the plane zpos property
  */
 struct rcar_du_vsp_plane_state {
        struct drm_plane_state state;
@@ -51,6 +52,7 @@ struct rcar_du_vsp_plane_state {
        const struct rcar_du_format_info *format;
 
        unsigned int alpha;
+       unsigned int zpos;
 };
 
 static inline struct rcar_du_vsp_plane_state *