Re: [PATCH v3 07/11] drm/mediatek: Support alpha blending in VDOSYS0

From: Shawn Sung (宋孝謙)
Date: Wed Nov 29 2023 - 04:45:18 EST


On Thu, 2023-11-23 at 09:22 +0000, CK Hu (胡俊光) wrote:
> Hi, Hsiao-chien:
>

----
snip
----

> > @@ -420,14 +496,92 @@ void mtk_ovl_layer_config(struct device *dev,
> > unsigned int idx,
> >
> > overlay_pitch.pitch = pitch;
> >
> > - if (!pending->enable) {
> > + if (!pending->enable || !pending->width || !pending->height) {
> > mtk_ovl_layer_off(dev, idx, cmdq_pkt);
> > return;
> > }
> >
> > - con = ovl_fmt_convert(ovl, fmt);
> > - if (state->base.fb && state->base.fb->format->has_alpha)
> > - con |= OVL_CON_AEN | OVL_CON_ALPHA;
> > + con = ovl_fmt_convert(ovl, fmt, blend_mode);
> > + if (state->base.fb) {
> > + con |= OVL_CON_AEN;
>
> It seems all SoC ovl hardware support alpha blending, why in mmsys
> just
> some support?

Because alpha blending was not implemented before, and we only verified
this patch on MT8195 and MT8188. Will review this part again. Thanks.

> > + con |= state->base.alpha & 0xff;
> > + }
> > +
> > + if (blend_mode == DRM_MODE_BLEND_PIXEL_NONE ||
> > + (state->base.fb && !state->base.fb->format->has_alpha))
> > + ignore_pixel_alpha = OVL_CONST_BLEND;
> > +
> > + /* need to do Y2R and R2R to reduce 10bit data to 8bit for CRC
> > calculation */
>
> Reducing 10 bit to 8 bit would lose color detail. Just for CRC to
> lose
> this detail? Why not just use 10 bit to calculate CRC?
>

This is a hardware limitation, OVL will only retrieve 8 bits per
channel for CRC calculation. Although we do limit this function to
8195/8188 only, the color detail will still lose on these platforms if
we must support CRC.

Regards,
Shawn