Re: [PATCH RESEND v2 26/32] drm/vkms: Introduce config for connector EDID

Luca Ceresoli
2025-12-19T18:56:18Z

On Wed Oct 29, 2025 at 3:37 PM CET, Louis Chauvet wrote:
> Allows configuration of EDID for each connector.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>

> --- a/drivers/gpu/drm/vkms/vkms_config.h
> +++ b/drivers/gpu/drm/vkms/vkms_config.h
> +/**
> + * vkms_config_connector_set_edid() - Set the EDID data for a connector
> + * @connector_cfg: Connector configuration to modify
> + * @edid: Pointer to the EDID data buffer
> + * @len: Length of the EDID data
> + *
> + * If @len is 0, the EDID data will be cleared. If memory allocation fails,
^

Adding "and @edid ignored" would be useful.

> static int vkms_conn_get_modes(struct drm_connector *connector)
> {
> - int count;
> + struct vkms_connector *vkms_connector = drm_connector_to_vkms_connector(connector);
> + const struct drm_edid *drm_edid = NULL;
> + int count = 0;
> + struct vkms_config_connector *context = NULL;
> + struct drm_device *dev = connector->dev;
> + struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
> + struct vkms_config_connector *connector_cfg;
>
> - /* Use the default modes list from DRM */
> - count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
> - drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
> + vkms_config_for_each_connector(vkmsdev->config, connector_cfg) {
> + if (connector_cfg->connector == vkms_connector)
> + context = connector_cfg;

You can add a break statement here to avoid keeping on looping after the
connector has been found.

With the above two changes:

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering