Commit 41740824 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] drm: rcar-du: Add alpha support for VSP planes

Make the global alpha multiplier of VSP planes configurable through the
alpha property, exactly as for the native DU planes.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c6b013ab
...@@ -148,40 +148,41 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) ...@@ -148,40 +148,41 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
struct rcar_du_vsp_plane_state *state = struct rcar_du_vsp_plane_state *state =
to_rcar_vsp_plane_state(plane->plane.state); to_rcar_vsp_plane_state(plane->plane.state);
struct drm_framebuffer *fb = plane->plane.state->fb; struct drm_framebuffer *fb = plane->plane.state->fb;
struct v4l2_rect src; struct vsp1_du_atomic_config cfg = {
struct v4l2_rect dst; .pixelformat = 0,
dma_addr_t paddr[2] = { 0, }; .pitch = fb->pitches[0],
u32 pixelformat = 0; .alpha = state->alpha,
.zpos = 0,
};
unsigned int i; unsigned int i;
src.left = state->state.src_x >> 16; cfg.src.left = state->state.src_x >> 16;
src.top = state->state.src_y >> 16; cfg.src.top = state->state.src_y >> 16;
src.width = state->state.src_w >> 16; cfg.src.width = state->state.src_w >> 16;
src.height = state->state.src_h >> 16; cfg.src.height = state->state.src_h >> 16;
dst.left = state->state.crtc_x; cfg.dst.left = state->state.crtc_x;
dst.top = state->state.crtc_y; cfg.dst.top = state->state.crtc_y;
dst.width = state->state.crtc_w; cfg.dst.width = state->state.crtc_w;
dst.height = state->state.crtc_h; cfg.dst.height = state->state.crtc_h;
for (i = 0; i < state->format->planes; ++i) { for (i = 0; i < state->format->planes; ++i) {
struct drm_gem_cma_object *gem; struct drm_gem_cma_object *gem;
gem = drm_fb_cma_get_gem_obj(fb, i); 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) { for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) {
if (formats_kms[i] == state->format->fourcc) { if (formats_kms[i] == state->format->fourcc) {
pixelformat = formats_v4l2[i]; cfg.pixelformat = formats_v4l2[i];
break; break;
} }
} }
WARN_ON(!pixelformat); WARN_ON(!cfg.pixelformat);
vsp1_du_atomic_update(plane->vsp->vsp, plane->index, pixelformat, vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
fb->pitches[0], paddr, &src, &dst);
} }
static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane, 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, ...@@ -220,8 +221,7 @@ static void rcar_du_vsp_plane_atomic_update(struct drm_plane *plane,
if (plane->state->crtc) if (plane->state->crtc)
rcar_du_vsp_plane_setup(rplane); rcar_du_vsp_plane_setup(rplane);
else else
vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, 0, 0, 0, vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, NULL);
NULL, NULL);
} }
static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = { static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment