summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/eglfs')
-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/qeglfsbackingstore.h6
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp10
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h8
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp38
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h11
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h6
8 files changed, 129 insertions, 22 deletions
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/qeglfsbackingstore.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
index 1eb4d8d79a..97ea322420 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.h
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QEGLWINDOWSURFACE_H
-#define QEGLWINDOWSURFACE_H
+#ifndef QEGLFSBACKINGSTORE_H
+#define QEGLFSBACKINGSTORE_H
#include <QtGui/qplatformbackingstore_qpa.h>
@@ -70,4 +70,4 @@ private:
QT_END_NAMESPACE
-#endif // QEGLWINDOWSURFACE_H
+#endif // QEGLFSBACKINGSTORE_H
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index d180de349e..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,15 +58,20 @@
QT_BEGIN_NAMESPACE
QEglFSIntegration::QEglFSIntegration()
- : mFontDb(new QGenericUnixFontDatabase())
+ : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QEglFSScreen)
{
- screenAdded(new QEglFSScreen(EGL_DEFAULT_DISPLAY));
+ screenAdded(mScreen);
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglIntegration\n");
#endif
}
+QEglFSIntegration::~QEglFSIntegration()
+{
+ delete mScreen;
+}
+
bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index ee30d4bbf2..eea36a489d 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef EGLINTEGRATION_H
-#define EGLINTEGRATION_H
+#ifndef QEGLFSINTEGRATION_H
+#define QEGLFSINTEGRATION_H
#include "qeglfsscreen.h"
@@ -55,6 +55,7 @@ class QEglFSIntegration : public QPlatformIntegration
{
public:
QEglFSIntegration();
+ ~QEglFSIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const;
@@ -70,9 +71,10 @@ public:
private:
QPlatformFontDatabase *mFontDb;
+ QPlatformScreen *mScreen;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif
+#endif // QEGLFSINTEGRATION_H
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 000bedf293..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");
@@ -146,6 +158,20 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
eglSwapInterval(m_dpy, swapInterval);
}
+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 {
const_cast<QEglFSScreen *>(this)->createAndSetPlatformContext();
}
@@ -177,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
@@ -201,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 18fc643b98..66e600d7c2 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QEGLSCREEN_H
-#define QEGLSCREEN_H
+#ifndef QEGLFSSCREEN_H
+#define QEGLFSSCREEN_H
#include <QPlatformScreen>
@@ -55,8 +55,8 @@ class QPlatformOpenGLContext;
class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to follow namespace
{
public:
- QEglFSScreen(EGLNativeDisplayType display);
- ~QEglFSScreen() {}
+ QEglFSScreen();
+ ~QEglFSScreen();
QRect geometry() const;
int depth() const;
@@ -76,7 +76,8 @@ private:
QPlatformOpenGLContext *m_platformContext;
EGLDisplay m_dpy;
EGLSurface m_surface;
+ EGLNativeWindowType m_window;
};
QT_END_NAMESPACE
-#endif // QEGLSCREEN_H
+#endif // QEGLFSSCREEN_H
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index 807470bc78..1376708ad6 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QEGLWINDOW_H
-#define QEGLWINDOW_H
+#ifndef QEGLFSWINDOW_H
+#define QEGLFSWINDOW_H
#include "qeglfsintegration.h"
#include "qeglfsscreen.h"
@@ -62,4 +62,4 @@ private:
WId m_winid;
};
QT_END_NAMESPACE
-#endif // QEGLWINDOW_H
+#endif // QEGLFSWINDOW_H