Due to limitation of ConfigFS, the max len of EDID is PAGE_SIZE (4kB on x86), it should be sufficient for many tests. One possible evolution is using a ConfigFS blob to allow bigger EDID. The EDID can be changed at any time. As for physical display, you need to trigger an HPD event to refresh the modes. Signed-off-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx> --- drivers/gpu/drm/vkms/vkms_configfs.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c index 76f28862c7652fbd9e84c42b60ad818ddee1485b..547b76d67c4cd1f9c2fb20e45f0f0583fa03b59a 100644 --- a/drivers/gpu/drm/vkms/vkms_configfs.c +++ b/drivers/gpu/drm/vkms/vkms_configfs.c @@ -814,6 +814,37 @@ static ssize_t connector_status_store(struct config_item *item, return count; } +static ssize_t connector_edid_show(struct config_item *item, char *page) +{ + struct vkms_config_connector *connector; + struct vkms_configfs_device *vkms_configfs = connector_child_item_to_vkms_configfs_device(item); + + scoped_guard(mutex, &vkms_configfs->lock) + { + connector = connector_item_to_vkms_configfs_connector(item)->vkms_config_connector; + memcpy(page, &connector->edid_blob, connector->edid_blob_len); + return connector->edid_blob_len; + } + + return -EINVAL; +} + +static ssize_t connector_edid_store(struct config_item *item, + const char *page, size_t count) +{ + struct vkms_configfs_device *vkms_configfs = connector_child_item_to_vkms_configfs_device(item); + + scoped_guard(mutex, &vkms_configfs->lock) + { + struct vkms_config_connector *connector = + connector_item_to_vkms_configfs_connector(item)->vkms_config_connector; + memcpy(&connector->edid_blob, page, count); + connector->edid_blob_len = count; + } + + return count; +} + static ssize_t connector_id_show(struct config_item *item, char *page) { struct vkms_configfs_device *vkms_configfs = @@ -833,12 +864,14 @@ static ssize_t connector_id_show(struct config_item *item, char *page) CONFIGFS_ATTR(connector_, type); CONFIGFS_ATTR(connector_, status); +CONFIGFS_ATTR(connector_, edid); CONFIGFS_ATTR_RO(connector_, id); static struct configfs_attribute *connector_attrs[] = { &connector_attr_type, &connector_attr_status, &connector_attr_id, + &connector_attr_edid, NULL, }; -- 2.47.1