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 <laszlo.agocs@digia.com>
This commit is contained in:
Xu Feng 2014-06-17 16:37:35 +08:00 committed by Laszlo Agocs
parent cd07830e3b
commit 99d78b40e9
3 changed files with 204 additions and 0 deletions

View File

@ -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 <EGL/fbdev_window.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
#include <private/qcore_unix_p.h>
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<fbdev_window *>(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

View File

@ -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:
# <path-to-qt-src>/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 <path-to-rootfs> -extprefix <path-to-targetinstall> -hostprefix <path-to-hostinstall>
# -prefix <path-to-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)

View File

@ -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"