summaryrefslogtreecommitdiffstats
path: root/tools/qmeegographicssystemhelper
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qmeegographicssystemhelper')
-rw-r--r--tools/qmeegographicssystemhelper/qmeegofencesync.cpp79
-rw-r--r--tools/qmeegographicssystemhelper/qmeegofencesync.h101
-rw-r--r--tools/qmeegographicssystemhelper/qmeegofencesync_p.h60
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp138
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h182
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro10
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp117
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.h112
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h57
-rw-r--r--tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp102
-rw-r--r--tools/qmeegographicssystemhelper/qmeegooverlaywidget.h86
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.cpp234
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.h68
13 files changed, 1346 insertions, 0 deletions
diff --git a/tools/qmeegographicssystemhelper/qmeegofencesync.cpp b/tools/qmeegographicssystemhelper/qmeegofencesync.cpp
new file mode 100644
index 0000000..499e102
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegofencesync.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegofencesync.h"
+#include "qmeegofencesync_p.h"
+#include "qmeegoruntime.h"
+
+/* QMeeGoFenceSyncPrivate */
+
+QMeeGoFenceSyncPrivate::QMeeGoFenceSyncPrivate() : syncObject(NULL)
+{
+}
+
+QMeeGoFenceSyncPrivate::~QMeeGoFenceSyncPrivate()
+{
+ if (syncObject) {
+ QMeeGoRuntime::destroyFenceSync(syncObject);
+ syncObject = NULL;
+ }
+}
+
+/* QMeeGoFenceSync */
+
+QMeeGoFenceSync::QMeeGoFenceSync(QWidget *parent) : QObject(parent), d_ptr(new QMeeGoFenceSyncPrivate())
+{
+ Q_D(QMeeGoFenceSync);
+ d->q_ptr = this;
+}
+
+QMeeGoFenceSync::~QMeeGoFenceSync()
+{
+}
+
+void QMeeGoFenceSync::setSyncPoint()
+{
+ Q_D(QMeeGoFenceSync);
+ if (d->syncObject)
+ QMeeGoRuntime::destroyFenceSync(d->syncObject);
+
+ d->syncObject = QMeeGoRuntime::createFenceSync();
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegofencesync.h b/tools/qmeegographicssystemhelper/qmeegofencesync.h
new file mode 100644
index 0000000..2d3f5c5
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegofencesync.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOFENCESYNC_H
+#define QMEEGOFENCESYNC_H
+
+#include <QWidget>
+
+class QMeeGoFenceSyncPrivate;
+
+//! A synchronization helper for GL pipeline.
+/*!
+ Fence syncs provide a mechanism for synchronizing access to certain GL primitives
+ and make it possible for the application developer to be sure that a certain point
+ in the GL processing pipeline has been already executed before continuing operation.
+
+ Currently fence syncs are only useful in conjunction with QMeeGoLivePixmaps.
+ \code
+ ...
+ // In your paint/expose event:
+ QImage *image = livePixmap->lock(&someGlobalFenceSync);
+ // Modify the image...
+ livePixmap->release(image);
+
+ painter->drawPixmap(0, 0, *livePixmap);
+ someGlobalFenceSync.setSyncPoint();
+ ...
+ \endcode
+
+ Assuming the paint/expose events come repeatedly, the lock operation
+ will block till the previous event completed painting the livePixmap.
+*/
+
+class Q_DECL_EXPORT QMeeGoFenceSync : public QObject
+{
+public:
+ //! Constructs a new fence sync.
+ /*!
+ The fence sync is created without a sync point. You need to set the sync point manually.
+ */
+ QMeeGoFenceSync(QWidget *parent = 0);
+
+ //! Destructor for the fence sync.
+ virtual ~QMeeGoFenceSync();
+
+ //! Sets the fence sync.
+ /*!
+ The fence sync synchronization point should be set after all drawing has been scheduled.
+ Setting a synchronization point always overrides the previous point -- whetver is was
+ used (waited upon) or not.
+ */
+ void setSyncPoint();
+
+private:
+ Q_DISABLE_COPY(QMeeGoFenceSync)
+ Q_DECLARE_PRIVATE(QMeeGoFenceSync)
+
+protected:
+ QScopedPointer<QMeeGoFenceSyncPrivate> d_ptr; //! Private bits.
+ friend class QMeeGoLivePixmap;
+};
+
+#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegofencesync_p.h b/tools/qmeegographicssystemhelper/qmeegofencesync_p.h
new file mode 100644
index 0000000..8a5d26e
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegofencesync_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegofencesync.h"
+
+#ifndef QMEEGOFENCESYNC_P_H
+#define QMEEGOFENCESYNC_P_H
+
+class QMeeGoFenceSyncPrivate
+{
+public:
+ Q_DECLARE_PUBLIC(QMeeGoFenceSync);
+ QMeeGoFenceSyncPrivate();
+
+ virtual ~QMeeGoFenceSyncPrivate();
+
+ void* syncObject;
+
+ QMeeGoFenceSync *q_ptr;
+};
+
+#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
new file mode 100644
index 0000000..d348e70
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define ENSURE_RUNNING_MEEGO {if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo()) { qFatal("Using meego functionality but not running meego graphics system!"); }}
+
+#include "qmeegographicssystemhelper.h"
+#include <private/qapplication_p.h>
+#include <private/qgraphicssystem_runtime_p.h>
+#include <private/qpixmap_raster_p.h>
+#include "qmeegoruntime.h"
+
+QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName()
+{
+ if (! QApplicationPrivate::instance()) {
+ qWarning("Querying graphics system but application not running yet!");
+ return QString();
+ }
+
+ QString name = QApplicationPrivate::instance()->graphics_system_name;
+ if (name == QLatin1String("runtime")) {
+ QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
+ name = rsystem->graphicsSystemName();
+ }
+
+ return name;
+}
+
+bool QMeeGoGraphicsSystemHelper::isRunningMeeGo()
+{
+ return (runningGraphicsSystemName() == QLatin1String("meego"));
+}
+
+bool QMeeGoGraphicsSystemHelper::isRunningRuntime()
+{
+ return (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime"));
+}
+
+void QMeeGoGraphicsSystemHelper::switchToMeeGo()
+{
+ if (isRunningMeeGo())
+ return;
+
+ if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
+ qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system.");
+ else {
+ QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
+ app->setGraphicsSystem(QLatin1String("meego"));
+ }
+}
+
+void QMeeGoGraphicsSystemHelper::switchToRaster()
+{
+ if (runningGraphicsSystemName() == QLatin1String("raster"))
+ return;
+
+ if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
+ qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system.");
+ else {
+ QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
+ app->setGraphicsSystem(QLatin1String("raster"));
+ }
+}
+
+Qt::HANDLE QMeeGoGraphicsSystemHelper::imageToEGLSharedImage(const QImage &image)
+{
+ ENSURE_RUNNING_MEEGO;
+ return QMeeGoRuntime::imageToEGLSharedImage(image);
+}
+
+QPixmap QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+{
+ // This function is supported when not running meego too. A raster-backed
+ // pixmap will be created... but when you switch back to 'meego', it'll
+ // be replaced with a EGL shared image backing.
+ return QPixmap(QMeeGoRuntime::pixmapDataFromEGLSharedImage(handle, softImage));
+}
+
+QPixmap QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(int w, int h)
+{
+ ENSURE_RUNNING_MEEGO;
+ return QPixmap(QMeeGoRuntime::pixmapDataWithGLTexture(w, h));
+}
+
+bool QMeeGoGraphicsSystemHelper::destroyEGLSharedImage(Qt::HANDLE handle)
+{
+ ENSURE_RUNNING_MEEGO;
+ return QMeeGoRuntime::destroyEGLSharedImage(handle);
+}
+
+void QMeeGoGraphicsSystemHelper::updateEGLSharedImagePixmap(QPixmap *p)
+{
+ ENSURE_RUNNING_MEEGO;
+ return QMeeGoRuntime::updateEGLSharedImagePixmap(p);
+}
+
+void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent)
+{
+ ENSURE_RUNNING_MEEGO;
+ QMeeGoRuntime::setTranslucent(translucent);
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
new file mode 100644
index 0000000..2baacbb
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOGRAPHICSSYSTEMHELPER_H
+#define QMEEGOGRAPHICSSYSTEMHELPER_H
+
+#include <QPixmap>
+#include <QImage>
+#include "qmeegolivepixmap.h"
+
+class QLibrary;
+
+//! The base class for accressing special meego graphics system features.
+/*!
+ This class is a helper class with static-only methods for accessing various
+ meego graphics system functionalities. The way it works is that the helper
+ dynamically calls-in to the loaded graphicssystem plugin... therefore, you're
+ expected to make sure that you're indeed running with 'meego' before using any
+ of the specialized methods.
+
+ In example:
+
+ \code
+ QPixmap p;
+ if (QMeeGoGraphicsSystemHelper::isRunningMeeGo()) {
+ p = QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(64, 64);
+ } else {
+ p = QPixmap(64, 64);
+ }
+ \endcode
+
+ Calling any of the meego-specific features while not running meego might
+ give unpredictable results. The only functions safe to call at all times are:
+
+ \code
+ QMeeGoGraphicsSystemHelper::isRunningMeeGo();
+ QMeeGoGraphicsSystemHelper::runningGraphicsSystemName();
+ QMeeGoGraphicsSystemHelper::switchToMeeGo();
+ QMeeGoGraphicsSystemHelper::switchToRaster();
+ \endcode
+*/
+
+class Q_DECL_EXPORT QMeeGoGraphicsSystemHelper
+{
+public:
+ //! Returns true if running meego.
+ /*!
+ Returns true if the currently active (running) system is 'meego' with OpenGL.
+ This returns both true if the app was started with 'meego' or was started with
+ 'runtime' graphics system and the currently active system through the runtime
+ switching is 'meego'.
+ */
+ static bool isRunningMeeGo();
+
+ //! Returns true if running with a 'runtime' graphicssystem.
+ /*!
+ This function can be used in combination with ::runningGraphicsSystemName to figure out
+ the existing situation.
+ */
+ static bool isRunningRuntime();
+
+ //! Switches to meego graphics system.
+ /*!
+ When running with the 'runtime' graphics system, sets the currently active
+ system to 'meego'. The window surface and all the resources are automatically
+ migrated to OpenGL. Will fail if the active graphics system is not 'runtime'.
+ */
+ static void switchToMeeGo();
+
+ //! Switches to raster graphics system
+ /*!
+ When running with the 'runtime' graphics system, sets the currently active
+ system to 'raster'. The window surface and the graphics resources (including the
+ EGL shared image resources) are automatically migrated back to the CPU. All OpenGL
+ resources (surface, context, cache, font cache) are automaticall anihilated.
+ */
+ static void switchToRaster();
+
+ //! Returns the name of the active graphics system
+ /*!
+ Returns the name of the currently active system. If running with 'runtime' graphics
+ system, returns the name of the active system inside the runtime graphics system
+ */
+ static QString runningGraphicsSystemName();
+
+ //! Creates a new EGL shared image.
+ /*!
+ Creates a new EGL shared image from the given image. The EGL shared image wraps
+ a GL texture in the native format and can be easily accessed from other processes.
+ */
+ static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
+
+ //! Creates a QPixmap from an EGL shared image
+ /*!
+ Creates a new QPixmap from the given EGL shared image handle. The QPixmap can be
+ used for painting like any other pixmap. The softImage should point to an alternative,
+ software version of the graphical resource -- ie. obtained from theme daemon. The
+ softImage can be allocated on a QSharedMemory slice for easy sharing across processes
+ too. When the application is migrated ToRaster, this softImage will replace the
+ contents of the sharedImage.
+
+ It's ok to call this function too when not running 'meego' graphics system. In this
+ case it'll create a QPixmap backed with a raster data (from softImage)... but when
+ the system is switched back to 'meego', the QPixmap will be migrated to a EGL-shared image
+ backed storage (handle).
+ */
+ static QPixmap pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+
+ //! Destroys an EGL shared image.
+ /*!
+ Destroys an EGLSharedImage previously created with an ::imageToEGLSharedImage call.
+ Returns true if the image was found and the destruction was successful. Notice that
+ this destroys the image for all processes using it.
+ */
+ static bool destroyEGLSharedImage(Qt::HANDLE handle);
+
+ //! Updates the QPixmap backed with an EGLShared image.
+ /*!
+ This function re-reads the softImage that was specified when creating the pixmap with
+ ::pixmapFromEGLSharedImage and updates the EGL Shared image contents. It can be used
+ to share cross-proccess mutable EGLShared images.
+ */
+ static void updateEGLSharedImagePixmap(QPixmap *p);
+
+ //! Create a new QPixmap with a GL texture.
+ /*!
+ Creates a new QPixmap which is backed by an OpenGL local texture. Drawing to this
+ QPixmap will be accelerated by hardware -- unlike the normal (new QPixmap()) pixmaps,
+ which are backed by a software engine and only migrated to GPU when used. Migrating those
+ GL-backed pixmaps when going ToRaster is expsensive (they need to be downloaded from
+ GPU to CPU) so use wisely.
+ */
+ static QPixmap pixmapWithGLTexture(int w, int h);
+
+ //! Sets translucency (alpha) on the base window surface.
+ /*!
+ This function needs to be called *before* any widget/content is created.
+ When called with true, the base window surface will be translucent and initialized
+ with QGLFormat.alpha == true.
+ */
+ static void setTranslucent(bool translucent);
+};
+
+#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
new file mode 100644
index 0000000..161a31b
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
@@ -0,0 +1,10 @@
+TEMPLATE = lib
+TARGET = QtMeeGoGraphicsSystemHelper
+
+include(../../src/qbase.pri)
+
+QT += gui
+INCLUDEPATH += '../../src/plugins/graphicssystems/meego'
+
+HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h
+SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegofencesync.cpp
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
new file mode 100644
index 0000000..9700581f
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegolivepixmap.h"
+#include "qmeegolivepixmap_p.h"
+#include "qmeegofencesync_p.h"
+#include "qmeegoruntime.h"
+
+/* QMeeGoLivePixmapPrivate */
+
+QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate()
+{
+}
+
+QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
+{
+}
+
+/* QMeeGoLivePixmap */
+
+QMeeGoLivePixmap* QMeeGoLivePixmap::livePixmapWithSize(int w, int h, Format format)
+{
+ QImage::Format qtFormat;
+ if (format == Format_RGB16)
+ qtFormat = QImage::Format_RGB16;
+ else if (format == Format_ARGB32_Premultiplied)
+ qtFormat = QImage::Format_ARGB32_Premultiplied;
+ else {
+ qWarning("Unsupported live pixmap format!");
+ return 0;
+ }
+
+ QPixmapData *pmd = QMeeGoRuntime::pixmapDataWithNewLiveTexture(w, h, qtFormat);
+ if (! pmd) {
+ qWarning("Failed to create a live texture with given size!");
+ return NULL;
+ }
+
+ return new QMeeGoLivePixmap(pmd);
+}
+
+QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate())
+{
+ Q_D(QMeeGoLivePixmap);
+ d->q_ptr = this;
+}
+
+QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE liveTextureHandle)
+{
+ QPixmapData *pmd = QMeeGoRuntime::pixmapDataFromLiveTextureHandle(liveTextureHandle);
+ if (! pmd) {
+ qWarning("Failed to create a live texture from given handle!");
+ return NULL;
+ }
+
+ return new QMeeGoLivePixmap(pmd);
+}
+
+Qt::HANDLE QMeeGoLivePixmap::handle()
+{
+ return QMeeGoRuntime::getLiveTextureHandle(this);
+}
+
+QMeeGoLivePixmap::~QMeeGoLivePixmap()
+{
+}
+
+QImage* QMeeGoLivePixmap::lock(QMeeGoFenceSync *fenceSync)
+{
+ if (fenceSync)
+ return QMeeGoRuntime::lockLiveTexture(this, fenceSync->d_func()->syncObject);
+ else
+ return QMeeGoRuntime::lockLiveTexture(this, NULL);
+}
+
+void QMeeGoLivePixmap::release(QImage *img)
+{
+ QMeeGoRuntime::releaseLiveTexture(this, img);
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
new file mode 100644
index 0000000..51b5976
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOLIVEPIXMAP_H
+#define QMEEGOLIVEPIXMAP_H
+
+#include <QPixmap>
+#include "qmeegofencesync.h"
+
+class QMeeGoLivePixmapPrivate;
+class QSharedMemory;
+class QImage;
+
+//! A pixmap representing streamed content.
+/*!
+*/
+
+class Q_DECL_EXPORT QMeeGoLivePixmap : public QPixmap
+{
+public:
+ enum Format {
+ Format_RGB16, //! 16bit, 5-6-5 RGB format.
+ Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format.
+ };
+
+ //! Creates and returns a new live pixmap with the given parameters.
+ /*!
+ The new pixmap is created with the given width w and the given height h.
+ The format specifies the color format used by the pixmap.
+ */
+ static QMeeGoLivePixmap* livePixmapWithSize(int w, int h, Format format);
+
+ //! Creates a new QMeeGoLivePixmap from the specified handle.
+ /*!
+ The handle can be used to share QMeeGoLivePixmap cross-process.
+ */
+ static QMeeGoLivePixmap* fromHandle(Qt::HANDLE handle);
+
+ //! Returns the handle for this QMeeGoLivePixmap.
+ /*!
+ The handle can be used to share QMeeGoLivePixmap cross-process.
+ */
+ Qt::HANDLE handle();
+
+ //! Locks the access to the pixmap.
+ /*!
+ The returned image can be used for direct access.
+ You can optionally specify a fence sync to wait upon before unlocking. When
+ you specify a fence sync, you can be sure that this function will return only
+ when the previsouly set QMeeGoFenceSync synchronization point has been executed/passed
+ by the GL processing pipeline.
+ */
+ QImage* lock(QMeeGoFenceSync *fenceSync = NULL);
+
+ //! Unlocks the access to the pixmap.
+ /*!
+ */
+ void release(QImage *img);
+
+ //! Destroys the QMeeGoLivePixmap.
+ /*!
+ */
+ virtual ~QMeeGoLivePixmap();
+
+private:
+ QMeeGoLivePixmap(QPixmapData *p);
+ Q_DISABLE_COPY(QMeeGoLivePixmap)
+ Q_DECLARE_PRIVATE(QMeeGoLivePixmap)
+
+protected:
+ QScopedPointer<QMeeGoLivePixmapPrivate> d_ptr; //! Private bits.
+};
+
+#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
new file mode 100644
index 0000000..78d9553
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegolivepixmap.h"
+
+#ifndef QMEEGOLIVEPIXMAP_P_H
+#define QMEEGOLIVEPIXMAP_P_H
+
+class QMeeGoLivePixmapPrivate
+{
+public:
+ Q_DECLARE_PUBLIC(QMeeGoLivePixmap);
+ QMeeGoLivePixmapPrivate();
+ virtual ~QMeeGoLivePixmapPrivate();
+
+ QMeeGoLivePixmap *q_ptr;
+};
+
+#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp
new file mode 100644
index 0000000..b42a7ea
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QEvent>
+#include <QMouseEvent>
+#include <QApplication>
+#include <QDesktopWidget>
+#include "qmeegooverlaywidget.h"
+#include "qmeegographicssystemhelper.h"
+#include "qmeegoruntime.h"
+
+QMeeGoOverlayWidget::QMeeGoOverlayWidget(int surfaceWidth, int surfaceHeight, QWidget *parent) : QWidget(parent, 0),
+ sw(surfaceWidth),
+ sh(surfaceHeight)
+{
+ if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo())
+ qFatal("QMeeGoOverlayWidget can only be used when running with 'meego' graphics system!");
+
+ const QRect desktop = QApplication::desktop()->screenGeometry(parent);
+
+ QMeeGoRuntime::setSurfaceFixedSize(surfaceWidth, surfaceHeight);
+
+ scaleW = sw / desktop.width();
+ scaleH = sh / desktop.height();
+ installEventFilter(this);
+}
+
+QPoint QMeeGoOverlayWidget::convertPoint(const QPoint &p)
+{
+ int x = p.x() * scaleW;
+ int y = p.y() * scaleH;
+ return QPoint(x, y);
+}
+
+void QMeeGoOverlayWidget::showEvent(QShowEvent *)
+{
+ QMeeGoRuntime::setSurfaceScaling(0, 0, width(), height());
+}
+
+bool QMeeGoOverlayWidget::eventFilter(QObject *, QEvent *event)
+{
+ if (event->spontaneous() == false)
+ return false;
+
+ switch(event->type()) {
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ {
+ QMouseEvent *e = static_cast <QMouseEvent *>(event);
+ QMouseEvent newEvent = QMouseEvent(e->type(),
+ convertPoint(e->pos()),
+ convertPoint(e->globalPos()),
+ e->button(),
+ e->buttons(),
+ e->modifiers());
+ QCoreApplication::sendEvent(this, &newEvent);
+ return true;
+ }
+
+ default:
+ return false;
+ }
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h
new file mode 100644
index 0000000..e67f59b
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOOVERLAYWIDGET_H
+#define QMEEGOOVERLAYWIDGET_H
+
+#include <QWidget>
+
+//! A widget automatically scaling it's content.
+/*!
+*/
+
+class Q_DECL_EXPORT QMeeGoOverlayWidget : public QWidget
+{
+public:
+ //! Constructs a new scaling widget.
+ /*!
+ The real surface used for this widget will have the specified
+ width and height.
+ */
+ QMeeGoOverlayWidget(int surfaceWidth, int surfaceHeight, QWidget *parent = 0);
+
+
+ //! Event filtering function.
+ /*!
+ Converts coordinates for mouse/touch event. Do not
+ call manually.
+ */
+ bool eventFilter(QObject *obj, QEvent *event);
+
+ //! Standard override.
+ /*!
+ The surface scaling on the target paint device is being
+ set when the widget is displayed for the first time.
+ */
+ virtual void showEvent(QShowEvent *event);
+
+private:
+ //! Converts coordinates between real & virtual area of the widget.
+ QPoint convertPoint(const QPoint &p);
+
+ int sw; /// Surface real width.
+ int sh; /// Surface real height.
+ float scaleW; /// Width scaling factor.
+ float scaleH; /// Height scaling factor.
+};
+
+#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
new file mode 100644
index 0000000..2d3ee3c
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegoruntime.h"
+
+#include <private/qlibrary_p.h>
+#include <private/qfactoryloader_p.h>
+#include <private/qgraphicssystemplugin_p.h>
+#include <stdio.h>
+
+#define ENSURE_INITIALIZED {if (!initialized) initialize();}
+
+bool QMeeGoRuntime::initialized = false;
+
+typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&);
+typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&);
+typedef QPixmapData* (*QMeeGoPixmapDataWithGLTextureFunc) (int w, int h);
+typedef bool (*QMeeGoDestroyEGLSharedImageFunc) (Qt::HANDLE handle);
+typedef void (*QMeeGoUpdateEglSharedImagePixmapFunc) (QPixmap*);
+typedef void (*QMeeGoSetSurfaceFixedSizeFunc) (int w, int h);
+typedef void (*QMeeGoSetSurfaceScalingFunc) (int x, int y, int w, int h);
+typedef void (*QMeeGoSetTranslucentFunc) (bool translucent);
+typedef QPixmapData* (*QMeeGoPixmapDataWithNewLiveTextureFunc) (int w, int h, QImage::Format format);
+typedef QPixmapData* (*QMeeGoPixmapDataFromLiveTextureHandleFunc) (Qt::HANDLE h);
+typedef QImage* (*QMeeGoLiveTextureLockFunc) (QPixmap*, void* fenceSync);
+typedef bool (*QMeeGoLiveTextureReleaseFunc) (QPixmap*, QImage *i);
+typedef Qt::HANDLE (*QMeeGoLiveTextureGetHandleFunc) (QPixmap*);
+typedef void* (*QMeeGoCreateFenceSyncFunc) (void);
+typedef void (*QMeeGoDestroyFenceSyncFunc) (void *fs);
+
+static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL;
+static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL;
+static QMeeGoPixmapDataWithGLTextureFunc qt_meego_pixmapdata_with_gl_texture = NULL;
+static QMeeGoDestroyEGLSharedImageFunc qt_meego_destroy_egl_shared_image = NULL;
+static QMeeGoUpdateEglSharedImagePixmapFunc qt_meego_update_egl_shared_image_pixmap = NULL;
+static QMeeGoSetSurfaceFixedSizeFunc qt_meego_set_surface_fixed_size = NULL;
+static QMeeGoSetSurfaceScalingFunc qt_meego_set_surface_scaling = NULL;
+static QMeeGoSetTranslucentFunc qt_meego_set_translucent = NULL;
+static QMeeGoPixmapDataWithNewLiveTextureFunc qt_meego_pixmapdata_with_new_live_texture = NULL;
+static QMeeGoPixmapDataFromLiveTextureHandleFunc qt_meego_pixmapdata_from_live_texture_handle = NULL;
+static QMeeGoLiveTextureLockFunc qt_meego_live_texture_lock = NULL;
+static QMeeGoLiveTextureReleaseFunc qt_meego_live_texture_release = NULL;
+static QMeeGoLiveTextureGetHandleFunc qt_meego_live_texture_get_handle = NULL;
+static QMeeGoCreateFenceSyncFunc qt_meego_create_fence_sync = NULL;
+static QMeeGoDestroyFenceSyncFunc qt_meego_destroy_fence_sync = NULL;
+
+void QMeeGoRuntime::initialize()
+{
+ QFactoryLoader loader(QGraphicsSystemFactoryInterface_iid, QLatin1String("/graphicssystems"), Qt::CaseInsensitive);
+
+ QLibraryPrivate *libraryPrivate = loader.library(QLatin1String("meego"));
+ Q_ASSERT(libraryPrivate);
+
+ QLibrary library(libraryPrivate->fileName, libraryPrivate->fullVersion);
+
+ bool success = library.load();
+
+ if (success) {
+ qt_meego_image_to_egl_shared_image = (QMeeGoImageToEglSharedImageFunc) library.resolve("qt_meego_image_to_egl_shared_image");
+ qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image");
+ qt_meego_pixmapdata_with_gl_texture = (QMeeGoPixmapDataWithGLTextureFunc) library.resolve("qt_meego_pixmapdata_with_gl_texture");
+ qt_meego_destroy_egl_shared_image = (QMeeGoDestroyEGLSharedImageFunc) library.resolve("qt_meego_destroy_egl_shared_image");
+ qt_meego_update_egl_shared_image_pixmap = (QMeeGoUpdateEglSharedImagePixmapFunc) library.resolve("qt_meego_update_egl_shared_image_pixmap");
+ qt_meego_set_surface_fixed_size = (QMeeGoSetSurfaceFixedSizeFunc) library.resolve("qt_meego_set_surface_fixed_size");
+ qt_meego_set_surface_scaling = (QMeeGoSetSurfaceScalingFunc) library.resolve("qt_meego_set_surface_scaling");
+ qt_meego_set_translucent = (QMeeGoSetTranslucentFunc) library.resolve("qt_meego_set_translucent");
+ qt_meego_pixmapdata_with_new_live_texture = (QMeeGoPixmapDataWithNewLiveTextureFunc) library.resolve("qt_meego_pixmapdata_with_new_live_texture");
+ qt_meego_pixmapdata_from_live_texture_handle = (QMeeGoPixmapDataFromLiveTextureHandleFunc) library.resolve("qt_meego_pixmapdata_from_live_texture_handle");
+ qt_meego_live_texture_lock = (QMeeGoLiveTextureLockFunc) library.resolve("qt_meego_live_texture_lock");
+ qt_meego_live_texture_release = (QMeeGoLiveTextureReleaseFunc) library.resolve("qt_meego_live_texture_release");
+ qt_meego_live_texture_get_handle = (QMeeGoLiveTextureGetHandleFunc) library.resolve("qt_meego_live_texture_get_handle");
+ qt_meego_create_fence_sync = (QMeeGoCreateFenceSyncFunc) library.resolve("qt_meego_create_fence_sync");
+ qt_meego_destroy_fence_sync = (QMeeGoDestroyFenceSyncFunc) library.resolve("qt_meego_destroy_fence_sync");
+
+ if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image &&
+ qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap &&
+ qt_meego_set_surface_fixed_size && qt_meego_set_surface_scaling && qt_meego_set_translucent &&
+ qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle &&
+ qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle &&
+ qt_meego_create_fence_sync && qt_meego_destroy_fence_sync)
+ {
+ qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion));
+ } else {
+ Q_ASSERT(false);
+ }
+ } else {
+ Q_ASSERT(false);
+ }
+
+ initialized = true;
+}
+
+Qt::HANDLE QMeeGoRuntime::imageToEGLSharedImage(const QImage &image)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_image_to_egl_shared_image);
+ return qt_meego_image_to_egl_shared_image(image);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_pixmapdata_from_egl_shared_image);
+ return qt_meego_pixmapdata_from_egl_shared_image(handle, softImage);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataWithGLTexture(int w, int h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_pixmapdata_with_gl_texture);
+ return qt_meego_pixmapdata_with_gl_texture(w, h);
+}
+
+bool QMeeGoRuntime::destroyEGLSharedImage(Qt::HANDLE handle)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_destroy_egl_shared_image);
+ return qt_meego_destroy_egl_shared_image(handle);
+}
+
+void QMeeGoRuntime::updateEGLSharedImagePixmap(QPixmap *p)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_update_egl_shared_image_pixmap);
+ return qt_meego_update_egl_shared_image_pixmap(p);
+}
+
+void QMeeGoRuntime::setSurfaceFixedSize(int w, int h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_set_surface_fixed_size);
+ qt_meego_set_surface_fixed_size(w, h);
+}
+
+void QMeeGoRuntime::setSurfaceScaling(int x, int y, int w, int h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_set_surface_scaling);
+ qt_meego_set_surface_scaling(x, y, w, h);
+}
+
+void QMeeGoRuntime::setTranslucent(bool translucent)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_set_translucent);
+ qt_meego_set_translucent(translucent);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_pixmapdata_with_new_live_texture);
+ return qt_meego_pixmapdata_with_new_live_texture(w, h, format);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataFromLiveTextureHandle(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_pixmapdata_from_live_texture_handle);
+ return qt_meego_pixmapdata_from_live_texture_handle(h);
+}
+
+QImage* QMeeGoRuntime::lockLiveTexture(QPixmap *p, void* fenceSync)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_lock);
+ return qt_meego_live_texture_lock(p, fenceSync);
+}
+
+bool QMeeGoRuntime::releaseLiveTexture(QPixmap *p, QImage *i)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_release);
+ return qt_meego_live_texture_release(p, i);
+}
+
+Qt::HANDLE QMeeGoRuntime::getLiveTextureHandle(QPixmap *pixmap)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_get_handle);
+ return qt_meego_live_texture_get_handle(pixmap);
+}
+
+void* QMeeGoRuntime::createFenceSync()
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_create_fence_sync);
+ return qt_meego_create_fence_sync();
+}
+
+void QMeeGoRuntime::destroyFenceSync(void *fs)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_destroy_fence_sync);
+ qt_meego_destroy_fence_sync(fs);
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h
new file mode 100644
index 0000000..be6ff6b
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QPixmap>
+#include <QImage>
+
+class QMeeGoRuntime
+{
+public:
+ static void initialize();
+
+ static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
+ static QPixmapData* pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+ static QPixmapData* pixmapDataWithGLTexture(int w, int h);
+ static bool destroyEGLSharedImage(Qt::HANDLE handle);
+ static void updateEGLSharedImagePixmap(QPixmap *p);
+ static void setSurfaceFixedSize(int w, int h);
+ static void setSurfaceScaling(int x, int y, int w, int h);
+ static void setTranslucent(bool translucent);
+ static QPixmapData* pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format);
+ static QPixmapData* pixmapDataFromLiveTextureHandle(Qt::HANDLE h);
+ static QImage* lockLiveTexture(QPixmap *pixmap, void *fenceSync);
+ static bool releaseLiveTexture(QPixmap *pixmap, QImage *image);
+ static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap);
+ static void* createFenceSync();
+ static void destroyFenceSync(void *fs);
+
+private:
+ static bool initialized;
+};