From patchwork Fri Nov 27 21:10:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leandro Ribeiro X-Patchwork-Id: 11939445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B093C64E8A for ; Mon, 30 Nov 2020 01:03:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3049220757 for ; Mon, 30 Nov 2020 01:03:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3049220757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B07D6E408; Mon, 30 Nov 2020 01:03:02 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 737BB6F40E for ; Fri, 27 Nov 2020 21:09:15 +0000 (UTC) Received: from [IPv6:2804:431:e7dc:db22::def] (unknown [IPv6:2804:431:e7dc:db22::def]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: leandrohrb) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 335FF1F465E3; Fri, 27 Nov 2020 21:09:11 +0000 (GMT) Subject: [PATCH] drm/vkms: detect modes during output initialization To: dri-devel References: <20201124143947.GP401619@phenom.ffwll.local> From: Leandro Ribeiro Message-ID: <9365f1d0-2bb7-d7e8-dad6-62111abadee8@collabora.com> Date: Fri, 27 Nov 2020 18:10:17 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201124143947.GP401619@phenom.ffwll.local> Content-Language: en-US X-Mailman-Approved-At: Mon, 30 Nov 2020 01:02:59 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Melissa Wen , Haneen Mohammed , Rodrigo Siqueira Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reported-by: kernel test robot --- 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");