Patchwork [meta-fsl-arm,RFC] qtbase: add xcb support for i.MX6

login
register
mail settings
Submitter Eric BENARD
Date Aug. 26, 2013, 7:07 p.m.
Message ID <1377544025-31822-1-git-send-email-eric@eukrea.com>
Download mbox | patch
Permalink /patch/56651/
State Superseded
Delegated to: Otavio Salvador
Headers show

Comments

Eric BENARD - Aug. 26, 2013, 7:07 p.m.
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
Juha Vuolle - Aug. 28, 2013, 12:35 p.m.
Built fine on master. Can't say if it works as there is no example
apps or qmake to build my own (and I ended up applying the patch on
5.1.0 instead of the 5.0.2). But I did get out an image with the Qt
libs in place so I'll try tomorrow with my hand-built apps and cross
fingers for binary compatibility. The resulting libEGL.so.1 on the
sysroot/rootfs seems to be libEGL-wl.so i.e. wayland, is this OK?

On master-next there is some (maybe unrelated) error:
libEGL.so: undefined reference to `gcoOS_CreateDrawable'
when it is building
nitrogen6x-poky-linux-gnueabi/qt4-x11-free/4.8.5-r0/qt-everywhere-opensource-src-4.8.5


2013/8/26 Eric Bénard <eric@eukrea.com>:
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
>  qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend |   24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
> index 33f0e8b..5553e27 100644
> --- a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
> +++ b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
> @@ -1,11 +1,14 @@
> +@@ -2,10 +2,12 @@
>  # Copyright (C) 2013 Eric Bénard - Eukréa Electromatique
>
>  HAS_X11 = "${@base_contains('DISTRO_FEATURES', 'x11', 1, 0, d)}"
>
> -GL_DEPENDS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}"
> -QT_GLFLAGS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}"
> +GL_DEPENDS_mx6 = "virtual/libgles2 virtual/egl"
> +QT_GLFLAGS_mx6 = "-opengl es2 -eglfs"
>  QT_EXAMPLES_mx6 = "-make examples"
>  QT_DEMOS_mx6 = "-make demos"
> +XCB_DEPENDS_mx6 += "${@base_contains('DISTRO_FEATURES', 'x11', 'xcb-util-wm xcb-util-image xcb-util-keysyms dbus', '', d)}"
> +QT_XCB_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '-qt-xcb', '', d)}"
>
>  GL_DEPENDS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}"
>  QT_GLFLAGS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}"
> @@ -47,6 +50,23 @@ EOF
>
>  # copy the hook in the mkspecs directory OE is using
>  cp ${S}/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp ${S}/mkspecs/linux-oe-g++/
> +
> +    else
> +# adapt qmake.conf to our needs
> +sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
> +cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
> +IMX6_CFLAGS             = -DLINUX=1
> +QMAKE_LIBS_EGL         += -lEGL
> +QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL -lGAL
> +QMAKE_LIBS_OPENVG      += -lOpenVG -lEGL -lGAL
> +QMAKE_CFLAGS_RELEASE   += \$\$IMX6_CFLAGS
> +QMAKE_CXXFLAGS_RELEASE += \$\$IMX6_CFLAGS
> +QMAKE_CFLAGS_DEBUG   += \$\$IMX6_CFLAGS
> +QMAKE_CXXFLAGS_DEBUG += \$\$IMX6_CFLAGS
> +QMAKE_CFLAGS_EGL += \$\$IMX6_CFLAGS
> +load(qt_config)
> +
> +EOF
>      fi
>  }
>
> --
> 1.7.10.4
>
Daiane Angolini - Aug. 28, 2013, 12:56 p.m.
On 08/28/2013 09:35 AM, Juha Vuolle wrote:
> Built fine on master. Can't say if it works as there is no example
> apps or qmake to build my own (and I ended up applying the patch on
> 5.1.0 instead of the 5.0.2). But I did get out an image with the Qt
> libs in place so I'll try tomorrow with my hand-built apps and cross
> fingers for binary compatibility. The resulting libEGL.so.1 on the
> sysroot/rootfs seems to be libEGL-wl.so i.e. wayland, is this OK?

wayland+x11  is the default choice when using poky.conf (the default 
distro from poky), so, if you have not changed DISTRO_FEATURES, it's the 
expected result.

If it's right, depends on your intention.


>
> On master-next there is some (maybe unrelated) error:
> libEGL.so: undefined reference to `gcoOS_CreateDrawable'
> when it is building
> nitrogen6x-poky-linux-gnueabi/qt4-x11-free/4.8.5-r0/qt-everywhere-opensource-src-4.8.5
>
>
> 2013/8/26 Eric Bénard <eric@eukrea.com>:
>> Signed-off-by: Eric Bénard <eric@eukrea.com>
>> ---
>>   qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend |   24 ++++++++++++++++++++++--
>>   1 file changed, 22 insertions(+), 2 deletions(-)
>>
>> diff --git a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
>> index 33f0e8b..5553e27 100644
>> --- a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
>> +++ b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
>> @@ -1,11 +1,14 @@
>> +@@ -2,10 +2,12 @@
>>   # Copyright (C) 2013 Eric Bénard - Eukréa Electromatique
>>
>>   HAS_X11 = "${@base_contains('DISTRO_FEATURES', 'x11', 1, 0, d)}"
>>
>> -GL_DEPENDS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}"
>> -QT_GLFLAGS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}"
>> +GL_DEPENDS_mx6 = "virtual/libgles2 virtual/egl"
>> +QT_GLFLAGS_mx6 = "-opengl es2 -eglfs"
>>   QT_EXAMPLES_mx6 = "-make examples"
>>   QT_DEMOS_mx6 = "-make demos"
>> +XCB_DEPENDS_mx6 += "${@base_contains('DISTRO_FEATURES', 'x11', 'xcb-util-wm xcb-util-image xcb-util-keysyms dbus', '', d)}"
>> +QT_XCB_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '-qt-xcb', '', d)}"
>>
>>   GL_DEPENDS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}"
>>   QT_GLFLAGS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}"
>> @@ -47,6 +50,23 @@ EOF
>>
>>   # copy the hook in the mkspecs directory OE is using
>>   cp ${S}/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp ${S}/mkspecs/linux-oe-g++/
>> +
>> +    else
>> +# adapt qmake.conf to our needs
>> +sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
>> +cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
>> +IMX6_CFLAGS             = -DLINUX=1
>> +QMAKE_LIBS_EGL         += -lEGL
>> +QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL -lGAL
>> +QMAKE_LIBS_OPENVG      += -lOpenVG -lEGL -lGAL
>> +QMAKE_CFLAGS_RELEASE   += \$\$IMX6_CFLAGS
>> +QMAKE_CXXFLAGS_RELEASE += \$\$IMX6_CFLAGS
>> +QMAKE_CFLAGS_DEBUG   += \$\$IMX6_CFLAGS
>> +QMAKE_CXXFLAGS_DEBUG += \$\$IMX6_CFLAGS
>> +QMAKE_CFLAGS_EGL += \$\$IMX6_CFLAGS
>> +load(qt_config)
>> +
>> +EOF
>>       fi
>>   }
>>
>> --
>> 1.7.10.4
>>
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale
>
Eric BENARD - Aug. 28, 2013, 1:34 p.m.
Le Wed, 28 Aug 2013 15:35:31 +0300,
Juha Vuolle <juvuolle@gmail.com> a écrit :

> Built fine on master. Can't say if it works as there is no example
> apps or qmake to build my own (and I ended up applying the patch on
> 5.1.0 instead of the 5.0.2). But I did get out an image with the Qt
> libs in place so I'll try tomorrow with my hand-built apps and cross
> fingers for binary compatibility. The resulting libEGL.so.1 on the
> sysroot/rootfs seems to be libEGL-wl.so i.e. wayland, is this OK?
> 
no :-(

Eric
Juha Vuolle - Aug. 29, 2013, 8:07 a.m.
2013/8/28 Eric Bénard <eric@eukrea.com>:
> Le Wed, 28 Aug 2013 15:35:31 +0300,
> Juha Vuolle <juvuolle@gmail.com> a écrit :
>
>> Built fine on master. Can't say if it works as there is no example
>> apps or qmake to build my own (and I ended up applying the patch on
>> 5.1.0 instead of the 5.0.2). But I did get out an image with the Qt
>> libs in place so I'll try tomorrow with my hand-built apps and cross
>> fingers for binary compatibility. The resulting libEGL.so.1 on the
>> sysroot/rootfs seems to be libEGL-wl.so i.e. wayland, is this OK?
>>
> no :-(

Ok removed the wayland from poky conf and got the libEGL-x11 in the image.

The Qt 5 widgets again work fine. Gles2 programs start but don't
render, just the title pane from the matchbox window manager. I guess
its still progress. Here is what it gives:

First start attempt:
root@nitrogen6x:~/qtapps/helloworld# DISPLAY=:0 ./helloworld
Qt Warning: Could not find a location of the system's Compose files.
Consider setting the QTCOMPOSE environment variable.
QXcbConnection: XCB error: 148 (Unknown), sequence: 148, resource id:
0, major code: 141 (Unknown), minor code: 20

Second and all later start attempts:
root@nitrogen6x:~/qtapps/helloworld# DISPLAY=:0 ./helloworld
Qt Warning: Could not find a location of the system's Compose files.
Consider setting the QTCOMPOSE environment variable.
QSGContext::initialize: depth buffer support missing, expect rendering errors
QSGContext::initialize: stencil buffer support missing, expect rendering errors
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QSGMaterialShader: Shader compilation failed:
...

Almost as if it would be using the wrong GL version and not getting on
with the shaders.
Some perhaps interesting picks from stracing the helloworld start:

open("/usr/lib/libGLESv2.so.2", O_RDONLY|O_CLOEXEC) = 3
...
open("/usr/lib/libEGL.so.1", O_RDONLY|O_CLOEXEC) = 3
...
open("/usr/lib/libGL.so.1", O_RDONLY|O_CLOEXEC) = 3
...
open("/usr/lib/libxcb-glx.so.0", O_RDONLY|O_CLOEXEC) = 4

Not sure where to look into next, any thoughts? Seems so close :-)
I wonder should it really open glx and libgl too.

Thanks,
Juha

> Eric
Eric BENARD - Aug. 29, 2013, 8:10 a.m.
Hi Juha,

Le Thu, 29 Aug 2013 11:07:18 +0300,
Juha Vuolle <juvuolle@gmail.com> a écrit :
> Not sure where to look into next, any thoughts? Seems so close :-)

may you please share your procedure to compile qt5 for xcb externaly
as you did initially ?
Maybe something is missing in my patch.

Eric
Juha Vuolle - Aug. 29, 2013, 8:25 a.m.
Hi Eric,

2013/8/29 Eric Bénard <eric@eukrea.com>:
> Hi Juha,
>
> Le Thu, 29 Aug 2013 11:07:18 +0300,
> Juha Vuolle <juvuolle@gmail.com> a écrit :
>> Not sure where to look into next, any thoughts? Seems so close :-)
>
> may you please share your procedure to compile qt5 for xcb externaly
> as you did initially ?
> Maybe something is missing in my patch.

I mostly did as in the
https://community.freescale.com/docs/DOC-94066

I suppose the interesting part is the configure line which for me was:

./configure  -v -opensource -confirm-license -no-pch -qpa xcb -qt-xcb
-no-eglfs -no-kms -no-linuxfb -no-directfb  -opengl es2 -make libs
-make examples -device imx6 -device-option
CROSS_COMPILE=/home/j/yocto/fsl-master/build/tmp/sysroots/i686-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-
-sysroot /home/j/yocto/fsl-master/build/tmp/sysroots/nitrogen6x
-prefix /home/j/nx6-xcb-inst

In Qt there is actually some .pro -file checks for xcb qpa
 contains(QT_CONFIG, opengles2) {
     DEFINES += XCB_USE_EGL
        LIBS += -lEGL
        HEADERS += qxcbeglsurface.h
} else{
     DEFINES += XCB_USE_GLX
        HEADERS += qglxintegration.h
        SOURCES += qglxintegration.cpp
}

Not sure if they could play some role here. Hmm..





> Eric
Juha Vuolle - Aug. 29, 2013, 1:40 p.m.
Against that image with handbuilt Qt XCB QPA starting egl/gles2 won't
start with the same reason as few tries ago:

Warning: EGL suggested using X Visual ID 33 (RGB565) for EGL config 28
(RGB444), but this is incompatable
Unable to find an X11 visual which matches EGL config 28
Could not initialize EGL

I forced Qt to return the "Visual ID" 33 and indeed the application started.

The application title is there again but no other visual output.
Interestingly the application responds to click events etc. i.e. it is
there, just as transparent.

In xorg logs there are

[3336165.957] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[3336165.957] (II) VIVANTE(0): using default device
[3336165.957] (II) VIVANTE(0): Creating default Display subsection in
Screen section
        "Default Screen Section" for depth/fbbpp 16/16
[3336165.957] (==) VIVANTE(0): Depth 16, (==) framebuffer bpp 16
[3336165.957] (==) VIVANTE(0): RGB weight 565
[3336165.957] (==) VIVANTE(0): Default visual is TrueColor

But I don't know how to tamper those values.

"Almost works"



2013/8/29 Juha Vuolle <juvuolle@gmail.com>:
> Hi Eric,
>
> 2013/8/29 Eric Bénard <eric@eukrea.com>:
>> Hi Juha,
>>
>> Le Thu, 29 Aug 2013 11:07:18 +0300,
>> Juha Vuolle <juvuolle@gmail.com> a écrit :
>>> Not sure where to look into next, any thoughts? Seems so close :-)
>>
>> may you please share your procedure to compile qt5 for xcb externaly
>> as you did initially ?
>> Maybe something is missing in my patch.
>
> I mostly did as in the
> https://community.freescale.com/docs/DOC-94066
>
> I suppose the interesting part is the configure line which for me was:
>
> ./configure  -v -opensource -confirm-license -no-pch -qpa xcb -qt-xcb
> -no-eglfs -no-kms -no-linuxfb -no-directfb  -opengl es2 -make libs
> -make examples -device imx6 -device-option
> CROSS_COMPILE=/home/j/yocto/fsl-master/build/tmp/sysroots/i686-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-
> -sysroot /home/j/yocto/fsl-master/build/tmp/sysroots/nitrogen6x
> -prefix /home/j/nx6-xcb-inst
>
> In Qt there is actually some .pro -file checks for xcb qpa
>  contains(QT_CONFIG, opengles2) {
>      DEFINES += XCB_USE_EGL
>         LIBS += -lEGL
>         HEADERS += qxcbeglsurface.h
> } else{
>      DEFINES += XCB_USE_GLX
>         HEADERS += qglxintegration.h
>         SOURCES += qglxintegration.cpp
> }
>
> Not sure if they could play some role here. Hmm..
>
>
>
>
>
>> Eric
Juha Vuolle - Aug. 30, 2013, 7:46 a.m.
(Just a little bit more monologing, I could only get the X working
with RGB565 and RGB888 (via uboot options), neither which work with
the EGL 4 bit colour depths. )

2013/8/29 Juha Vuolle <juvuolle@gmail.com>:
> Against that image with handbuilt Qt XCB QPA starting egl/gles2 won't
> start with the same reason as few tries ago:
>
> Warning: EGL suggested using X Visual ID 33 (RGB565) for EGL config 28
> (RGB444), but this is incompatable
> Unable to find an X11 visual which matches EGL config 28
> Could not initialize EGL
>
> I forced Qt to return the "Visual ID" 33 and indeed the application started.
>
> The application title is there again but no other visual output.
> Interestingly the application responds to click events etc. i.e. it is
> there, just as transparent.
>
> In xorg logs there are
>
> [3336165.957] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
> [3336165.957] (II) VIVANTE(0): using default device
> [3336165.957] (II) VIVANTE(0): Creating default Display subsection in
> Screen section
>         "Default Screen Section" for depth/fbbpp 16/16
> [3336165.957] (==) VIVANTE(0): Depth 16, (==) framebuffer bpp 16
> [3336165.957] (==) VIVANTE(0): RGB weight 565
> [3336165.957] (==) VIVANTE(0): Default visual is TrueColor
>
> But I don't know how to tamper those values.
>
> "Almost works"
>
>
>
> 2013/8/29 Juha Vuolle <juvuolle@gmail.com>:
>> Hi Eric,
>>
>> 2013/8/29 Eric Bénard <eric@eukrea.com>:
>>> Hi Juha,
>>>
>>> Le Thu, 29 Aug 2013 11:07:18 +0300,
>>> Juha Vuolle <juvuolle@gmail.com> a écrit :
>>>> Not sure where to look into next, any thoughts? Seems so close :-)
>>>
>>> may you please share your procedure to compile qt5 for xcb externaly
>>> as you did initially ?
>>> Maybe something is missing in my patch.
>>
>> I mostly did as in the
>> https://community.freescale.com/docs/DOC-94066
>>
>> I suppose the interesting part is the configure line which for me was:
>>
>> ./configure  -v -opensource -confirm-license -no-pch -qpa xcb -qt-xcb
>> -no-eglfs -no-kms -no-linuxfb -no-directfb  -opengl es2 -make libs
>> -make examples -device imx6 -device-option
>> CROSS_COMPILE=/home/j/yocto/fsl-master/build/tmp/sysroots/i686-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-
>> -sysroot /home/j/yocto/fsl-master/build/tmp/sysroots/nitrogen6x
>> -prefix /home/j/nx6-xcb-inst
>>
>> In Qt there is actually some .pro -file checks for xcb qpa
>>  contains(QT_CONFIG, opengles2) {
>>      DEFINES += XCB_USE_EGL
>>         LIBS += -lEGL
>>         HEADERS += qxcbeglsurface.h
>> } else{
>>      DEFINES += XCB_USE_GLX
>>         HEADERS += qglxintegration.h
>>         SOURCES += qglxintegration.cpp
>> }
>>
>> Not sure if they could play some role here. Hmm..
>>
>>
>>
>>
>>
>>> Eric

Patch

diff --git a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
index 33f0e8b..5553e27 100644
--- a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
+++ b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend
@@ -1,11 +1,14 @@ 
+@@ -2,10 +2,12 @@
 # Copyright (C) 2013 Eric Bénard - Eukréa Electromatique
 
 HAS_X11 = "${@base_contains('DISTRO_FEATURES', 'x11', 1, 0, d)}"
 
-GL_DEPENDS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}"
-QT_GLFLAGS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}"
+GL_DEPENDS_mx6 = "virtual/libgles2 virtual/egl"
+QT_GLFLAGS_mx6 = "-opengl es2 -eglfs"
 QT_EXAMPLES_mx6 = "-make examples"
 QT_DEMOS_mx6 = "-make demos"
+XCB_DEPENDS_mx6 += "${@base_contains('DISTRO_FEATURES', 'x11', 'xcb-util-wm xcb-util-image xcb-util-keysyms dbus', '', d)}"
+QT_XCB_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '-qt-xcb', '', d)}"
 
 GL_DEPENDS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}"
 QT_GLFLAGS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}"
@@ -47,6 +50,23 @@  EOF
 
 # copy the hook in the mkspecs directory OE is using
 cp ${S}/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp ${S}/mkspecs/linux-oe-g++/
+
+    else
+# adapt qmake.conf to our needs
+sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
+cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
+IMX6_CFLAGS             = -DLINUX=1
+QMAKE_LIBS_EGL         += -lEGL
+QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL -lGAL
+QMAKE_LIBS_OPENVG      += -lOpenVG -lEGL -lGAL
+QMAKE_CFLAGS_RELEASE   += \$\$IMX6_CFLAGS
+QMAKE_CXXFLAGS_RELEASE += \$\$IMX6_CFLAGS
+QMAKE_CFLAGS_DEBUG   += \$\$IMX6_CFLAGS
+QMAKE_CXXFLAGS_DEBUG += \$\$IMX6_CFLAGS
+QMAKE_CFLAGS_EGL += \$\$IMX6_CFLAGS
+load(qt_config)
+
+EOF
     fi
 }