[PATCH] drm/vkms: detect modes during output initialization

Leandro Ribeiro leandro.ribeiro at collabora.com
Fri Nov 27 21:10:17 UTC 2020


In userspace we can use drmGetConnector() or drmGetConnectorCurrent() in
order to retrieve connector information. The difference between both is
that the former retrieves the complete set of modes and encoders
associated with the connector, while the latter only retrieves the
currently known set of modes and encoders - but is much faster.

This performance improvement is the reason why userspace applications
may prefer to use drmGetConnectorCurrent() when they need to retrieve
information from a device. The problem is that until now VKMS used to
init its output with an encoder, but without any valid mode, so
these userspace applications would not be able to use VKMS.

Call drm_helper_probe_single_connector_modes() during VKMS output
initialization in order to start with the set of all valid modes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro at collabora.com>
---
 drivers/gpu/drm/vkms/vkms_output.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 4a1848b0318f..20343592d38a 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -80,6 +80,12 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
 		goto err_attach;
 	}
 
+	ret = drm_helper_probe_single_connector_modes(connector, XRES_MAX, YRES_MAX);
+	if (ret == 0) {
+		DRM_ERROR("Failed to get modes for connector\n");
+		goto err_attach;
+	}
+
 	ret = vkms_enable_writeback_connector(vkmsdev);
 	if (ret)
 		DRM_ERROR("Failed to init writeback connector\n");
-- 
2.29.2



More information about the dri-devel mailing list