Re: [PATCH 13/13] drm/vkms: Allow to attach connectors and encoders

Louis Chauvet
2025-01-30T13:48:44Z

On 29/01/25 - 12:00, José Expósito wrote:
> Add a list of possible encoders to the connector configuration and
> helpers to attach and detach them.
>
> Now that the default configuration has its connector and encoder
> correctly, configure the output following the configuration.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>

Co-developped-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>

> ---
> drivers/gpu/drm/vkms/tests/vkms_config_test.c | 62 +++++++++++++++++
> drivers/gpu/drm/vkms/vkms_config.c | 69 +++++++++++++++++++
> drivers/gpu/drm/vkms/vkms_config.h | 33 +++++++++
> drivers/gpu/drm/vkms/vkms_output.c | 57 +++++++++++----
> 4 files changed, 209 insertions(+), 12 deletions(-)

[...]

> +int __must_check vkms_config_connector_attach_encoder(struct vkms_config_connector *connector_cfg,
> + struct vkms_config_encoder *encoder_cfg)
> +{
> + struct vkms_config_encoder *possible_encoder;
> + unsigned long idx = 0;
> + u32 encoder_idx = 0;
> +
> + xa_for_each(&connector_cfg->possible_encoders, idx, possible_encoder) {
> + if (possible_encoder == encoder_cfg)
> + return -EINVAL;

Is this really an error? For me this should be valid: we want to attach
the connector and the encoder, it is already the case, so it is good.

> + }
> +
> + return xa_alloc(&connector_cfg->possible_encoders, &encoder_idx,
> + encoder_cfg, xa_limit_32b, GFP_KERNEL);
> +}
> + …