summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp95
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf2
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro11
-rw-r--r--src/plugins/platforms/eglfs/qeglfs_hooks.h61
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp30
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h3
7 files changed, 197 insertions, 8 deletions
diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp
new file mode 100644
index 0000000000..06cb424e4f
--- /dev/null
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qeglfs_hooks.h"
+#include <EGL/fbdev_window.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/fb.h>
+
+void QEglFSHooks::platformInit()
+{
+}
+
+void QEglFSHooks::platformDestroy()
+{
+}
+
+EGLNativeDisplayType QEglFSHooks::platformDisplay() const
+{
+ return EGL_DEFAULT_DISPLAY;
+}
+
+QSize QEglFSHooks::screenSize() const
+{
+ int fd = open("/dev/fb0", O_RDONLY);
+ if (fd == -1) {
+ qFatal("Failed to open fb to detect screen resolution!");
+ }
+
+ struct fb_var_screeninfo vinfo;
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
+ qFatal("Could not get variable screen info");
+ }
+
+ close(fd);
+
+ return QSize(vinfo.xres, vinfo.yres);
+}
+
+EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+{
+ fbdev_window *window = new fbdev_window;
+ window->width = size.width();
+ window->height = size.height();
+
+ return window;
+}
+
+void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+{
+ delete window;
+}
+
+QEglFSHooks platform_hooks;
diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
index e57b2e7ed7..b0b02f32e6 100644
--- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
@@ -31,4 +31,6 @@ QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
deviceSanityCheckCompiler()
+EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks_8726m.cpp
+
load(qt_config)
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index c12d612c98..89d56efc82 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -21,7 +21,16 @@ SOURCES = main.cpp \
HEADERS = qeglfsintegration.h \
qeglfswindow.h \
qeglfsbackingstore.h \
- qeglfsscreen.h
+ qeglfsscreen.h \
+ qeglfs_hooks.h
+
+QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
+
+!isEmpty(EGLFS_PLATFORM_HOOKS_SOURCES) {
+ HEADERS += $$EGLFS_PLATFORM_HOOKS_HEADERS
+ SOURCES += $$EGLFS_PLATFORM_HOOKS_SOURCES
+ DEFINES += EGLFS_PLATFORM_HOOKS
+}
CONFIG += egl qpa/genericunixfontdatabase
diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks.h b/src/plugins/platforms/eglfs/qeglfs_hooks.h
new file mode 100644
index 0000000000..a30af9409f
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfs_hooks.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QEGLFS_HOOKS_H
+#define QEGLFS_HOOKS_H
+
+#include "qplatformintegration_qpa.h"
+#include <EGL/egl.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QEglFSHooks {
+ void platformInit();
+ void platformDestroy();
+ EGLNativeDisplayType platformDisplay() const;
+ QSize screenSize() const;
+ EGLNativeWindowType createNativeWindow(const QSize &size);
+ void destroyNativeWindow(EGLNativeWindowType window);
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index ef889cd70d..d9214f87fe 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -43,6 +43,7 @@
#include "qeglfswindow.h"
#include "qeglfsbackingstore.h"
+#include "qeglfs_hooks.h"
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
@@ -57,7 +58,7 @@
QT_BEGIN_NAMESPACE
QEglFSIntegration::QEglFSIntegration()
- : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QEglFSScreen(EGL_DEFAULT_DISPLAY))
+ : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QEglFSScreen)
{
screenAdded(mScreen);
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index fdffd96d6e..c7e983b0fb 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -41,6 +41,7 @@
#include "qeglfsscreen.h"
#include "qeglfswindow.h"
+#include "qeglfs_hooks.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
@@ -52,6 +53,13 @@
QT_BEGIN_NAMESPACE
+#ifdef EGLFS_PLATFORM_HOOKS
+extern QEglFSHooks platform_hooks;
+static QEglFSHooks *hooks = &platform_hooks;
+#else
+static QEglFSHooks *hooks = 0;
+#endif
+
// #define QEGL_EXTRA_DEBUG
#ifdef QEGL_EXTRA_DEBUG
@@ -104,16 +112,20 @@ public:
}
};
-QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
+QEglFSScreen::QEglFSScreen()
: m_depth(32)
, m_format(QImage::Format_Invalid)
, m_platformContext(0)
, m_surface(0)
+ , m_window(0)
{
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglScreen %p\n", this);
#endif
+ if (hooks)
+ hooks->platformInit();
+
EGLint major, minor;
if (!eglBindAPI(EGL_OPENGL_ES_API)) {
@@ -121,7 +133,7 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
qFatal("EGL error");
}
- m_dpy = eglGetDisplay(display);
+ m_dpy = eglGetDisplay(hooks ? hooks->platformDisplay() : EGL_DEFAULT_DISPLAY);
if (m_dpy == EGL_NO_DISPLAY) {
qWarning("Could not open egl display\n");
qFatal("EGL error");
@@ -151,7 +163,13 @@ QEglFSScreen::~QEglFSScreen()
if (m_surface)
eglDestroySurface(m_dpy, m_surface);
+ if (hooks)
+ hooks->destroyNativeWindow(m_window);
+
eglTerminate(m_dpy);
+
+ if (hooks)
+ hooks->platformDestroy();
}
void QEglFSScreen::createAndSetPlatformContext() const {
@@ -185,14 +203,16 @@ void QEglFSScreen::createAndSetPlatformContext()
EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat);
- EGLNativeWindowType eglWindow = 0;
#ifdef Q_OPENKODE
if (kdInitializeNV() == KD_ENOTINITIALIZED) {
qFatal("Did not manage to initialize openkode");
}
KDWindow *window = kdCreateWindow(m_dpy,config,0);
- kdRealizeWindow(window,&eglWindow);
+ kdRealizeWindow(window, &m_window);
+#else
+ if (hooks)
+ m_window = hooks->createNativeWindow(hooks->screenSize());
#endif
#ifdef QEGL_EXTRA_DEBUG
@@ -209,7 +229,7 @@ void QEglFSScreen::createAndSetPlatformContext()
qWarning("\n");
#endif
- m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL);
+ m_surface = eglCreateWindowSurface(m_dpy, config, m_window, NULL);
if (m_surface == EGL_NO_SURFACE) {
qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError());
eglTerminate(m_dpy);
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
index 30ef55f13f..66e600d7c2 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -55,7 +55,7 @@ class QPlatformOpenGLContext;
class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to follow namespace
{
public:
- QEglFSScreen(EGLNativeDisplayType display);
+ QEglFSScreen();
~QEglFSScreen();
QRect geometry() const;
@@ -76,6 +76,7 @@ private:
QPlatformOpenGLContext *m_platformContext;
EGLDisplay m_dpy;
EGLSurface m_surface;
+ EGLNativeWindowType m_window;
};
QT_END_NAMESPACE