Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp196350rdh; Wed, 7 Feb 2024 01:52:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUjvpBGpFmLZsRGiebqRu4t2JFHGd4n+/jUE3NG/fB3OCQfuCLXZfZXH/fEHxp+OYI1wCYsv8lkOzv7FrBe3+PpECVOaQ6DMvYH+NR95Q== X-Google-Smtp-Source: AGHT+IEeqhy8OVEEYJxmxwTUfWTg8wZjWJ6h7yvtyiDMHizOqJYus0cXLqwhNac9IE/MZkgmUW3Y X-Received: by 2002:a0d:d74c:0:b0:604:9831:11a3 with SMTP id z73-20020a0dd74c000000b00604983111a3mr399433ywd.2.1707299527866; Wed, 07 Feb 2024 01:52:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707299527; cv=pass; d=google.com; s=arc-20160816; b=TLoo08p4yenogMNu8U/pAAYvUzLn++5B21ggZQm/+uY9dyv8LDQ530OeuKVCiU/0eV LSuvAIaq0f+KfL91KcD9fk81pqpgL4rZ8NkFzU8p8xJONirpu8v18g64XLqdNg/WWIfd XnmwVvex/40ZigfHQzCly2tuzBKeLttpIAawVRAwaEpRGjHfLVnslFqA6obXTYSIYXii syEGrPsthclbeeIFRE0KSU0votkzgmP+jUFgxmMo4c+2kgueBQKdcuIeiPcxQbTmhrFn 9gLNVXLDAUGZiMvJvQQR+c0JYT5K8krtE6QIk2l2iL+PxioAGqzQk/S6BDzviETinB9C pofQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=EkQyZ0MI8wRFHDASNpaqF76TZwJQiavWYlONDY7LM2I=; fh=Z1afLvcrwGH9RE71I3uM1NzY/KH3ej3xiwZiJDlLttM=; b=kxFyVWGJxWpZly98AIpzPDPj3Msa6vN4MIhOR8p8j81dJimBAfs/uxdKtlvO6TdPDp BfHUzBLt+LcFPqgXSUobGn7TiQSVqOeKwAdWfkwY8MCN6nYvhUswpY+uZV2N9rBp48T0 rrBdDKRf8bDaXah3Ly7iC/L5P2N6TfgfCX+RZsH/tuyOAOxI+bUp4v607VUp5EMm/26u wLhI/5I3/FbbP/U3toS1AsH3bYUtiYjvT9N3ErTKNLfQeGXtzhHRQD2dIx66jFBr2iPz rpyKhO/XYF0kGFX+nfd8CmJVmbIABayNBxDnGBQcHILSootLAtZ80jiEIEjDP4gp8pHe pCHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=PgECd6Mf; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-56252-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56252-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXLWP7CRJKFJq6X1YZnk8tbxDQnCknyfkwK4ExxJzJ8LVw9gqYUqYY9NsawBg+Uxm7V8sPD/DGNLpbzV2ocKspG1Z3VTcvipq5iDCinIA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p25-20020a637419000000b005d622b60818si1152513pgc.803.2024.02.07.01.52.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 01:52:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56252-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=PgECd6Mf; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-56252-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56252-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9374B28198D for ; Wed, 7 Feb 2024 09:51:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6A7222EE8; Wed, 7 Feb 2024 09:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="PgECd6Mf" Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 881B5225CC for ; Wed, 7 Feb 2024 09:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707299483; cv=none; b=qCR45h2vWpzPoXmp1ImnrwG4o4EJGkWXJBmNFdxIMxEWgPQxwzDZrWi+xQHLKri0Rqwd+9aAhXSCCJv/CD7DY8n8ZurOcqpmRN7gSikQ8FIyH7+DMuBkyuq0f264W3PqSmWmzKUPWFKNznYRayvzCjrOpTLsfaLGA/651hWWBCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707299483; c=relaxed/simple; bh=+wLfjivlnDC/nRMpk/ta4RN6xFv0zswj9bBhqdzUxdE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IYO91y3XwCRCMlCLuTIO4BVc/NIpDUT07Y6nOGCFfm3VOpJa8dozlXsnnF9OyVWrrOOibaNKeIliU6LaQzoo3M7C3oS452JhKetsyGObij9CU0kWAs0JYSgSPab8g+YEoEp86ARCFWYa5gs6vXrRSuPZ9YcELe8NS0N7o4zqglA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=PgECd6Mf; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-33b1c33b9c9so99964f8f.0 for ; Wed, 07 Feb 2024 01:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1707299480; x=1707904280; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=EkQyZ0MI8wRFHDASNpaqF76TZwJQiavWYlONDY7LM2I=; b=PgECd6MfriRo2Mudrjw1IiMFjLwHgEuwqhVLj7lzgEpWxSwzCbMYur3Miy4dRkDiIn JUD80egbOIu1PAuL5qNBJgC4hBrIfH9gzPcxjiORIHjK5aa4Jds8EmjntMfFMSIAZ7Ja ec4KeZoqA8PozGFVlin+lXC7tE99NThcscyiw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707299480; x=1707904280; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EkQyZ0MI8wRFHDASNpaqF76TZwJQiavWYlONDY7LM2I=; b=DgT+YlR80nthrvj6VB5s4YPy63vMsv4F0rcSlkayeiKk3RZqekiUBIpVQ7B+5vtyx9 0zKjPr3MjBdk6A5v9D7uGOmde1t7XR27LjKb8Al6FgismajP5IdYtmBEW44Lqzyaq594 biXaPeD8iWf3n2VuaHKiG7exdOywOcFyy84tvbXQ1AlPrQxlX1lIq/5eTYMzpHXqw0pZ CWAl7dNc+4q7mC0hmt2aa7cZUirOkKFJUiaAXpewvDVvFwJ9jOpkHCfZRW8JwNjY/HyX tX58c6vSNbD1GB13/oeaX8DS6eFVhckV8wb2V0MuhZokUVgLVdXeKx6rdW7FPwG8ZydX Fwbg== X-Forwarded-Encrypted: i=1; AJvYcCWQ9kChHuJwI50OFVaSgFXz2Ck1bOjPxoAmYIgLm6kkAwkAyIJtwcBIiw//1Oq+YKp/5DA2n85+Wyf67ot9h3GJySmcxcZyx8CR1XIU X-Gm-Message-State: AOJu0YwHgDunXgmrY14fziP85hofiX1OOXUFjx6et/aawcxU5z2m1DNU 2AVjsY8uEnznMAk4vUdXmPVREBdw84tkoF6Vkw3vET36XSF43gNE1Sb0agbkQmY= X-Received: by 2002:adf:e481:0:b0:33b:50e9:738 with SMTP id i1-20020adfe481000000b0033b50e90738mr326080wrm.7.1707299479636; Wed, 07 Feb 2024 01:51:19 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUN+wH4FMpYY1KvrFGNMyc5TEF8rohsy3qqHObc/Mx0XKUvKZvceDJDWvcdR35GH3U42vZP3qkGdnM/yZfV7gWl+L1fyFhthC/1glV0IAzfr1E83jrD9Fy8wkbNVgKaen2KcXeWOE2rwSvY7FPUgv86bUJvTroJaLLwyXKgy66gpZTyG0w3VSgRHUDEQQcgDrQTrG3sfukcb6+VEgnMjQJxDjB6u7vkTF16ZdJiv5SD+mBW2rBHzq288HDIVnhGys3ht2RV6oeuVMzWUckWmbJEat7SVtRrht0oCHsymBhZOqlvFzEnZR25ZqXyX04q Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id a6-20020a056000100600b0033b3c03053esm1062568wrx.78.2024.02.07.01.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 01:51:19 -0800 (PST) Date: Wed, 7 Feb 2024 10:51:17 +0100 From: Daniel Vetter To: Daniel van Vugt Cc: Mario Limonciello , Daniel Vetter , Greg Kroah-Hartman , Helge Deller , Jani Nikula , Danilo Krummrich , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] fbcon: Defer console takeover for splash screens to first switch Message-ID: Mail-Followup-To: Daniel van Vugt , Mario Limonciello , Greg Kroah-Hartman , Helge Deller , Jani Nikula , Danilo Krummrich , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20240206101100.25536-1-daniel.van.vugt@canonical.com> <20240206101100.25536-2-daniel.van.vugt@canonical.com> <26893900-2d0d-4624-94f1-c4aa88386e9c@canonical.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <26893900-2d0d-4624-94f1-c4aa88386e9c@canonical.com> X-Operating-System: Linux phenom 6.6.11-amd64 On Wed, Feb 07, 2024 at 10:03:10AM +0800, Daniel van Vugt wrote: > On 6/2/24 23:41, Mario Limonciello wrote: > > On 2/6/2024 08:21, Daniel Vetter wrote: > >> On Tue, Feb 06, 2024 at 06:10:51PM +0800, Daniel van Vugt wrote: > >>> Until now, deferred console takeover only meant defer until there is > >>> output. But that risks stepping on the toes of userspace splash screens, > >>> as console messages may appear before the splash screen. So check the > >>> command line for the expectation of userspace splash and if present then > >>> extend the deferral until after the first switch. > >>> > >>> V2: Added Kconfig option instead of hard coding "splash". > >>> > >>> Closes: https://bugs.launchpad.net/bugs/1970069 > >>> Cc: Mario Limonciello > >>> Signed-off-by: Daniel van Vugt > >>> --- > >>> ? drivers/video/console/Kconfig??? | 13 +++++++++++ > >>> ? drivers/video/fbdev/core/fbcon.c | 38 ++++++++++++++++++++++++++++++-- > >>> ? 2 files changed, 49 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig > >>> index bc31db6ef7..a6e371bfb4 100644 > >>> --- a/drivers/video/console/Kconfig > >>> +++ b/drivers/video/console/Kconfig > >>> @@ -138,6 +138,19 @@ config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER > >>> ??????? by the firmware in place, rather then replacing the contents with a > >>> ??????? black screen as soon as fbcon loads. > >>> ? +config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER_CONDITION > >>> +??? string "Framebuffer Console Deferred Takeover Condition" > >>> +??? depends on FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER > >>> +??? default "splash" > >>> +??? help > >>> +????? If enabled this defers further the framebuffer console taking over > >>> +????? until the first console switch has occurred. And even then only if > >>> +????? text has been output, and only if the specified parameter is found > >>> +????? on the command line. This ensures fbcon does not interrupt userspace > >>> +????? splash screens such as Plymouth which may be yet to start rendering > >>> +????? at the time of the first console output. "splash" is the simplest > >>> +????? distro-agnostic condition for this that Plymouth checks for. > >> > >> Hm this seems a bit strange since a lot of complexity that no one needs, > >> also my impression is that it's rather distro specific how you want this > >> to work. So why not just a Kconfig option that lets you choose how much > >> you want to delay fbcon setup, with the following options: > >> > >> - no delay at all > >> - dely until first output from the console (which then works for distros > >> ?? which set a log-level to suppress unwanted stuff) > >> - delay until first vt-switch. In that case I don't think we also need to > >> ?? delay for first output, since vt switch usually means you'll get first > >> ?? output right away (if it's a vt terminal) or you switch to a different > >> ?? graphical console (which will keep fbcon fully suppressed on the drm > >> ?? side). > >> > > I had similar thoughts, and had prototyped some of this already. But in the end > it felt like extra complexity there was no demand for. For me this one is a bit too complex, since if you enable the vt switch delay you also get the output delay on top. That seems one too much and I can't come up with a use-case where you actually want that. So just a choice of one or the other or none feels cleaner. > If you would like to specify the preferred Kconfig design then I can implement > it. Though I don't think there is an enumeration type. It could also be a > runtime enumeration (deferred_takeover) controlled by fbcon=something. There's a choice in Kconfig, see e.g. kernel/Kconfig.hz for an example. > > IIUC there is an "automatic" VT switch that happens with Ubuntu GRUB + Ubuntu > > kernels. > > > > Why? > > > > Couldn't this also be suppressed by just not doing that? > > I have not seen any automatic VT switches in debugging but now that you mention > it I was probably only debugging on drm-misc-next and not an Ubuntu kernel. Hm but I don't see how the output delay would paper over a race (if there is one) reliable for this case? If you do vt switch for boot splash or login screen and don't yet have drm opened for display or something like that, then fbcon can sneak in anyway ... Cheers, Sima > > - Daniel > > > > >> I think you could even reuse the existing > >> CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER for this, and then just > >> compile-time select which kind of notifier to register (well plus the > >> check for "splash" on the cmdline for the vt switch one I guess). > >> > >> Thoughts? > >> > >> Cheers, Sima > >> > >> > >>> + > >>> ? config STI_CONSOLE > >>> ????? bool "STI text console" > >>> ????? depends on PARISC && HAS_IOMEM > >>> diff --git a/drivers/video/fbdev/core/fbcon.c > >>> b/drivers/video/fbdev/core/fbcon.c > >>> index 63af6ab034..98155d2256 100644 > >>> --- a/drivers/video/fbdev/core/fbcon.c > >>> +++ b/drivers/video/fbdev/core/fbcon.c > >>> @@ -76,6 +76,7 @@ > >>> ? #include /* For counting font checksums */ > >>> ? #include > >>> ? #include > >>> +#include > >>> ? ? #include "fbcon.h" > >>> ? #include "fb_internal.h" > >>> @@ -3358,6 +3359,26 @@ static int fbcon_output_notifier(struct > >>> notifier_block *nb, > >>> ? ????? return NOTIFY_OK; > >>> ? } > >>> + > >>> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER_CONDITION > >>> +static int initial_console; > >>> +static struct notifier_block fbcon_switch_nb; > >>> + > >>> +static int fbcon_switch_notifier(struct notifier_block *nb, > >>> +???????????????? unsigned long action, void *data) > >>> +{ > >>> +??? struct vc_data *vc = data; > >>> + > >>> +??? WARN_CONSOLE_UNLOCKED(); > >>> + > >>> +??? if (vc->vc_num != initial_console) { > >>> +??????? dummycon_unregister_switch_notifier(&fbcon_switch_nb); > >>> +??????? dummycon_register_output_notifier(&fbcon_output_nb); > >>> +??? } > >>> + > >>> +??? return NOTIFY_OK; > >>> +} > >>> +#endif > >>> ? #endif > >>> ? ? static void fbcon_start(void) > >>> @@ -3370,7 +3391,16 @@ static void fbcon_start(void) > >>> ? ????? if (deferred_takeover) { > >>> ????????? fbcon_output_nb.notifier_call = fbcon_output_notifier; > >>> -??????? dummycon_register_output_notifier(&fbcon_output_nb); > >>> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER_CONDITION > >>> +??????? if (cmdline_find_option_bool(boot_command_line, > >>> +????????????? CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER_CONDITION)) { > >>> +??????????? initial_console = fg_console; > >>> +??????????? fbcon_switch_nb.notifier_call = fbcon_switch_notifier; > >>> +??????????? dummycon_register_switch_notifier(&fbcon_switch_nb); > >>> +??????? } else > >>> +#endif > >>> +??????????? dummycon_register_output_notifier(&fbcon_output_nb); > >>> + > >>> ????????? return; > >>> ????? } > >>> ? #endif > >>> @@ -3417,8 +3447,12 @@ void __exit fb_console_exit(void) > >>> ? { > >>> ? #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER > >>> ????? console_lock(); > >>> -??? if (deferred_takeover) > >>> +??? if (deferred_takeover) { > >>> ????????? dummycon_unregister_output_notifier(&fbcon_output_nb); > >>> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER_CONDITION > >>> +??????? dummycon_unregister_switch_notifier(&fbcon_switch_nb); > >>> +#endif > >>> +??? } > >>> ????? console_unlock(); > >>> ? ????? cancel_work_sync(&fbcon_deferred_takeover_work); > >>> --? > >>> 2.43.0 > >>> > >> > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch