dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Liu Ying" <victor.liu@nxp.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	imx@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org,
	Frank.Li@kernel.org
Subject: Re: [PATCH v7 10/15] drm/imx: dc-ed: Support getting source selection
Date: Mon, 26 Oct 2026 12:01:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-185150@kernel.org> (raw)
In-Reply-To: <20261026-imx8-dc-prefetch-v7-10-a0b50cc4fc65@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/imx: dc-ed: invalid link IDs accepted in dc_ed_pec_src_sel_get()
--

commit e94375137aef3b831a8ffe20e951e2c25abaed0f
Author: Liu Ying <victor.liu@nxp.com>

drm/imx: dc-ed: Support getting source selection

This commit adds dc_ed_pec_src_sel_get() to read and validate the ExtDst
source selection from PIXENGCFG_DYNAMIC.

> diff --git a/drivers/gpu/drm/imx/dc/dc-ed.c b/drivers/gpu/drm/imx/dc/dc-ed.c
> index de1b71315eabd..67163dca1363c 100644
> --- a/drivers/gpu/drm/imx/dc/dc-ed.c
> +++ b/drivers/gpu/drm/imx/dc/dc-ed.c
> @@ -149,6 +149,35 @@ void dc_ed_pec_src_sel(struct dc_ed *ed, enum dc_link_id src)
>  	}
>  }
>  
> +int dc_ed_pec_src_sel_get(struct dc_ed *ed, enum dc_link_id *src)
> +{
> +	u32 val;
> +	int ret;
> +
> +	ret = regmap_read(ed->reg_pec, PIXENGCFG_DYNAMIC, &val);
> +	if (ret)
> +		return -EINVAL;
> +
> +	switch (val) {
> +	case LINK_ID_NONE:
> +	case LINK_ID_CONSTFRAME0:
> +	case LINK_ID_CONSTFRAME4:
> +	case LINK_ID_CONSTFRAME1:
> +	case LINK_ID_CONSTFRAME5:
> +	case LINK_ID_FETCHWARP2:
> +	case LINK_ID_FETCHLAYER0:
> +	case LINK_ID_LAYERBLEND0:
> +	case LINK_ID_LAYERBLEND1:
> +	case LINK_ID_LAYERBLEND2:
> +	case LINK_ID_LAYERBLEND3:
> +		*src = val;
> +		dev_dbg(ed->dev, "get source selection: 0x%02x\n", val);
> +		return 0;
> +	default:
> +		return -EINVAL;
> +	}
> +}

[Severity: Medium]
Should dc_ed_pec_src_sel_get() validate the value read from PIXENGCFG_DYNAMIC
against src_sels[] rather than accepting LINK_ID_FETCHWARP2 and
LINK_ID_FETCHLAYER0?

In drivers/gpu/drm/imx/dc/dc-ed.c, src_sels[] defines the valid source link
IDs for the ExtDst unit and is used by dc_ed_pec_src_sel():

static const enum dc_link_id src_sels[] = {
	LINK_ID_NONE,
	LINK_ID_CONSTFRAME0,
	LINK_ID_CONSTFRAME1,
	LINK_ID_CONSTFRAME4,
	LINK_ID_CONSTFRAME5,
	LINK_ID_LAYERBLEND3,
	LINK_ID_LAYERBLEND2,
	LINK_ID_LAYERBLEND1,
	LINK_ID_LAYERBLEND0,
};

void dc_ed_pec_src_sel(struct dc_ed *ed, enum dc_link_id src)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(src_sels); i++) {
		if (src_sels[i] == src) {
			regmap_write(ed->reg_pec, PIXENGCFG_DYNAMIC, src);
			return;
		}
	}
}

Because fetch units only connect to LayerBlend secondary inputs (sec_sels[] in
dc-lb.c), LINK_ID_FETCHWARP2 and LINK_ID_FETCHLAYER0 are rejected by
dc_ed_pec_src_sel(). However, dc_ed_pec_src_sel_get() accepts them and returns
0 instead of -EINVAL, which could cause callers such as
dc_crtc_disable_at_boot() to treat an invalid ExtDst source as an active
pipeline.

Would it be better to iterate over src_sels[] in dc_ed_pec_src_sel_get() just
like dc_ed_pec_src_sel() does?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261026-imx8-dc-prefetch-v7-0-a0b50cc4fc65@nxp.com?part=10

  parent reply	other threads:[~2026-10-26 12:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 10:05 [PATCH v7 00/15] drm/imx: dc: Use prefetch engine Liu Ying
2026-10-26 10:05 ` [PATCH v7 01/15] dt-bindings: display: imx: Add i.MX8qxp/qm PRG binding Liu Ying
2026-10-26 10:05 ` [PATCH v7 02/15] dt-bindings: display: imx: Add i.MX8qxp/qm DPR channel binding Liu Ying
2026-10-26 10:05 ` [PATCH v7 03/15] drm/imx: dc-plane: Disable plane when it is invisible Liu Ying
2026-10-29  9:28   ` Laurentiu Palcu
2026-10-26 10:05 ` [PATCH v7 04/15] drm/imx: dc-fu: Fix dimensions Liu Ying
2026-10-26 10:05 ` [PATCH v7 05/15] drm/imx: dc: Flag CRTC status in GERNERALPURPOSE register Liu Ying
2026-10-29  9:28   ` Laurentiu Palcu
2026-10-26 10:05 ` [PATCH v7 06/15] drm/imx: dc-crtc: Disable at boot Liu Ying
2026-10-26 11:18   ` sashiko-bot
2026-10-29  9:30   ` Laurentiu Palcu
2026-10-26 10:05 ` [PATCH v7 07/15] drm/imx: dc: Add PRG support Liu Ying
2026-10-26 11:32   ` sashiko-bot
2026-10-29  9:30   ` Laurentiu Palcu
2026-10-26 10:05 ` [PATCH v7 08/15] drm/imx: dc: Add DPR channel support Liu Ying
2026-10-26 11:52   ` sashiko-bot
2026-10-29  9:31   ` Laurentiu Palcu
2026-10-26 10:05 ` [PATCH v7 09/15] drm/imx: dc: Use TCON operation mode Liu Ying
2026-10-26 10:05 ` [PATCH v7 10/15] drm/imx: dc-ed: Support getting source selection Liu Ying
2026-10-26 10:41   ` Alexander Stein
2026-10-26 12:01   ` sashiko-bot [this message]
2026-10-26 10:05 ` [PATCH v7 11/15] drm/imx: dc-lb: Support getting secondary input selection Liu Ying
2026-10-26 10:05 ` [PATCH v7 12/15] drm/imx: dc-ed: Drop initial source selection Liu Ying
2026-10-26 10:05 ` [PATCH v7 13/15] drm/imx: dc-lb: Drop initial primary and secondary input selections Liu Ying
2026-10-26 10:05 ` [PATCH v7 14/15] drm/imx: dc-fu: Get DPR channel Liu Ying
2026-10-26 10:05 ` [PATCH v7 15/15] drm/imx: dc: Use prefetch engine Liu Ying
2026-10-26 12:41   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-185150@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=victor.liu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox