Implement nativeResourceFunctionForContext for kms
authorElvis Lee <kwangwoong.lee@lge.com>
Thu, 19 Jul 2012 06:54:23 +0000 (15:54 +0900)
committerQt by Nokia <qt-info@nokia.com>
Fri, 20 Jul 2012 07:13:00 +0000 (09:13 +0200)
Change-Id: I4e0486744f4c3eb711a9252c90b0d06c5bb3c670
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
src/plugins/platforms/kms/qkmsnativeinterface.cpp
src/plugins/platforms/kms/qkmsnativeinterface.h

index b24e9d7..a192d1e 100644 (file)
@@ -44,6 +44,8 @@
 #include "qkmsdevice.h"
 
 #include "qscreen.h"
+#include "qkmscontext.h"
+#include <QOpenGLContext>
 
 class QKmsResourceMap : public QMap<QByteArray, QKmsNativeInterface::ResourceType>
 {
@@ -76,6 +78,17 @@ void *QKmsNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr
     return result;
 }
 
+QPlatformNativeInterface::NativeResourceForContextFunction QKmsNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource)
+{
+    QByteArray lowerCaseResource = resource.toLower();
+    if (lowerCaseResource == "get_egl_context") {
+        return eglContextForContext;
+    }
+    return 0;
+}
+
+
+
 void *QKmsNativeInterface::eglDisplayForWindow(QWindow *window)
 {
     QKmsScreen *screen = qPlatformScreenForWindow(window);
@@ -97,3 +110,12 @@ QKmsScreen *QKmsNativeInterface::qPlatformScreenForWindow(QWindow *window)
     QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
     return static_cast<QKmsScreen *>(screen->handle());
 }
+
+void *QKmsNativeInterface::eglContextForContext(QOpenGLContext *context)
+{
+    Q_ASSERT(context);
+
+    QKmsContext *eglPlatformContext = static_cast<QKmsContext *>(context->handle());
+
+    return eglPlatformContext->eglContext();
+}
index 20949be..9141e4b 100644 (file)
@@ -56,8 +56,11 @@ public:
 
     void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
 
+    NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource);
+
     void *eglDisplayForWindow(QWindow *window);
     void *eglContextForWindow(QWindow *window);
+    static void *eglContextForContext(QOpenGLContext *context);
 
 private:
     static QKmsScreen *qPlatformScreenForWindow(QWindow *window);