diff mbox series

[v2] package/cog: add libgbm as dependency when building with DRM support

Message ID 20220722070150.40715-1-ardeleanalex@gmail.com
State Accepted
Headers show
Series [v2] package/cog: add libgbm as dependency when building with DRM support | expand

Commit Message

Alexandru Ardelean July 22, 2022, 7:01 a.m. UTC
When building with the DRM support, it can happen that the libgbm library
is not yet built by the provider of this lib (specified by
BR2_PACKAGE_PROVIDES_LIBGBM).

The docs in cog `docs/platform-drm.md` specify this dep-list:
- **WPEBackend-fdo**:
- **Wayland**:
- **libdrm**:
- **libgbm**:
- **libinput**:
- **libudev**:

libgbm needs to be added.
Adding libegl as well.

Updated package/cog/Config.in to define the dependencies (for DRM)
according to libegl & libgbm.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
 package/cog/Config.in | 9 ++++++---
 package/cog/cog.mk    | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

Comments

Alexandru Ardelean July 22, 2022, 7:05 a.m. UTC | #1
On Fri, Jul 22, 2022 at 10:02 AM Alexandru Ardelean
<ardeleanalex@gmail.com> wrote:
>
> When building with the DRM support, it can happen that the libgbm library
> is not yet built by the provider of this lib (specified by
> BR2_PACKAGE_PROVIDES_LIBGBM).
>
> The docs in cog `docs/platform-drm.md` specify this dep-list:
> - **WPEBackend-fdo**:
> - **Wayland**:
> - **libdrm**:
> - **libgbm**:
> - **libinput**:
> - **libudev**:
>
> libgbm needs to be added.
> Adding libegl as well.
>
> Updated package/cog/Config.in to define the dependencies (for DRM)
> according to libegl & libgbm.
>

I was sending this V2 while you (Thomas) were replying to my previous email :p

Feel free to nitpick directly on this patch.
I'm still not 100% what you would like this to be.
I'm happy to re-spin as needed ; as long as you tell me directly what to change.

> Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> ---
>  package/cog/Config.in | 9 ++++++---
>  package/cog/cog.mk    | 2 +-
>  2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/package/cog/Config.in b/package/cog/Config.in
> index d4238750f9..484eb85c70 100644
> --- a/package/cog/Config.in
> +++ b/package/cog/Config.in
> @@ -39,7 +39,8 @@ config BR2_PACKAGE_COG_PLATFORM_FDO
>  config BR2_PACKAGE_COG_PLATFORM_DRM
>         bool "DRM backend"
>         depends on BR2_PACKAGE_HAS_UDEV # libinput
> -       depends on BR2_PACKAGE_MESA3D_OPENGL_EGL # gbm
> +       depends on BR2_PACKAGE_HAS_LIBEGL
> +       depends on BR2_PACKAGE_HAS_LIBGBM
>         select BR2_PACKAGE_LIBDRM
>         select BR2_PACKAGE_LIBINPUT
>         help
> @@ -52,7 +53,9 @@ config BR2_PACKAGE_COG_USE_SYSTEM_DBUS
>         help
>           Expose remote control interface on system bus
>
> -comment "DRM platform needs mesa3d w/ EGL driver and GBM"
> -       depends on !BR2_PACKAGE_MESA3D_OPENGL_EGL
> +comment "DRM platform needs EGL and GBM"
> +       depends on \
> +               !BR2_PACKAGE_HAS_LIBEGL || \
> +               !BR2_PACKAGE_HAS_LIBGBM
>
>  endif
> diff --git a/package/cog/cog.mk b/package/cog/cog.mk
> index f2ca0af93d..da660eb7c1 100644
> --- a/package/cog/cog.mk
> +++ b/package/cog/cog.mk
> @@ -28,7 +28,7 @@ endif
>
>  ifeq ($(BR2_PACKAGE_COG_PLATFORM_DRM),y)
>  COG_CONF_OPTS += -DCOG_PLATFORM_DRM=ON
> -COG_DEPENDENCIES += libdrm libinput
> +COG_DEPENDENCIES += libdrm libinput libgbm libegl
>  else
>  COG_CONF_OPTS += -DCOG_PLATFORM_DRM=OFF
>  endif
> --
> 2.34.1
>
Arnout Vandecappelle July 23, 2022, 8:48 a.m. UTC | #2
On 22/07/2022 09:01, Alexandru Ardelean wrote:
> When building with the DRM support, it can happen that the libgbm library
> is not yet built by the provider of this lib (specified by
> BR2_PACKAGE_PROVIDES_LIBGBM).

  I've applied this one to master already, however there are two comments on v1 
that remain unaddressed.

> 
> The docs in cog `docs/platform-drm.md` specify this dep-list:
> - **WPEBackend-fdo**:
> - **Wayland**:
> - **libdrm**:
> - **libgbm**:
> - **libinput**:
> - **libudev**:

  This would imply that a dependency on udev is needed as well (both in the 
Config.in and the .mk). It is actually implied by libinput, so we won't get 
build failures, but it's better to have explicit dependencies.

> 
> libgbm needs to be added.
> Adding libegl as well.
> 
> Updated package/cog/Config.in to define the dependencies (for DRM)
> according to libegl & libgbm.
> 
> Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> ---
>   package/cog/Config.in | 9 ++++++---
>   package/cog/cog.mk    | 2 +-
>   2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/package/cog/Config.in b/package/cog/Config.in
> index d4238750f9..484eb85c70 100644
> --- a/package/cog/Config.in
> +++ b/package/cog/Config.in
> @@ -39,7 +39,8 @@ config BR2_PACKAGE_COG_PLATFORM_FDO
>   config BR2_PACKAGE_COG_PLATFORM_DRM
>   	bool "DRM backend"
>   	depends on BR2_PACKAGE_HAS_UDEV # libinput
> -	depends on BR2_PACKAGE_MESA3D_OPENGL_EGL # gbm
> +	depends on BR2_PACKAGE_HAS_LIBEGL
> +	depends on BR2_PACKAGE_HAS_LIBGBM

  It apparently needs the 
BR2_PACKAGE_LIBGBM_HAS_FEATURE_FORMAT_MODIFIER_PLANE_COUNT feature. You can test 
that by trying a build with rockchip-mali or ti-sgx-um as provider, since those 
packages don't have that feature.


  Regards,
  Arnout

>   	select BR2_PACKAGE_LIBDRM
>   	select BR2_PACKAGE_LIBINPUT
>   	help
> @@ -52,7 +53,9 @@ config BR2_PACKAGE_COG_USE_SYSTEM_DBUS
>   	help
>   	  Expose remote control interface on system bus
>   
> -comment "DRM platform needs mesa3d w/ EGL driver and GBM"
> -	depends on !BR2_PACKAGE_MESA3D_OPENGL_EGL
> +comment "DRM platform needs EGL and GBM"
> +	depends on \
> +		!BR2_PACKAGE_HAS_LIBEGL || \
> +		!BR2_PACKAGE_HAS_LIBGBM
>   
>   endif
> diff --git a/package/cog/cog.mk b/package/cog/cog.mk
> index f2ca0af93d..da660eb7c1 100644
> --- a/package/cog/cog.mk
> +++ b/package/cog/cog.mk
> @@ -28,7 +28,7 @@ endif
>   
>   ifeq ($(BR2_PACKAGE_COG_PLATFORM_DRM),y)
>   COG_CONF_OPTS += -DCOG_PLATFORM_DRM=ON
> -COG_DEPENDENCIES += libdrm libinput
> +COG_DEPENDENCIES += libdrm libinput libgbm libegl
>   else
>   COG_CONF_OPTS += -DCOG_PLATFORM_DRM=OFF
>   endif
Thomas Petazzoni July 24, 2022, 2:53 p.m. UTC | #3
Hello Michael,

On Sun, 24 Jul 2022 15:25:00 +0200
"Michael Nosthoff" <michael@nosthoff.rocks> wrote:

> I'm currently maintaining an external package for the newest ti-sgx-um version which provides
> (i think) a newer/more complete version of libegl/libgbm. For this I currently have to patch
> the cog package but the output is working fine with the drm backend.

Wow, do you have that available somewhere? I'm also working on a
project that uses ti-sgx, we're also working on updating it to the
latest version from TI, and we had issues with libgbm being
insufficient to run Cog.

> Is there a way to find out which features a certain libegl/libgbm provides? Maybe I can then pick-up
> the work on bumping the ti-sgx-um/km packages again to bring them to a more recent version.

It is explained in package/opengl/libgbm/Config.in:

# gbm implementations should select
# BR2_PACKAGE_LIBGBM_HAS_FEATURE_FORMAT_MODIFIER_PLANE_COUNT if they
# provide the format modifier plane count feature. This API was
# initially introduced in mesa3d version 17. A gbm implementation
# provides this feature if it is implement function
# gbm_device_get_format_modifier_plane_count.
config BR2_PACKAGE_LIBGBM_HAS_FEATURE_FORMAT_MODIFIER_PLANE_COUNT
        bool
        depends on BR2_PACKAGE_HAS_LIBGBM

# gbm implementations should select
# BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF if they provide the dma
# buffer feature. This API was initially introduced in mesa3d version
# 10. A gbm implementation provides this feature if it is implement
# function gbm_bo_get_fd.
config BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF
        bool
        depends on BR2_PACKAGE_HAS_LIBGBM

So basically, you can readelf on libgbm.so, and based on the functions
that it provides, decide which of the above feature flag your ti-sgx-um
package should select.

If you need some help on this, feel free to get in touch on IRC (if
you're not already there), I'll be happy to have a look as I'm
interested in Cog + ti-sgx-um.

Thanks!

Thomas
Alexandru Ardelean July 26, 2022, 8:29 a.m. UTC | #4
On Sat, Jul 23, 2022 at 11:48 AM Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
>
> On 22/07/2022 09:01, Alexandru Ardelean wrote:
> > When building with the DRM support, it can happen that the libgbm library
> > is not yet built by the provider of this lib (specified by
> > BR2_PACKAGE_PROVIDES_LIBGBM).
>
>   I've applied this one to master already, however there are two comments on v1
> that remain unaddressed.

yes
i wasn't sure whether to do this patch-first (which is more of a fix)
and do a follow-up
will do a follow-up :)
since this was applied
thanks :)

>
> >
> > The docs in cog `docs/platform-drm.md` specify this dep-list:
> > - **WPEBackend-fdo**:
> > - **Wayland**:
> > - **libdrm**:
> > - **libgbm**:
> > - **libinput**:
> > - **libudev**:
>
>   This would imply that a dependency on udev is needed as well (both in the
> Config.in and the .mk). It is actually implied by libinput, so we won't get
> build failures, but it's better to have explicit dependencies.

ack; will add

>
> >
> > libgbm needs to be added.
> > Adding libegl as well.
> >
> > Updated package/cog/Config.in to define the dependencies (for DRM)
> > according to libegl & libgbm.
> >
> > Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> > ---
> >   package/cog/Config.in | 9 ++++++---
> >   package/cog/cog.mk    | 2 +-
> >   2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/package/cog/Config.in b/package/cog/Config.in
> > index d4238750f9..484eb85c70 100644
> > --- a/package/cog/Config.in
> > +++ b/package/cog/Config.in
> > @@ -39,7 +39,8 @@ config BR2_PACKAGE_COG_PLATFORM_FDO
> >   config BR2_PACKAGE_COG_PLATFORM_DRM
> >       bool "DRM backend"
> >       depends on BR2_PACKAGE_HAS_UDEV # libinput
> > -     depends on BR2_PACKAGE_MESA3D_OPENGL_EGL # gbm
> > +     depends on BR2_PACKAGE_HAS_LIBEGL
> > +     depends on BR2_PACKAGE_HAS_LIBGBM
>
>   It apparently needs the
> BR2_PACKAGE_LIBGBM_HAS_FEATURE_FORMAT_MODIFIER_PLANE_COUNT feature. You can test
> that by trying a build with rockchip-mali or ti-sgx-um as provider, since those
> packages don't have that feature.

ack; will add
i think i should also add BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF as
Thomas mentioned

>
>
>   Regards,
>   Arnout
>
> >       select BR2_PACKAGE_LIBDRM
> >       select BR2_PACKAGE_LIBINPUT
> >       help
> > @@ -52,7 +53,9 @@ config BR2_PACKAGE_COG_USE_SYSTEM_DBUS
> >       help
> >         Expose remote control interface on system bus
> >
> > -comment "DRM platform needs mesa3d w/ EGL driver and GBM"
> > -     depends on !BR2_PACKAGE_MESA3D_OPENGL_EGL
> > +comment "DRM platform needs EGL and GBM"
> > +     depends on \
> > +             !BR2_PACKAGE_HAS_LIBEGL || \
> > +             !BR2_PACKAGE_HAS_LIBGBM
> >
> >   endif
> > diff --git a/package/cog/cog.mk b/package/cog/cog.mk
> > index f2ca0af93d..da660eb7c1 100644
> > --- a/package/cog/cog.mk
> > +++ b/package/cog/cog.mk
> > @@ -28,7 +28,7 @@ endif
> >
> >   ifeq ($(BR2_PACKAGE_COG_PLATFORM_DRM),y)
> >   COG_CONF_OPTS += -DCOG_PLATFORM_DRM=ON
> > -COG_DEPENDENCIES += libdrm libinput
> > +COG_DEPENDENCIES += libdrm libinput libgbm libegl
> >   else
> >   COG_CONF_OPTS += -DCOG_PLATFORM_DRM=OFF
> >   endif
Peter Korsgaard Aug. 12, 2022, 3:05 p.m. UTC | #5
>>>>> "Alexandru" == Alexandru Ardelean <ardeleanalex@gmail.com> writes:

 > When building with the DRM support, it can happen that the libgbm library
 > is not yet built by the provider of this lib (specified by
 > BR2_PACKAGE_PROVIDES_LIBGBM).

 > The docs in cog `docs/platform-drm.md` specify this dep-list:
 > - **WPEBackend-fdo**:
 > - **Wayland**:
 > - **libdrm**:
 > - **libgbm**:
 > - **libinput**:
 > - **libudev**:

 > libgbm needs to be added.
 > Adding libegl as well.

 > Updated package/cog/Config.in to define the dependencies (for DRM)
 > according to libegl & libgbm.

 > Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>

Committed to 2022.05.x and 2022.02.x, thanks.
diff mbox series

Patch

diff --git a/package/cog/Config.in b/package/cog/Config.in
index d4238750f9..484eb85c70 100644
--- a/package/cog/Config.in
+++ b/package/cog/Config.in
@@ -39,7 +39,8 @@  config BR2_PACKAGE_COG_PLATFORM_FDO
 config BR2_PACKAGE_COG_PLATFORM_DRM
 	bool "DRM backend"
 	depends on BR2_PACKAGE_HAS_UDEV # libinput
-	depends on BR2_PACKAGE_MESA3D_OPENGL_EGL # gbm
+	depends on BR2_PACKAGE_HAS_LIBEGL
+	depends on BR2_PACKAGE_HAS_LIBGBM
 	select BR2_PACKAGE_LIBDRM
 	select BR2_PACKAGE_LIBINPUT
 	help
@@ -52,7 +53,9 @@  config BR2_PACKAGE_COG_USE_SYSTEM_DBUS
 	help
 	  Expose remote control interface on system bus
 
-comment "DRM platform needs mesa3d w/ EGL driver and GBM"
-	depends on !BR2_PACKAGE_MESA3D_OPENGL_EGL
+comment "DRM platform needs EGL and GBM"
+	depends on \
+		!BR2_PACKAGE_HAS_LIBEGL || \
+		!BR2_PACKAGE_HAS_LIBGBM
 
 endif
diff --git a/package/cog/cog.mk b/package/cog/cog.mk
index f2ca0af93d..da660eb7c1 100644
--- a/package/cog/cog.mk
+++ b/package/cog/cog.mk
@@ -28,7 +28,7 @@  endif
 
 ifeq ($(BR2_PACKAGE_COG_PLATFORM_DRM),y)
 COG_CONF_OPTS += -DCOG_PLATFORM_DRM=ON
-COG_DEPENDENCIES += libdrm libinput
+COG_DEPENDENCIES += libdrm libinput libgbm libegl
 else
 COG_CONF_OPTS += -DCOG_PLATFORM_DRM=OFF
 endif