From patchwork Tue Jan 24 13:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13114156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 15706C25B4E for ; Tue, 24 Jan 2023 13:40:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 382A210E6A1; Tue, 24 Jan 2023 13:40:20 +0000 (UTC) X-Greylist: delayed 99249 seconds by postgrey-1.36 at gabe; Tue, 24 Jan 2023 13:40:13 UTC Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by gabe.freedesktop.org (Postfix) with ESMTPS id A085C10E68B; Tue, 24 Jan 2023 13:40:13 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 44AC12187C; Tue, 24 Jan 2023 13:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1674567612; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eo0f0ziBdtPN9cBdDtmQB+JADnGJzSFyqXzDLQUPm/A=; b=0zjZSeeIiKnDLsONC7QfuWog3HHelQyQVKjRllqhFixFsSj7m9hNGZDcNa5GPpHKCVK9sD LtmSiXhDDdwF39KYiWojFsrTLbL8bEBYecX5cwQ2UWgh7uG6yeBDRqbPCIMnX4Sae3jYAx E7Al4o7LulEg4TCWlfdkj3SB5ybEin0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1674567612; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eo0f0ziBdtPN9cBdDtmQB+JADnGJzSFyqXzDLQUPm/A=; b=G31XWDRMxbO4uAuovcxnZpj/k+CfC/cj0SlkJw2m7Fu5z4fZsqXZVdCUA0h9v0Cc/4JaRZ MAo4PojcuqQI3FBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F35CE139FF; Tue, 24 Jan 2023 13:40:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8AN8Orvfz2PWZgAAMHmgww (envelope-from ); Tue, 24 Jan 2023 13:40:11 +0000 From: Thomas Zimmermann To: airlied@gmail.com, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, mripard@kernel.org, javierm@redhat.com Subject: [PATCH v2 02/10] drm/client: Add hotplug_failed flag Date: Tue, 24 Jan 2023 14:40:02 +0100 Message-Id: <20230124134010.30263-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230124134010.30263-1-tzimmermann@suse.de> References: <20230124134010.30263-1-tzimmermann@suse.de> MIME-Version: 1.0 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: linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Thomas Zimmermann , linux-tegra@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signal failed hotplugging with a flag in struct drm_client_dev. If set, the client helpers will not further try to set up the fbdev display. This used to be signalled with a combination of cleared pointers in struct drm_fb_helper, which prevents us from initializing these pointers early after allocation. The change also harmonizes behavior among DRM clients. Additional DRM clients will now handle failed hotplugging like fbdev does. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/drm_client.c | 5 +++++ drivers/gpu/drm/drm_fbdev_generic.c | 4 ---- include/drm/drm_client.h | 8 ++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index 09ac191c202d..009e7b10455c 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -208,8 +208,13 @@ void drm_client_dev_hotplug(struct drm_device *dev) if (!client->funcs || !client->funcs->hotplug) continue; + if (client->hotplug_failed) + continue; + ret = client->funcs->hotplug(client); drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); + if (ret) + client->hotplug_failed = true; } mutex_unlock(&dev->clientlist_mutex); } diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c index 3d455a2e3fb5..135d58b8007b 100644 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@ -382,10 +382,6 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client) struct drm_device *dev = client->dev; int ret; - /* Setup is not retried if it has failed */ - if (!fb_helper->dev && fb_helper->funcs) - return 0; - if (dev->fb_helper) return drm_fb_helper_hotplug_event(dev->fb_helper); diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 4fc8018eddda..39482527a775 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h @@ -106,6 +106,14 @@ struct drm_client_dev { * @modesets: CRTC configurations */ struct drm_mode_set *modesets; + + /** + * @hotplug failed: + * + * Set by client hotplug helpers if the hotplugging failed + * before. It is usually not tried again. + */ + bool hotplug_failed; }; int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,