Message ID | 20220704025231.3911138-4-taki@igel.co.jp (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add DRM pixel blend mode support to R-Car DU | expand |
Hi Hayama-san, Thank you for the patch. On Mon, Jul 04, 2022 at 11:52:31AM +0900, Takanari Hayama wrote: > R-Car DU supports different blend modes via VSP1. Add DRM blend mode > supports to make it configurable. > > As drm_plane_create_blend_mode_property() creates the blend mode > property with the default value of DRM_MODE_BLEND_PREMULTI, it changes > the default blending behavior on R-Car DU. The rcar-du's blend mode was > same as DRM_MODE_BLEND_COVERAGE, i.e., pixel color values have not been > pre-multitplied. If that's what KMS userspace requires I'm fine with it. > Signed-off-by: Takanari Hayama <taki@igel.co.jp> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> but I expect this patch to change based on my suggestions for 2/3. > --- > drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > index 8eb9b2b097ae..283327046aa5 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > @@ -170,6 +170,18 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) > format = rcar_du_format_info(state->format->fourcc); > cfg.pixelformat = format->v4l2; > > + switch (state->state.pixel_blend_mode) { > + case DRM_MODE_BLEND_PREMULTI: > + cfg.blend_mode = VSP1_DU_BLEND_MODE_PREMULTI; > + break; > + case DRM_MODE_BLEND_COVERAGE: > + cfg.blend_mode = VSP1_DU_BLEND_MODE_COVERAGE; > + break; > + case DRM_MODE_BLEND_PIXEL_NONE: > + cfg.blend_mode = VSP1_DU_BLEND_MODE_PIXEL_NONE; > + break; > + } > + > vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe, > plane->index, &cfg); > } > @@ -444,6 +456,11 @@ 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)); > + > vsp->num_planes++; > } >
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 8eb9b2b097ae..283327046aa5 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -170,6 +170,18 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) format = rcar_du_format_info(state->format->fourcc); cfg.pixelformat = format->v4l2; + switch (state->state.pixel_blend_mode) { + case DRM_MODE_BLEND_PREMULTI: + cfg.blend_mode = VSP1_DU_BLEND_MODE_PREMULTI; + break; + case DRM_MODE_BLEND_COVERAGE: + cfg.blend_mode = VSP1_DU_BLEND_MODE_COVERAGE; + break; + case DRM_MODE_BLEND_PIXEL_NONE: + cfg.blend_mode = VSP1_DU_BLEND_MODE_PIXEL_NONE; + break; + } + vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe, plane->index, &cfg); } @@ -444,6 +456,11 @@ 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)); + vsp->num_planes++; }
R-Car DU supports different blend modes via VSP1. Add DRM blend mode supports to make it configurable. As drm_plane_create_blend_mode_property() creates the blend mode property with the default value of DRM_MODE_BLEND_PREMULTI, it changes the default blending behavior on R-Car DU. The rcar-du's blend mode was same as DRM_MODE_BLEND_COVERAGE, i.e., pixel color values have not been pre-multitplied. Signed-off-by: Takanari Hayama <taki@igel.co.jp> --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)