From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "robh@kernel.org" <robh@kernel.org>,
"tzimmermann@suse.de" <tzimmermann@suse.de>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"mripard@kernel.org" <mripard@kernel.org>,
"kernel@collabora.com" <kernel@collabora.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"airlied@gmail.com" <airlied@gmail.com>,
"Justin Yeh (葉英茂)" <Justin.Yeh@mediatek.com>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
Subject: Re: [PATCH v2 23/46] drm/mediatek: Fully migrate to new Display Controller HW indexing
Date: Fri, 6 Nov 2026 08:36:10 +0000 [thread overview]
Message-ID: <e720371d6a3e4bb9ffa56bd8e06ae759c4d4c5cc.camel@mediatek.com> (raw)
In-Reply-To: <20260714114414.184512-24-angelogioacchino.delregno@collabora.com>
On Tue, 2026-07-14 at 13:43 +0200, AngeloGioacchino Del Regno wrote:
> Perform a full migration to HW Type -> HW Instance ID indexing
> for all of the currently supported Display Controller hardware
> sub-components.
>
> This allows to remove the big fixed-size catch-all components
> array (that contains as many element as much as the number of
> supported hardware and number of instances of that), which is
> currently growing bigger and bigger at every sub-ip support
> addition in mediatek-drm.
>
> Note that this cleanup became necessary seen the need to add
> support for new components found in MT8196, MT8994 and other
> variants of it, and of course those SoCs won't be the last
> ones to be upstreamed... so the size of that array would get
> out of control pretty fast (and again, it's already very big).
>
> As a side effect, while saving memory compared to before this
> change, this also allows to have up to 24 (as an extensible fixed
> size declared in this driver) instances of the same HW Type with
> no further increase in memory footprint.
> Similarly, adding support for new hardware will not produce an
> increase of memory footprint on all SoCs (if not only temporarily
> while the probe process is in place) as there's no more catch-all
> array, but only a dynamically allocated list of per display output
> components.
>
> Unfortunately, this change needs to go along with the related one
> in the mtk-mmsys driver, otherwise functionality of the Display
> Controller will regress.
>
> The only way to make this possible in two steps is to duplicate
> all of the routes structure arrays for all of the SoCs, which
> would result in a total of around ~1200 lines changed twice, and
> that ignores the big increase in size for this driver during the
> migration process so, in order to avoid useless bloat, I opted
> for an inter-dependency between the two changes: mediatek-drm
> and mtk-mmsys.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
[snip]
> @@ -1143,25 +1158,15 @@ int mtk_crtc_create(struct drm_device *drm_dev,
> crtc_i++;
>
> for (i = 0; i < output_path[i].len; i++) {
> - enum mtk_ddp_comp_id comp_id = output_path->comp[i].type;
> - struct device_node *node;
> + enum mtk_ddp_comp_type comp_type = output_path->comp[i].type;
> + u8 comp_inst = output_path->comp[i].inst_id;
> struct mtk_ddp_comp *comp;
>
> - node = priv->comp_node[comp_id];
> - comp = mtk_ddp_comp_find_by_id(&priv->hlist, comp_id);
> -
> - /* Not all drm components have a DTS device node, such as ovl_adaptor,
> - * which is the drm bring up sub driver
> - */
> - if (!node && comp_id != DDP_COMPONENT_DRM_OVL_ADAPTOR) {
> - dev_info(dev,
> - "Not creating crtc %d because component %d is disabled or missing\n",
> - crtc_i, comp_id);
> - return 0;
The original behavior for disabled component would return 0, but you change the behavior here.
Is is safe for legacy SoC?
> - }
> -
> + comp = mtk_ddp_comp_find_by_id(&priv->hlist, comp_type, comp_inst);
> if (!comp || !comp->dev) {
> - dev_err(dev, "Component %pOF not initialized\n", node);
> + dev_err(dev,
> + "CRTC%d: Component type=%u inst=%u not initialized\n",
> + crtc_i, comp_type, comp_inst);
> return -ENODEV;
> }
> }
>
[snip]
> static bool mtk_ddp_find_comp_dev_in_table(const struct mtk_drm_comp_list *hlist,
> - const unsigned int comp_id,
> + const unsigned int comp_type,
> struct device *dev)
> {
> struct mtk_ddp_comp *ddp_comp;
>
> - hash_for_each_possible(hlist->ddp_list, ddp_comp, lnode, comp_id) {
> + hash_for_each_possible(hlist->ddp_list, ddp_comp, lnode, comp_type) {
You change the comp_id to comp_type.
If the correct match is DPI0, after this patch, the DPI1 would match?
> if (ddp_comp->dev == dev)
> return true;
> }
>
[snip]
> int mtk_ddp_comp_get_id(struct device_node *node,
> enum mtk_ddp_comp_type comp_type)
> {
> - int id = of_alias_get_id(node, mtk_ddp_comp_stem[comp_type]);
> - int i;
> -
> - for (i = 0; i < ARRAY_SIZE(mtk_ddp_matches); i++) {
> - if (comp_type == mtk_ddp_matches[i].type &&
> - (id < 0 || id == mtk_ddp_matches[i].alias_id))
> - return i;
> + /* If there's an alias, return the ID from that */
> + if (mtk_ddp_comp_stem[comp_type]) {
> + int alias_id = of_alias_get_id(node, mtk_ddp_comp_stem[comp_type]);
> + if (alias_id >= 0)
> + return alias_id;
> }
>
> - return -EINVAL;
> + return 0;
0 is valid id so this function would not return error.
You change this behavior, so I would like some explain.
> }
>
> int mtk_find_possible_crtcs(struct drm_device *drm, struct device *dev)
>
[snip]
> @@ -16,6 +16,7 @@
> #include <drm/drm_modes.h>
>
> #define MTK_DISP_CONTROLLER_MAX_COMP_PER_PATH 24
> +#define MTK_DISP_CONTROLLER_MAX_HW_COMP_INSTANCE 32
MTK_DISP_CONTROLLER_MAX_HW_COMP_INSTANCE is useless, so drop it.
>
> struct device;
> struct device_node;
>
[snip]
> @@ -924,18 +928,16 @@ static int mtk_drm_probe(struct platform_device *pdev)
> continue;
> }
>
> - comp_id = mtk_ddp_comp_get_id(node, comp_type);
> - if (comp_id < 0) {
> + comp_inst_id = mtk_ddp_comp_get_id(node, comp_type);
> + if (comp_inst_id < 0) {
comp_inst_id is u8, so this would never happen.
Regards,
CK
> dev_warn(dev, "Skipping unknown component %pOF\n",
> node);
> continue;
> }
>
> - if (!mtk_drm_find_mmsys_comp(private, comp_id))
> + if (!mtk_drm_find_mmsys_comp(private, comp_type, comp_inst_id))
> continue;
>
> - private->comp_node[comp_id] = of_node_get(node);
> -
> /*
> * Currently only the AAL, CCORR, COLOR, GAMMA, MERGE, OVL, RDMA, DSI, and DPI
> * blocks have separate component platform drivers and initialize their own
>
next prev parent reply other threads:[~2026-11-06 8:36 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 11:43 [PATCH v2 00/46] drm/mediatek: The Huge Restructuring and MT8196 support AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 01/46] drm/mediatek: Rename OVL format naming AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 02/46] drm/mediatek: Export OVL formats definitions and format conversion API AngeloGioacchino Del Regno
2026-08-28 8:52 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 03/46] drm/mediatek: Export OVL Blend function AngeloGioacchino Del Regno
2026-08-28 9:04 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 04/46] drm/mediatek: Move mtk_ddp_comp_type enumeration to mtk-mmsys.h AngeloGioacchino Del Regno
2026-08-28 9:15 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 05/46] drm/mediatek: Add missing component types in mtk_ddp_comp_type AngeloGioacchino Del Regno
2026-08-28 9:18 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 06/46] drm/mediatek: Rename all display component type to have DISP_ prefix AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 07/46] drm/mediatek: Use hashtable for components discovery and registration AngeloGioacchino Del Regno
2026-10-27 7:42 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 08/46] drm/mediatek: ddp_comp: Move internal component register in function AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 09/46] drm/mediatek: De-duplicate internal component checks AngeloGioacchino Del Regno
2026-10-27 7:54 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 10/46] drm/mediatek: Introduce and use path/comp definition structures AngeloGioacchino Del Regno
2026-10-28 7:04 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 11/46] drm/mediatek: Create new mtk_drm_legacy and move deprecated code AngeloGioacchino Del Regno
2026-10-28 8:23 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 12/46] dt-bindings: soc: mediatek: mutex: Allow #trigger-source-cells AngeloGioacchino Del Regno
2026-07-22 15:45 ` Rob Herring
2026-07-22 16:39 ` AngeloGioacchino Del Regno
2026-07-22 15:46 ` Rob Herring (Arm)
2026-10-28 8:33 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 13/46] dt-bindings: display: mediatek: Allow trigger-sources on relevant HW AngeloGioacchino Del Regno
2026-10-28 8:35 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 14/46] drm/mediatek: Add support for MuteX trigger-sources parsing AngeloGioacchino Del Regno
2026-10-29 6:52 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 15/46] drm/mediatek: ovl_adaptor: Add special MERGE component check AngeloGioacchino Del Regno
2026-11-03 8:04 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 16/46] drm/mediatek: mtk_hdmi_v2: Don't warn on RPM active during detach AngeloGioacchino Del Regno
2026-11-04 5:57 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 17/46] drm/mediatek: Add support for hardware multi-stage layers AngeloGioacchino Del Regno
2026-11-04 9:46 ` CK Hu (胡俊光)
2026-11-04 10:19 ` AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 18/46] drm/mediatek: mtk_crtc: Complete documentation for struct mtk_crtc AngeloGioacchino Del Regno
2026-11-05 2:29 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 19/46] drm/mediatek: mtk_crtc: Minimize spinlocked time in cmdq callback AngeloGioacchino Del Regno
2026-11-05 6:19 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 20/46] drm/mediatek: mtk_crtc: Dynamically find vblank/cfg component indices AngeloGioacchino Del Regno
2026-11-05 9:36 ` CK Hu (胡俊光)
2026-07-14 11:43 ` [PATCH v2 21/46] soc: mediatek: mtk-mutex: Add new functions to add/remove triggers AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 22/46] soc: mediatek: mtk-mmsys: Migrate to new Multimedia DDP HW indexing AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 23/46] drm/mediatek: Fully migrate to new Display Controller " AngeloGioacchino Del Regno
2026-11-06 8:36 ` CK Hu (胡俊光) [this message]
2026-07-14 11:43 ` [PATCH v2 24/46] drm/mediatek: mtk_dpi: Pass parameters with new mtk_dpi_sync structure AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 25/46] drm/mediatek: mtk_dpi: Fully separate HW setup from common code AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 26/46] drm/mediatek: Create new mtk_dpi_common lib and move mtk_dpi code AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 27/46] dt-bindings: display: mediatek: Introduce Digital Video Output HW AngeloGioacchino Del Regno
2026-07-22 16:40 ` Rob Herring
2026-07-14 11:43 ` [PATCH v2 28/46] drm/mediatek: Add support for MediaTek Digital Video Output (DVO) AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 29/46] drm/mediatek: Pass mtk_ddp_comp in clk and config callbacks AngeloGioacchino Del Regno
2026-07-14 11:43 ` [PATCH v2 30/46] dt-bindings: display: mediatek: Introduce MT8196 Layer Blender AngeloGioacchino Del Regno
2026-07-22 16:42 ` Rob Herring
2026-07-14 11:43 ` [PATCH v2 31/46] drm/mediatek: Add support for Display Layer Blender component AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 32/46] dt-bindings: display: mediatek: Introduce MT8196 extended DMA Engine AngeloGioacchino Del Regno
2026-07-22 16:43 ` Rob Herring
2026-07-14 11:44 ` [PATCH v2 33/46] drm/mediatek: Add support for Display Controller exDMA component AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 34/46] dt-bindings: display: mediatek: Introduce MT8196 Output Processor AngeloGioacchino Del Regno
2026-07-22 16:45 ` Rob Herring
2026-07-14 11:44 ` [PATCH v2 35/46] drm/mediatek: Add support for Display Output Processor component AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 36/46] drm/mediatek: mtk_crtc: Dynamically find suitable CRTC DMA device AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 37/46] drm/mediatek: Prepare path builder for multi-controller architecture AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 38/46] drm/mediatek: Enable bring-up of multi-controller CRTC paths AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 39/46] drm/mediatek: Introduce MediaTek Asynchronous DirectLink Controller AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 40/46] drm/mediatek: Support registering disp controller device subnodes AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 41/46] soc: mediatek: mtk-mmsys: Populate multimedia subsystem subdevices AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 42/46] dt-bindings: display: mediatek: Introduce MT8196 2D Sharpness Processor AngeloGioacchino Del Regno
2026-07-28 13:40 ` Rob Herring
2026-07-28 13:49 ` AngeloGioacchino Del Regno
2026-08-04 18:19 ` Rob Herring
2026-08-05 3:48 ` Chen-Yu Tsai
2026-07-14 11:44 ` [PATCH v2 43/46] drm/mediatek: Add Two-Dimension Sharpness Processor (TDSHP) driver AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 44/46] dt-bindings: display: mediatek: Introduce MT8196 Image Resizer AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 45/46] drm/mediatek: Add support for Display Image Resizer (Scaler) AngeloGioacchino Del Regno
2026-07-14 11:44 ` [PATCH v2 46/46] drm/mediatek: mtk_drm_drv: Fail init only if all paths are invalid AngeloGioacchino Del Regno
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=e720371d6a3e4bb9ffa56bd8e06ae759c4d4c5cc.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=Jason-JH.Lin@mediatek.com \
--cc=Justin.Yeh@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthias.bgg@gmail.com \
--cc=mripard@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®