diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-04-24 16:40:22 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-09 13:24:55 +0200 |
commit | 0b5c0ad2ef49a262de5bdb18a3cdab30ae6772a2 (patch) | |
tree | 19f2d2fc25c22ea628bb7be0874488f69b33593f /src/plugins/platforms/eglfs/qeglfsintegration.cpp | |
parent | 3b6d8ba49b39b75dda33fb3c3a784330791efed2 (diff) |
Support adopting an existing EGLContext in eglfs and xcb
Add also a manual test application. For GLX there is an autotest since
that is likely to be run on one of the CIs. For EGL and especially
eglfs this is likely not the case so a manual test is better.
Task-number: QTBUG-37552
Change-Id: Ib09db5d909befb68d16f69abd401a56abe55f28a
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfsintegration.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsintegration.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 2941806f17..d770ea763a 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -50,6 +50,7 @@ #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglplatformcontext_p.h> #include <QtPlatformSupport/private/qeglpbuffer_p.h> +#include <QtPlatformHeaders/QEGLNativeContext> #include <qpa/qplatformwindow.h> #include <QtGui/QSurfaceFormat> @@ -115,9 +116,20 @@ QEGLPlatformWindow *QEglFSIntegration::createWindow(QWindow *window) const QEGLPlatformContext *QEglFSIntegration::createContext(const QSurfaceFormat &format, QPlatformOpenGLContext *shareContext, - EGLDisplay display) const + EGLDisplay display, + QVariant *nativeHandle) const { - return new QEglFSContext(QEglFSHooks::hooks()->surfaceFormatFor(format), shareContext, display); + QEglFSContext *ctx; + if (!nativeHandle || nativeHandle->isNull()) { + EGLConfig config = QEglFSIntegration::chooseConfig(display, format); + ctx = new QEglFSContext(QEglFSHooks::hooks()->surfaceFormatFor(format), shareContext, display, + &config, QVariant()); + } else { + ctx = new QEglFSContext(QEglFSHooks::hooks()->surfaceFormatFor(format), shareContext, display, + 0, *nativeHandle); + } + *nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), display)); + return ctx; } QPlatformOffscreenSurface *QEglFSIntegration::createOffscreenSurface(EGLDisplay display, |