Re: [PATCH v2 31/46] drm/mediatek: Add support for Display Layer Blender component

From: CK Hu (胡俊光)

Date: Tue Nov 24 2026 - 03:31:45 EST


On Tue, 2026-07-14 at 13:43 +0200, AngeloGioacchino Del Regno wrote:
> Add support for the Layer Blender hardware component, found in the
> MediaTek Kompanio Ultra MT8196, Genio Pro 5100 MT8894, Dimensity
> 9400 MT6991 and others.
>
> This component is responsible for managing blending of single
> layer stages and therefore implements one full layer stage which
> gets completed by an exDMA hardware component.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> ---

[snip]

> +static void mtk_blender_unset_input_bgclr(struct mtk_disp_blender *priv)
> +{
> + u32 val;
> +
> + val = readl(priv->regs + DISP_REG_OVL_BLD_DATAPATH_CON);
> + val &= ~OVL_BLD_BGCLR_IN_SEL;
> + writel(val, priv->regs + DISP_REG_OVL_BLD_DATAPATH_CON);

mtk_ddp_write_mask().

> +}
> +

[snip]

> +void mtk_blender_config(struct mtk_ddp_comp *comp, unsigned int w,
> + unsigned int h, unsigned int vrefresh,
> + unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
> +{
> + struct mtk_disp_blender *priv = dev_get_drvdata(comp->dev);
> + u32 val;
> +
> + /* Set ROI for this Blender */
> + val = ((h & GENMASK(15, 0)) << 16) | (w & GENMASK(15, 0));
> + writel(val, priv->regs + DISP_REG_OVL_BLD_ROI_SIZE);

There is parameter cmdq_pkt, so use mtk_ddp_write().

> +
> + /*
> + * Set both background color and constant layer color to Opaque Black
> + * (ARGB) for eventual Alpha Blending to be effective
> + */
> + writel(OVL_BLD_BGCLR_BLACK, priv->regs + DISP_REG_OVL_BLD_BGCLR_CLR);
> + writel(OVL_BLD_BGCLR_BLACK, priv->regs + DISP_REG_OVL_BLD_L0_CLR);
> +}
> +
> +void mtk_blender_connect(struct mtk_ddp_comp *comp, struct device *mmsys_dev,
> + struct mtk_ddp_comp *next)
> +{
> + struct mtk_disp_blender *priv = dev_get_drvdata(comp->dev);
> + const u32 mask = OVL_BLD_BGCLR_OUT_TO_PROC |
> + OVL_BLD_BGCLR_OUT_TO_NEXT_LAYER |
> + OVL_BLD_BGCLR_IN_SEL;
> + u32 data_path = OVL_BLD_BGCLR_IN_SEL;
> + u32 val;
> +
> + /* Usually the next component is either another OUTPROC or an exDMA */
> + if (next->type == MTK_DISP_OUTPROC)

MTK_DISP_OUTPROC is not defined until this patch.
Move this patch after MTK_DISP_OUTPROC is defined.

Regards,
CK

> + data_path |= OVL_BLD_BGCLR_OUT_TO_PROC;
> + else
> + data_path |= OVL_BLD_BGCLR_OUT_TO_NEXT_LAYER;
> +
> + val = readl(priv->regs + DISP_REG_OVL_BLD_DATAPATH_CON);
> + val = (val & ~mask) | data_path;
> + writel(val, priv->regs + DISP_REG_OVL_BLD_DATAPATH_CON);
> +
> + mtk_mmsys_hw_connect(mmsys_dev,
> + comp->type, comp->inst_id, next->type, next->inst_id);
> +}
> +