All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
To: dri-devel <dri-devel@lists.freedesktop.org>
Cc: Melissa Wen <melissa.srw@gmail.com>,
	Haneen Mohammed <hamohammed.sa@gmail.com>,
	Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Subject: [PATCH] drm/vkms: detect modes during output initialization
Date: Fri, 27 Nov 2020 18:10:17 -0300	[thread overview]
Message-ID: <9365f1d0-2bb7-d7e8-dad6-62111abadee8@collabora.com> (raw)
In-Reply-To: <20201124143947.GP401619@phenom.ffwll.local>

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@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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-11-30  1:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 16:19 [BUG] drm/vkms: Failure when using drmGetConnectorCurrent() Leandro Ribeiro
2020-11-24 14:39 ` Daniel Vetter
2020-11-27 20:31   ` Leandro Ribeiro
2020-11-27 21:10   ` Leandro Ribeiro [this message]
2020-11-27 21:16     ` [PATCH] drm/vkms: detect modes during output initialization Leandro Ribeiro
2020-11-30 10:23     ` Simon Ser
2020-11-30 11:13       ` Pekka Paalanen
2020-11-30 11:16         ` Simon Ser
2020-11-30 11:24           ` Pekka Paalanen
2020-11-30 12:20             ` Simon Ser
2020-12-01  8:46               ` Pekka Paalanen
2020-12-01  8:55                 ` Simon Ser
2020-12-01  2:24     ` [drm/vkms] b6c9ddb8c4: WARNING:at_drivers/gpu/drm/drm_probe_helper.c:#drm_helper_probe_single_connector_modes kernel test robot
2020-12-01  2:24       ` kernel test robot
2020-12-01  2:24       ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9365f1d0-2bb7-d7e8-dad6-62111abadee8@collabora.com \
    --to=leandro.ribeiro@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=melissa.srw@gmail.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.