Add minimalegl QPA platform plugin

The EGLFS platform plugin was originally meant to be an example
and thus to be kept simple. However, EGLFS is becoming more
and more complex with the addition of hooks for board support,
cursor integration, built-in evdev support etc.

minimalegl is a new platform plugin that intends to follow
the original intentions of EGLFS.

The code is an adaptation of EGLFS as of f913859f8

Change-Id: I3d4cf84cde380cdcc7e0e8bfefff4df6be731b8d
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
bb10
Girish Ramakrishnan 2012-05-27 09:27:57 -07:00 committed by Qt by Nokia
parent 9e424adbdd
commit 0cb7dac534
12 changed files with 929 additions and 0 deletions

View File

@ -0,0 +1,74 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
#include <qpa/qplatformintegrationplugin.h>
#include "qminimaleglintegration.h"
QT_BEGIN_NAMESPACE
class QMinimalEglIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPlatformIntegrationFactoryInterface" FILE "minimalegl.json")
public:
QStringList keys() const;
QPlatformIntegration *create(const QString&, const QStringList&);
};
QStringList QMinimalEglIntegrationPlugin::keys() const
{
QStringList list;
list << "MinimalEgl";
return list;
}
QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
if (system.toLower() == "minimalegl")
return new QMinimalEglIntegration;
return 0;
}
QT_END_NAMESPACE
#include "main.moc"

View File

@ -0,0 +1,3 @@
{
"Keys": [ "minimalegl" ]
}

View File

@ -0,0 +1,32 @@
TARGET = qminimalegl
load(qt_plugin)
QT += core-private gui-private platformsupport-private
DESTDIR = $$QT.gui.plugins/platforms
#DEFINES += QEGL_EXTRA_DEBUG
#DEFINES += Q_OPENKODE
#Avoid X11 header collision
DEFINES += MESA_EGL_NO_X11_HEADERS
SOURCES = main.cpp \
qminimaleglintegration.cpp \
qminimaleglwindow.cpp \
qminimaleglbackingstore.cpp \
qminimaleglscreen.cpp
HEADERS = qminimaleglintegration.h \
qminimaleglwindow.h \
qminimaleglbackingstore.h \
qminimaleglscreen.h
CONFIG += egl qpa/genericunixfontdatabase
target.path += $$[QT_INSTALL_PLUGINS]/platforms
INSTALLS += target
OTHER_FILES += \
minimalegl.json

View File

@ -0,0 +1,100 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
#include "qminimaleglbackingstore.h"
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLPaintDevice>
QT_BEGIN_NAMESPACE
QMinimalEglBackingStore::QMinimalEglBackingStore(QWindow *window)
: QPlatformBackingStore(window)
, m_context(new QOpenGLContext)
{
m_context->setFormat(window->requestedFormat());
m_context->setScreen(window->screen());
m_context->create();
}
QMinimalEglBackingStore::~QMinimalEglBackingStore()
{
delete m_context;
}
QPaintDevice *QMinimalEglBackingStore::paintDevice()
{
return m_device;
}
void QMinimalEglBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
Q_UNUSED(region);
Q_UNUSED(offset);
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglBackingStore::flush %p", window);
#endif
m_context->swapBuffers(window);
}
void QMinimalEglBackingStore::beginPaint(const QRegion &)
{
// needed to prevent QOpenGLContext::makeCurrent() from failing
window()->setSurfaceType(QSurface::OpenGLSurface);
m_context->makeCurrent(window());
m_device = new QOpenGLPaintDevice(window()->size());
}
void QMinimalEglBackingStore::endPaint()
{
delete m_device;
}
void QMinimalEglBackingStore::resize(const QSize &size, const QRegion &staticContents)
{
Q_UNUSED(size);
Q_UNUSED(staticContents);
}
QT_END_NAMESPACE

View File

@ -0,0 +1,73 @@
/****************************************************************************
**
** 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 QMINIMALEGLBACKINGSTORE_H
#define QMINIMALEGLBACKINGSTORE_H
#include <qpa/qplatformbackingstore.h>
QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOpenGLPaintDevice;
class QMinimalEglBackingStore : public QPlatformBackingStore
{
public:
QMinimalEglBackingStore(QWindow *window);
~QMinimalEglBackingStore();
QPaintDevice *paintDevice();
void beginPaint(const QRegion &);
void endPaint();
void flush(QWindow *window, const QRegion &region, const QPoint &offset);
void resize(const QSize &size, const QRegion &staticContents);
private:
QOpenGLContext *m_context;
QOpenGLPaintDevice *m_device;
};
QT_END_NAMESPACE
#endif // QMINIMALEGLBACKINGSTORE_H

View File

@ -0,0 +1,126 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
#include "qminimaleglintegration.h"
#include "qminimaleglwindow.h"
#include "qminimaleglbackingstore.h"
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#include <qpa/qplatformwindow.h>
#include <QtGui/QSurfaceFormat>
#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
QMinimalEglIntegration::QMinimalEglIntegration()
: mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY))
{
screenAdded(mScreen);
#ifdef QEGL_EXTRA_DEBUG
qWarning("QMinimalEglIntegration\n");
#endif
}
QMinimalEglIntegration::~QMinimalEglIntegration()
{
delete mScreen;
}
bool QMinimalEglIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
case ThreadedPixmaps: return true;
case OpenGL: return true;
case ThreadedOpenGL: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
QPlatformWindow *QMinimalEglIntegration::createPlatformWindow(QWindow *window) const
{
#ifdef QEGL_EXTRA_DEBUG
qWarning("QMinimalEglIntegration::createPlatformWindow %p\n",window);
#endif
QPlatformWindow *w = new QMinimalEglWindow(window);
w->requestActivateWindow();
return w;
}
QPlatformBackingStore *QMinimalEglIntegration::createPlatformBackingStore(QWindow *window) const
{
#ifdef QEGL_EXTRA_DEBUG
qWarning("QMinimalEglIntegration::createWindowSurface %p\n", window);
#endif
return new QMinimalEglBackingStore(window);
}
QPlatformOpenGLContext *QMinimalEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
return static_cast<QMinimalEglScreen *>(context->screen()->handle())->platformContext();
}
QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
{
return mFontDb;
}
QAbstractEventDispatcher *QMinimalEglIntegration::guiThreadEventDispatcher() const
{
return createUnixEventDispatcher();
}
QVariant QMinimalEglIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
{
if (hint == QPlatformIntegration::ShowIsFullScreen)
return true;
return QPlatformIntegration::styleHint(hint);
}
QT_END_NAMESPACE

View File

@ -0,0 +1,80 @@
/****************************************************************************
**
** 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 QMINIMALEGLINTEGRATION_H
#define QMINIMALEGLINTEGRATION_H
#include "qminimaleglscreen.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QMinimalEglIntegration : public QPlatformIntegration
{
public:
QMinimalEglIntegration();
~QMinimalEglIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
QPlatformFontDatabase *fontDatabase() const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
private:
QPlatformFontDatabase *mFontDb;
QPlatformScreen *mScreen;
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QMINIMALEGLINTEGRATION_H

View File

@ -0,0 +1,216 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
#include "qminimaleglscreen.h"
#include "qminimaleglwindow.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#ifdef Q_OPENKODE
#include <KD/kd.h>
#include <KD/NV_initialize.h>
#endif //Q_OPENKODE
QT_BEGIN_NAMESPACE
// #define QEGL_EXTRA_DEBUG
class QMinimalEglContext : public QEGLPlatformContext
{
public:
QMinimalEglContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
EGLenum eglApi = EGL_OPENGL_ES_API)
: QEGLPlatformContext(format, share, display, eglApi)
{
}
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface)
{
QMinimalEglWindow *window = static_cast<QMinimalEglWindow *>(surface);
QMinimalEglScreen *screen = static_cast<QMinimalEglScreen *>(window->screen());
return screen->surface();
}
};
QMinimalEglScreen::QMinimalEglScreen(EGLNativeDisplayType display)
: m_depth(32)
, m_format(QImage::Format_Invalid)
, m_platformContext(0)
, m_surface(0)
{
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglScreen %p\n", this);
#endif
EGLint major, minor;
if (!eglBindAPI(EGL_OPENGL_ES_API)) {
qWarning("Could not bind GL_ES API\n");
qFatal("EGL error");
}
m_dpy = eglGetDisplay(display);
if (m_dpy == EGL_NO_DISPLAY) {
qWarning("Could not open egl display\n");
qFatal("EGL error");
}
qWarning("Opened display %p\n", m_dpy);
if (!eglInitialize(m_dpy, &major, &minor)) {
qWarning("Could not initialize egl display\n");
qFatal("EGL error");
}
qWarning("Initialized display %d %d\n", major, minor);
int swapInterval = 1;
QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL");
if (!swapIntervalString.isEmpty()) {
bool ok;
swapInterval = swapIntervalString.toInt(&ok);
if (!ok)
swapInterval = 1;
}
eglSwapInterval(m_dpy, swapInterval);
}
QMinimalEglScreen::~QMinimalEglScreen()
{
if (m_surface)
eglDestroySurface(m_dpy, m_surface);
eglTerminate(m_dpy);
}
void QMinimalEglScreen::createAndSetPlatformContext() const {
const_cast<QMinimalEglScreen *>(this)->createAndSetPlatformContext();
}
void QMinimalEglScreen::createAndSetPlatformContext()
{
QSurfaceFormat platformFormat;
QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH");
if (depthString.toInt() == 16) {
platformFormat.setDepthBufferSize(16);
platformFormat.setRedBufferSize(5);
platformFormat.setGreenBufferSize(6);
platformFormat.setBlueBufferSize(5);
m_depth = 16;
m_format = QImage::Format_RGB16;
} else {
platformFormat.setDepthBufferSize(24);
platformFormat.setStencilBufferSize(8);
platformFormat.setRedBufferSize(8);
platformFormat.setGreenBufferSize(8);
platformFormat.setBlueBufferSize(8);
m_depth = 32;
m_format = QImage::Format_RGB32;
}
if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty())
platformFormat.setSamples(4);
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);
#endif
#ifdef QEGL_EXTRA_DEBUG
q_printEglConfig(m_dpy, config);
#endif
m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL);
if (m_surface == EGL_NO_SURFACE) {
qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError());
eglTerminate(m_dpy);
qFatal("EGL error");
}
// qWarning("Created surface %dx%d\n", w, h);
QEGLPlatformContext *platformContext = new QMinimalEglContext(platformFormat, 0, m_dpy);
m_platformContext = platformContext;
EGLint w,h; // screen size detection
eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w);
eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h);
m_geometry = QRect(0,0,w,h);
}
QRect QMinimalEglScreen::geometry() const
{
if (m_geometry.isNull()) {
createAndSetPlatformContext();
}
return m_geometry;
}
int QMinimalEglScreen::depth() const
{
return m_depth;
}
QImage::Format QMinimalEglScreen::format() const
{
if (m_format == QImage::Format_Invalid)
createAndSetPlatformContext();
return m_format;
}
QPlatformOpenGLContext *QMinimalEglScreen::platformContext() const
{
if (!m_platformContext) {
QMinimalEglScreen *that = const_cast<QMinimalEglScreen *>(this);
that->createAndSetPlatformContext();
}
return m_platformContext;
}
QT_END_NAMESPACE

View File

@ -0,0 +1,82 @@
/****************************************************************************
**
** 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 QMINIMALEGLSCREEN_H
#define QMINIMALEGLSCREEN_H
#include <qpa/qplatformscreen.h>
#include <QtCore/QTextStream>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
class QPlatformOpenGLContext;
class QMinimalEglScreen : public QPlatformScreen
{
public:
QMinimalEglScreen(EGLNativeDisplayType display);
~QMinimalEglScreen();
QRect geometry() const;
int depth() const;
QImage::Format format() const;
QPlatformOpenGLContext *platformContext() const;
EGLSurface surface() const { return m_surface; }
private:
void createAndSetPlatformContext() const;
void createAndSetPlatformContext();
QRect m_geometry;
int m_depth;
QImage::Format m_format;
QPlatformOpenGLContext *m_platformContext;
EGLDisplay m_dpy;
EGLSurface m_surface;
};
QT_END_NAMESPACE
#endif // QMINIMALEGLSCREEN_H

View File

@ -0,0 +1,77 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
#include "qminimaleglwindow.h"
#include <QtGui/QWindowSystemInterface>
QT_BEGIN_NAMESPACE
QMinimalEglWindow::QMinimalEglWindow(QWindow *w)
: QPlatformWindow(w)
{
static int serialNo = 0;
m_winid = ++serialNo;
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid));
#endif
QRect screenGeometry(screen()->availableGeometry());
if (w->geometry() != screenGeometry) {
QWindowSystemInterface::handleGeometryChange(w, screenGeometry);
}
}
void QMinimalEglWindow::setGeometry(const QRect &)
{
// We only support full-screen windows
QRect rect(screen()->availableGeometry());
QWindowSystemInterface::handleGeometryChange(window(), rect);
QPlatformWindow::setGeometry(rect);
}
WId QMinimalEglWindow::winId() const
{
return m_winid;
}
QT_END_NAMESPACE

View File

@ -0,0 +1,65 @@
/****************************************************************************
**
** 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 QMINIMALEGLWINDOW_H
#define QMINIMALEGLWINDOW_H
#include "qminimaleglintegration.h"
#include "qminimaleglscreen.h"
#include <qpa/qplatformwindow.h>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class QMinimalEglWindow : public QPlatformWindow
{
public:
QMinimalEglWindow(QWindow *w);
void setGeometry(const QRect &);
WId winId() const;
private:
WId m_winid;
};
QT_END_NAMESPACE
#endif // QMINIMALEGLWINDOW_H

View File

@ -16,6 +16,7 @@ qnx {
contains(QT_CONFIG, eglfs) {
SUBDIRS += eglfs
SUBDIRS += minimalegl
}
contains(QT_CONFIG, directfb) {