[PATCH v3] simplefb: Enable boot time VESA graphic mode selection.

Michal Suchanek posted 1 patch 4 years, 4 months ago
arch/x86/Kconfig            |  6 ++++++
arch/x86/boot/video-vesa.c  |  4 ++--
drivers/firmware/Kconfig    |  1 +
drivers/video/fbdev/Kconfig | 13 +++----------
4 files changed, 12 insertions(+), 12 deletions(-)
[PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Michal Suchanek 4 years, 4 months ago
Since switch to simplefb/simpledrm VESA graphic modes are no longer
available with legacy BIOS.

The x86 realmode boot code enables the VESA graphic modes when option
FB_BOOT_VESA_SUPPORT is enabled.

To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
dependency of BOOT_VESA_SUPPORT on FB, also drop the FB_ prefix, and
select the option when simplefb enabled on x86.

The BOOT_VESA_SUPPORT is not specific to framebuffer but rather to x86
platform, move it from fbdev to x86 Kconfig.

Fixes: e3263ab389a7 ("x86: provide platform-devices for boot-framebuffers")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2: Select BOOT_VESA_SUPPORT from simplefb rather than simpledrm. The
simpledrm driver uses the firmware provided video modes only indirectly
through simplefb, and both can be enabled independently.
v3: Move BOOT_VESA_SUPPORT from fbdev to x86
---
 arch/x86/Kconfig            |  6 ++++++
 arch/x86/boot/video-vesa.c  |  4 ++--
 drivers/firmware/Kconfig    |  1 +
 drivers/video/fbdev/Kconfig | 13 +++----------
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9f5bd41bf660..cceb1aab0486 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -942,6 +942,12 @@ config GART_IOMMU
 
 	  If unsure, say Y.
 
+config BOOT_VESA_SUPPORT
+	bool
+	help
+	  If true, at least one selected framebuffer driver can take advantage
+	  of VESA video modes set at an early boot stage via the vga= parameter.
+
 config MAXSMP
 	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
 	depends on X86_64 && SMP && DEBUG_KERNEL
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
index 7e185977a984..c2c6d35e3a43 100644
--- a/arch/x86/boot/video-vesa.c
+++ b/arch/x86/boot/video-vesa.c
@@ -83,7 +83,7 @@ static int vesa_probe(void)
 			   (vminfo.memory_layout == 4 ||
 			    vminfo.memory_layout == 6) &&
 			   vminfo.memory_planes == 1) {
-#ifdef CONFIG_FB_BOOT_VESA_SUPPORT
+#ifdef CONFIG_BOOT_VESA_SUPPORT
 			/* Graphics mode, color, linear frame buffer
 			   supported.  Only register the mode if
 			   if framebuffer is configured, however,
@@ -121,7 +121,7 @@ static int vesa_set_mode(struct mode_info *mode)
 	if ((vminfo.mode_attr & 0x15) == 0x05) {
 		/* It's a supported text mode */
 		is_graphic = 0;
-#ifdef CONFIG_FB_BOOT_VESA_SUPPORT
+#ifdef CONFIG_BOOT_VESA_SUPPORT
 	} else if ((vminfo.mode_attr & 0x99) == 0x99) {
 		/* It's a graphics mode with linear frame buffer */
 		is_graphic = 1;
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 75cb91055c17..ad64f3a6f54f 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -224,6 +224,7 @@ config SYSFB
 config SYSFB_SIMPLEFB
 	bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
 	depends on SYSFB
+	select BOOT_VESA_SUPPORT
 	help
 	  Firmwares often provide initial graphics framebuffers so the BIOS,
 	  bootloader or kernel can show basic video-output during boot for
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 6ed5e608dd04..5bdd303b5268 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -66,13 +66,6 @@ config FB_DDC
 	select I2C_ALGOBIT
 	select I2C
 
-config FB_BOOT_VESA_SUPPORT
-	bool
-	depends on FB
-	help
-	  If true, at least one selected framebuffer driver can take advantage
-	  of VESA video modes set at an early boot stage via the vga= parameter.
-
 config FB_CFB_FILLRECT
 	tristate
 	depends on FB
@@ -627,7 +620,7 @@ config FB_VESA
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BOOT_VESA_SUPPORT
+	select BOOT_VESA_SUPPORT
 	help
 	  This is the frame buffer device driver for generic VESA 2.0
 	  compliant graphic cards. The older VESA 1.2 cards are not supported.
@@ -1051,7 +1044,7 @@ config FB_INTEL
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BOOT_VESA_SUPPORT if FB_INTEL = y
+	select BOOT_VESA_SUPPORT if FB_INTEL = y
 	depends on !DRM_I915
 	help
 	  This driver supports the on-board graphics built in to the Intel
@@ -1378,7 +1371,7 @@ config FB_SIS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BOOT_VESA_SUPPORT if FB_SIS = y
+	select BOOT_VESA_SUPPORT if FB_SIS = y
 	select FB_SIS_300 if !FB_SIS_315
 	help
 	  This is the frame buffer device driver for the SiS 300, 315, 330
-- 
2.31.1

Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Thomas Zimmermann 4 years, 4 months ago
Hi

Am 18.02.22 um 17:04 schrieb Michal Suchanek:
> Since switch to simplefb/simpledrm VESA graphic modes are no longer
> available with legacy BIOS.
> 
> The x86 realmode boot code enables the VESA graphic modes when option
> FB_BOOT_VESA_SUPPORT is enabled.
> 
> To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
> dependency of BOOT_VESA_SUPPORT on FB, also drop the FB_ prefix, and
> select the option when simplefb enabled on x86.
> 
> The BOOT_VESA_SUPPORT is not specific to framebuffer but rather to x86
> platform, move it from fbdev to x86 Kconfig.
> 
> Fixes: e3263ab389a7 ("x86: provide platform-devices for boot-framebuffers")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for the patch. I'll wait a bit for additional reviews before 
merging it.

Best regards
Thomas

> ---
> v2: Select BOOT_VESA_SUPPORT from simplefb rather than simpledrm. The
> simpledrm driver uses the firmware provided video modes only indirectly
> through simplefb, and both can be enabled independently.
> v3: Move BOOT_VESA_SUPPORT from fbdev to x86
> ---
>   arch/x86/Kconfig            |  6 ++++++
>   arch/x86/boot/video-vesa.c  |  4 ++--
>   drivers/firmware/Kconfig    |  1 +
>   drivers/video/fbdev/Kconfig | 13 +++----------
>   4 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 9f5bd41bf660..cceb1aab0486 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -942,6 +942,12 @@ config GART_IOMMU
>   
>   	  If unsure, say Y.
>   
> +config BOOT_VESA_SUPPORT
> +	bool
> +	help
> +	  If true, at least one selected framebuffer driver can take advantage
> +	  of VESA video modes set at an early boot stage via the vga= parameter.
> +
>   config MAXSMP
>   	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>   	depends on X86_64 && SMP && DEBUG_KERNEL
> diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
> index 7e185977a984..c2c6d35e3a43 100644
> --- a/arch/x86/boot/video-vesa.c
> +++ b/arch/x86/boot/video-vesa.c
> @@ -83,7 +83,7 @@ static int vesa_probe(void)
>   			   (vminfo.memory_layout == 4 ||
>   			    vminfo.memory_layout == 6) &&
>   			   vminfo.memory_planes == 1) {
> -#ifdef CONFIG_FB_BOOT_VESA_SUPPORT
> +#ifdef CONFIG_BOOT_VESA_SUPPORT
>   			/* Graphics mode, color, linear frame buffer
>   			   supported.  Only register the mode if
>   			   if framebuffer is configured, however,
> @@ -121,7 +121,7 @@ static int vesa_set_mode(struct mode_info *mode)
>   	if ((vminfo.mode_attr & 0x15) == 0x05) {
>   		/* It's a supported text mode */
>   		is_graphic = 0;
> -#ifdef CONFIG_FB_BOOT_VESA_SUPPORT
> +#ifdef CONFIG_BOOT_VESA_SUPPORT
>   	} else if ((vminfo.mode_attr & 0x99) == 0x99) {
>   		/* It's a graphics mode with linear frame buffer */
>   		is_graphic = 1;
> diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
> index 75cb91055c17..ad64f3a6f54f 100644
> --- a/drivers/firmware/Kconfig
> +++ b/drivers/firmware/Kconfig
> @@ -224,6 +224,7 @@ config SYSFB
>   config SYSFB_SIMPLEFB
>   	bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
>   	depends on SYSFB
> +	select BOOT_VESA_SUPPORT
>   	help
>   	  Firmwares often provide initial graphics framebuffers so the BIOS,
>   	  bootloader or kernel can show basic video-output during boot for
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index 6ed5e608dd04..5bdd303b5268 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -66,13 +66,6 @@ config FB_DDC
>   	select I2C_ALGOBIT
>   	select I2C
>   
> -config FB_BOOT_VESA_SUPPORT
> -	bool
> -	depends on FB
> -	help
> -	  If true, at least one selected framebuffer driver can take advantage
> -	  of VESA video modes set at an early boot stage via the vga= parameter.
> -
>   config FB_CFB_FILLRECT
>   	tristate
>   	depends on FB
> @@ -627,7 +620,7 @@ config FB_VESA
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> -	select FB_BOOT_VESA_SUPPORT
> +	select BOOT_VESA_SUPPORT
>   	help
>   	  This is the frame buffer device driver for generic VESA 2.0
>   	  compliant graphic cards. The older VESA 1.2 cards are not supported.
> @@ -1051,7 +1044,7 @@ config FB_INTEL
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> -	select FB_BOOT_VESA_SUPPORT if FB_INTEL = y
> +	select BOOT_VESA_SUPPORT if FB_INTEL = y
>   	depends on !DRM_I915
>   	help
>   	  This driver supports the on-board graphics built in to the Intel
> @@ -1378,7 +1371,7 @@ config FB_SIS
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> -	select FB_BOOT_VESA_SUPPORT if FB_SIS = y
> +	select BOOT_VESA_SUPPORT if FB_SIS = y
>   	select FB_SIS_300 if !FB_SIS_315
>   	help
>   	  This is the frame buffer device driver for the SiS 300, 315, 330

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Javier Martinez Canillas 4 years, 4 months ago
Hello Michal,

On 2/18/22 17:04, Michal Suchanek wrote:
> Since switch to simplefb/simpledrm VESA graphic modes are no longer
> available with legacy BIOS.
>

Maybe you can mention that is the "vga=" kernel command line parameter
since that may be more evident to people reading the commit message ?
 
> The x86 realmode boot code enables the VESA graphic modes when option
> FB_BOOT_VESA_SUPPORT is enabled.
> 
> To enable use of VESA modes with simplefb in legacy BIOS boot mode drop

I think you meant "VESA modes with the sysfb driver" ? or something like
that since otherwise it seems that you meant to use it with the simplefb
(drivers/video/fbdev/simplefb.c) fbdev driver, which doesn't support the
"vga=" param as far as I understand (it just uses whatever was setup).

The name sysfb_simplefb is really horrible, because it is too confusing
and probably we should change it at some point...

Patch itself looks good to me though.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat

Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Michal Suchánek 4 years, 4 months ago
On Wed, Feb 23, 2022 at 05:34:50PM +0100, Javier Martinez Canillas wrote:
> Hello Michal,
> 
> On 2/18/22 17:04, Michal Suchanek wrote:
> > Since switch to simplefb/simpledrm VESA graphic modes are no longer
> > available with legacy BIOS.
> 
> Maybe you can mention that is the "vga=" kernel command line parameter
> since that may be more evident to people reading the commit message ?

Yes, I suppose that could be added.

> > The x86 realmode boot code enables the VESA graphic modes when option
> > FB_BOOT_VESA_SUPPORT is enabled.
> > 
> > To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
> 
> I think you meant "VESA modes with the sysfb driver" ? or something like
> that since otherwise it seems that you meant to use it with the simplefb
> (drivers/video/fbdev/simplefb.c) fbdev driver, which doesn't support the
> "vga=" param as far as I understand (it just uses whatever was setup).

And the vga= is whatever was set up by the realmode code. And the config
option for realmode code to do that is selected by vesafb and not
simplefb so it does not wotk for simplefb/simpledrm/whatewer when efifib
is not built into the kernel.

> The name sysfb_simplefb is really horrible, because it is too confusing
> and probably we should change it at some point...
> 
> Patch itself looks good to me though.
> 
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Thanks

Michal
Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Javier Martinez Canillas 4 years, 4 months ago
On 2/23/22 17:45, Michal Suchánek wrote:

[snip]

>>>
>>> To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
>>
>> I think you meant "VESA modes with the sysfb driver" ? or something like
>> that since otherwise it seems that you meant to use it with the simplefb
>> (drivers/video/fbdev/simplefb.c) fbdev driver, which doesn't support the
>> "vga=" param as far as I understand (it just uses whatever was setup).
> 
> And the vga= is whatever was set up by the realmode code. And the config
> option for realmode code to do that is selected by vesafb and not
> simplefb so it does not wotk for simplefb/simpledrm/whatewer when efifib
> is not built into the kernel.
>

Yes, that's what I tried to say. But your commit message says "To enable
use of VESA modes with simplefb in legacy BIOS boot mode" and that isn't
accurate AFAIU (unless you meant sysfb instead).
 Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat

Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Javier Martinez Canillas 4 years, 4 months ago
On 2/23/22 17:54, Javier Martinez Canillas wrote:
> On 2/23/22 17:45, Michal Suchánek wrote:
> 
> [snip]
> 
>>>>
>>>> To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
>>>
>>> I think you meant "VESA modes with the sysfb driver" ? or something like
>>> that since otherwise it seems that you meant to use it with the simplefb
>>> (drivers/video/fbdev/simplefb.c) fbdev driver, which doesn't support the
>>> "vga=" param as far as I understand (it just uses whatever was setup).
>>
>> And the vga= is whatever was set up by the realmode code. And the config
>> option for realmode code to do that is selected by vesafb and not
>> simplefb so it does not wotk for simplefb/simpledrm/whatewer when efifib
>> is not built into the kernel.
>>
> 
> Yes, that's what I tried to say. But your commit message says "To enable
> use of VESA modes with simplefb in legacy BIOS boot mode" and that isn't
> accurate AFAIU (unless you meant sysfb instead).

In fact, probably the subject line should also be something like following:

firmware: sysfb: Enable boot time VESA graphic mode selection

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat

Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Michal Suchánek 4 years, 4 months ago
On Wed, Feb 23, 2022 at 05:54:54PM +0100, Javier Martinez Canillas wrote:
> On 2/23/22 17:45, Michal Suchánek wrote:
>
> [snip]
>
> >>>
> >>> To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
> >>
> >> I think you meant "VESA modes with the sysfb driver" ? or something like
> >> that since otherwise it seems that you meant to use it with the simplefb
> >> (drivers/video/fbdev/simplefb.c) fbdev driver, which doesn't support the
> >> "vga=" param as far as I understand (it just uses whatever was setup).
> >
> > And the vga= is whatever was set up by the realmode code. And the config
> > option for realmode code to do that is selected by vesafb and not
> > simplefb so it does not wotk for simplefb/simpledrm/whatewer when efifib
> > is not built into the kernel.
> >
>
> Yes, that's what I tried to say. But your commit message says "To enable
> use of VESA modes with simplefb in legacy BIOS boot mode" and that isn't
> accurate AFAIU (unless you meant sysfb instead).

 config SYSFB_SIMPLEFB
        bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
        depends on SYSFB
+       select BOOT_VESA_SUPPORT if X86

This to me means that it's simplefb specifically that requires it, not sysfb.
More precisely SYSFB_SIMPLEFB which is the simplefb implementation on top of
legacy BIOS.

Thanks

Michal
Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Javier Martinez Canillas 4 years, 4 months ago
On 2/23/22 18:12, Michal Suchánek wrote:
> On Wed, Feb 23, 2022 at 05:54:54PM +0100, Javier Martinez Canillas wrote:

[snip]

>>
>> Yes, that's what I tried to say. But your commit message says "To enable
>> use of VESA modes with simplefb in legacy BIOS boot mode" and that isn't
>> accurate AFAIU (unless you meant sysfb instead).
> 
>  config SYSFB_SIMPLEFB
>         bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
>         depends on SYSFB
> +       select BOOT_VESA_SUPPORT if X86
> 
> This to me means that it's simplefb specifically that requires it, not sysfb.
> More precisely SYSFB_SIMPLEFB which is the simplefb implementation on top of
> legacy BIOS.
> 

Ok, I see what you meant. The fact that simplefb is what's named to the part
of the sysfb driver that register the "simple-framebuffer" platform device
and also the name of the fbdev driver that matches the "simple-framebuffer"
is too confusing.

My point about the subject line remains thought, I would use something like:

firmware: sysfb: Enable boot time VESA graphic mode selection for simplefb

But I'll stop bike-shedding this. I don't mind if you keep the current line
and feel free to keep my r-b tag.

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat

Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Michal Suchánek 4 years, 4 months ago
On Wed, Feb 23, 2022 at 07:13:07PM +0100, Javier Martinez Canillas wrote:
> On 2/23/22 18:12, Michal Suchánek wrote:
> > On Wed, Feb 23, 2022 at 05:54:54PM +0100, Javier Martinez Canillas wrote:
> 
> [snip]
> 
> >>
> >> Yes, that's what I tried to say. But your commit message says "To enable
> >> use of VESA modes with simplefb in legacy BIOS boot mode" and that isn't
> >> accurate AFAIU (unless you meant sysfb instead).
> > 
> >  config SYSFB_SIMPLEFB
> >         bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
> >         depends on SYSFB
> > +       select BOOT_VESA_SUPPORT if X86
> > 
> > This to me means that it's simplefb specifically that requires it, not sysfb.
> > More precisely SYSFB_SIMPLEFB which is the simplefb implementation on top of
> > legacy BIOS.
> > 
> 
> Ok, I see what you meant. The fact that simplefb is what's named to the part
> of the sysfb driver that register the "simple-framebuffer" platform device
> and also the name of the fbdev driver that matches the "simple-framebuffer"
> is too confusing.
> 
> My point about the subject line remains thought, I would use something like:
> 
> firmware: sysfb: Enable boot time VESA graphic mode selection for simplefb

I see where the confusion comes from.

The efifb (and probably vesafb) has implicit unstated dependency on
sysfb. So the drivers that select BOOT_VESA_SUPPORT should instead
depend on SYSFB, and then SYSFB can select BOOT_VESA_SUPPORT, and it
will look much saner.

Thanks

Michal
Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Javier Martinez Canillas 4 years, 4 months ago
On 2/23/22 19:23, Michal Suchánek wrote:

[snip]

>> My point about the subject line remains thought, I would use something like:
>>
>> firmware: sysfb: Enable boot time VESA graphic mode selection for simplefb
> 
> I see where the confusion comes from.
>

Yeah. And just to clarify, the "simplefb" in the subject line I proposed
was about the sysfb simplefb and not the fbdev simplefb :)
 
> The efifb (and probably vesafb) has implicit unstated dependency on
> sysfb. So the drivers that select BOOT_VESA_SUPPORT should instead
> depend on SYSFB, and then SYSFB can select BOOT_VESA_SUPPORT, and it
> will look much saner.
>

That indeed would be much nicer. And I agree with you that there's an
implicit dependency that should be made explicit since SYSFB is what
registers the "efi-framebuffer" or "vesa-framebuffer" if SYSFB_SIMPLEFB
is not enabled.

Should SYSFB should only select BOOT_VESA_SUPPORT if x86 ? I know that
in practice shouldn't matter because BOOT_VESA_SUPPORT is under x86 but
I guess is more correct if that's the case.

And I think that FB_SIMPLE should depend on SYSFB_SIMPLEFB if !OF (since
a "simple-framebuffer" platform device could be registered by OF if a
Device Tree node with compatible "simple-framebuffer" exists).

Best regards, -- 
Javier Martinez Canillas
Linux Engineering
Red Hat

Re: [PATCH v3] simplefb: Enable boot time VESA graphic mode selection.
Posted by Michal Suchánek 4 years, 4 months ago
On Wed, Feb 23, 2022 at 07:34:54PM +0100, Javier Martinez Canillas wrote:
> On 2/23/22 19:23, Michal Suchánek wrote:
> 
> [snip]
> 
> >> My point about the subject line remains thought, I would use something like:
> >>
> >> firmware: sysfb: Enable boot time VESA graphic mode selection for simplefb
> > 
> > I see where the confusion comes from.
> >
> 
> Yeah. And just to clarify, the "simplefb" in the subject line I proposed
> was about the sysfb simplefb and not the fbdev simplefb :)
>  
> > The efifb (and probably vesafb) has implicit unstated dependency on
> > sysfb. So the drivers that select BOOT_VESA_SUPPORT should instead
> > depend on SYSFB, and then SYSFB can select BOOT_VESA_SUPPORT, and it
> > will look much saner.
> >
> 
> That indeed would be much nicer. And I agree with you that there's an
> implicit dependency that should be made explicit since SYSFB is what
> registers the "efi-framebuffer" or "vesa-framebuffer" if SYSFB_SIMPLEFB
> is not enabled.
> 
> Should SYSFB should only select BOOT_VESA_SUPPORT if x86 ? I know that
> in practice shouldn't matter because BOOT_VESA_SUPPORT is under x86 but
> I guess is more correct if that's the case.

Part of the reason to move it to x86 is to avoid the conditional.
Technically there is nothing stopping other platforms from running the
VESA BIOS, it's just not very practical.

> And I think that FB_SIMPLE should depend on SYSFB_SIMPLEFB if !OF (since
> a "simple-framebuffer" platform device could be registered by OF if a
> Device Tree node with compatible "simple-framebuffer" exists).

So generally SYSFB_SIMPLEFB || OF. The part that you can enable the
driver and it does not do anything because you are missing
SYSFB_SIMPLEFB is indeed confusing. There is a comment in SIMLEDRM
description but not FB_SIMPLE.

Then there is the part that if neither simplefb nor vesafb nor efifb nor
offb is built then the sysfb code is unused.

Thanks

Michal
[PATCH v4 1/3] sysfb: Make config option dependencies explicit
Posted by Michal Suchanek 4 years, 4 months ago
efifb and vesafb requires sysfb implicitly but this is not stated in
Kconfig. Add the dependency.

With that all drivers that require sysfb depend on it so it can default
to disabled.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v4: new patch
---
 drivers/firmware/Kconfig    | 5 ++---
 drivers/video/fbdev/Kconfig | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 75cb91055c17..5265eca74ba1 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -218,12 +218,11 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
 
 config SYSFB
 	bool
-	default y
-	depends on X86 || EFI
 
 config SYSFB_SIMPLEFB
 	bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
-	depends on SYSFB
+	depends on X86 || EFI
+	select SYSFB
 	help
 	  Firmwares often provide initial graphics framebuffers so the BIOS,
 	  bootloader or kernel can show basic video-output during boot for
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 3cfce8dce8d9..907c305caf27 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -628,6 +628,7 @@ config FB_VESA
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
 	select FB_BOOT_VESA_SUPPORT
+	select SYSFB
 	help
 	  This is the frame buffer device driver for generic VESA 2.0
 	  compliant graphic cards. The older VESA 1.2 cards are not supported.
@@ -641,6 +642,7 @@ config FB_EFI
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select SYSFB
 	help
 	  This is the EFI frame buffer device driver. If the firmware on
 	  your platform is EFI 1.10 or UEFI 2.0, select Y to add support for
-- 
2.34.1

Re: [PATCH v4 1/3] sysfb: Make config option dependencies explicit
Posted by Javier Martinez Canillas 4 years, 4 months ago
Hello Michal,

On 2/25/22 21:51, Michal Suchanek wrote:
> efifb and vesafb requires sysfb implicitly but this is not stated in
> Kconfig. Add the dependency.
> 
> With that all drivers that require sysfb depend on it so it can default
> to disabled.
> 
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---

Thanks for the patch. This makes much more sense to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat

[PATCH v4 2/3] sysfb: Enable boot time VESA graphic mode selection
Posted by Michal Suchanek 4 years, 4 months ago
Since switch to simplefb/simpledrm VESA graphic mode selection with vga=
kernel parameter is no longer available with legacy BIOS.

The x86 realmode boot code enables the VESA graphic modes when option
FB_BOOT_VESA_SUPPORT is enabled.

This option is selected by vesafb but not simplefb/simpledrm.

To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
dependency of BOOT_VESA_SUPPORT on FB, also drop the FB_ prefix. Select
the option from sysfb rather than the drivers that depend on it.

The BOOT_VESA_SUPPORT is not specific to framebuffer but rather to x86
platform, move it from fbdev to x86 Kconfig.

Fixes: e3263ab389a7 ("x86: provide platform-devices for boot-framebuffers")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Acked-by: Borislav Petkov <bp@suse.de>
---
v2: Select BOOT_VESA_SUPPORT from simplefb rather than simpledrm. The
simpledrm driver uses the firmware provided video modes only indirectly
through simplefb, and both can be enabled independently.
v3: Move BOOT_VESA_SUPPORT from fbdev to x86
v4: Select BOOT_VESA_SUPPORT from sysfb rather than individial sysfb based drivers.
---
 arch/x86/Kconfig            |  6 ++++++
 arch/x86/boot/video-vesa.c  |  4 ++--
 drivers/firmware/Kconfig    |  1 +
 drivers/video/fbdev/Kconfig | 12 ++----------
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9f5bd41bf660..cceb1aab0486 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -942,6 +942,12 @@ config GART_IOMMU
 
 	  If unsure, say Y.
 
+config BOOT_VESA_SUPPORT
+	bool
+	help
+	  If true, at least one selected framebuffer driver can take advantage
+	  of VESA video modes set at an early boot stage via the vga= parameter.
+
 config MAXSMP
 	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
 	depends on X86_64 && SMP && DEBUG_KERNEL
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
index 7e185977a984..c2c6d35e3a43 100644
--- a/arch/x86/boot/video-vesa.c
+++ b/arch/x86/boot/video-vesa.c
@@ -83,7 +83,7 @@ static int vesa_probe(void)
 			   (vminfo.memory_layout == 4 ||
 			    vminfo.memory_layout == 6) &&
 			   vminfo.memory_planes == 1) {
-#ifdef CONFIG_FB_BOOT_VESA_SUPPORT
+#ifdef CONFIG_BOOT_VESA_SUPPORT
 			/* Graphics mode, color, linear frame buffer
 			   supported.  Only register the mode if
 			   if framebuffer is configured, however,
@@ -121,7 +121,7 @@ static int vesa_set_mode(struct mode_info *mode)
 	if ((vminfo.mode_attr & 0x15) == 0x05) {
 		/* It's a supported text mode */
 		is_graphic = 0;
-#ifdef CONFIG_FB_BOOT_VESA_SUPPORT
+#ifdef CONFIG_BOOT_VESA_SUPPORT
 	} else if ((vminfo.mode_attr & 0x99) == 0x99) {
 		/* It's a graphics mode with linear frame buffer */
 		is_graphic = 1;
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 5265eca74ba1..be42ae6f079e 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -218,6 +218,7 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
 
 config SYSFB
 	bool
+	select BOOT_VESA_SUPPORT
 
 config SYSFB_SIMPLEFB
 	bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 907c305caf27..0e25434a71e1 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -66,13 +66,6 @@ config FB_DDC
 	select I2C_ALGOBIT
 	select I2C
 
-config FB_BOOT_VESA_SUPPORT
-	bool
-	depends on FB
-	help
-	  If true, at least one selected framebuffer driver can take advantage
-	  of VESA video modes set at an early boot stage via the vga= parameter.
-
 config FB_CFB_FILLRECT
 	tristate
 	depends on FB
@@ -627,7 +620,6 @@ config FB_VESA
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BOOT_VESA_SUPPORT
 	select SYSFB
 	help
 	  This is the frame buffer device driver for generic VESA 2.0
@@ -1053,7 +1045,7 @@ config FB_INTEL
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BOOT_VESA_SUPPORT if FB_INTEL = y
+	select BOOT_VESA_SUPPORT if FB_INTEL = y
 	depends on !DRM_I915
 	help
 	  This driver supports the on-board graphics built in to the Intel
@@ -1380,7 +1372,7 @@ config FB_SIS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BOOT_VESA_SUPPORT if FB_SIS = y
+	select BOOT_VESA_SUPPORT if FB_SIS = y
 	select FB_SIS_300 if !FB_SIS_315
 	help
 	  This is the frame buffer device driver for the SiS 300, 315, 330
-- 
2.34.1

Re: [PATCH v4 2/3] sysfb: Enable boot time VESA graphic mode selection
Posted by Javier Martinez Canillas 4 years, 4 months ago
On 2/25/22 21:51, Michal Suchanek wrote:
> Since switch to simplefb/simpledrm VESA graphic mode selection with vga=
> kernel parameter is no longer available with legacy BIOS.
> 
> The x86 realmode boot code enables the VESA graphic modes when option
> FB_BOOT_VESA_SUPPORT is enabled.
> 
> This option is selected by vesafb but not simplefb/simpledrm.
> 
> To enable use of VESA modes with simplefb in legacy BIOS boot mode drop
> dependency of BOOT_VESA_SUPPORT on FB, also drop the FB_ prefix. Select
> the option from sysfb rather than the drivers that depend on it.
> 
> The BOOT_VESA_SUPPORT is not specific to framebuffer but rather to x86
> platform, move it from fbdev to x86 Kconfig.
> 
> Fixes: e3263ab389a7 ("x86: provide platform-devices for boot-framebuffers")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> Acked-by: Borislav Petkov <bp@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat

[PATCH v4 3/3] efifb: Remove redundant efifb_setup_from_dmi stub
Posted by Michal Suchanek 4 years, 4 months ago
efifb is the only user of efifb_setup_from_dmi which is provided by
sysfb which is selected by efifb. That makes the stub redundant.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v4: new patch
---
 include/linux/efi.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/efi.h b/include/linux/efi.h
index ccd4d3f91c98..0cbbc4103632 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1329,10 +1329,6 @@ static inline struct efi_mokvar_table_entry *efi_mokvar_entry_find(
 }
 #endif
 
-#ifdef CONFIG_SYSFB
 extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
-#else
-static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt) { }
-#endif
 
 #endif /* _LINUX_EFI_H */
-- 
2.34.1

Re: [PATCH v4 3/3] efifb: Remove redundant efifb_setup_from_dmi stub
Posted by Javier Martinez Canillas 4 years, 4 months ago
On 2/25/22 21:51, Michal Suchanek wrote:
> efifb is the only user of efifb_setup_from_dmi which is provided by
> sysfb which is selected by efifb. That makes the stub redundant.
> 
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat