diff mbox series

[3/3] package/sdl2: rework KMS/DRM video driver dependencies

Message ID 20220804221559.46394-3-thomas.petazzoni@bootlin.com
State Accepted
Headers show
Series [1/3] package/sdl2: be more explicit in disabling optional features | expand

Commit Message

Thomas Petazzoni Aug. 4, 2022, 10:15 p.m. UTC
The KMS/DRM video driver of SDL2 can currently only be enabled when
mesa3d is the OpenGL provider, as the option has a dependency on
BR2_PACKAGE_MESA3D_GBM. Now that we have a libgbm virtual package and
BR2_PACKAGE_HAS_LIBGBM, we can do better.

However, this has uncovered a number of additional related issues that
are resolved at the same time. Here are some details:

 * the 'depends on BR2_PACKAGE_LIBDRM' is changed to a select, as we
   normally do for library dependencies. Due to this, we inherit a
   BR2_TOOLCHAIN_HAS_THREADS dependency.

 * the 'depends on BR2_PACKAGE_MESA3D_GBM' is changed to 'depends on
   BR2_PACKAGE_HAS_LIBGBM', and the 'mesa3d' dependency is changed to
   'libgbm'.

 * the KMS/DRM video driver in SDL2 needs EGL (hence the additional
   'depends on BR2_PACKAGE_HAS_LIBEGL' and the libegbl dependency is
   added in the .mk file). But in turn, EGL support is only checked
   when either OpenGL or OpenGLES support is enabled in SDL2, which is
   why we add logic to select the appropriate options.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/sdl2/Config.in | 17 ++++++++++-------
 package/sdl2/sdl2.mk   |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

Comments

Yann E. MORIN Aug. 20, 2022, 8:12 a.m. UTC | #1
Thomas, All,

On 2022-08-05 00:15 +0200, Thomas Petazzoni via buildroot spake thusly:
> The KMS/DRM video driver of SDL2 can currently only be enabled when
> mesa3d is the OpenGL provider, as the option has a dependency on
> BR2_PACKAGE_MESA3D_GBM. Now that we have a libgbm virtual package and
> BR2_PACKAGE_HAS_LIBGBM, we can do better.

I think this is a feature change, so this does not fit master. However,
it can't be applied to next either as it requires the previous tw
patches.

Do, I've left this pending for later (either after we merge next back
into master, or after we merge the next -rc into next).

Regards,
Yann E. MORIN.

> However, this has uncovered a number of additional related issues that
> are resolved at the same time. Here are some details:
> 
>  * the 'depends on BR2_PACKAGE_LIBDRM' is changed to a select, as we
>    normally do for library dependencies. Due to this, we inherit a
>    BR2_TOOLCHAIN_HAS_THREADS dependency.
> 
>  * the 'depends on BR2_PACKAGE_MESA3D_GBM' is changed to 'depends on
>    BR2_PACKAGE_HAS_LIBGBM', and the 'mesa3d' dependency is changed to
>    'libgbm'.
> 
>  * the KMS/DRM video driver in SDL2 needs EGL (hence the additional
>    'depends on BR2_PACKAGE_HAS_LIBEGL' and the libegbl dependency is
>    added in the .mk file). But in turn, EGL support is only checked
>    when either OpenGL or OpenGLES support is enabled in SDL2, which is
>    why we add logic to select the appropriate options.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/sdl2/Config.in | 17 ++++++++++-------
>  package/sdl2/sdl2.mk   |  2 +-
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/package/sdl2/Config.in b/package/sdl2/Config.in
> index 2ad45e4d00..bce7d4e272 100644
> --- a/package/sdl2/Config.in
> +++ b/package/sdl2/Config.in
> @@ -31,14 +31,17 @@ comment "X11 video driver needs X.org"
>  
>  config BR2_PACKAGE_SDL2_KMSDRM
>  	bool "KMS/DRM video driver"
> -	depends on BR2_PACKAGE_LIBDRM
> -	depends on BR2_PACKAGE_MESA3D_GBM
> +	depends on BR2_PACKAGE_HAS_LIBGBM
> +	depends on BR2_PACKAGE_SDL2_OPENGL || BR2_PACKAGE_SDL2_OPENGLES
> +	depends on BR2_PACKAGE_HAS_LIBEGL
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	select BR2_PACKAGE_LIBDRM
>  
> -comment "KMS/DRM video driver needs libdrm"
> -	depends on !BR2_PACKAGE_LIBDRM
> -
> -comment "KMS/DRM video driver needs mesa3d w/ GBM"
> -	depends on !BR2_PACKAGE_MESA3D_GBM
> +comment "KMS/DRM video driver needs a GBM provider, OpenGL or OpenGLES support, toolchain w/threads"
> +	depends on !BR2_PACKAGE_HAS_LIBGBM || \
> +		!(BR2_PACKAGE_SDL2_OPENGL || BR2_PACKAGE_SDL2_OPENGLES) || \
> +		BR2_PACKAGE_HAS_LIBEGL || \
> +		BR2_TOOLCHAIN_HAS_THREADS
>  
>  config BR2_PACKAGE_SDL2_OPENGL
>  	bool "OpenGL (GLX)"
> diff --git a/package/sdl2/sdl2.mk b/package/sdl2/sdl2.mk
> index c5e7968cec..b5e09b6078 100644
> --- a/package/sdl2/sdl2.mk
> +++ b/package/sdl2/sdl2.mk
> @@ -169,7 +169,7 @@ SDL2_CONF_OPTS += --disable-alsa
>  endif
>  
>  ifeq ($(BR2_PACKAGE_SDL2_KMSDRM),y)
> -SDL2_DEPENDENCIES += libdrm mesa3d
> +SDL2_DEPENDENCIES += libdrm libgbm libegl
>  SDL2_CONF_OPTS += --enable-video-kmsdrm
>  else
>  SDL2_CONF_OPTS += --disable-video-kmsdrm
> -- 
> 2.37.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN Aug. 22, 2022, 3:01 p.m. UTC | #2
Thomas, All,

On 2022-08-05 00:15 +0200, Thomas Petazzoni via buildroot spake thusly:
> The KMS/DRM video driver of SDL2 can currently only be enabled when
> mesa3d is the OpenGL provider, as the option has a dependency on
> BR2_PACKAGE_MESA3D_GBM. Now that we have a libgbm virtual package and
> BR2_PACKAGE_HAS_LIBGBM, we can do better.
> 
> However, this has uncovered a number of additional related issues that
> are resolved at the same time. Here are some details:
> 
>  * the 'depends on BR2_PACKAGE_LIBDRM' is changed to a select, as we
>    normally do for library dependencies. Due to this, we inherit a
>    BR2_TOOLCHAIN_HAS_THREADS dependency.
> 
>  * the 'depends on BR2_PACKAGE_MESA3D_GBM' is changed to 'depends on
>    BR2_PACKAGE_HAS_LIBGBM', and the 'mesa3d' dependency is changed to
>    'libgbm'.
> 
>  * the KMS/DRM video driver in SDL2 needs EGL (hence the additional
>    'depends on BR2_PACKAGE_HAS_LIBEGL' and the libegbl dependency is
>    added in the .mk file). But in turn, EGL support is only checked
>    when either OpenGL or OpenGLES support is enabled in SDL2, which is
>    why we add logic to select the appropriate options.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

I've forward-ported the tzo other patches to thhe next bracnh, fixed the
dependencies of the comment, and applied to next, thanks.

Regards,
Yann E. MORIN.

> ---
>  package/sdl2/Config.in | 17 ++++++++++-------
>  package/sdl2/sdl2.mk   |  2 +-
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/package/sdl2/Config.in b/package/sdl2/Config.in
> index 2ad45e4d00..bce7d4e272 100644
> --- a/package/sdl2/Config.in
> +++ b/package/sdl2/Config.in
> @@ -31,14 +31,17 @@ comment "X11 video driver needs X.org"
>  
>  config BR2_PACKAGE_SDL2_KMSDRM
>  	bool "KMS/DRM video driver"
> -	depends on BR2_PACKAGE_LIBDRM
> -	depends on BR2_PACKAGE_MESA3D_GBM
> +	depends on BR2_PACKAGE_HAS_LIBGBM
> +	depends on BR2_PACKAGE_SDL2_OPENGL || BR2_PACKAGE_SDL2_OPENGLES
> +	depends on BR2_PACKAGE_HAS_LIBEGL
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	select BR2_PACKAGE_LIBDRM
>  
> -comment "KMS/DRM video driver needs libdrm"
> -	depends on !BR2_PACKAGE_LIBDRM
> -
> -comment "KMS/DRM video driver needs mesa3d w/ GBM"
> -	depends on !BR2_PACKAGE_MESA3D_GBM
> +comment "KMS/DRM video driver needs a GBM provider, OpenGL or OpenGLES support, toolchain w/threads"
> +	depends on !BR2_PACKAGE_HAS_LIBGBM || \
> +		!(BR2_PACKAGE_SDL2_OPENGL || BR2_PACKAGE_SDL2_OPENGLES) || \
> +		BR2_PACKAGE_HAS_LIBEGL || \
> +		BR2_TOOLCHAIN_HAS_THREADS
>  
>  config BR2_PACKAGE_SDL2_OPENGL
>  	bool "OpenGL (GLX)"
> diff --git a/package/sdl2/sdl2.mk b/package/sdl2/sdl2.mk
> index c5e7968cec..b5e09b6078 100644
> --- a/package/sdl2/sdl2.mk
> +++ b/package/sdl2/sdl2.mk
> @@ -169,7 +169,7 @@ SDL2_CONF_OPTS += --disable-alsa
>  endif
>  
>  ifeq ($(BR2_PACKAGE_SDL2_KMSDRM),y)
> -SDL2_DEPENDENCIES += libdrm mesa3d
> +SDL2_DEPENDENCIES += libdrm libgbm libegl
>  SDL2_CONF_OPTS += --enable-video-kmsdrm
>  else
>  SDL2_CONF_OPTS += --disable-video-kmsdrm
> -- 
> 2.37.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/sdl2/Config.in b/package/sdl2/Config.in
index 2ad45e4d00..bce7d4e272 100644
--- a/package/sdl2/Config.in
+++ b/package/sdl2/Config.in
@@ -31,14 +31,17 @@  comment "X11 video driver needs X.org"
 
 config BR2_PACKAGE_SDL2_KMSDRM
 	bool "KMS/DRM video driver"
-	depends on BR2_PACKAGE_LIBDRM
-	depends on BR2_PACKAGE_MESA3D_GBM
+	depends on BR2_PACKAGE_HAS_LIBGBM
+	depends on BR2_PACKAGE_SDL2_OPENGL || BR2_PACKAGE_SDL2_OPENGLES
+	depends on BR2_PACKAGE_HAS_LIBEGL
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_LIBDRM
 
-comment "KMS/DRM video driver needs libdrm"
-	depends on !BR2_PACKAGE_LIBDRM
-
-comment "KMS/DRM video driver needs mesa3d w/ GBM"
-	depends on !BR2_PACKAGE_MESA3D_GBM
+comment "KMS/DRM video driver needs a GBM provider, OpenGL or OpenGLES support, toolchain w/threads"
+	depends on !BR2_PACKAGE_HAS_LIBGBM || \
+		!(BR2_PACKAGE_SDL2_OPENGL || BR2_PACKAGE_SDL2_OPENGLES) || \
+		BR2_PACKAGE_HAS_LIBEGL || \
+		BR2_TOOLCHAIN_HAS_THREADS
 
 config BR2_PACKAGE_SDL2_OPENGL
 	bool "OpenGL (GLX)"
diff --git a/package/sdl2/sdl2.mk b/package/sdl2/sdl2.mk
index c5e7968cec..b5e09b6078 100644
--- a/package/sdl2/sdl2.mk
+++ b/package/sdl2/sdl2.mk
@@ -169,7 +169,7 @@  SDL2_CONF_OPTS += --disable-alsa
 endif
 
 ifeq ($(BR2_PACKAGE_SDL2_KMSDRM),y)
-SDL2_DEPENDENCIES += libdrm mesa3d
+SDL2_DEPENDENCIES += libdrm libgbm libegl
 SDL2_CONF_OPTS += --enable-video-kmsdrm
 else
 SDL2_CONF_OPTS += --disable-video-kmsdrm