From: Takanari Hayama Date: Wed, 10 Aug 2022 08:37:11 +0000 (+0900) Subject: drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support X-Git-Tag: v6.6.17~6361^2~13^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a58c9b11b7958a1c9a2d804c5b45f9ab33609e4;p=platform%2Fkernel%2Flinux-rpi.git drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support DRM_MODE_BLEND_PIXEL_NONE ignores an alpha channel. Rcar-du driver supports only 3 formats with an alpha channel (DRM_FORMAT_ARGB1555, DRM_FORMAT_ARGB8888 and DRM_FORMAT_ARGB4444). We simply override the format passed to VSP1 for blending with the pixel format without alpha channel. Suggested-by: Laurent Pinchart Signed-off-by: Takanari Hayama Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 3d56096..e465aef 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -152,6 +152,7 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) .alpha = state->state.alpha >> 8, .zpos = state->state.zpos, }; + u32 fourcc = state->format->fourcc; unsigned int i; cfg.src.left = state->state.src.x1 >> 16; @@ -168,7 +169,23 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) cfg.mem[i] = sg_dma_address(state->sg_tables[i].sgl) + fb->offsets[i]; - format = rcar_du_format_info(state->format->fourcc); + if (state->state.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) { + switch (fourcc) { + case DRM_FORMAT_ARGB1555: + fourcc = DRM_FORMAT_XRGB1555; + break; + + case DRM_FORMAT_ARGB4444: + fourcc = DRM_FORMAT_XRGB4444; + break; + + case DRM_FORMAT_ARGB8888: + fourcc = DRM_FORMAT_XRGB8888; + break; + } + } + + format = rcar_du_format_info(fourcc); cfg.pixelformat = format->v4l2; cfg.premult = state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI; @@ -439,6 +456,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, num_planes - 1); drm_plane_create_blend_mode_property(&plane->plane, + BIT(DRM_MODE_BLEND_PIXEL_NONE) | BIT(DRM_MODE_BLEND_PREMULTI) | BIT(DRM_MODE_BLEND_COVERAGE));