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>
This commit is contained in:
parent
e3ed95dd44
commit
1b905b3fa4
@ -66,7 +66,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QPlatformBackingStore;
|
||||
class QPlatformOpenGLContext;
|
||||
class QPlatformScreenPrivate;
|
||||
class QPlatformWindow;
|
||||
class QPlatformCursor;
|
||||
|
@ -1,21 +1,26 @@
|
||||
|
||||
SOURCES += $$PWD/qeglfswindow.cpp \
|
||||
$$PWD/qeglfsscreen.cpp \
|
||||
$$PWD/qeglfscursor.cpp \
|
||||
$$PWD/qeglfshooks.cpp \
|
||||
$$PWD/qeglfsdeviceintegration.cpp \
|
||||
$$PWD/qeglfsintegration.cpp \
|
||||
$$PWD/qeglfscontext.cpp \
|
||||
$$PWD/qeglfsoffscreenwindow.cpp
|
||||
|
||||
HEADERS += $$PWD/qeglfswindow_p.h \
|
||||
$$PWD/qeglfsscreen_p.h \
|
||||
$$PWD/qeglfscursor_p.h \
|
||||
$$PWD/qeglfshooks_p.h \
|
||||
$$PWD/qeglfsdeviceintegration_p.h \
|
||||
$$PWD/qeglfsintegration_p.h \
|
||||
$$PWD/qeglfscontext_p.h \
|
||||
$$PWD/qeglfsoffscreenwindow_p.h \
|
||||
$$PWD/qeglfsglobal_p.h
|
||||
|
||||
qtConfig(opengl) {
|
||||
SOURCES += \
|
||||
$$PWD/qeglfscursor.cpp \
|
||||
$$PWD/qeglfscontext.cpp
|
||||
HEADERS += \
|
||||
$$PWD/qeglfscursor_p.h \
|
||||
$$PWD/qeglfscontext_p.h
|
||||
}
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
|
@ -39,7 +39,9 @@
|
||||
|
||||
#include "qeglfsdeviceintegration_p.h"
|
||||
#include "qeglfsintegration_p.h"
|
||||
#include "qeglfscursor_p.h"
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include "qeglfscursor_p.h"
|
||||
#endif
|
||||
#include "qeglfswindow_p.h"
|
||||
#include "qeglfsscreen_p.h"
|
||||
#include "qeglfshooks_p.h"
|
||||
@ -312,7 +314,12 @@ bool QEglFSDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap
|
||||
|
||||
QPlatformCursor *QEglFSDeviceIntegration::createCursor(QPlatformScreen *screen) const
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
return new QEglFSCursor(static_cast<QEglFSScreen *>(screen));
|
||||
#else
|
||||
Q_UNUSED(screen);
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
|
||||
|
@ -42,9 +42,11 @@
|
||||
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <QtGui/QSurfaceFormat>
|
||||
#include <QtGui/QOpenGLContext>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtGui/QOffscreenSurface>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <QtGui/QOpenGLContext>
|
||||
# include <QtGui/QOffscreenSurface>
|
||||
#endif
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
@ -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 <QtEglSupport/private/qeglconvenience_p.h>
|
||||
#include <QtEglSupport/private/qeglplatformcontext_p.h>
|
||||
#include <QtEglSupport/private/qeglpbuffer_p.h>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <QtEglSupport/private/qeglplatformcontext_p.h>
|
||||
# include <QtEglSupport/private/qeglpbuffer_p.h>
|
||||
#endif
|
||||
|
||||
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
|
||||
#include <QtServiceSupport/private/qgenericunixservices_p.h>
|
||||
#include <QtThemeSupport/private/qgenericunixthemes_p.h>
|
||||
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
|
||||
#include <QtFbSupport/private/qfbvthandler_p.h>
|
||||
#include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h>
|
||||
#endif
|
||||
|
||||
#include <QtPlatformHeaders/QEGLNativeContext>
|
||||
|
||||
@ -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<QEglFSWindow *>(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<QEglFSScreen *>(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;
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,10 @@ 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;
|
||||
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
|
||||
|
||||
#endif
|
||||
bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
|
||||
|
||||
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
|
||||
@ -93,7 +94,9 @@ public:
|
||||
void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
|
||||
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE;
|
||||
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_OPENGL
|
||||
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
|
||||
|
||||
QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE;
|
||||
|
@ -41,7 +41,9 @@
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <qpa/qplatformcursor.h>
|
||||
#include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h>
|
||||
#endif
|
||||
|
||||
#include "qeglfsscreen_p.h"
|
||||
#include "qeglfswindow_p.h"
|
||||
@ -60,7 +62,9 @@ QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
|
||||
QEglFSScreen::~QEglFSScreen()
|
||||
{
|
||||
delete m_cursor;
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor::destroy();
|
||||
#endif
|
||||
}
|
||||
|
||||
QRect QEglFSScreen::geometry() const
|
||||
@ -145,6 +149,7 @@ void QEglFSScreen::setPrimarySurface(EGLSurface surface)
|
||||
|
||||
void QEglFSScreen::handleCursorMove(const QPoint &pos)
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
const QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
const QList<QOpenGLCompositorWindow *> windows = compositor->windows();
|
||||
|
||||
@ -178,10 +183,12 @@ void QEglFSScreen::handleCursorMove(const QPoint &pos)
|
||||
|
||||
if (enter && leave)
|
||||
QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) const
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
const QList<QOpenGLCompositorWindow *> windows = compositor->windows();
|
||||
Q_ASSERT(!windows.isEmpty());
|
||||
@ -224,7 +231,7 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c
|
||||
return QPixmap::fromImage(img).copy(rect);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,17 @@
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <QtGui/private/qopenglcontext_p.h>
|
||||
#include <QtGui/QOpenGLContext>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <QtGui/private/qopenglcontext_p.h>
|
||||
# include <QtGui/QOpenGLContext>
|
||||
# include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h>
|
||||
#endif
|
||||
#include <QtEglSupport/private/qeglconvenience_p.h>
|
||||
#include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h>
|
||||
|
||||
#include "qeglfswindow_p.h"
|
||||
#include "qeglfscursor_p.h"
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include "qeglfscursor_p.h"
|
||||
#endif
|
||||
#include "qeglfshooks_p.h"
|
||||
#include "qeglfsdeviceintegration_p.h"
|
||||
|
||||
@ -55,7 +59,9 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QEglFSWindow::QEglFSWindow(QWindow *w)
|
||||
: QPlatformWindow(w),
|
||||
#ifndef QT_NO_OPENGL
|
||||
m_backingStore(0),
|
||||
#endif
|
||||
m_raster(false),
|
||||
m_winId(0),
|
||||
m_surface(EGL_NO_SURFACE),
|
||||
@ -107,6 +113,7 @@ void QEglFSWindow::create()
|
||||
// raster windows will not have their own native window, surface and context. Instead,
|
||||
// they will be composited onto the root window's surface.
|
||||
QEglFSScreen *screen = this->screen();
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
if (screen->primarySurface() != EGL_NO_SURFACE) {
|
||||
if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow())) {
|
||||
@ -120,6 +127,7 @@ void QEglFSWindow::create()
|
||||
m_format = compositor->targetWindow()->format();
|
||||
return;
|
||||
}
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
m_flags |= HasNativeWindow;
|
||||
setGeometry(QRect()); // will become fullscreen
|
||||
@ -135,6 +143,7 @@ void QEglFSWindow::create()
|
||||
|
||||
screen->setPrimarySurface(m_surface);
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
if (isRaster()) {
|
||||
QOpenGLContext *context = new QOpenGLContext(QGuiApplication::instance());
|
||||
context->setShareContext(qt_gl_global_share_context());
|
||||
@ -153,16 +162,18 @@ void QEglFSWindow::create()
|
||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_OPENGL
|
||||
}
|
||||
|
||||
void QEglFSWindow::destroy()
|
||||
{
|
||||
QEglFSScreen *screen = this->screen();
|
||||
if (m_flags.testFlag(HasNativeWindow)) {
|
||||
#ifndef QT_NO_OPENGL
|
||||
QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(screen->cursor());
|
||||
if (cursor)
|
||||
cursor->resetResources();
|
||||
|
||||
#endif
|
||||
if (screen->primarySurface() == m_surface)
|
||||
screen->setPrimarySurface(EGL_NO_SURFACE);
|
||||
|
||||
@ -170,7 +181,9 @@ void QEglFSWindow::destroy()
|
||||
}
|
||||
|
||||
m_flags = 0;
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor::instance()->removeWindow(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QEglFSWindow::invalidateSurface()
|
||||
@ -197,6 +210,7 @@ void QEglFSWindow::resetSurface()
|
||||
|
||||
void QEglFSWindow::setVisible(bool visible)
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
QList<QOpenGLCompositorWindow *> windows = compositor->windows();
|
||||
QWindow *wnd = window();
|
||||
@ -211,7 +225,9 @@ void QEglFSWindow::setVisible(bool visible)
|
||||
windows.last()->sourceWindow()->requestActivate();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
QWindow *wnd = window();
|
||||
#endif
|
||||
QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size()));
|
||||
|
||||
if (visible)
|
||||
@ -247,9 +263,10 @@ QRect QEglFSWindow::geometry() const
|
||||
|
||||
void QEglFSWindow::requestActivateWindow()
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
if (window()->type() != Qt::Desktop)
|
||||
QOpenGLCompositor::instance()->moveToTop(this);
|
||||
|
||||
#endif
|
||||
QWindow *wnd = window();
|
||||
QWindowSystemInterface::handleWindowActivated(wnd);
|
||||
QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size()));
|
||||
@ -259,13 +276,16 @@ void QEglFSWindow::raise()
|
||||
{
|
||||
QWindow *wnd = window();
|
||||
if (wnd->type() != Qt::Desktop) {
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor::instance()->moveToTop(this);
|
||||
#endif
|
||||
QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size()));
|
||||
}
|
||||
}
|
||||
|
||||
void QEglFSWindow::lower()
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
QList<QOpenGLCompositorWindow *> windows = compositor->windows();
|
||||
if (window()->type() != Qt::Desktop && windows.count() > 1) {
|
||||
@ -276,6 +296,7 @@ void QEglFSWindow::lower()
|
||||
QRect(QPoint(0, 0), windows.last()->sourceWindow()->geometry().size()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
EGLSurface QEglFSWindow::surface() const
|
||||
@ -303,6 +324,7 @@ bool QEglFSWindow::isRaster() const
|
||||
return m_raster || window()->surfaceType() == QSurface::RasterGLSurface;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QWindow *QEglFSWindow::sourceWindow() const
|
||||
{
|
||||
return window();
|
||||
@ -321,6 +343,7 @@ void QEglFSWindow::endCompositing()
|
||||
if (m_backingStore)
|
||||
m_backingStore->notifyComposited();
|
||||
}
|
||||
#endif
|
||||
|
||||
WId QEglFSWindow::winId() const
|
||||
{
|
||||
|
@ -56,14 +56,19 @@
|
||||
#include "qeglfsscreen_p.h"
|
||||
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenGLCompositorBackingStore;
|
||||
class QPlatformTextureList;
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow, public QOpenGLCompositorWindow
|
||||
#else
|
||||
class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
QEglFSWindow(QWindow *w);
|
||||
@ -97,16 +102,21 @@ public:
|
||||
virtual void invalidateSurface() Q_DECL_OVERRIDE;
|
||||
virtual void resetSurface();
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; }
|
||||
void setBackingStore(QOpenGLCompositorBackingStore *backingStore) { m_backingStore = backingStore; }
|
||||
#endif
|
||||
bool isRaster() const;
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QWindow *sourceWindow() const Q_DECL_OVERRIDE;
|
||||
const QPlatformTextureList *textures() const Q_DECL_OVERRIDE;
|
||||
void endCompositing() Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositorBackingStore *m_backingStore;
|
||||
#endif
|
||||
bool m_raster;
|
||||
WId m_winId;
|
||||
|
||||
|
@ -2,6 +2,8 @@ TARGET = qeglfs
|
||||
|
||||
QT += eglfsdeviceintegration-private
|
||||
|
||||
CONFIG += egl
|
||||
|
||||
SOURCES += $$PWD/qeglfsmain.cpp
|
||||
|
||||
OTHER_FILES += $$PWD/eglfs.json
|
||||
|
@ -12,11 +12,14 @@ QT += \
|
||||
core-private gui-private \
|
||||
devicediscovery_support-private eventdispatcher_support-private \
|
||||
service_support-private theme_support-private fontdatabase_support-private \
|
||||
fb_support-private egl_support-private platformcompositor_support-private
|
||||
fb_support-private egl_support-private
|
||||
|
||||
qtHaveModule(input_support-private): \
|
||||
QT += input_support-private
|
||||
|
||||
qtHaveModule(platformcompositor_support-private): \
|
||||
QT += platformcompositor_support-private
|
||||
|
||||
LIBS += $$QMAKE_LIBS_DYNLOAD
|
||||
|
||||
# Avoid X11 header collision, use generic EGL native types
|
||||
|
@ -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 += \
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user