diff options
author | Eric BENARD <eric@eukrea.com> | 2013-06-10 13:35:07 +0000 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2013-07-29 13:18:04 -0300 |
commit | 6025af38ba321b04c82a7b5e56c71bdff8c720c6 (patch) | |
tree | 1c3c2eec99fab47059994e3ef0e24434f88e0776 | |
parent | d6e649f81466831a8596aad3d8b8553e45ac5ac3 (diff) | |
download | meta-fsl-arm-6025af38ba321b04c82a7b5e56c71bdff8c720c6.tar.gz |
qt5: add mx5 and mx6 support
- this allow to build qt5 with OpenGL ES support for i.MX5 and i.MX6
- tested on i.MX51, i.MX53 and i.MX6Q
- X11 support is not yet tested so we don't change the core settings
when x11 is in DISTRO_FEATURES
Change-Id: Ie9c6b25cafe20ba0a3dc8ab4c6e6cdac4eee3f0d
Signed-off-by: Eric Bénard <eric@eukrea.com>
-rw-r--r-- | qt5-layer/recipes-qt/qt5/qtbase/mx5/qeglfshooks_imx5.cpp | 105 | ||||
-rw-r--r-- | qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend | 74 |
2 files changed, 179 insertions, 0 deletions
diff --git a/qt5-layer/recipes-qt/qt5/qtbase/mx5/qeglfshooks_imx5.cpp b/qt5-layer/recipes-qt/qt5/qtbase/mx5/qeglfshooks_imx5.cpp new file mode 100644 index 0000000..43e6d8d --- /dev/null +++ b/qt5-layer/recipes-qt/qt5/qtbase/mx5/qeglfshooks_imx5.cpp | |||
@@ -0,0 +1,105 @@ | |||
1 | /**************************************************************************** | ||
2 | ** | ||
3 | ** hacked by Eric Bénard - Eukréa Electromatique | ||
4 | ** inspired from https://community.freescale.com/docs/DOC-94123 | ||
5 | ** and from fbset.c http://users.telenet.be/geertu/Linux/fbdev/ | ||
6 | ** | ||
7 | ** based on qeglfshooks_imx6.cpp which is : | ||
8 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | ||
9 | ** Contact: http://www.qt-project.org/legal | ||
10 | ** | ||
11 | ** This file is part of the qmake spec of the Qt Toolkit. | ||
12 | ** | ||
13 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
14 | ** Commercial License Usage | ||
15 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
16 | ** accordance with the commercial license agreement provided with the | ||
17 | ** Software or, alternatively, in accordance with the terms contained in | ||
18 | ** a written agreement between you and Digia. For licensing terms and | ||
19 | ** conditions see http://qt.digia.com/licensing. For further information | ||
20 | ** use the contact form at http://qt.digia.com/contact-us. | ||
21 | ** | ||
22 | ** GNU Lesser General Public License Usage | ||
23 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
24 | ** General Public License version 2.1 as published by the Free Software | ||
25 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
26 | ** packaging of this file. Please review the following information to | ||
27 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
28 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
29 | ** | ||
30 | ** In addition, as a special exception, Digia gives you certain additional | ||
31 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
32 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
33 | ** | ||
34 | ** GNU General Public License Usage | ||
35 | ** Alternatively, this file may be used under the terms of the GNU | ||
36 | ** General Public License version 3.0 as published by the Free Software | ||
37 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
38 | ** packaging of this file. Please review the following information to | ||
39 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
40 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
41 | ** | ||
42 | ** | ||
43 | ** $QT_END_LICENSE$ | ||
44 | ** | ||
45 | ****************************************************************************/ | ||
46 | #include <fcntl.h> /* For O_RDWR */ | ||
47 | #include <unistd.h> /* For open(), creat() */ | ||
48 | #include "qeglfshooks.h" | ||
49 | #include <EGL/egl.h> | ||
50 | #include <linux/fb.h> | ||
51 | #include <sys/ioctl.h> | ||
52 | |||
53 | QT_BEGIN_NAMESPACE | ||
54 | |||
55 | class QEglFSImx5Hooks : public QEglFSHooks | ||
56 | { | ||
57 | public: | ||
58 | QEglFSImx5Hooks(); | ||
59 | virtual QSize screenSize() const; | ||
60 | virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); | ||
61 | virtual void destroyNativeWindow(EGLNativeWindowType window); | ||
62 | |||
63 | private: | ||
64 | QSize mScreenSize; | ||
65 | EGLNativeDisplayType mNativeDisplay; | ||
66 | }; | ||
67 | |||
68 | |||
69 | QEglFSImx5Hooks::QEglFSImx5Hooks() | ||
70 | { | ||
71 | int width, height; | ||
72 | /* code taken from fbset.c */ | ||
73 | int fh; | ||
74 | struct fb_var_screeninfo var; | ||
75 | fh = open("/dev/fb0", O_RDONLY); | ||
76 | ioctl(fh, FBIOGET_VSCREENINFO, &var); | ||
77 | mScreenSize.setHeight(var.yres); | ||
78 | mScreenSize.setWidth(var.xres); | ||
79 | close(fh); | ||
80 | mNativeDisplay = EGL_DEFAULT_DISPLAY; | ||
81 | } | ||
82 | |||
83 | QSize QEglFSImx5Hooks::screenSize() const | ||
84 | { | ||
85 | return mScreenSize; | ||
86 | } | ||
87 | |||
88 | EGLNativeWindowType QEglFSImx5Hooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) | ||
89 | { | ||
90 | Q_UNUSED(format); | ||
91 | |||
92 | EGLNativeWindowType eglWindow = open("/dev/fb0", O_RDWR); | ||
93 | return eglWindow; | ||
94 | } | ||
95 | |||
96 | |||
97 | void QEglFSImx5Hooks::destroyNativeWindow(EGLNativeWindowType window) | ||
98 | { | ||
99 | close(window); | ||
100 | } | ||
101 | |||
102 | QEglFSImx5Hooks eglFSImx5Hooks; | ||
103 | QEglFSHooks *platformHooks = &eglFSImx5Hooks; | ||
104 | |||
105 | QT_END_NAMESPACE | ||
diff --git a/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend new file mode 100644 index 0000000..33f0e8b --- /dev/null +++ b/qt5-layer/recipes-qt/qt5/qtbase_5.0.2.bbappend | |||
@@ -0,0 +1,74 @@ | |||
1 | # Copyright (C) 2013 Eric Bénard - Eukréa Electromatique | ||
2 | |||
3 | HAS_X11 = "${@base_contains('DISTRO_FEATURES', 'x11', 1, 0, d)}" | ||
4 | |||
5 | GL_DEPENDS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}" | ||
6 | QT_GLFLAGS_mx6 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}" | ||
7 | QT_EXAMPLES_mx6 = "-make examples" | ||
8 | QT_DEMOS_mx6 = "-make demos" | ||
9 | |||
10 | GL_DEPENDS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', 'virtual/libgles2 virtual/egl', d)}" | ||
11 | QT_GLFLAGS_mx5 = "${@base_contains('DISTRO_FEATURES', 'x11', '', '-opengl es2 -eglfs', d)}" | ||
12 | QT_EXAMPLES_mx5 = "-make examples" | ||
13 | QT_DEMOS_mx5 = "-make demos" | ||
14 | |||
15 | TSLIB_DEPENDS_mx6 = "tslib" | ||
16 | QT_TSLIB_mx6 = "-tslib" | ||
17 | |||
18 | TSLIB_DEPENDS_mx5 = "tslib" | ||
19 | QT_TSLIB_mx5 = "-tslib" | ||
20 | |||
21 | PACKAGE_ARCH_mx6 = "${MACHINE_ARCH}" | ||
22 | PACKAGE_ARCH_mx5 = "${MACHINE_ARCH}" | ||
23 | |||
24 | FILESEXTRAPATHS_prepend_mx5 := "${THISDIR}/${PN}:" | ||
25 | SRC_URI_append_mx5 += " \ | ||
26 | file://qeglfshooks_imx5.cpp \ | ||
27 | " | ||
28 | |||
29 | do_configure_prepend_mx6() { | ||
30 | if test ${HAS_X11} -eq 0; then | ||
31 | # adapt qmake.conf to our needs | ||
32 | sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf | ||
33 | cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF | ||
34 | EGLFS_PLATFORM_HOOKS_SOURCES = \$\$PWD/qeglfshooks_imx6.cpp | ||
35 | IMX6_CFLAGS = -DLINUX=1 -DEGL_API_FB=1 | ||
36 | QMAKE_LIBS_EGL += -lEGL | ||
37 | QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL | ||
38 | QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL | ||
39 | QMAKE_CFLAGS_RELEASE += \$\$IMX6_CFLAGS | ||
40 | QMAKE_CXXFLAGS_RELEASE += \$\$IMX6_CFLAGS | ||
41 | QMAKE_CFLAGS_DEBUG += \$\$IMX6_CFLAGS | ||
42 | QMAKE_CXXFLAGS_DEBUG += \$\$IMX6_CFLAGS | ||
43 | QMAKE_CFLAGS_EGL += \$\$IMX6_CFLAGS | ||
44 | load(qt_config) | ||
45 | |||
46 | EOF | ||
47 | |||
48 | # copy the hook in the mkspecs directory OE is using | ||
49 | cp ${S}/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp ${S}/mkspecs/linux-oe-g++/ | ||
50 | fi | ||
51 | } | ||
52 | |||
53 | do_configure_prepend_mx5() { | ||
54 | if test ${HAS_X11} -eq 0; then | ||
55 | # adapt qmake.conf to our needs | ||
56 | sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf | ||
57 | cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF | ||
58 | EGLFS_PLATFORM_HOOKS_SOURCES = \$\$PWD/qeglfshooks_imx5.cpp | ||
59 | IMX5_CFLAGS = -D_LINUX | ||
60 | QMAKE_LIBS_EGL += -lEGL | ||
61 | QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL | ||
62 | QMAKE_LIBS_OPENVG += -lOpenVG -lEGL | ||
63 | QMAKE_CFLAGS_RELEASE += \$\$IMX5_CFLAGS | ||
64 | QMAKE_CXXFLAGS_RELEASE += \$\$IMX5_CFLAGS | ||
65 | QMAKE_CFLAGS_DEBUG += \$\$IMX5_CFLAGS | ||
66 | QMAKE_CXXFLAGS_DEBUG += \$\$IMX5_CFLAGS | ||
67 | QMAKE_CFLAGS_EGL += \$\$IMX5_CFLAGS | ||
68 | load(qt_config) | ||
69 | |||
70 | EOF | ||
71 | |||
72 | cp ${WORKDIR}/qeglfshooks_imx5.cpp ${S}/mkspecs/linux-oe-g++/ | ||
73 | fi | ||
74 | } | ||