From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
"magnus.damm" <magnus.damm@gmail.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v10 10/12] drm: renesas: rz-du: Support several DU instances in one DRM device
Date: Tue, 24 Nov 2026 15:52:48 +0100 [thread overview]
Message-ID: <awWkwJTxdJV1owf-@tom-desktop> (raw)
In-Reply-To: <TYYPR01MB6603D650B839F808ACBA811F86442@TYYPR01MB6603.jpnprd01.prod.outlook.com>
Hi Biju,
On Tue, Nov 24, 2026 at 02:11:16PM +0000, Biju Das wrote:
> Hi Tommaso,
>
> > -----Original Message-----
> > From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > Sent: 24 November 2026 13:59
> > Subject: Re: [PATCH v10 10/12] drm: renesas: rz-du: Support several DU instances in one DRM device
> >
> > Hi Biju,
> >
> > On Tue, Nov 24, 2026 at 01:18:43PM +0000, Biju Das wrote:
> > > Hi Tommaso,
> > >
> > > > -----Original Message-----
> > > > From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > > > Sent: 24 November 2026 11:53
> > > > Subject: Re: [PATCH v10 10/12] drm: renesas: rz-du: Support several
> > > > DU instances in one DRM device
> > > >
> > > > Hi Biju,
> > > > Thanks for your review.
> > > >
> > > > On Tue, Nov 24, 2026 at 07:47:04AM +0000, Biju Das wrote:
> > > > > Hi Tommaso,
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > > > > > Sent: 13 November 2026 12:20
> > > > > > Subject: [PATCH v10 10/12] drm: renesas: rz-du: Support several
> > > > > > DU instances in one DRM device
> > > > > >
> > > > > > RZ/G3E has two DU instances that share a single DRM device.
> > > > > >
> > > > > > Add an RZG2L_DU_FEATURE_COMPONENT flag and use the component
> > > > > > framework for it. The first available
> > > > DU
> > > > > > instance is the master and creates the DRM device, the other one binds to it as a component.
> > > > > >
> > > > > > If only one DU instance is available, it creates the DRM device
> > > > > > directly at probe time, as on SoCs without the flag.
> > > > > >
> > > > > > Set the index of each instance to the number of CRTCs already created.
> > > > > >
> > > > > > Signed-off-by: Tommaso Merciai
> > > > > > <tommaso.merciai.xr@bp.renesas.com>
> > > > > > ---
> > > > > > v9->v10:
> > > > > > - New patch.
> > > > > >
> > > > > > drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 118 ++++++++++++++++++-
> > > > > > drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h | 2 +
> > > > > > 2 files changed, 115 insertions(+), 5 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> > > > > > b/drivers/gpu/drm/renesas/rz- du/rzg2l_du_drv.c index
> > > > > > 93d59e2cf8a4..873586f2ef28 100644
> > > > > > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> > > > > > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> > > > > > @@ -7,6 +7,7 @@
> > > > > > * Based on rcar_du_drv.c
> > > > > > */
> > > > > >
> > > > > > +#include <linux/component.h>
> > > > > > #include <linux/dma-mapping.h>
> > > > > > #include <linux/module.h>
> > > > > > #include <linux/of.h>
> > > > > > @@ -14,10 +15,12 @@
> > > > > >
> > > > > > #include <drm/clients/drm_client_setup.h> #include
> > > > > > <drm/drm_atomic_helper.h>
> > > > > > +#include <drm/drm_crtc.h>
> > > > > > #include <drm/drm_drv.h>
> > > > > > #include <drm/drm_fbdev_dma.h>
> > > > > > #include <drm/drm_gem_dma_helper.h> #include
> > > > > > <drm/drm_managed.h>
> > > > > > +#include <drm/drm_of.h>
> > > > > > #include <drm/drm_print.h>
> > > > > > #include <drm/drm_probe_helper.h>
> > > > > >
> > > > > > @@ -170,6 +173,7 @@ static int rzg2l_du_instance_init(struct rzg2l_du_device *du,
> > > > > > struct drm_device *ddev)
> > > > > > {
> > > > > > struct rzg2l_du_device *rcdu;
> > > > > > + int ret;
> > > > > >
> > > > > > rcdu = drmm_kzalloc(ddev, sizeof(*rcdu), GFP_KERNEL);
> > > > > > if (!rcdu)
> > > > > > @@ -180,9 +184,28 @@ static int rzg2l_du_instance_init(struct rzg2l_du_device *du,
> > > > > > rcdu->mmio = du->mmio;
> > > > > > rcdu->ddev = ddev;
> > > > > >
> > > > > > - return rzg2l_du_modeset_init_du(rcdu);
> > > > > > + rcdu->index = ddev->mode_config.num_crtc;
> > > > > > +
> > > > > > + ret = rzg2l_du_modeset_init_du(rcdu);
> > > > > > + if (ret < 0)
> > > > > > + return ret;
> > > > > > +
> > > > > > + if (WARN_ON(drm_crtc_index(&rcdu->crtcs[0].crtc) != rcdu->index))
> > > > > > + return -EINVAL;
> > > > > > +
> > > > > > + return 0;
> > > > > > }
> > > > > >
> > > > > > +static int rzg2l_du_instance_bind(struct device *dev, struct device *master,
> > > > > > + void *data)
> > > > > > +{
> > > > > > + return rzg2l_du_instance_init(dev_get_drvdata(dev), data); }
> > > > > > +
> > > > > > +static const struct component_ops rzg2l_du_instance_ops = {
> > > > > > + .bind = rzg2l_du_instance_bind, };
> > > > > > +
> > > > > > /* -----------------------------------------------------------------------------
> > > > > > * DRM device
> > > > > > */
> > > > > > @@ -191,7 +214,7 @@ struct rzg2l_du_drm {
> > > > > > struct drm_device ddev;
> > > > > > };
> > > > > >
> > > > > > -static int rzg2l_du_drm_init(struct device *dev)
> > > > > > +static int rzg2l_du_drm_init(struct device *dev, bool
> > > > > > +has_components)
> > > > > > {
> > > > > > struct rzg2l_du_device *du = dev_get_drvdata(dev);
> > > > > > struct rzg2l_du_drm *rzgdrm;
> > > > > > @@ -213,6 +236,12 @@ static int rzg2l_du_drm_init(struct device *dev)
> > > > > > if (ret < 0)
> > > > > > goto error;
> > > > > >
> > > > > > + if (has_components) {
> > > > > > + ret = component_bind_all(dev, ddev);
> > > > > > + if (ret < 0)
> > > > > > + goto error;
> > > > > > + }
> > > > > > +
> > > > > > ret = rzg2l_du_modeset_init_finish(ddev);
> > > > > > if (ret < 0)
> > > > > > goto error_fini;
> > > > > > @@ -235,6 +264,8 @@ static int rzg2l_du_drm_init(struct device
> > > > > > *dev)
> > > > > >
> > > > > > error_fini:
> > > > > > drm_kms_helper_poll_fini(ddev);
> > > > > > + if (has_components)
> > > > > > + component_unbind_all(dev, ddev);
> > > > > > error:
> > > > > > /*
> > > > > > * Don't use dev_err_probe(), as it would overwrite the probe
> > > > > > deferral @@ -246,7 +277,7 @@ static int rzg2l_du_drm_init(struct device *dev)
> > > > > > return ret;
> > > > > > }
> > > > > >
> > > > > > -static void rzg2l_du_drm_fini(struct device *dev)
> > > > > > +static void rzg2l_du_drm_fini(struct device *dev, bool
> > > > > > +has_components)
> > > > > > {
> > > > > > struct rzg2l_du_device *du = dev_get_drvdata(dev);
> > > > > > struct drm_device *ddev = du->ddev; @@ -254,6 +285,83 @@
> > > > > > static void rzg2l_du_drm_fini(struct device *dev)
> > > > > > drm_dev_unregister(ddev);
> > > > > > drm_atomic_helper_shutdown(ddev);
> > > > > > drm_kms_helper_poll_fini(ddev);
> > > > > > +
> > > > > > + if (has_components)
> > > > > > + component_unbind_all(dev, ddev);
> > > > > > +
> > > > > > + du->ddev = NULL;
> > > > > > +}
> > > > > > +
> > > > > > +/*
> > > > > > +---------------------------------------------------------------
> > > > > > +--------
> > > > > > +------
> > > > > > + * Component master
> > > > > > + */
> > > > > > +
> > > > > > +static int rzg2l_du_master_bind(struct device *dev) {
> > > > > > + return rzg2l_du_drm_init(dev, true); }
> > > > > > +
> > > > > > +static void rzg2l_du_master_unbind(struct device *dev) {
> > > > > > + rzg2l_du_drm_fini(dev, true);
> > > > > > +}
> > > > > > +
> > > > > > +static const struct component_master_ops rzg2l_du_master_ops = {
> > > > > > + .bind = rzg2l_du_master_bind,
> > > > > > + .unbind = rzg2l_du_master_unbind, };
> > > > > > +
> > > > > > +static int rzg2l_du_instance_probe(struct rzg2l_du_device *du) {
> > > > > > + struct component_match *match = NULL;
> > > > > > + const struct of_device_id *of_id;
> > > > > > + struct device *dev = du->dev;
> > > > > > +
> > > > > > + if (!rzg2l_du_has(du, RZG2L_DU_FEATURE_COMPONENT))
> > > > > > + return rzg2l_du_drm_init(dev, false);
> > > > > > +
> > > > > > + for_each_available_child_of_node_scoped(dev->of_node->parent, np) {
> > > > > > + of_id = of_match_node(dev->driver->of_match_table, np);
> > > > > > + if (!of_id || of_id->data != du->info)
> > > > > > + continue;
> > > > > > +
> > > > > > + /* The first available DU instance is the component master. */
> > > > > > + if (!du->is_master) {
> > > > > > + if (np != dev->of_node)
> > > > > > + return component_add(dev, &rzg2l_du_instance_ops);
> > > > > > +
> > > > > > + du->is_master = true;
> > > > > > + continue;
> > > > > > + }
> > > > > > +
> > > > > > + drm_of_component_match_add(dev, &match, component_compare_of,
> > > > > > +np);
> > > > >
> > > > >
> > > > > The master is chosen purely by DT order. If the first available DU
> > > > > never probes, the second never gets a DRM device. How do you handle this case?
> > > >
> > > > All available instances are part of the component match, so the DRM
> > > > device is only created once all of them have probed, whichever one
> > > > is the master.
> > > >
> > > > This is how the component framework works.
> > > >
> > > > To use a single DU, the other one can be disabled in DT, in this
> > > > case the remaining instance becomes the master and initializes the
> > > > DRM device on its own.
> > >
> > >
> > > Assume both DU's available and run time
> > >
> > > second DU is probed first and master never probed at all.
> > > What is the state of second DU as bind never calls?
> >
> >
> > The second DU probes, registers itself with component_add() and stays idle, without touching the
> > hardware.
> >
> > When the master probes, both instances are bound and the DRM device is created.
> >
> > If the master never probes, there is no DRM device, because the bind is only triggered once the master
> > has registered the aggregate device with
> > component_master_add_with_match()
>
> Not sure is it the normal use case? DU0 and DU1 are independent devices
>
> 1) DU0 or DU1 should work independently irrespective of the probe failure of
> other device
>
> 2) When both DU's are probed, then we need to aggregate the device using component
> framework so that use case like dynamically switching DSI0 to DSI1 can be achieved.
IMHO 1) and 2) can't be achieved together.
CRTCs and planes can't be added to a DRM device after it has been registered.
If DU0 registered the DRM device on its own, DU1 could not join it later.
To have both DUs in one DRM device, as needed for 2), the DRM device must be
created once both instances are present.
That is what the component framework does here.
I'm seeing others, let me say "multi-instance" drivers such as:
- rockchip_drm_drv.c [1]
- imx-drm-core.c [2]
- sun4i_drv.c [3]
Which are working with the same pattern.
IMHO a probe failure is also unlikely in practice: the DU probe only maps the
registers, sets the DMA mask and allocates memory.
The dependencies (VSP, bridges, clocks) are looked up at bind time, where -EPROBE_DEFER
is handled. To use a single DU, the other one can be disabled in the
device tree.
[1] https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/rockchip/rockchip_drm_drv.c#L145
[2] https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c#L210
[3] https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/sun4i/sun4i_drv.c#L62
Kind regards,
Tommaso
>
> Cheers,
> Biju
>
>
next prev parent reply other threads:[~2026-11-24 14:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 12:19 [PATCH v10 00/12] drm: renesas: rz-du: Add RZ/G3E support Tommaso Merciai
2026-11-13 12:19 ` [PATCH v10 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/G3E SoC Tommaso Merciai
2026-11-13 12:19 ` [PATCH v10 02/12] drm: renesas: rz-du: vsp: Keep the planes in the VSP Tommaso Merciai
2026-11-18 14:09 ` Biju Das
2026-11-18 18:08 ` Tommaso Merciai
2026-11-13 12:19 ` [PATCH v10 03/12] drm: renesas: rz-du: Reference the DRM device by pointer Tommaso Merciai
2026-11-23 15:55 ` Biju Das
2026-11-13 12:20 ` [PATCH v10 04/12] drm: renesas: rz-du: Count all registered encoders for the possible clones Tommaso Merciai
2026-11-23 16:16 ` Biju Das
2026-11-13 12:20 ` [PATCH v10 05/12] drm: renesas: rz-du: Split the mode setting initialization Tommaso Merciai
2026-11-23 16:31 ` Biju Das
2026-11-13 12:20 ` [PATCH v10 06/12] drm: renesas: rz-du: Make the CRTC index relative to the DRM device Tommaso Merciai
2026-11-23 16:37 ` Biju Das
2026-11-13 12:20 ` [PATCH v10 07/12] drm: renesas: rz-du: Share the encoder of an output driven by several DUs Tommaso Merciai
2026-11-23 16:44 ` Biju Das
2026-11-13 12:20 ` [PATCH v10 08/12] drm: renesas: rz-du: Separate the DU instance from the DRM device Tommaso Merciai
2026-11-23 16:59 ` Biju Das
2026-11-24 9:20 ` Tommaso Merciai
2026-11-24 9:33 ` Biju Das
2026-11-24 11:59 ` Tommaso Merciai
2026-11-24 12:51 ` Biju Das
2026-11-24 15:24 ` Tommaso Merciai
2026-11-13 12:20 ` [PATCH v10 09/12] drm: renesas: rz-du: Move the DRM device initialization to helpers Tommaso Merciai
2026-11-13 12:20 ` [PATCH v10 10/12] drm: renesas: rz-du: Support several DU instances in one DRM device Tommaso Merciai
2026-11-24 7:47 ` Biju Das
2026-11-24 11:53 ` Tommaso Merciai
2026-11-24 13:18 ` Biju Das
2026-11-24 13:59 ` Tommaso Merciai
2026-11-24 14:11 ` Biju Das
2026-11-24 14:52 ` Tommaso Merciai [this message]
2026-11-13 12:20 ` [PATCH v10 11/12] drm: renesas: rz-du: Add RZ/G3E (R9A09G047) DU support Tommaso Merciai
2026-11-13 12:20 ` [PATCH v10 12/12] arm64: dts: renesas: r9a09g047: Add DU{0,1} nodes Tommaso Merciai
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=awWkwJTxdJV1owf-@tom-desktop \
--to=tommaso.merciai.xr@bp.renesas.com \
--cc=airlied@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=magnus.damm@gmail.com \
--cc=mripard@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomm.merciai@gmail.com \
--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