[media] drm: rcar-du: Add alpha 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:16:45 +0000 (08:16 -0300)
Make the global alpha multiplier of VSP planes configurable through the
alpha 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

index e671a7cd346378c22b15a3085c455abaee18db45..f892cf14e71282469673208b5e211e4d22e747a3 100644 (file)
@@ -148,40 +148,41 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
        struct rcar_du_vsp_plane_state *state =
                to_rcar_vsp_plane_state(plane->plane.state);
        struct drm_framebuffer *fb = plane->plane.state->fb;
-       struct v4l2_rect src;
-       struct v4l2_rect dst;
-       dma_addr_t paddr[2] = { 0, };
-       u32 pixelformat = 0;
+       struct vsp1_du_atomic_config cfg = {
+               .pixelformat = 0,
+               .pitch = fb->pitches[0],
+               .alpha = state->alpha,
+               .zpos = 0,
+       };
        unsigned int i;
 
-       src.left = state->state.src_x >> 16;
-       src.top = state->state.src_y >> 16;
-       src.width = state->state.src_w >> 16;
-       src.height = state->state.src_h >> 16;
+       cfg.src.left = state->state.src_x >> 16;
+       cfg.src.top = state->state.src_y >> 16;
+       cfg.src.width = state->state.src_w >> 16;
+       cfg.src.height = state->state.src_h >> 16;
 
-       dst.left = state->state.crtc_x;
-       dst.top = state->state.crtc_y;
-       dst.width = state->state.crtc_w;
-       dst.height = state->state.crtc_h;
+       cfg.dst.left = state->state.crtc_x;
+       cfg.dst.top = state->state.crtc_y;
+       cfg.dst.width = state->state.crtc_w;
+       cfg.dst.height = state->state.crtc_h;
 
        for (i = 0; i < state->format->planes; ++i) {
                struct drm_gem_cma_object *gem;
 
                gem = drm_fb_cma_get_gem_obj(fb, i);
-               paddr[i] = gem->paddr + fb->offsets[i];
+               cfg.mem[i] = gem->paddr + fb->offsets[i];
        }
 
        for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) {
                if (formats_kms[i] == state->format->fourcc) {
-                       pixelformat = formats_v4l2[i];
+                       cfg.pixelformat = formats_v4l2[i];
                        break;
                }
        }
 
-       WARN_ON(!pixelformat);
+       WARN_ON(!cfg.pixelformat);
 
-       vsp1_du_atomic_update(plane->vsp->vsp, plane->index, pixelformat,
-                             fb->pitches[0], paddr, &src, &dst);
+       vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
 }
 
 static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane,
@@ -220,8 +221,7 @@ static void rcar_du_vsp_plane_atomic_update(struct drm_plane *plane,
        if (plane->state->crtc)
                rcar_du_vsp_plane_setup(rplane);
        else
-               vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, 0, 0, 0,
-                                     NULL, NULL);
+               vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, NULL);
 }
 
 static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {