* [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-10 8:37 [PATCH v2 0/3] Add DRM pixel blend mode support to R-Car DU Takanari Hayama
@ 2022-08-10 8:37 ` Takanari Hayama
2022-08-10 17:41 ` Sergey Shtylyov
2022-08-19 2:01 ` Laurent Pinchart
2022-08-10 8:37 ` [PATCH v2 2/3] drm: rcar-du: Add DRM_MODE_BLEND_PREMULTI support Takanari Hayama
2022-08-10 8:37 ` [PATCH v2 3/3] drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support Takanari Hayama
2 siblings, 2 replies; 13+ messages in thread
From: Takanari Hayama @ 2022-08-10 8:37 UTC (permalink / raw)
To: dri-devel, linux-media, linux-renesas-soc
Cc: Takanari Hayama, airlied, kieran.bingham+renesas,
laurent.pinchart, mchehab
To support DRM blend mode in R-Car DU driver, we must be able to pass
a plane with the premultiplied alpha. Adding a new property to
vsp1_du_atomic_config allows the R-Car DU driver to pass the
premultiplied alpha plane.
Signed-off-by: Takanari Hayama <taki@igel.co.jp>
---
drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
include/media/vsp1.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
index 0c2507dc03d6..019e18976bd8 100644
--- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
@@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
rpf->mem.addr[1] = cfg->mem[1];
rpf->mem.addr[2] = cfg->mem[2];
+ rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
+
vsp1->drm->inputs[rpf_index].crop = cfg->src;
vsp1->drm->inputs[rpf_index].compose = cfg->dst;
vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index cc1b0d42ce95..48f4a5023d81 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -51,6 +51,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
* @dst: destination rectangle on the display (integer coordinates)
* @alpha: alpha value (0: fully transparent, 255: fully opaque)
* @zpos: Z position of the plane (from 0 to number of planes minus 1)
+ * @premult: true for premultiplied alpha
*/
struct vsp1_du_atomic_config {
u32 pixelformat;
@@ -60,6 +61,7 @@ struct vsp1_du_atomic_config {
struct v4l2_rect dst;
unsigned int alpha;
unsigned int zpos;
+ bool premult;
};
/**
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-10 8:37 ` [PATCH v2 1/3] media: vsp1: add premultiplied alpha support Takanari Hayama
@ 2022-08-10 17:41 ` Sergey Shtylyov
2022-08-16 6:01 ` Takanari Hayama
2022-08-19 2:01 ` Laurent Pinchart
1 sibling, 1 reply; 13+ messages in thread
From: Sergey Shtylyov @ 2022-08-10 17:41 UTC (permalink / raw)
To: Takanari Hayama, dri-devel, linux-media, linux-renesas-soc
Cc: airlied, mchehab, kieran.bingham+renesas, laurent.pinchart
Hello!
On 8/10/22 11:37 AM, Takanari Hayama wrote:
> To support DRM blend mode in R-Car DU driver, we must be able to pass
> a plane with the premultiplied alpha. Adding a new property to
> vsp1_du_atomic_config allows the R-Car DU driver to pass the
> premultiplied alpha plane.
>
> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
> ---
> drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
> include/media/vsp1.h | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> index 0c2507dc03d6..019e18976bd8 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> @@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
> rpf->mem.addr[1] = cfg->mem[1];
> rpf->mem.addr[2] = cfg->mem[2];
>
> + rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
> +
Parens are hardly needed here... :-)
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-10 17:41 ` Sergey Shtylyov
@ 2022-08-16 6:01 ` Takanari Hayama
0 siblings, 0 replies; 13+ messages in thread
From: Takanari Hayama @ 2022-08-16 6:01 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: airlied, dri-devel, linux-renesas-soc, kieran.bingham+renesas,
laurent.pinchart, mchehab, linux-media
Hi,
> 2022/08/11 2:41、Sergey Shtylyov <s.shtylyov@omp.ru>のメール:
>
> Hello!
>
> On 8/10/22 11:37 AM, Takanari Hayama wrote:
>
>> To support DRM blend mode in R-Car DU driver, we must be able to pass
>> a plane with the premultiplied alpha. Adding a new property to
>> vsp1_du_atomic_config allows the R-Car DU driver to pass the
>> premultiplied alpha plane.
>>
>> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
>> ---
>> drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
>> include/media/vsp1.h | 2 ++
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
>> index 0c2507dc03d6..019e18976bd8 100644
>> --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
>> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
>> @@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
>> rpf->mem.addr[1] = cfg->mem[1];
>> rpf->mem.addr[2] = cfg->mem[2];
>>
>> + rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
>> +
>
> Parens are hardly needed here... :-)
True. :) Thank you.
Cheers,
Takanari Hayama, Ph.D. <taki@igel.co.jp>
IGEL Co., Ltd.
https://www.igel.co.jp/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-10 8:37 ` [PATCH v2 1/3] media: vsp1: add premultiplied alpha support Takanari Hayama
2022-08-10 17:41 ` Sergey Shtylyov
@ 2022-08-19 2:01 ` Laurent Pinchart
2022-08-19 2:04 ` Takanari Hayama
2022-08-19 2:38 ` Laurent Pinchart
1 sibling, 2 replies; 13+ messages in thread
From: Laurent Pinchart @ 2022-08-19 2:01 UTC (permalink / raw)
To: Takanari Hayama
Cc: airlied, dri-devel, linux-renesas-soc, kieran.bingham+renesas,
mchehab, linux-media
Hi Hayama-san,
Thank you for the patch.
On Wed, Aug 10, 2022 at 05:37:09PM +0900, Takanari Hayama wrote:
> To support DRM blend mode in R-Car DU driver, we must be able to pass
> a plane with the premultiplied alpha. Adding a new property to
> vsp1_du_atomic_config allows the R-Car DU driver to pass the
> premultiplied alpha plane.
>
> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
> ---
> drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
> include/media/vsp1.h | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> index 0c2507dc03d6..019e18976bd8 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> @@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
> rpf->mem.addr[1] = cfg->mem[1];
> rpf->mem.addr[2] = cfg->mem[2];
>
> + rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
I'll drop the parentheses when applying.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> +
> vsp1->drm->inputs[rpf_index].crop = cfg->src;
> vsp1->drm->inputs[rpf_index].compose = cfg->dst;
> vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
> diff --git a/include/media/vsp1.h b/include/media/vsp1.h
> index cc1b0d42ce95..48f4a5023d81 100644
> --- a/include/media/vsp1.h
> +++ b/include/media/vsp1.h
> @@ -51,6 +51,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
> * @dst: destination rectangle on the display (integer coordinates)
> * @alpha: alpha value (0: fully transparent, 255: fully opaque)
> * @zpos: Z position of the plane (from 0 to number of planes minus 1)
> + * @premult: true for premultiplied alpha
> */
> struct vsp1_du_atomic_config {
> u32 pixelformat;
> @@ -60,6 +61,7 @@ struct vsp1_du_atomic_config {
> struct v4l2_rect dst;
> unsigned int alpha;
> unsigned int zpos;
> + bool premult;
> };
>
> /**
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-19 2:01 ` Laurent Pinchart
@ 2022-08-19 2:04 ` Takanari Hayama
2022-08-19 2:38 ` Laurent Pinchart
1 sibling, 0 replies; 13+ messages in thread
From: Takanari Hayama @ 2022-08-19 2:04 UTC (permalink / raw)
To: Laurent Pinchart
Cc: airlied, dri-devel, linux-renesas-soc, kieran.bingham+renesas,
mchehab, linux-media
Hi Laurent,
> 2022/08/19 11:01、Laurent Pinchart <laurent.pinchart@ideasonboard.com>のメール:
>
> Hi Hayama-san,
>
> Thank you for the patch.
>
> On Wed, Aug 10, 2022 at 05:37:09PM +0900, Takanari Hayama wrote:
>> To support DRM blend mode in R-Car DU driver, we must be able to pass
>> a plane with the premultiplied alpha. Adding a new property to
>> vsp1_du_atomic_config allows the R-Car DU driver to pass the
>> premultiplied alpha plane.
>>
>> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
>> ---
>> drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
>> include/media/vsp1.h | 2 ++
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
>> index 0c2507dc03d6..019e18976bd8 100644
>> --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
>> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
>> @@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
>> rpf->mem.addr[1] = cfg->mem[1];
>> rpf->mem.addr[2] = cfg->mem[2];
>>
>> + rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
>
> I'll drop the parentheses when applying.
Thank you!
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
>> +
>> vsp1->drm->inputs[rpf_index].crop = cfg->src;
>> vsp1->drm->inputs[rpf_index].compose = cfg->dst;
>> vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
>> diff --git a/include/media/vsp1.h b/include/media/vsp1.h
>> index cc1b0d42ce95..48f4a5023d81 100644
>> --- a/include/media/vsp1.h
>> +++ b/include/media/vsp1.h
>> @@ -51,6 +51,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
>> * @dst: destination rectangle on the display (integer coordinates)
>> * @alpha: alpha value (0: fully transparent, 255: fully opaque)
>> * @zpos: Z position of the plane (from 0 to number of planes minus 1)
>> + * @premult: true for premultiplied alpha
>> */
>> struct vsp1_du_atomic_config {
>> u32 pixelformat;
>> @@ -60,6 +61,7 @@ struct vsp1_du_atomic_config {
>> struct v4l2_rect dst;
>> unsigned int alpha;
>> unsigned int zpos;
>> + bool premult;
>> };
>>
>> /**
>
> --
> Regards,
>
> Laurent Pinchart
Cheers,
Takanari Hayama, Ph.D. <taki@igel.co.jp>
IGEL Co., Ltd.
https://www.igel.co.jp/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-19 2:01 ` Laurent Pinchart
2022-08-19 2:04 ` Takanari Hayama
@ 2022-08-19 2:38 ` Laurent Pinchart
2022-09-06 11:10 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 13+ messages in thread
From: Laurent Pinchart @ 2022-08-19 2:38 UTC (permalink / raw)
To: mchehab
Cc: Takanari Hayama, airlied, dri-devel, linux-renesas-soc,
kieran.bingham+renesas, linux-media
Mauro, would you be fine with this patch going through the DRM tree for
v6.1 ? I don't foresee any risk of conflict with other changes to the
VSP driver scheduled for the next kernel version. If that's fine with
you, could you give an Acked-by ? Otherwise I can send you a pull
request to create an immutable branch and base the rest on it in my pull
request for DRM, but given how small this change is, it seems a bit
overkill.
On Fri, Aug 19, 2022 at 05:01:10AM +0300, Laurent Pinchart wrote:
> Hi Hayama-san,
>
> Thank you for the patch.
>
> On Wed, Aug 10, 2022 at 05:37:09PM +0900, Takanari Hayama wrote:
> > To support DRM blend mode in R-Car DU driver, we must be able to pass
> > a plane with the premultiplied alpha. Adding a new property to
> > vsp1_du_atomic_config allows the R-Car DU driver to pass the
> > premultiplied alpha plane.
> >
> > Signed-off-by: Takanari Hayama <taki@igel.co.jp>
> > ---
> > drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
> > include/media/vsp1.h | 2 ++
> > 2 files changed, 4 insertions(+)
> >
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > index 0c2507dc03d6..019e18976bd8 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > @@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
> > rpf->mem.addr[1] = cfg->mem[1];
> > rpf->mem.addr[2] = cfg->mem[2];
> >
> > + rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
>
> I'll drop the parentheses when applying.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> > +
> > vsp1->drm->inputs[rpf_index].crop = cfg->src;
> > vsp1->drm->inputs[rpf_index].compose = cfg->dst;
> > vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
> > diff --git a/include/media/vsp1.h b/include/media/vsp1.h
> > index cc1b0d42ce95..48f4a5023d81 100644
> > --- a/include/media/vsp1.h
> > +++ b/include/media/vsp1.h
> > @@ -51,6 +51,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
> > * @dst: destination rectangle on the display (integer coordinates)
> > * @alpha: alpha value (0: fully transparent, 255: fully opaque)
> > * @zpos: Z position of the plane (from 0 to number of planes minus 1)
> > + * @premult: true for premultiplied alpha
> > */
> > struct vsp1_du_atomic_config {
> > u32 pixelformat;
> > @@ -60,6 +61,7 @@ struct vsp1_du_atomic_config {
> > struct v4l2_rect dst;
> > unsigned int alpha;
> > unsigned int zpos;
> > + bool premult;
> > };
> >
> > /**
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/3] media: vsp1: add premultiplied alpha support
2022-08-19 2:38 ` Laurent Pinchart
@ 2022-09-06 11:10 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-06 11:10 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Takanari Hayama, airlied, dri-devel, linux-renesas-soc,
kieran.bingham+renesas, linux-media
Em Fri, 19 Aug 2022 05:38:28 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> Mauro, would you be fine with this patch going through the DRM tree for
> v6.1 ? I don't foresee any risk of conflict with other changes to the
> VSP driver scheduled for the next kernel version. If that's fine with
> you, could you give an Acked-by ? Otherwise I can send you a pull
> request to create an immutable branch and base the rest on it in my pull
> request for DRM, but given how small this change is, it seems a bit
> overkill.
Please, don't top-post.
>
> On Fri, Aug 19, 2022 at 05:01:10AM +0300, Laurent Pinchart wrote:
> > Hi Hayama-san,
> >
> > Thank you for the patch.
> >
> > On Wed, Aug 10, 2022 at 05:37:09PM +0900, Takanari Hayama wrote:
> > > To support DRM blend mode in R-Car DU driver, we must be able to pass
> > > a plane with the premultiplied alpha. Adding a new property to
> > > vsp1_du_atomic_config allows the R-Car DU driver to pass the
> > > premultiplied alpha plane.
> > >
> > > Signed-off-by: Takanari Hayama <taki@igel.co.jp>
Sure, this can be merged via DRM tree.
> > > ---
> > > drivers/media/platform/renesas/vsp1/vsp1_drm.c | 2 ++
> > > include/media/vsp1.h | 2 ++
> > > 2 files changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > > index 0c2507dc03d6..019e18976bd8 100644
> > > --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > > +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > > @@ -856,6 +856,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
> > > rpf->mem.addr[1] = cfg->mem[1];
> > > rpf->mem.addr[2] = cfg->mem[2];
> > >
> > > + rpf->format.flags = (cfg->premult) ? V4L2_PIX_FMT_FLAG_PREMUL_ALPHA : 0;
> >
> > I'll drop the parentheses when applying.
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
With this change:
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Regards,
Mauro
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 2/3] drm: rcar-du: Add DRM_MODE_BLEND_PREMULTI support
2022-08-10 8:37 [PATCH v2 0/3] Add DRM pixel blend mode support to R-Car DU Takanari Hayama
2022-08-10 8:37 ` [PATCH v2 1/3] media: vsp1: add premultiplied alpha support Takanari Hayama
@ 2022-08-10 8:37 ` Takanari Hayama
2022-08-19 2:08 ` Laurent Pinchart
2022-08-10 8:37 ` [PATCH v2 3/3] drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support Takanari Hayama
2 siblings, 1 reply; 13+ messages in thread
From: Takanari Hayama @ 2022-08-10 8:37 UTC (permalink / raw)
To: dri-devel, linux-media, linux-renesas-soc
Cc: Takanari Hayama, airlied, kieran.bingham+renesas,
laurent.pinchart, mchehab
R-Car DU driver implicitly supports DRM_MODE_BLEND_COVERAGE only.
This adds a support for DRM_MODE_BLEND_PREMULTI. As a consequence,
DRM_MODE_BLEND_PREMULTI becomes the default. If DRM_MODE_BLEND_COVERAGE
is desired, it should be set explicitly.
This behavior comes from how DRM blend mode is supported.
drm_plane_create_blend_mode_property() creates the blend mode property
with the default value of DRM_MODE_BLEND_PREMULTI. This default value
cannot be modified from the atomic driver.
Signed-off-by: Takanari Hayama <taki@igel.co.jp>
---
drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 ++++++
1 file changed, 6 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..b9580fcfec7a 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -167,6 +167,8 @@ 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];
+ cfg.premult = (state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI);
+
format = rcar_du_format_info(state->format->fourcc);
cfg.pixelformat = format->v4l2;
@@ -444,6 +446,10 @@ 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_PREMULTI) |
+ BIT(DRM_MODE_BLEND_COVERAGE));
+
vsp->num_planes++;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] drm: rcar-du: Add DRM_MODE_BLEND_PREMULTI support
2022-08-10 8:37 ` [PATCH v2 2/3] drm: rcar-du: Add DRM_MODE_BLEND_PREMULTI support Takanari Hayama
@ 2022-08-19 2:08 ` Laurent Pinchart
2022-08-19 3:05 ` Takanari Hayama
0 siblings, 1 reply; 13+ messages in thread
From: Laurent Pinchart @ 2022-08-19 2:08 UTC (permalink / raw)
To: Takanari Hayama
Cc: airlied, dri-devel, linux-renesas-soc, kieran.bingham+renesas,
mchehab, linux-media
Hello Hayama-san,
Thank you for the patch.
On Wed, Aug 10, 2022 at 05:37:10PM +0900, Takanari Hayama wrote:
> R-Car DU driver implicitly supports DRM_MODE_BLEND_COVERAGE only.
> This adds a support for DRM_MODE_BLEND_PREMULTI. As a consequence,
> DRM_MODE_BLEND_PREMULTI becomes the default. If DRM_MODE_BLEND_COVERAGE
> is desired, it should be set explicitly.
>
> This behavior comes from how DRM blend mode is supported.
> drm_plane_create_blend_mode_property() creates the blend mode property
> with the default value of DRM_MODE_BLEND_PREMULTI. This default value
> cannot be modified from the atomic driver.
>
> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 ++++++
> 1 file changed, 6 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..b9580fcfec7a 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -167,6 +167,8 @@ 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];
>
> + cfg.premult = (state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI);
I'll drop the parentheses here too, and if you don't mind, I'll move
this down after setting cfg.pixelformat, as premult qualifies the format
so it's more logical in that reading order (no change on the behaviour
of course).
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> +
> format = rcar_du_format_info(state->format->fourcc);
> cfg.pixelformat = format->v4l2;
>
> @@ -444,6 +446,10 @@ 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_PREMULTI) |
> + BIT(DRM_MODE_BLEND_COVERAGE));
> +
> vsp->num_planes++;
> }
>
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] drm: rcar-du: Add DRM_MODE_BLEND_PREMULTI support
2022-08-19 2:08 ` Laurent Pinchart
@ 2022-08-19 3:05 ` Takanari Hayama
0 siblings, 0 replies; 13+ messages in thread
From: Takanari Hayama @ 2022-08-19 3:05 UTC (permalink / raw)
To: Laurent Pinchart
Cc: airlied, dri-devel, linux-renesas-soc, kieran.bingham+renesas,
mchehab, linux-media
Hi Laurent,
> 2022/08/19 11:08、Laurent Pinchart <laurent.pinchart@ideasonboard.com>のメール:
>
> Hello Hayama-san,
>
> Thank you for the patch.
>
> On Wed, Aug 10, 2022 at 05:37:10PM +0900, Takanari Hayama wrote:
>> R-Car DU driver implicitly supports DRM_MODE_BLEND_COVERAGE only.
>> This adds a support for DRM_MODE_BLEND_PREMULTI. As a consequence,
>> DRM_MODE_BLEND_PREMULTI becomes the default. If DRM_MODE_BLEND_COVERAGE
>> is desired, it should be set explicitly.
>>
>> This behavior comes from how DRM blend mode is supported.
>> drm_plane_create_blend_mode_property() creates the blend mode property
>> with the default value of DRM_MODE_BLEND_PREMULTI. This default value
>> cannot be modified from the atomic driver.
>>
>> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
>> ---
>> drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 ++++++
>> 1 file changed, 6 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..b9580fcfec7a 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
>> @@ -167,6 +167,8 @@ 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];
>>
>> + cfg.premult = (state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI);
>
> I'll drop the parentheses here too, and if you don't mind, I'll move
> this down after setting cfg.pixelformat, as premult qualifies the format
> so it's more logical in that reading order (no change on the behaviour
> of course).
Thank you. I also agree with the proposed change in order.
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
>> +
>> format = rcar_du_format_info(state->format->fourcc);
>> cfg.pixelformat = format->v4l2;
>>
>> @@ -444,6 +446,10 @@ 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_PREMULTI) |
>> + BIT(DRM_MODE_BLEND_COVERAGE));
>> +
>> vsp->num_planes++;
>> }
>>
>
> --
> Regards,
>
> Laurent Pinchart
Cheers,
Takanari Hayama, Ph.D. <taki@igel.co.jp>
IGEL Co., Ltd.
https://www.igel.co.jp/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 3/3] drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support
2022-08-10 8:37 [PATCH v2 0/3] Add DRM pixel blend mode support to R-Car DU Takanari Hayama
2022-08-10 8:37 ` [PATCH v2 1/3] media: vsp1: add premultiplied alpha support Takanari Hayama
2022-08-10 8:37 ` [PATCH v2 2/3] drm: rcar-du: Add DRM_MODE_BLEND_PREMULTI support Takanari Hayama
@ 2022-08-10 8:37 ` Takanari Hayama
2022-08-19 2:10 ` Laurent Pinchart
2 siblings, 1 reply; 13+ messages in thread
From: Takanari Hayama @ 2022-08-10 8:37 UTC (permalink / raw)
To: dri-devel, linux-media, linux-renesas-soc
Cc: Takanari Hayama, airlied, kieran.bingham+renesas,
laurent.pinchart, mchehab
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 <laurent.pinchart@ideasonboard.com>
Signed-off-by: Takanari Hayama <taki@igel.co.jp>
---
drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index b9580fcfec7a..7cce2d414ced 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -151,6 +151,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;
@@ -169,7 +170,23 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
cfg.premult = (state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI);
- 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;
vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe,
@@ -447,6 +464,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
}
drm_plane_create_blend_mode_property(&plane->plane,
+ BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE));
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 3/3] drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support
2022-08-10 8:37 ` [PATCH v2 3/3] drm: rcar-du: Add DRM_MODE_BLEND_PIXEL_NONE support Takanari Hayama
@ 2022-08-19 2:10 ` Laurent Pinchart
0 siblings, 0 replies; 13+ messages in thread
From: Laurent Pinchart @ 2022-08-19 2:10 UTC (permalink / raw)
To: Takanari Hayama
Cc: airlied, dri-devel, linux-renesas-soc, kieran.bingham+renesas,
mchehab, linux-media
Hello Hayama-san,
Thank you for the patch.
On Wed, Aug 10, 2022 at 05:37:11PM +0900, Takanari Hayama wrote:
> 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 <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> index b9580fcfec7a..7cce2d414ced 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -151,6 +151,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;
> @@ -169,7 +170,23 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
>
> cfg.premult = (state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI);
>
> - 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;
>
> vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe,
> @@ -447,6 +464,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
> }
>
> drm_plane_create_blend_mode_property(&plane->plane,
> + BIT(DRM_MODE_BLEND_PIXEL_NONE) |
> BIT(DRM_MODE_BLEND_PREMULTI) |
> BIT(DRM_MODE_BLEND_COVERAGE));
>
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread