RE: [PATCH v10 06/12] drm: renesas: rz-du: Make the CRTC index relative to the DRM device
From: Biju Das
Date: Mon Nov 23 2026 - 11:37:25 EST
Hi Tommaso,
> -----Original Message-----
> From: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> Sent: 13 November 2026 12:20
> Subject: [PATCH v10 06/12] drm: renesas: rz-du: Make the CRTC index relative to the DRM device
>
> The possible_crtcs masks of planes and encoders hold CRTC indices within the DRM device, but
> rzg2l_du_vsps_init() and
> rzg2l_du_modeset_init_finish() build them from the index of the CRTC within the DU instance. The two
> only match while an instance owns the whole DRM device.
>
> In preparation for supporting RZ/G3E, where two instances share one, record in each instance the index
> of its first CRTC and offset the masks by it. The index is zero for instances that own their DRM
> device, so their masks are unchanged.
>
> No functional change intended.
>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
> ---
> v9->v10:
> - No changes.
>
> v8->v9:
> - New patch.
>
> drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h | 1 + drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 4
> ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h b/drivers/gpu/drm/renesas/rz-
> du/rzg2l_du_drv.h
> index 47ceaf892339..2952c9d7348b 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h
> @@ -70,6 +70,7 @@ struct rzg2l_du_device {
> void __iomem *mmio;
>
> struct drm_device *ddev;
> + unsigned int index;
>
> struct rzg2l_du_crtc crtcs[RZG2L_DU_MAX_CRTCS];
> unsigned int num_crtcs;
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c b/drivers/gpu/drm/renesas/rz-
> du/rzg2l_du_kms.c
> index 73cb3199f90f..456b29538db9 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c
> @@ -367,7 +367,7 @@ static int rzg2l_du_vsps_init(struct rzg2l_du_device *rcdu)
> else
> vsps[vsps_count++].np = args.np;
>
> - vsps[j].crtcs_mask |= BIT(i);
> + vsps[j].crtcs_mask |= BIT(rcdu->index + i);
>
> /*
> * Store the VSP pointer and pipe index in the CRTC. If the @@ -480,7 +480,7 @@ int
> rzg2l_du_modeset_init_finish(struct drm_device *dev)
> const struct rzg2l_du_output_routing *route =
> &renc->dev->info->routes[renc->output];
>
> - encoder->possible_crtcs = route->possible_outputs;
> + encoder->possible_crtcs = route->possible_outputs <<
> +renc->dev->index;
If you define struct rzg2l_du_device *rcdu = renc->rcdu; in patch#5
encoder->possible_crtcs = route->possible_outputs << rcdu->index;
Cheers,
Biju
> encoder->possible_clones = (1 << num_encoders) - 1;
> }
>
> --
> 2.54.0