summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp (renamed from mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp)32
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf2
-rw-r--r--mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp (renamed from mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp)31
-rw-r--r--mkspecs/devices/linux-rasp-pi-g++/qmake.conf2
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro7
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h (renamed from src/plugins/platforms/eglfs/qeglfs_hooks.h)31
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp81
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_x11.cpp (renamed from src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp)33
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp2
10 files changed, 164 insertions, 59 deletions
diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
index 40fb2a336b..6655c50573 100644
--- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <EGL/fbdev_window.h>
#include <stdio.h>
#include <sys/ioctl.h>
@@ -48,20 +48,15 @@
#include <fcntl.h>
#include <linux/fb.h>
-void QEglFSHooks::platformInit()
+class QEglFS8726MHooks : public QEglFSHooks
{
-}
+public:
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+};
-void QEglFSHooks::platformDestroy()
-{
-}
-
-EGLNativeDisplayType QEglFSHooks::platformDisplay() const
-{
- return EGL_DEFAULT_DISPLAY;
-}
-
-QSize QEglFSHooks::screenSize() const
+QSize QEglFS8726MHooks::screenSize() const
{
int fd = open("/dev/fb0", O_RDONLY);
if (fd == -1) {
@@ -78,7 +73,7 @@ QSize QEglFSHooks::screenSize() const
return QSize(vinfo.xres, vinfo.yres);
}
-EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+EGLNativeWindowType QEglFS8726MHooks::createNativeWindow(const QSize &size)
{
fbdev_window *window = new fbdev_window;
window->width = size.width();
@@ -87,14 +82,11 @@ EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
return window;
}
-void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+void QEglFS8726MHooks::destroyNativeWindow(EGLNativeWindowType window)
{
delete window;
}
-bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
-{
- return false;
-}
+QEglFS8726MHooks eglFS8726MHooks;
+QEglFSHooks *platformHooks = &eglFS8726MHooks;
-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 b0b02f32e6..7525397a65 100644
--- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
@@ -31,6 +31,6 @@ QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
deviceSanityCheckCompiler()
-EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks_8726m.cpp
+EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_8726m.cpp
load(qt_config)
diff --git a/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp b/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
index f17af55947..21052a5b63 100644
--- a/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp
+++ b/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <bcm_host.h>
@@ -55,23 +55,35 @@
static DISPMANX_DISPLAY_HANDLE_T dispman_display = 0;
static DISPMANX_UPDATE_HANDLE_T dispman_update = 0;
-void QEglFSHooks::platformInit()
+class QEglFSPiHooks : public QEglFSHooks
+{
+public:
+ virtual void platformInit();
+ virtual void platformDestroy();
+ virtual EGLNativeDisplayType platformDisplay() const;
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+ virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
+};
+
+void QEglFSPiHooks::platformInit()
{
bcm_host_init();
}
-EGLNativeDisplayType QEglFSHooks::platformDisplay() const
+EGLNativeDisplayType QEglFSPiHooks::platformDisplay() const
{
dispman_display = vc_dispmanx_display_open(0/* LCD */);
return EGL_DEFAULT_DISPLAY;
}
-void QEglFSHooks::platformDestroy()
+void QEglFSPiHooks::platformDestroy()
{
vc_dispmanx_display_close(dispman_display);
}
-QSize QEglFSHooks::screenSize() const
+QSize QEglFSPiHooks::screenSize() const
{
//both mechanisms work
#if 1
@@ -98,7 +110,7 @@ QSize QEglFSHooks::screenSize() const
#endif
}
-EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+EGLNativeWindowType QEglFSPiHooks::createNativeWindow(const QSize &size)
{
VC_RECT_T dst_rect;
dst_rect.x = 0;
@@ -133,14 +145,14 @@ EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
return eglWindow;
}
-void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+void QEglFSPiHooks::destroyNativeWindow(EGLNativeWindowType window)
{
EGL_DISPMANX_WINDOW_T *eglWindow = static_cast<EGL_DISPMANX_WINDOW_T *>(window);
vc_dispmanx_element_remove(dispman_update, eglWindow->element);
delete eglWindow;
}
-bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
+bool QEglFSPiHooks::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
case QPlatformIntegration::ThreadedPixmaps:
@@ -153,4 +165,5 @@ bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
}
}
-QEglFSHooks platform_hooks;
+QEglFSPiHooks eglFSPiHooks;
+QEglFSHooks *platformHooks = &eglFSPiHooks;
diff --git a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf
index 326d6b3b61..4c75e0b0b2 100644
--- a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf
+++ b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf
@@ -48,7 +48,7 @@ QMAKE_CFLAGS_RELEASE += \
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks.cpp
+EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_pi.cpp
# Sanity check
deviceSanityCheckCompiler()
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index 9a36cacd05..421bbd5561 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -13,20 +13,21 @@ DESTDIR = $$QT.gui.plugins/platforms
DEFINES += MESA_EGL_NO_X11_HEADERS
#To test the hooks on x11 (xlib), comment the above define too
-#EGLFS_PLATFORM_HOOKS_SOURCES += qeglfs_hooks_x11.cpp
+#EGLFS_PLATFORM_HOOKS_SOURCES += qeglfshooks_x11.cpp
#LIBS += -lX11
SOURCES = main.cpp \
qeglfsintegration.cpp \
qeglfswindow.cpp \
qeglfsbackingstore.cpp \
- qeglfsscreen.cpp
+ qeglfsscreen.cpp \
+ qeglfshooks_stub.cpp
HEADERS = qeglfsintegration.h \
qeglfswindow.h \
qeglfsbackingstore.h \
qeglfsscreen.h \
- qeglfs_hooks.h
+ qeglfshooks.h
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index 628ef1f33b..a56c80261b 100644
--- a/src/plugins/platforms/eglfs/qeglfs_hooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -39,31 +39,34 @@
**
****************************************************************************/
-#ifndef QEGLFS_HOOKS_H
-#define QEGLFS_HOOKS_H
+#ifndef QEGLFSHOOKS_H
+#define QEGLFSHOOKS_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);
- bool hasCapability(QPlatformIntegration::Capability cap) const;
+class QEglFSHooks
+{
+public:
+ virtual void platformInit();
+ virtual void platformDestroy();
+ virtual EGLNativeDisplayType platformDisplay() const;
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+ virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
};
#ifdef EGLFS_PLATFORM_HOOKS
-extern QEglFSHooks platform_hooks;
-static QEglFSHooks *hooks = &platform_hooks;
+extern QEglFSHooks *platformHooks;
+static QEglFSHooks *hooks = platformHooks;
#else
-static QEglFSHooks *hooks = 0;
+extern QEglFSHooks stubHooks;
+static QEglFSHooks *hooks = &stubHooks;
#endif
QT_END_NAMESPACE
-#endif
+#endif // QEGLFSHOOKS_H
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
new file mode 100644
index 0000000000..7cc3527a0c
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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 "qeglfshooks.h"
+
+void QEglFSHooks::platformInit()
+{
+}
+
+void QEglFSHooks::platformDestroy()
+{
+}
+
+EGLNativeDisplayType QEglFSHooks::platformDisplay() const
+{
+ return EGL_DEFAULT_DISPLAY;
+}
+
+QSize QEglFSHooks::screenSize() const
+{
+ return QSize();
+}
+
+EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+{
+ Q_UNUSED(size);
+ return 0;
+}
+
+void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+{
+ Q_UNUSED(window);
+}
+
+bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ Q_UNUSED(cap);
+ return false;
+}
+
+#ifndef EGLFS_PLATFORM_HOOKS
+QEglFSHooks stubHooks;
+#endif
diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
index 594614e7a0..cb788c52f2 100644
--- a/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
@@ -39,31 +39,42 @@
**
****************************************************************************/
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <X11/Xlib.h>
-QEglFSHooks platform_hooks;
+class QEglFSX11Hooks : public QEglFSHooks
+{
+public:
+ virtual void platformInit();
+ virtual void platformDestroy();
+ virtual EGLNativeDisplayType platformDisplay() const;
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+ virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
+};
+
static Display *display = 0;
-void QEglFSHooks::platformInit()
+void QEglFSX11Hooks::platformInit()
{
display = XOpenDisplay(NULL);
if (!display)
qFatal("Could not open display");
}
-void QEglFSHooks::platformDestroy()
+void QEglFSX11Hooks::platformDestroy()
{
XCloseDisplay(display);
}
-EGLNativeDisplayType QEglFSHooks::platformDisplay() const
+EGLNativeDisplayType QEglFSX11Hooks::platformDisplay() const
{
return display;
}
-QSize QEglFSHooks::screenSize() const
+QSize QEglFSX11Hooks::screenSize() const
{
QList<QByteArray> env = qgetenv("EGLFS_X11_SIZE").split('x');
if (env.length() != 2)
@@ -71,7 +82,7 @@ QSize QEglFSHooks::screenSize() const
return QSize(env.at(0).toInt(), env.at(1).toInt());
}
-EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+EGLNativeWindowType QEglFSX11Hooks::createNativeWindow(const QSize &size)
{
Window root = DefaultRootWindow(display);
XSetWindowAttributes swa;
@@ -83,13 +94,17 @@ EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
return win;
}
-void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+void QEglFSX11Hooks::destroyNativeWindow(EGLNativeWindowType window)
{
XDestroyWindow(display, window);
}
-bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
+bool QEglFSX11Hooks::hasCapability(QPlatformIntegration::Capability cap) const
{
+ Q_UNUSED(cap);
return false;
}
+static QEglFSX11Hooks eglFSX11Hooks;
+QEglFSHooks *platformHooks = &eglFSX11Hooks;
+
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index b1f5a69570..9b7d9246f9 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -43,7 +43,7 @@
#include "qeglfswindow.h"
#include "qeglfsbackingstore.h"
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 3c2f4c580d..ea939a9821 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -41,7 +41,7 @@
#include "qeglfsscreen.h"
#include "qeglfswindow.h"
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>