From 1b905b3fa4955e26b39aaa51b0ca47e9c05e680b Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 8 Nov 2016 16:02:01 +0100 Subject: Enable building EGLFS and MinimalEGL with QT_NO_OPENGL It is possible to have support for EGL without having support for OpenGL for example with OpenVG. Unfortanately many features of EGLFS require OpenGL (Cursor, MultiWindow, QEGLPlatformContext, QBackingStore), so the plugins become pretty useless on their own. This is necessary if you still want to use Qt as a method to provide an EGL surface to render to via QWindow. This is the method by which Qt Quick uses OpenVG to render its content when available. Change-Id: I34973b21bf1932865950ce6a78b71b3a29360d65 Reviewed-by: Laszlo Agocs --- .../platforms/eglfs/api/qeglfsintegration.cpp | 43 +++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'src/plugins/platforms/eglfs/api/qeglfsintegration.cpp') diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 733f0bd139..7f1da614eb 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -42,9 +42,11 @@ #include #include -#include #include -#include +#ifndef QT_NO_OPENGL +# include +# include +#endif #include #include #include @@ -53,20 +55,26 @@ #include "qeglfsintegration_p.h" #include "qeglfswindow_p.h" #include "qeglfshooks_p.h" -#include "qeglfscontext_p.h" +#ifndef QT_NO_OPENGL +# include "qeglfscontext_p.h" +# include "qeglfscursor_p.h" +#endif #include "qeglfsoffscreenwindow_p.h" -#include "qeglfscursor_p.h" #include -#include -#include +#ifndef QT_NO_OPENGL +# include +# include +#endif #include #include #include #include #include -#include +#ifndef QT_NO_OPENGL +# include +#endif #include @@ -179,11 +187,15 @@ QPlatformTheme *QEglFSIntegration::createPlatformTheme(const QString &name) cons QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const { +#ifndef QT_NO_OPENGL QOpenGLCompositorBackingStore *bs = new QOpenGLCompositorBackingStore(window); if (!window->handle()) window->create(); static_cast(window->handle())->setBackingStore(bs); return bs; +#else + return nullptr; +#endif } QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const @@ -196,6 +208,7 @@ QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const return w; } +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { EGLDisplay dpy = context->screen() ? static_cast(context->screen()->handle())->display() : display(); @@ -230,6 +243,7 @@ QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOf } // Never return null. Multiple QWindows are not supported by this plugin. } +#endif // QT_NO_OPENGL bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const { @@ -239,10 +253,16 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons switch (cap) { case ThreadedPixmaps: return true; +#ifndef QT_NO_OPENGL case OpenGL: return true; case ThreadedOpenGL: return true; - case WindowManagement: return false; case RasterGLSurface: return true; +#else + case OpenGL: return false; + case ThreadedOpenGL: return false; + case RasterGLSurface: return false; +#endif + case WindowManagement: return false; default: return QPlatformIntegration::hasCapability(cap); } } @@ -340,6 +360,7 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi return result; } +#ifndef QT_NO_OPENGL void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { void *result = 0; @@ -374,13 +395,17 @@ static void *eglContextForContext(QOpenGLContext *context) return handle->eglContext(); } +#endif QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::nativeResourceFunctionForContext(const QByteArray &resource) { +#ifndef QT_NO_OPENGL QByteArray lowerCaseResource = resource.toLower(); if (lowerCaseResource == "get_egl_context") return NativeResourceForContextFunction(eglContextForContext); - +#else + Q_UNUSED(resource); +#endif return 0; } -- cgit v1.2.3