2023-07-02 19:58:18

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 0/3] Allow disabling all native fbdev drivers and only keeping DRM emulation

This patch series splits the fbdev core support in two different Kconfig
symbols: FB and FB_CORE. The motivation for this is to allow CONFIG_FB to
be disabled, while still having the the core fbdev support needed for the
CONFIG_DRM_FBDEV_EMULATION to be enabled. The motivation is automatically
disabling all fbdev drivers instead of having to be disabled individually.

The reason for doing this is that now with simpledrm, there's no need for
the legacy fbdev (e.g: efifb or vesafb) drivers anymore and many distros
now disable them. But it would simplify the config a lot fo have a single
Kconfig symbol to disable all fbdev drivers.

I've built tested with possible combinations of CONFIG_FB, CONFIG_FB_CORE,
CONFIG_DRM_FBDEV_EMULATION and CONFIG_FB_DEVICE symbols set to 'y' or 'n'.

Patch #1 is just a cleanup for the DRM symbol prompt and help texts, patch
DRM symbol to select FB_CORE if CONFIG_DRM_FBDEV_EMULATION was enabled.

This is a v3 of the patch-set that addresses issues pointed out by Arnd
Bergmann, Thomas Zimmermann and Geert Uytterhoeven in the previous v2:

https://lists.freedesktop.org/archives/dri-devel/2023-July/411660.html

Changes in v3:
- Really make a hidden symbol by removing the prompt (Arnd Bergmann).
- Change FB_CORE to config instead of menuconfig (Arnd Bergmann).
- Keep "depends on FB" for FIRMWARE_EDID (Arnd Bergmann).
- Compile out fb_backlight.o and fbmon.o that are only needed for FB
(Arnd Bergmann).
- Make FB_DEVICE to depend on FB_CORE instead of selecting it.
- Make the DRM symbol to select FB_CORE if DRM_FBDEV_EMULATION is
enabled (Arnd Bergmann).
- Also make DRM select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
- Make DRM_FBDEV_EMULATION to depend on DRM instead of DRM_KMS_HELPER.

Changes in v2:
- Keep "depends on FB" for FB_DDC, FB_HECUBA, FB_SVGALIB, FB_MACMODES,
FB_BACKLIGHT, FB_MODE_HELPERS and FB_TILEBLITTING (Arnd Bergmann).
- Don't change the fb.o object name (Arnd Bergmann).
- Make FB_CORE a non-visible Kconfig symbol instead (Thomas Zimmermann).
- Make CONFIG_DRM_FBDEV_EMULATION to select FB_CORE (Thomas Zimmermann).

Javier Martinez Canillas (3):
drm: Improve Kconfig symbol prompt and help texts
fbdev: Split frame buffer support in FB and FB_CORE symbols
drm: Make FB_CORE to be selected if DRM fbdev emulation is enabled

arch/x86/Makefile | 2 +-
arch/x86/video/Makefile | 2 +-
drivers/gpu/drm/Kconfig | 29 ++++++++++++----------
drivers/video/console/Kconfig | 2 +-
drivers/video/fbdev/Kconfig | 40 +++++++++++++++++++------------
drivers/video/fbdev/core/Makefile | 8 +++----
6 files changed, 49 insertions(+), 34 deletions(-)

--
2.41.0



2023-07-02 19:58:23

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 1/3] drm: Improve Kconfig symbol prompt and help texts

The current text were not changed since the original Linux-2.6.12-rc2 git
import. Let's improve it and make that more aligned with the DRM/KMS docs.

Suggested-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/Kconfig | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index afb3b2f5f425..373f85e174c2 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -3,10 +3,11 @@
# Drm device configuration
#
# This driver provides support for the
-# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+# Direct Rendering Infrastructure (DRI) that is composed of the Direct
+# Rendering Manager (DRM) and Kernel Mode Settings (KMS) subsystems.
#
menuconfig DRM
- tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
+ tristate "Direct Rendering Manager (DRM) and Kernel Mode Settings (KMS)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
select DRM_PANEL_ORIENTATION_QUIRKS
select HDMI
@@ -19,13 +20,16 @@ menuconfig DRM
select VIDEO_CMDLINE
select VIDEO_NOMODESET
help
- Kernel-level support for the Direct Rendering Infrastructure (DRI)
- introduced in XFree86 4.0. If you say Y here, you need to select
- the module that's right for your graphics card from the list below.
- These modules provide support for synchronization, security, and
- DMA transfers. Please see <http://dri.sourceforge.net/> for more
- details. You should also select and configure AGP
- (/dev/agpgart) support if it is available for your platform.
+ Kernel-level support for the Direct Rendering Infrastructure (DRI),
+ that is composed of the Direct Rendering Manager (DRM) and Kernel
+ Mode Settings (KMS) subsystems.
+
+ If you say Y here, you need to select the module that's right for
+ your graphics card from the list below. These modules provide support
+ for synchronization, security, and DMA transfers.
+
+ Please see <https://www.kernel.org/doc/html/latest/gpu/index.html>
+ for more details about the Linux DRM and KMS subsystems.

config DRM_MIPI_DBI
tristate
--
2.41.0


2023-07-02 19:59:21

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 2/3] fbdev: Split frame buffer support in FB and FB_CORE symbols

Currently the CONFIG_FB option has to be enabled even if no legacy fbdev
drivers are needed (e.g: only to have support for framebuffer consoles).

The DRM subsystem has a fbdev emulation layer, but depends on CONFIG_FB
and so it can only be enabled if that dependency is enabled as well.

That means fbdev drivers have to be explicitly disabled if users want to
enable CONFIG_FB, only to use fbcon and/or the DRM fbdev emulation layer.

This patch introduces a non-visible CONFIG_FB_CORE symbol that could be
enabled just to have core support needed for CONFIG_DRM_FBDEV_EMULATION,
allowing CONFIG_FB to be disabled (and automatically disabling all the
fbdev drivers).

Nothing from fb_backlight.o and fbmon.o is used by the DRM fbdev emulation
layer so these two objects can be compiled out when CONFIG_FB is disabled.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---

Changes in v3:
- Really make a hidden symbol by removing the prompt (Arnd Bergmann).
- Change FB_CORE to config instead of menuconfig (Arnd Bergmann).
- Keep "depends on FB" for FIRMWARE_EDID (Arnd Bergmann).
- Compile out fb_backlight.o and fbmon.o that are only needed for FB
(Arnd Bergmann).
- Make FB_DEVICE to depend on FB_CORE instead of selecting it.

Changes in v2:
- Keep "depends on FB" for FB_DDC, FB_HECUBA, FB_SVGALIB, FB_MACMODES,
FB_BACKLIGHT, FB_MODE_HELPERS and FB_TILEBLITTING (Arnd Bergmann).
- Don't change the fb.o object name (Arnd Bergmann).
- Make FB_CORE a non-visible Kconfig symbol instead (Thomas Zimmermann).

arch/x86/Makefile | 2 +-
arch/x86/video/Makefile | 2 +-
drivers/video/console/Kconfig | 2 +-
drivers/video/fbdev/Kconfig | 40 +++++++++++++++++++------------
drivers/video/fbdev/core/Makefile | 8 +++----
5 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index b39975977c03..89a02e69be5f 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -259,7 +259,7 @@ drivers-$(CONFIG_PCI) += arch/x86/pci/
# suspend and hibernation support
drivers-$(CONFIG_PM) += arch/x86/power/

-drivers-$(CONFIG_FB) += arch/x86/video/
+drivers-$(CONFIG_FB_CORE) += arch/x86/video/

####
# boot loader support. Several targets are kept for legacy purposes
diff --git a/arch/x86/video/Makefile b/arch/x86/video/Makefile
index 11640c116115..5ebe48752ffc 100644
--- a/arch/x86/video/Makefile
+++ b/arch/x86/video/Makefile
@@ -1,2 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_FB) += fbdev.o
+obj-$(CONFIG_FB_CORE) += fbdev.o
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index a2a88d42edf0..1b5a319971ed 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -72,7 +72,7 @@ config DUMMY_CONSOLE_ROWS

config FRAMEBUFFER_CONSOLE
bool "Framebuffer Console support"
- depends on FB && !UML
+ depends on FB_CORE && !UML
select VT_HW_CONSOLE_BINDING
select CRC32
select FONT_SUPPORT
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index cecf15418632..d436a4fd6f0a 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -6,10 +6,14 @@
config FB_NOTIFY
bool

+config FB_CORE
+ select VIDEO_CMDLINE
+ tristate
+
menuconfig FB
- tristate "Support for frame buffer devices"
+ tristate "Support for frame buffer device drivers"
+ select FB_CORE
select FB_NOTIFY
- select VIDEO_CMDLINE
help
The frame buffer device provides an abstraction for the graphics
hardware. It represents the frame buffer of some video hardware and
@@ -33,6 +37,12 @@ menuconfig FB
<http://www.munted.org.uk/programming/Framebuffer-HOWTO-1.3.html> for more
information.

+ This enables support for native frame buffer device (fbdev) drivers.
+
+ The DRM subsystem provides support for emulated frame buffer devices
+ on top of KMS drivers, but this option allows legacy fbdev drivers to
+ be enabled as well.
+
Say Y here and to the driver for your graphics board below if you
are compiling a kernel for a non-x86 architecture.

@@ -59,7 +69,7 @@ config FIRMWARE_EDID

config FB_DEVICE
bool "Provide legacy /dev/fb* device"
- depends on FB
+ depends on FB_CORE
default y
help
Say Y here if you want the legacy /dev/fb* device file and
@@ -75,7 +85,7 @@ config FB_DDC

config FB_CFB_FILLRECT
tristate
- depends on FB
+ depends on FB_CORE
help
Include the cfb_fillrect function for generic software rectangle
filling. This is used by drivers that don't provide their own
@@ -83,7 +93,7 @@ config FB_CFB_FILLRECT

config FB_CFB_COPYAREA
tristate
- depends on FB
+ depends on FB_CORE
help
Include the cfb_copyarea function for generic software area copying.
This is used by drivers that don't provide their own (accelerated)
@@ -91,7 +101,7 @@ config FB_CFB_COPYAREA

config FB_CFB_IMAGEBLIT
tristate
- depends on FB
+ depends on FB_CORE
help
Include the cfb_imageblit function for generic software image
blitting. This is used by drivers that don't provide their own
@@ -99,7 +109,7 @@ config FB_CFB_IMAGEBLIT

config FB_CFB_REV_PIXELS_IN_BYTE
bool
- depends on FB
+ depends on FB_CORE
help
Allow generic frame-buffer functions to work on displays with 1, 2
and 4 bits per pixel depths which has opposite order of pixels in
@@ -107,7 +117,7 @@ config FB_CFB_REV_PIXELS_IN_BYTE

config FB_SYS_FILLRECT
tristate
- depends on FB
+ depends on FB_CORE
help
Include the sys_fillrect function for generic software rectangle
filling. This is used by drivers that don't provide their own
@@ -115,7 +125,7 @@ config FB_SYS_FILLRECT

config FB_SYS_COPYAREA
tristate
- depends on FB
+ depends on FB_CORE
help
Include the sys_copyarea function for generic software area copying.
This is used by drivers that don't provide their own (accelerated)
@@ -123,7 +133,7 @@ config FB_SYS_COPYAREA

config FB_SYS_IMAGEBLIT
tristate
- depends on FB
+ depends on FB_CORE
help
Include the sys_imageblit function for generic software image
blitting. This is used by drivers that don't provide their own
@@ -162,22 +172,22 @@ endchoice

config FB_SYS_FOPS
tristate
- depends on FB
+ depends on FB_CORE

config FB_DEFERRED_IO
bool
- depends on FB
+ depends on FB_CORE

config FB_IO_HELPERS
bool
- depends on FB
+ depends on FB_CORE
select FB_CFB_COPYAREA
select FB_CFB_FILLRECT
select FB_CFB_IMAGEBLIT

config FB_SYS_HELPERS
bool
- depends on FB
+ depends on FB_CORE
select FB_SYS_COPYAREA
select FB_SYS_FILLRECT
select FB_SYS_FOPS
@@ -185,7 +195,7 @@ config FB_SYS_HELPERS

config FB_SYS_HELPERS_DEFERRED
bool
- depends on FB
+ depends on FB_CORE
select FB_DEFERRED_IO
select FB_SYS_HELPERS

diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
index 9150bafd9e89..2cd213716c12 100644
--- a/drivers/video/fbdev/core/Makefile
+++ b/drivers/video/fbdev/core/Makefile
@@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_FB_NOTIFY) += fb_notify.o
-obj-$(CONFIG_FB) += fb.o
-fb-y := fb_backlight.o \
- fb_info.o \
- fbmem.o fbmon.o fbcmap.o \
+obj-$(CONFIG_FB_CORE) += fb.o
+fb-y := fb_info.o \
+ fbmem.o fbcmap.o \
modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o
+fb-$(CONFIG_FB) += fb_backlight.o fbmon.o
fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o
fb-$(CONFIG_FB_DEVICE) += fb_chrdev.o \
fb_procfs.o \
--
2.41.0


2023-07-03 09:47:24

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] drm: Improve Kconfig symbol prompt and help texts

Hi Javier

Am 02.07.23 um 21:15 schrieb Javier Martinez Canillas:
> The current text were not changed since the original Linux-2.6.12-rc2 git
> import. Let's improve it and make that more aligned with the DRM/KMS docs.
>
> Suggested-by: Geert Uytterhoeven <[email protected]>
> Signed-off-by: Javier Martinez Canillas <[email protected]>
> ---
>
> (no changes since v1)
>
> drivers/gpu/drm/Kconfig | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index afb3b2f5f425..373f85e174c2 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -3,10 +3,11 @@
> # Drm device configuration
> #
> # This driver provides support for the
> -# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
> +# Direct Rendering Infrastructure (DRI) that is composed of the Direct
> +# Rendering Manager (DRM) and Kernel Mode Settings (KMS) subsystems.
> #
> menuconfig DRM
> - tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
> + tristate "Direct Rendering Manager (DRM) and Kernel Mode Settings (KMS)"
> depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> select DRM_PANEL_ORIENTATION_QUIRKS
> select HDMI
> @@ -19,13 +20,16 @@ menuconfig DRM
> select VIDEO_CMDLINE
> select VIDEO_NOMODESET
> help
> - Kernel-level support for the Direct Rendering Infrastructure (DRI)
> - introduced in XFree86 4.0. If you say Y here, you need to select
> - the module that's right for your graphics card from the list below.
> - These modules provide support for synchronization, security, and
> - DMA transfers. Please see <http://dri.sourceforge.net/> for more
> - details. You should also select and configure AGP
> - (/dev/agpgart) support if it is available for your platform.
> + Kernel-level support for the Direct Rendering Infrastructure (DRI),
> + that is composed of the Direct Rendering Manager (DRM) and Kernel
> + Mode Settings (KMS) subsystems.

It's slightly off, as KMS is part of DRM. I'd just drop any mention of KMS.

But TBH instead of these small fixes, we should first discuss how we
organize the menu structures. For example, the DRM drivers are all
listed in the graphics menu. They might as well go into a DRM menu.

The framebuffer will be split into drivers and 'core'. The core options
(FB_DEVICE, FIRMWARE_EDID, FB_*_ENDIAN) probably deserve a separate menu.

And there's the framebuffer console, which has its own menu. We need to
show it even if only DRM is supported. Plus the other consoles.

I'm not sure what drivers/auxdisplay is, it might fit here as well.

It would be nice to rethink the overall menu.

Best regards
Thomas

> +
> + If you say Y here, you need to select the module that's right for
> + your graphics card from the list below. These modules provide support
> + for synchronization, security, and DMA transfers.
> +
> + Please see <https://www.kernel.org/doc/html/latest/gpu/index.html>
> + for more details about the Linux DRM and KMS subsystems.
>
> config DRM_MIPI_DBI
> tristate

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2023-07-03 10:01:47

by Javier Martinez Canillas

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] drm: Improve Kconfig symbol prompt and help texts

Thomas Zimmermann <[email protected]> writes:

> Hi Javier
>
> Am 02.07.23 um 21:15 schrieb Javier Martinez Canillas:

[...]

>> - Kernel-level support for the Direct Rendering Infrastructure (DRI)
>> - introduced in XFree86 4.0. If you say Y here, you need to select
>> - the module that's right for your graphics card from the list below.
>> - These modules provide support for synchronization, security, and
>> - DMA transfers. Please see <http://dri.sourceforge.net/> for more
>> - details. You should also select and configure AGP
>> - (/dev/agpgart) support if it is available for your platform.
>> + Kernel-level support for the Direct Rendering Infrastructure (DRI),
>> + that is composed of the Direct Rendering Manager (DRM) and Kernel
>> + Mode Settings (KMS) subsystems.
>
> It's slightly off, as KMS is part of DRM. I'd just drop any mention of KMS.
>
> But TBH instead of these small fixes, we should first discuss how we

Right, I'll just drop this patch and we can cleanup the text later.

> organize the menu structures. For example, the DRM drivers are all
> listed in the graphics menu. They might as well go into a DRM menu.
>
> The framebuffer will be split into drivers and 'core'. The core options
> (FB_DEVICE, FIRMWARE_EDID, FB_*_ENDIAN) probably deserve a separate menu.
>

Yes, that is what we agreed with Arnd and Geert. To add a new Kconfig in
drivers/video/fbdev/core/Kconfig and drivers/video/fbdev/Kconfig source it.

> And there's the framebuffer console, which has its own menu. We need to
> show it even if only DRM is supported. Plus the other consoles.
>
> I'm not sure what drivers/auxdisplay is, it might fit here as well.
>

That seems to be for simple character-based displays. And agree that could
be in framebuffer console as well. So we should improve the menu structure
before attempting to complicate with more options like adding the FB_CORE.

> It would be nice to rethink the overall menu.
>
> Best regards
> Thomas
>

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat