Skip to contentSkip to conversation

libgbm hackery to build with QT5

PATCH New Einar Jon Gunnarsson 1 participant 6 messages Nov 30, 2018 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

cover libgbm hackery to build with QT5

NOTE: NOT FOR BUILDROOT MASTER!!!

This is a bunch of hacks and fixes to build the "EGLFS GBM" module for QT5.

The only thing this is proven to do is to make sure that build/qt5base-*/config summary contains yes for these:
EGLFS .................................. yes EGLFS details:

    EGLFS GBM ............................ yes

And that the build succeeds.
Otherwise it is totally untested due to lack of hardware/time, and may blow up in your face.

This is based on the origin/gbm branch of
http://git.bootlin.com/users/thomas-petazzoni/buildroot
Previous commit: 27848ebac02855af2cfa79475891d5aa29f93343

Einar Jon Gunnarsson (5):
package/ti-sgx-um: Add dependency on wayland package/qt5: Use any libgbm provider package/qt5: fix EGLFS for embedded boards package/sunxi-mali-mainline: Fix QT5 build for EGLFS
configs: libgbm defconfigs build qt5

 configs/libgbm_mesa3d_defconfig                    | 5 +++++
 configs/libgbm_sunxi_mali_defconfig                | 9 +++++++--
 configs/libgbm_ti_sgx_defconfig                    | 9 +++++----
 package/qt5/qt5base/qt5base.mk                     | 9 ++++++---
 package/sunxi-mali-mainline/Config.in              | 3 ++-
 package/sunxi-mali-mainline/sunxi-mali-mainline.mk | 5 +++++
 package/ti-sgx-um/Config.in                        | 2 ++
 package/ti-sgx-um/ti-sgx-um.mk                     | 1 +
 8 files changed, 33 insertions(+), 10 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 package/ti-sgx-um: Add dependency on wayland

---
 package/ti-sgx-um/Config.in    | 2 ++
 package/ti-sgx-um/ti-sgx-um.mk | 1 +
 2 files changed, 3 insertions(+)
package/ti-sgx-um/Config.in +2 -0
index e448a4b..7f0c386 100644
@@ -11,8 +11,10 @@ config BR2_PACKAGE_TI_SGX_UM
 	select BR2_PACKAGE_LIBDRM
 	select BR2_PACKAGE_LIBDRM_OMAP
 	select BR2_PACKAGE_HAS_LIBEGL
+	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
 	select BR2_PACKAGE_HAS_LIBGLES
 	select BR2_PACKAGE_HAS_POWERVR
+	select BR2_PACKAGE_WAYLAND
 	select BR2_PACKAGE_TI_SGX_LIBGBM
 	help
 	  Graphics libraries for TI CPUs with SGX5xx GPU.
package/ti-sgx-um/ti-sgx-um.mk +1 -0
index c252ea1..47a3bb0 100644
@@ -15,6 +15,7 @@ TI_SGX_UM_INSTALL_STAGING = YES
 TI_SGX_UM_DEPENDENCIES = libdrm
 # ti-sgx-libgbm must be built before QT to find EGL
 TI_SGX_UM_DEPENDENCIES += ti-sgx-libgbm
+TI_SGX_UM_DEPENDENCIES += wayland
 
 # NOTE: TI_SGX_UM is intentionally using TI_SGX_KM variables
 ifeq ($(BR2_PACKAGE_TI_SGX_KM_AM335X),y)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 package/qt5: Use any libgbm provider

In reply to Einar Jon Gunnarsson

libgbm is not limited to mesa3d

-------------------
Only tested for libgbm-ti-sgx - not sunxi_mali.
I have not been able to test on actual hardware, but I do get qt to build with gbm
*** ./output_ti/build/qt5base-5.11.2/config.summary 2018-11-08 13:18:20.553522890 +0100
--- ./output_ti/build/qt5base-5.11.2-nogbm/config.summary 2018-11-08 11:55:04.709670885 +0100
***************
*** 90,96 ****

      EGLFS i.Mx6 Wayland .................. no
      EGLFS RCAR ........................... no
      EGLFS EGLDevice ...................... no
!     EGLFS GBM ............................ yes
      EGLFS VSP2 ........................... no
      EGLFS Mali ........................... no
      EGLFS Raspberry Pi ................... no
--- 90,96 ----
      EGLFS i.Mx6 Wayland .................. no
      EGLFS RCAR ........................... no
      EGLFS EGLDevice ...................... no
!     EGLFS GBM ............................ no
      EGLFS VSP2 ........................... no
      EGLFS Mali ........................... no
      EGLFS Raspberry Pi ................... no
---
 package/qt5/qt5base/qt5base.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/qt5/qt5base/qt5base.mk +3 -3
index 2b6fd39..4cd6ac0 100644
@@ -42,10 +42,10 @@ else
 QT5BASE_CONFIGURE_OPTS += -no-kms
 endif
 
-# Uses libgbm from mesa3d
-ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
+# Uses libgbm from mesa3d,ti-sgx-libgbm or sunxi_mali
+ifeq ($(BR2_PACKAGE_HAS_LIBGBM),y)
 QT5BASE_CONFIGURE_OPTS += -gbm
-QT5BASE_DEPENDENCIES += mesa3d
+QT5BASE_DEPENDENCIES += $(call qstrip,$(BR2_PACKAGE_PROVIDES_LIBGBM))
 else
 QT5BASE_CONFIGURE_OPTS += -no-gbm
 endif
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 package/qt5: fix EGLFS for embedded boards

In reply to Einar Jon Gunnarsson

Note that on some boards the special value of none is used instead of an actual plugin. This indicates that no special integration is necessary to use EGL with the framebuffer and so no plugins must be loaded.

-----------
see http://doc.qt.io/qt-5/embedded-linux.html

---
 package/qt5/qt5base/qt5base.mk | 3 +++
 1 file changed, 3 insertions(+)
package/qt5/qt5base/qt5base.mk +3 -0
index 4cd6ac0..ee72ba9 100644
@@ -254,6 +254,9 @@ QT5BASE_EGLFS_DEVICE = EGLFS_DEVICE_INTEGRATION = eglfs_viv
 else ifeq ($(BR2_PACKAGE_SUNXI_MALI)$(BR2_PACKAGE_SUNXI_MALI_MAINLINE),y)
 # use mali backend
 QT5BASE_EGLFS_DEVICE = EGLFS_DEVICE_INTEGRATION = eglfs_mali
+else ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),)
+# avoid error "EGL library doesn't support Emulator extensions". Needed for ti_sgx
+QT5BASE_EGLFS_DEVICE = EGLFS_DEVICE_INTEGRATION = none
 endif
 endif
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 package/sunxi-mali-mainline: Fix QT5 build for EGLFS

In reply to Einar Jon Gunnarsson

Added BR2_PACKAGE_HAS_LIBEGL_WAYLAND, but to avoid a circular dependency, BR2_PACKAGE_WAYLAND is selected instead of being a dependency.
Also add -D__GBM__ in order to build EGL.

----
I can't test this on HW, but without -D__GBM__, the QT config will not build EGLFS and give up on feature.egl failure. With it, we get:
EGLFS .................................. yes

    EGLFS EGLDevice ...................... yes
    EGLFS GBM ............................ yes
    EGLFS Mali ........................... no  (?)
---
 configs/libgbm_sunxi_mali_defconfig                | 1 -
 package/sunxi-mali-mainline/Config.in              | 3 ++-
 package/sunxi-mali-mainline/sunxi-mali-mainline.mk | 5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)
configs/libgbm_sunxi_mali_defconfig +0 -1
index 422d1db..c89a781 100644
@@ -8,5 +8,4 @@ BR2_SYSTEM_BIN_SH_NONE=y
 BR2_PACKAGE_KMSCUBE=y
 BR2_PACKAGE_SUNXI_MALI_MAINLINE=y
 BR2_PACKAGE_SUNXI_MALI_MAINLINE_OUTPUT_WAYLAND=y
-BR2_PACKAGE_WAYLAND=y
 # BR2_TARGET_ROOTFS_TAR is not set
package/sunxi-mali-mainline/Config.in +2 -1
index 837bf19..911e9d1 100644
@@ -28,8 +28,9 @@ config BR2_PACKAGE_SUNXI_MALI_MAINLINE_OUTPUT_FBDEV
 
 config BR2_PACKAGE_SUNXI_MALI_MAINLINE_OUTPUT_WAYLAND
 	bool "wayland"
-	depends on BR2_PACKAGE_WAYLAND
+	select BR2_PACKAGE_WAYLAND
 	select BR2_PACKAGE_HAS_LIBGBM
+	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
 
 config BR2_PACKAGE_SUNXI_MALI_MAINLINE_OUTPUT_X11_DMABUF
 	bool "x11 dma-buf"
package/sunxi-mali-mainline/sunxi-mali-mainline.mk +5 -0
index 8a76b46..3cddcdf 100644
@@ -39,6 +39,10 @@ endif
 ifeq ($(BR2_PACKAGE_SUNXI_MALI_MAINLINE_OUTPUT_WAYLAND),y)
 SUNXI_MALI_MAINLINE_DEPENDENCIES += wayland
 SUNXI_MALI_MAINLINE_PROVIDES += libgbm
+define SUNXI_MALI_MAINLINE_GBM_FIXUP_EGL_PC
+	$(SED) "s/Cflags: /Cflags: -D__GBM__ /" \
+		$(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
+endef
 endif
 
 # FIXME: install gbm.pc conditionally
@@ -56,6 +60,7 @@ define SUNXI_MALI_MAINLINE_INSTALL_STAGING_CMDS
 		$(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
 	$(INSTALL) -D -m 0644 package/sunxi-mali-mainline/gbm.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gbm.pc
+	$(SUNXI_MALI_MAINLINE_GBM_FIXUP_EGL_PC)
 	$(SUNXI_MALI_MAINLINE_FIXUP_EGL_PC)
 endef
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 configs: libgbm defconfigs build qt5

In reply to Einar Jon Gunnarsson

kmscube removed from ti_sgx and sunxi_mali,
since it doesn't work

----------------------
Like before - can't test any of these, but they all build QT5 with EGLFS GBM.
The sunxi_mali was a bit of a shot in the dark, but I figured out that with -D__GBM__we do get a valid EGLFS for QT. I have no idea if I added that correctly.

---
 configs/libgbm_mesa3d_defconfig     | 5 +++++
 configs/libgbm_sunxi_mali_defconfig | 8 +++++++-
 configs/libgbm_ti_sgx_defconfig     | 9 +++++----
 3 files changed, 17 insertions(+), 5 deletions(-)
configs/libgbm_mesa3d_defconfig +5 -0
index 9816680..9a9c391 100644
@@ -16,4 +16,9 @@ BR2_PACKAGE_MESA3D=y
 BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
 BR2_PACKAGE_MESA3D_OPENGL_EGL=y
 BR2_PACKAGE_MESA3D_OPENGL_ES=y
+BR2_PACKAGE_QT5=y
+BR2_PACKAGE_QT5BASE_EXAMPLES=y
+BR2_PACKAGE_QT5BASE_GUI=y
+BR2_PACKAGE_QT5BASE_OPENGL_LIB=y
+BR2_PACKAGE_QT5BASE_EGLFS=y
 # BR2_TARGET_ROOTFS_TAR is not set
configs/libgbm_sunxi_mali_defconfig +7 -1
index c89a781..d83e792 100644
@@ -3,9 +3,15 @@ BR2_cortex_a8=y
 BR2_TOOLCHAIN_EXTERNAL=y
 BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y
 BR2_INIT_NONE=y
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
 BR2_SYSTEM_BIN_SH_NONE=y
 # BR2_PACKAGE_BUSYBOX is not set
-BR2_PACKAGE_KMSCUBE=y
+BR2_PACKAGE_QT5=y
+BR2_PACKAGE_QT5BASE_EXAMPLES=y
+BR2_PACKAGE_QT5BASE_GUI=y
+BR2_PACKAGE_QT5BASE_OPENGL_LIB=y
+BR2_PACKAGE_QT5BASE_EGLFS=y
 BR2_PACKAGE_SUNXI_MALI_MAINLINE=y
 BR2_PACKAGE_SUNXI_MALI_MAINLINE_OUTPUT_WAYLAND=y
+BR2_PACKAGE_LIBDRM=y
 # BR2_TARGET_ROOTFS_TAR is not set
configs/libgbm_ti_sgx_defconfig +5 -4
index 0226e2b..e70b9c7 100644
@@ -6,9 +6,10 @@ BR2_INIT_NONE=y
 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
 BR2_SYSTEM_BIN_SH_NONE=y
 # BR2_PACKAGE_BUSYBOX is not set
-BR2_PACKAGE_KMSCUBE=y
+BR2_PACKAGE_QT5=y
+BR2_PACKAGE_QT5BASE_EXAMPLES=y
+BR2_PACKAGE_QT5BASE_GUI=y
+BR2_PACKAGE_QT5BASE_OPENGL_LIB=y
+BR2_PACKAGE_QT5BASE_EGLFS=y
 BR2_PACKAGE_TI_SGX_UM=y
-BR2_PACKAGE_EXPAT=y
-BR2_PACKAGE_LIBXML2=y
-BR2_PACKAGE_LIBFFI=y
 # BR2_TARGET_ROOTFS_TAR is not set
Signature · 1 line
2.7.4