summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/minimalegl
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2016-11-08 16:02:01 +0100
committerAndy Nichols <andy.nichols@qt.io>2016-11-17 14:59:47 +0000
commit1b905b3fa4955e26b39aaa51b0ca47e9c05e680b (patch)
treed17513037673b80299555034b9550a3c01b2eb8e /src/plugins/platforms/minimalegl
parente3ed95dd44b95b6e9361b562807e711d7ce5a58b (diff)
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 <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/minimalegl')
-rw-r--r--src/plugins/platforms/minimalegl/minimalegl.pro7
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.cpp12
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.h3
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglscreen.cpp14
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglscreen.h4
5 files changed, 29 insertions, 11 deletions
diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro
index 88466e7f36..b7dde9069f 100644
--- a/src/plugins/platforms/minimalegl/minimalegl.pro
+++ b/src/plugins/platforms/minimalegl/minimalegl.pro
@@ -14,14 +14,17 @@ DEFINES += QT_EGL_NO_X11
SOURCES = main.cpp \
qminimaleglintegration.cpp \
qminimaleglwindow.cpp \
- qminimaleglbackingstore.cpp \
qminimaleglscreen.cpp
HEADERS = qminimaleglintegration.h \
qminimaleglwindow.h \
- qminimaleglbackingstore.h \
qminimaleglscreen.h
+qtConfig(opengl) {
+ SOURCES += qminimaleglbackingstore.cpp
+ HEADERS += qminimaleglbackingstore.h
+}
+
CONFIG += egl
OTHER_FILES += \
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
index c564e1e431..81512b1561 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
@@ -40,8 +40,9 @@
#include "qminimaleglintegration.h"
#include "qminimaleglwindow.h"
-#include "qminimaleglbackingstore.h"
-
+#ifndef QT_NO_OPENGL
+# include "qminimaleglbackingstore.h"
+#endif
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
#if defined(Q_OS_UNIX)
@@ -127,13 +128,18 @@ QPlatformBackingStore *QMinimalEglIntegration::createPlatformBackingStore(QWindo
#ifdef QEGL_EXTRA_DEBUG
qWarning("QMinimalEglIntegration::createWindowSurface %p\n", window);
#endif
+#ifndef QT_NO_OPENGL
return new QMinimalEglBackingStore(window);
+#else
+ return nullptr;
+#endif
}
-
+#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *QMinimalEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
return static_cast<QMinimalEglScreen *>(context->screen()->handle())->platformContext();
}
+#endif
QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
{
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.h b/src/plugins/platforms/minimalegl/qminimaleglintegration.h
index 529e89f85a..d0ab75bd3c 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.h
@@ -55,8 +55,9 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
-
+#endif
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp
index d3d091fab7..0175d2dbdd 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp
@@ -41,7 +41,9 @@
#include "qminimaleglwindow.h"
#include <QtEglSupport/private/qeglconvenience_p.h>
-#include <QtEglSupport/private/qeglplatformcontext_p.h>
+#ifndef QT_NO_OPENGL
+# include <QtEglSupport/private/qeglplatformcontext_p.h>
+#endif
#ifdef Q_OPENKODE
#include <KD/kd.h>
@@ -52,6 +54,8 @@ QT_BEGIN_NAMESPACE
// #define QEGL_EXTRA_DEBUG
+#ifndef QT_NO_OPENGL
+
class QMinimalEglContext : public QEGLPlatformContext
{
public:
@@ -68,6 +72,8 @@ public:
}
};
+#endif
+
QMinimalEglScreen::QMinimalEglScreen(EGLNativeDisplayType display)
: m_depth(32)
, m_format(QImage::Format_Invalid)
@@ -161,9 +167,10 @@ void QMinimalEglScreen::createAndSetPlatformContext()
}
// qWarning("Created surface %dx%d\n", w, h);
+#ifndef QT_NO_OPENGL
QEGLPlatformContext *platformContext = new QMinimalEglContext(platformFormat, 0, m_dpy);
m_platformContext = platformContext;
-
+#endif
EGLint w,h; // screen size detection
eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w);
eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h);
@@ -191,6 +198,7 @@ QImage::Format QMinimalEglScreen::format() const
createAndSetPlatformContext();
return m_format;
}
+#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *QMinimalEglScreen::platformContext() const
{
if (!m_platformContext) {
@@ -199,5 +207,5 @@ QPlatformOpenGLContext *QMinimalEglScreen::platformContext() const
}
return m_platformContext;
}
-
+#endif
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.h b/src/plugins/platforms/minimalegl/qminimaleglscreen.h
index ba605835a8..24098b8127 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglscreen.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.h
@@ -59,9 +59,9 @@ public:
QRect geometry() const Q_DECL_OVERRIDE;
int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE;
-
+#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *platformContext() const;
-
+#endif
EGLSurface surface() const { return m_surface; }
private: