Skip to contentSkip to conversation

qt5: add rPi EGL glue code

PATCH New Floris Bos 2 participants 3 messages Mar 1, 2013

lore
Share & tools
lore

Floris Bos

author
#0 lore raw

PATCH 1/1 qt5: add rPi EGL glue code

When the rpi-userland package is selected, assume we are targetting the Raspberry Pi, and add the right platform glue code when building the Qt5 EGLFS plugin.

---
 package/qt5/qt5base/qt5base-mkspecs-files.patch |    6 +++++-
 package/qt5/qt5base/qt5base.mk                  |    8 ++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
package/qt5/qt5base/qt5base-mkspecs-files.patch +5 -1
index a86d0b1..56d3b03 100644
@@ -14,7 +14,7 @@ Index: b/mkspecs/devices/linux-buildroot-g++/qmake.conf
 ===================================================================
 --- /dev/null
 +++ b/mkspecs/devices/linux-buildroot-g++/qmake.conf
-@@ -0,0 +1,38 @@
+@@ -0,0 +1,42 @@
 +MAKEFILE_GENERATOR      = UNIX
 +CONFIG                  += incremental gdb_dwarf_index
 +QMAKE_INCREMENTAL_STYLE = sublib
@@ -49,6 +49,10 @@ Index: b/mkspecs/devices/linux-buildroot-g++/qmake.conf
 +
 +QMAKE_LIBS             += -lrt -lpthread -ldl
 +
++# device specific glue code
++EGLFS_PLATFORM_HOOKS_SOURCES =
++EGLFS_PLATFORM_HOOKS_LIBS =
++
 +# Sanity check
 +deviceSanityCheckCompiler()
 +
package/qt5/qt5base/qt5base.mk +8 -0
index 0ea15c2..75492c8 100644
@@ -75,6 +75,12 @@ endif
 ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
 QT5BASE_CONFIGURE_OPTS += -opengl es2 -eglfs
 QT5BASE_DEPENDENCIES   += libgles libegl
+ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
+QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
+QT5BASE_EGLFS_PLATFORM_HOOKS_LIBS = -lbcm_host
+QT5BASE_CONFIGURE_OPTS += -I$(STAGING_DIR)/usr/include/interface/vcos/pthreads
+QT5BASE_CONFIGURE_OPTS += -I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux
+endif
 else
 QT5BASE_CONFIGURE_OPTS += -no-opengl -no-eglfs
 endif
@@ -125,6 +131,8 @@ define QT5BASE_CONFIGURE_CMDS
 	$(call QT5BASE_CONFIG_SET,CROSS_COMPILE,$(TARGET_CROSS))
 	$(call QT5BASE_CONFIG_SET,COMPILER_CFLAGS,$(TARGET_CFLAGS))
 	$(call QT5BASE_CONFIG_SET,COMPILER_CXXFLAGS,$(TARGET_CXXFLAGS))
+	$(call QT5BASE_CONFIG_SET,EGLFS_PLATFORM_HOOKS_SOURCES,$(QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES))
+	$(call QT5BASE_CONFIG_SET,EGLFS_PLATFORM_HOOKS_LIBS,$(QT5BASE_EGLFS_PLATFORM_HOOKS_LIBS))
 	(cd $(@D); \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 		PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 qt5: add rPi EGL glue code

Dear Floris Bos,

Quoted 4 lines · Floris Bos

When the rpi-userland package is selected, assume we are targetting the Raspberry Pi, and add the right platform glue code when building the Qt5 EGLFS plugin.

Sounds great. Could you wrap your commit log to ~80 columns? I'd like to apply your patch as-is in my patch series in order to preserve your authorship.

package/qt5/qt5base/qt5base.mk endif · line 82

Quoted 2 lines
package/qt5/qt5base/qt5base.mk +2 -0
+QT5BASE_CONFIGURE_OPTS += -I$(STAGING_DIR)/usr/include/interface/vcos/pthreads
+QT5BASE_CONFIGURE_OPTS += -I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux

Are you sure this is needed? I've added the installation of some .pc files in the rpi-userland package. At least the first header path is part of the .pc file for libEGL.

++Cflags: -I${includedir}/ -I${includedir}/interface/vcos/pthreads/

We can of course add the second one as well, as long as we understand if it's needed for OpenGL or EGL.

See the patch 07/30 in my series.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#2 lore raw

PATCH 1/1 qt5: add rPi EGL glue code

Hi,

Quoted 8 lines · Thomas Petazzoni
Quoted 4 lines · Floris Bos

When the rpi-userland package is selected, assume we are targetting the Raspberry Pi, and add the right platform glue code when building the Qt5 EGLFS plugin.

Sounds great. Could you wrap your commit log to ~80 columns? I'd like to apply your patch as-is in my patch series in order to preserve your authorship.

Will do

Quoted 10 lines

package/qt5/qt5base/qt5base.mk endif · line 82

Quoted 2 lines
package/qt5/qt5base/qt5base.mk +2 -0
+QT5BASE_CONFIGURE_OPTS += -I$(STAGING_DIR)/usr/include/interface/vcos/pthreads
+QT5BASE_CONFIGURE_OPTS += -I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux

Are you sure this is needed? I've added the installation of some .pc files in the rpi-userland package. At least the first header path is part of the .pc file for libEGL.

++Cflags: -I${includedir}/ -I${includedir}/interface/vcos/pthreads/

We can of course add the second one as well, as long as we understand if it's needed for OpenGL or EGL.

Oops, you are right.
The first line is indeed redundant.

Second line is for the bcm_host stuff, otherwise you get:

==
In file included from /hdd/max/dev/qtbuildroot/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bcm_host.h:50:0,
from
../../../../mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp:50:
/hdd/max/dev/qtbuildroot/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/interface/vmcs_host/vcgencmd.h:33:27:
fatal error: vchost_config.h: No such file or directory
compilation terminated.
make[5]: *** [.obj/release-shared/qeglfshooks_pi.o] Error 1
make[5]: *** Waiting for unfinished jobs....
==

Every application that wants to use the rPi GPU libraries needs it to call bcm_host_initialize() before anything else.
So I think it could indeed be added to the EGL pkgconfig file.

Regarding fonts:

Quoted 2 lines

If so, then I can include a path that makes fonts.path be $$[QT_INSTALL_PREFIX]/share/fonts/.

Came accross another problem with that.
With font-config disabled it only searches /usr/lib/fonts itself for fonts, not subdirectories.
So if we were to change the default font path to /usr/share/fonts, it still would not pick up fonts in subdirectories like /usr/share/fonts/liberation
So might not be much use of that.

Also found out that if I do enable font-config it fails to compile:

==
.obj/release-shared/qeglfsintegration.o: In function `QEglFSIntegration::QEglFSIntegration()':
qeglfsintegration.cpp:(.text+0x8e4): undefined reference to `vtable for QFontconfigDatabase'
collect2: ld returned 1 exit status
==

Haven't looked further into that.

Did find out that with font-config disabled, Qt does install the bundled standard fonts into staging.
So think we should just copy those to target.

Another issue I'm still having -but which is likely an upstream problem- is that with the EGLFS plugin when you type on the keyboard all input will be send to both to the Qt application and the terminal. Once the Qt application terminates, everything you typed earlier is visible on the console.

From a quick look it seems the Qt code does request exclusive usage of
the evdev device for tablets and touch input devices, but not for keyboards.

== buildroot/output/build/qt5base-5.0.0/src/platformsupport/input$ grep -R EVIOCGRAB *
evdevtablet/qevdevtablet.cpp: bool grabSuccess = !ioctl(fd,
EVIOCGRAB, (void *) 1);

evdevtablet/qevdevtablet.cpp:        ioctl(fd, EVIOCGRAB, (void *) 0);
evdevtouch/qevdevtouch.cpp:    bool grabSuccess = !ioctl(m_fd, 

EVIOCGRAB, (void *) 1);
evdevtouch/qevdevtouch.cpp: ioctl(m_fd, EVIOCGRAB, (void *) 0);
==

Anyone know if they have a reason for that?

Yours sincerely,

Floris Bos