summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-05-15 08:12:45 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-16 19:36:27 +0200
commit9487acb9d2dea07a89a82c1a723bd08c45133cdd (patch)
treeb12110c9b0297058476a3db9563f202d0b0fafa4
parentce2b46daea5815df1070463b6bc379e1b4573dae (diff)
Handle EglDisplay and EglContext in the native interface of eglfs.
Change-Id: I793176204f12eea9d915fb7fe489bd3450a283cd Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp31
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h8
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h1
3 files changed, 39 insertions, 1 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 257c3cd3dc..a62d3bdaed 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -47,6 +47,7 @@
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
+#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <qpa/qplatformwindow.h>
#include <QtGui/QSurfaceFormat>
@@ -130,4 +131,34 @@ QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) cons
return QPlatformIntegration::styleHint(hint);
}
+QPlatformNativeInterface *QEglFSIntegration::nativeInterface() const
+{
+ return const_cast<QEglFSIntegration *>(this);
+}
+
+void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource)
+{
+ QByteArray lowerCaseResource = resource.toLower();
+
+ if (lowerCaseResource == "egldisplay")
+ return static_cast<QEglFSScreen *>(mScreen)->display();
+
+ return 0;
+}
+
+void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
+{
+ QByteArray lowerCaseResource = resource.toLower();
+
+ QEGLPlatformContext *handle = static_cast<QEGLPlatformContext *>(context->handle());
+
+ if (!handle)
+ return 0;
+
+ if (lowerCaseResource == "eglcontext")
+ return handle->eglContext();
+
+ return 0;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index b7cb715a9c..04d77a5903 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -45,13 +45,14 @@
#include "qeglfsscreen.h"
#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformscreen.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QEglFSIntegration : public QPlatformIntegration
+class QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
{
public:
QEglFSIntegration();
@@ -62,6 +63,7 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+ QPlatformNativeInterface *nativeInterface() const;
QPlatformFontDatabase *fontDatabase() const;
@@ -69,6 +71,10 @@ public:
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
+ // QPlatformNativeInterface
+ void *nativeResourceForIntegration(const QByteArray &resource);
+ void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
+
private:
QPlatformFontDatabase *mFontDb;
QPlatformScreen *mScreen;
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
index ca1a3ef91b..ba5db653ad 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -68,6 +68,7 @@ public:
QPlatformOpenGLContext *platformContext() const;
EGLSurface surface() const { return m_surface; }
+ EGLDisplay display() const { return m_dpy; }
private:
void createAndSetPlatformContext() const;