RE: [PATCH v10 10/12] drm: renesas: rz-du: Support several DU instances in one DRM device

From: Biju Das

Date: Wed Nov 25 2026 - 12:17:16 EST


Tommaso,

> -----Original Message-----
> From: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> Sent: 25 November 2026 17:08
> Subject: Re: [PATCH v10 10/12] drm: renesas: rz-du: Support several DU instances in one DRM device
>
> Hi Biju,
>
> On Wed, Nov 25, 2026 at 03:42:43PM +0000, Biju Das wrote:
> > Hi Tommaso,
> >
> > > -----Original Message-----
> > > From: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> > > Sent: 25 November 2026 14:14
> > > Subject: Re: [PATCH v10 10/12] drm: renesas: rz-du: Support several
> > > DU instances in one DRM device
> > >
> > > Hi Biju,
> > >
> > > On Wed, Nov 25, 2026 at 01:45:46PM +0000, Biju Das wrote:
> > > > Hi Tommaso,
> > > >
> > > > > -----Original Message-----
> > > > > From: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> > > > > Sent: 25 November 2026 13:36
> > > > > Subject: Re: [PATCH v10 10/12] drm: renesas: rz-du: Support
> > > > > several DU instances in one DRM device
> > > > >
> > > > > Hi Biju,
> > > > >
> > > > > On Wed, Nov 25, 2026 at 07:28:17AM +0000, Biju Das wrote:
> > > > > > Hi Tommaso,
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> > > > > > > Sent: 24 November 2026 14:53
> > > > > > > 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 02:11:16PM +0000, Biju Das wrote:
> > > > > > > > Hi Tommaso,
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Tommaso Merciai
> > > > > > > > > <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> > > > > > > > > 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@xxxxxxxxxxxxxx>
> > > > > > > > > > > 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@xxxxxxxxxxxxxx>
> > > > > > > > > > > > > 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@xxxxxxxxxxxxxx>
> > > > > > > > > > > > > ---
> > > > > > > > > > > > > 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.
> > > > > > >
> > > > > >
> > > > > > I guess we can achieve both use cases, if we define a companion property in the second
> device.
> > > > > > This is a static design choice left to the DT user to choose between either 1 or 2.
> > > > > >
> > > > > > Krystof/Rob/Conor: Is it ok to add optional companion property
> > > > > > to support both
> > > > > > 1 and 2? Otherwise, we plan to stick with use case 2.
> > > > > >
> > > > > > Use case 1: 1 DRM device per DU
> > > > >
> > > > > Some clarification:
> > > > >
> > > > > For 1)
> > > > >
> > > > > Just FYI, the series already supports this when only one DU is
> > > > > enabled in DT. If only DU0 (or only
> > > > > DU1) is enabled, it creates its own DRM device directly, without
> > > > > the component framework, and we will get 1 DRM device with 1 CRTC.
> > > > >
> > > > >
> > > > > # r9a09g047e57-smarc-du0-dsi.dtso
> > > > >
> > > > > &du0 {
> > > > > status = "okay";
> > > > > };
> > > > >
> > > > > &du1 {
> > > > > status = "disabled";
> > > > > };
> > > > >
> > > > > > Use case 2: 1 DRM device for 2 DU's
> > > > >
> > > > > For 2)
> > > > >
> > > > > When both DU0 and DU1 are enabled, DU0 registers the aggregate
> > > > > device with
> > > > > component_master_add_with_match() and DU1 registers itself with
> > > > > component_add(). Both are driven by the same DRM device, with 2 CRTCs.
> > > > >
> > > > >
> > > > > &du0 {
> > > > > status = "okay";
> > > > > };
> > > > >
> > > > > &du1 {
> > > > > status = "okay";
> > > > > };
> > > >
> > > > DU0 and DU1 are independent devices.
> > > > Currently if DU0 fails to probe, DU1 won't work.
> > > > So, there is a limitation in the current design.
> > >
> > > Mmmm, checking better the others vendor drivers I can see the same behaviour:
> > > if one member of the aggregate fails to probe, the others won't work either.
> > >
> > > mtk_drm_drv.c driver where we have vdosys0 and vdosys1 [1] that are
> > > sharing the same drm device. And also in this case if one fails to probe there is no drm device.
> > >
> > > Same for rk3399-base.dtsi where we have vopl_out and vopb_out [2]
> > > Same for imx6q.dtsi with ipu1_di0, ipu1_di1, ipu2_di0, ipu2_di1 [3]
> > > Same for sun7i-a20.dtsi where we have fe0, fe1 [4]
> > >
> > > Please correct me if I'm wrong.
> > >
> > > [1]
> > > https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/med
> > > iatek/mtk_drm_drv.c#L374 [2]
> > > https://elixir.bootlin.com/linux/v7.4-rc1/source/arch/arm64/boot/dts
> > > /rockchip/rk3399-
> > > base.dtsi#L245
> > > [3]
> > > https://elixir.bootlin.com/linux/v7.4-rc1/source/arch/arm/boot/dts/n
> > > xp/imx/imx6q.dtsi#L304 [4]
> > > https://elixir.bootlin.com/linux/v7.4-rc1/source/arch/arm/boot/dts/a
> > > llwinner/sun7i-a20.dtsi#L254
> > >
> >
> > Thanks for the link. After googling
> >
> > Separate DRM devices (card0 + card1) are only advantageous when
> > physical isolation is mandatory (e.g., safety-critical medical or
> > automotive instrument clusters where a primary gauge cluster cannot
> > share a kernel driver/compositor with an infotainment screen) and no
> > one normally split SoC display engine for such use case. So, I think we can go with single DRM card
> approach and no need to support 2 separate DRM cards.
>
> Thanks for sharing.
> So we can stick with the current approach right?

We need to create a separate ticket checking internally for
any customer use case for separate DRM devices?

Mostly it is single DRM device, but better to check.

Cheers,
Biju