[v2,2/2] drm: Make fbdev emulation select FB_CORE instead of depends on FB

Message ID 20230701214503.550549-3-javierm@redhat.com
State New
Headers
Series Allow disabling all native fbdev drivers and only keeping DRM emulation |

Commit Message

Javier Martinez Canillas July 1, 2023, 9:44 p.m. UTC
  Now that the fbdev core has been split in FB_CORE and FB, make DRM fbdev
emulation layer to just select the former.

This allows to disable the CONFIG_FB option if is not needed, which will
avoid the need to explicitly disable each of the legacy fbdev drivers.

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

Changes in v2:
- Make CONFIG_DRM_FBDEV_EMULATION to select FB_CORE (Thomas Zimmermann).

 drivers/gpu/drm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Arnd Bergmann July 1, 2023, 10:06 p.m. UTC | #1
On Sat, Jul 1, 2023, at 23:44, Javier Martinez Canillas wrote:
> Now that the fbdev core has been split in FB_CORE and FB, make DRM fbdev
> emulation layer to just select the former.
>
> This allows to disable the CONFIG_FB option if is not needed, which will
> avoid the need to explicitly disable each of the legacy fbdev drivers.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> Changes in v2:
> - Make CONFIG_DRM_FBDEV_EMULATION to select FB_CORE (Thomas Zimmermann).
>
>  drivers/gpu/drm/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index afb3b2f5f425..d9b1710e3ad0 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -132,7 +132,7 @@ config DRM_DEBUG_MODESET_LOCK
>  config DRM_FBDEV_EMULATION
>  	bool "Enable legacy fbdev support for your modesetting driver"
>  	depends on DRM_KMS_HELPER
> -	depends on FB=y || FB=DRM_KMS_HELPER
> +	select FB_CORE

This will unfortunately force FB_CORE=y even with DRM=m, it would be nice
to allow both to be loadable modules. Any of these should work:

a) Add another hidden symbol like

config DRM_FB_CORE
      def_tristate DRM && DRM_FBDEV_EMULATION
      select FB_CORE

b) move the 'select' to DRM

config DRM
      tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
      select FB_CORE if DRM_FBDEV_EMULATION

c) Remove the 'select' and instead use the default 

config FB_CORE
     def_tristate FB || (DRM && DRM_FBDEV_EMULATION)

       Arnd
  
Geert Uytterhoeven July 2, 2023, 9:04 a.m. UTC | #2
Hi Arnd,

On Sun, Jul 2, 2023 at 12:07 AM Arnd Bergmann <arnd@arndb.de> wrote:
> On Sat, Jul 1, 2023, at 23:44, Javier Martinez Canillas wrote:
> > Now that the fbdev core has been split in FB_CORE and FB, make DRM fbdev
> > emulation layer to just select the former.
> >
> > This allows to disable the CONFIG_FB option if is not needed, which will
> > avoid the need to explicitly disable each of the legacy fbdev drivers.
> >
> > Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> > ---
> >
> > Changes in v2:
> > - Make CONFIG_DRM_FBDEV_EMULATION to select FB_CORE (Thomas Zimmermann).
> >
> >  drivers/gpu/drm/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> > index afb3b2f5f425..d9b1710e3ad0 100644
> > --- a/drivers/gpu/drm/Kconfig
> > +++ b/drivers/gpu/drm/Kconfig
> > @@ -132,7 +132,7 @@ config DRM_DEBUG_MODESET_LOCK
> >  config DRM_FBDEV_EMULATION
> >       bool "Enable legacy fbdev support for your modesetting driver"
> >       depends on DRM_KMS_HELPER
> > -     depends on FB=y || FB=DRM_KMS_HELPER
> > +     select FB_CORE
>
> This will unfortunately force FB_CORE=y even with DRM=m, it would be nice
> to allow both to be loadable modules. Any of these should work:
>
> a) Add another hidden symbol like
>
> config DRM_FB_CORE
>       def_tristate DRM && DRM_FBDEV_EMULATION
>       select FB_CORE

More complexity to keep track of...

>
> b) move the 'select' to DRM
>
> config DRM
>       tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
>       select FB_CORE if DRM_FBDEV_EMULATION

I prefer this one, as it keeps the select close to the user.

BTW, the tristate help text can use some overhaul ;-)

> c) Remove the 'select' and instead use the default
>
> config FB_CORE
>      def_tristate FB || (DRM && DRM_FBDEV_EMULATION)

Adding it here means this patch would touch two subsystems.

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
  
Javier Martinez Canillas July 2, 2023, 10:17 a.m. UTC | #3
Geert Uytterhoeven <geert@linux-m68k.org> writes:

> Hi Arnd,
>
> On Sun, Jul 2, 2023 at 12:07 AM Arnd Bergmann <arnd@arndb.de> wrote:
>> On Sat, Jul 1, 2023, at 23:44, Javier Martinez Canillas wrote:
>> > Now that the fbdev core has been split in FB_CORE and FB, make DRM fbdev
>> > emulation layer to just select the former.
>> >
>> > This allows to disable the CONFIG_FB option if is not needed, which will
>> > avoid the need to explicitly disable each of the legacy fbdev drivers.
>> >
>> > Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>> > ---
>> >
>> > Changes in v2:
>> > - Make CONFIG_DRM_FBDEV_EMULATION to select FB_CORE (Thomas Zimmermann).
>> >
>> >  drivers/gpu/drm/Kconfig | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
>> > index afb3b2f5f425..d9b1710e3ad0 100644
>> > --- a/drivers/gpu/drm/Kconfig
>> > +++ b/drivers/gpu/drm/Kconfig
>> > @@ -132,7 +132,7 @@ config DRM_DEBUG_MODESET_LOCK
>> >  config DRM_FBDEV_EMULATION
>> >       bool "Enable legacy fbdev support for your modesetting driver"
>> >       depends on DRM_KMS_HELPER
>> > -     depends on FB=y || FB=DRM_KMS_HELPER
>> > +     select FB_CORE
>>
>> This will unfortunately force FB_CORE=y even with DRM=m, it would be nice
>> to allow both to be loadable modules. Any of these should work:
>>

Right, I missed that. Thanks for pointing that out.

>> a) Add another hidden symbol like
>>
>> config DRM_FB_CORE
>>       def_tristate DRM && DRM_FBDEV_EMULATION
>>       select FB_CORE
>
> More complexity to keep track of...
>

Yes, I would avoid this option as well.

>>
>> b) move the 'select' to DRM
>>
>> config DRM
>>       tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
>>       select FB_CORE if DRM_FBDEV_EMULATION
>
> I prefer this one, as it keeps the select close to the user.
>

Agreed with Geert that this is the best option.

> BTW, the tristate help text can use some overhaul ;-)
>

Indeed :) I will add a preparatory patch to this series improving that
prompt text.

>> c) Remove the 'select' and instead use the default
>>
>> config FB_CORE
>>      def_tristate FB || (DRM && DRM_FBDEV_EMULATION)
>
> Adding it here means this patch would touch two subsystems.
>

Yeah. Even when in practice we push changes for drivers/video and
drivers/gpu/drm in drm-misc, I agree that option (b) is better.

> Gr{oetje,eeting}s,
>
>                         Geert
>
>
  

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index afb3b2f5f425..d9b1710e3ad0 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -132,7 +132,7 @@  config DRM_DEBUG_MODESET_LOCK
 config DRM_FBDEV_EMULATION
 	bool "Enable legacy fbdev support for your modesetting driver"
 	depends on DRM_KMS_HELPER
-	depends on FB=y || FB=DRM_KMS_HELPER
+	select FB_CORE
 	select FRAMEBUFFER_CONSOLE if !EXPERT
 	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
 	default y