From 99d78b40e92e00286700cab1dbcf4b130f7ecd58 Mon Sep 17 00:00:00 2001 From: Xu Feng Date: Tue, 17 Jun 2014 16:37:35 +0800 Subject: add support for device linux-arm-hisilicon-hix5hd2-g++ 1. add qmake configuration for linux-arm-hisilicon-x5hd2-g++ using the arm-linux-gnueabihf-g++ crosscompiler 2. add eglfs platform hooks file: qeglfshooks_hix5hd2.cpp 3. support hisilicon platform hix5hd2 Change-Id: I22bdbe5785d1a6bc77715b8e8aa7caa22b62ddce Reviewed-by: Laszlo Agocs --- .../qeglfshooks_hix5hd2.cpp | 118 +++++++++++++++++++++ .../linux-arm-hisilicon-hix5hd2-g++/qmake.conf | 44 ++++++++ .../qplatformdefs.h | 42 ++++++++ 3 files changed, 204 insertions(+) create mode 100644 mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp create mode 100644 mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf create mode 100644 mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h (limited to 'mkspecs') diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp new file mode 100644 index 0000000000..a148a30adf --- /dev/null +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglfshooks.h" +#include + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QEglFSHiX5Hd2Hooks : public QEglFSHooks +{ +private: + void fbInit(); +public: + void platformInit() Q_DECL_OVERRIDE; + EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) Q_DECL_OVERRIDE; + void destroyNativeWindow(EGLNativeWindowType window) Q_DECL_OVERRIDE; +}; + +void QEglFSHiX5Hd2Hooks::fbInit() +{ + int fd = qt_safe_open("/dev/fb0", O_RDWR, 0); + if (fd == -1) + qWarning("Failed to open fb to detect screen resolution!"); + + struct fb_var_screeninfo vinfo; + memset(&vinfo, 0, sizeof(vinfo)); + if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) + qWarning("Could not get variable screen info"); + + vinfo.bits_per_pixel = 32; + vinfo.red.length = 8; + vinfo.green.length = 8; + vinfo.blue.length = 8; + vinfo.transp.length = 8; + vinfo.blue.offset = 0; + vinfo.green.offset = 8; + vinfo.red.offset = 16; + vinfo.transp.offset = 24; + vinfo.yres_virtual = 2 * vinfo.yres; + + if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) == -1) + qErrnoWarning(errno, "Unable to set double buffer mode!"); + + qt_safe_close(fd); + return; +} + +void QEglFSHiX5Hd2Hooks::platformInit() +{ + QEglFSHooks::platformInit(); + fbInit(); +} + +EGLNativeWindowType QEglFSHiX5Hd2Hooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) +{ + fbdev_window *fbwin = reinterpret_cast(malloc(sizeof(fbdev_window))); + if (NULL == fbwin) + return 0; + + fbwin->width = size.width(); + fbwin->height = size.height(); + return (EGLNativeWindowType)fbwin; +} + +void QEglFSHiX5Hd2Hooks::destroyNativeWindow(EGLNativeWindowType window) +{ + free(window); +} + +QEglFSHiX5Hd2Hooks eglFSHiX5Hd2Hooks; +QEglFSHooks *platformHooks = &eglFSHiX5Hd2Hooks; + +QT_END_NAMESPACE diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf new file mode 100644 index 0000000000..851d08600f --- /dev/null +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf @@ -0,0 +1,44 @@ +# +# qmake configuration for linux-arm-hisilicon-hix5hd2-g++ using the arm-linux-gnueabihf-g++ crosscompiler +# +# A typical configure line looks like this: +# /configure -opensource -confirm-license -release -make libs -make examples -optimized-qmake +# -platform linux-g++-64 -device linux-arm-hisilicon-hix5hd2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- +# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -no-audio-backend -qt-zlib -qt-libjpeg -qt-libpng +# -no-icu -no-nis -sysroot -extprefix -hostprefix +# -prefix +# +# such as +# ./configure -opensource -confirm-license -release -make libs -make examples -optimized-qmake +# -platform linux-g++-64 -device linux-arm-hisilicon-hix5hd2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- +# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -no-audio-backend -qt-zlib -qt-libjpeg -qt-libpng +# -no-icu -no-nis -sysroot /home/abc/project/sysbase +# -extprefix /home/abc/project/sysbase/qt_install +# -hostprefix /home/abc/project/qtdir/qtbase_hostinstall +# -prefix /home/abc/project/sysbase/qt_install + +include(../common/linux_device_pre.conf) +EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_hix5hd2.cpp + +QMAKE_INCDIR += /usr/arm-linux-gnueabihf/include +QMAKE_LIBDIR += /usr/arm-linux-gnueabihf/lib + +QMAKE_LIBS += -lrt + +QMAKE_INCDIR_EGL += $$[QT_SYSROOT]/egl/include +QMAKE_LIBDIR_EGL += $$[QT_SYSROOT]/egl/lib +QMAKE_INCDIR_OPENGL_ES2 += $$QMAKE_INCDIR_EGL +QMAKE_LIBDIR_OPENGL_ES2 += $$QMAKE_LIBDIR_EGL + +QMAKE_LIBS_EGL += -lMali +QMAKE_LIBS_OPENGL_ES2 += $$QMAKE_LIBS_EGL +QMAKE_LIBS_OPENVG += $$QMAKE_LIBS_EGL + +DISTRO_OPTS += hard-float + +QMAKE_CFLAGS +=-march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3-d16 +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS + +include(../common/linux_arm_device_post.conf) + +load(qt_config) diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h new file mode 100644 index 0000000000..9236ebd657 --- /dev/null +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../linux-g++/qplatformdefs.h" -- cgit v1.2.3