diff options
author | Laszlo Agocs <[email protected]> | 2016-04-22 17:13:38 +0200 |
---|---|---|
committer | Laszlo Agocs <[email protected]> | 2016-05-03 14:38:14 +0000 |
commit | ecf127505effbbf4dbfd1e7cb9561de5dae51bf2 (patch) | |
tree | 35bc46e3511e7a7cf8a6efb1736631d629290874 | |
parent | e6b1e918e12df25a359fbb87ae26f584d46df823 (diff) |
egl: Reshuffle headers to help less fortunate systems with X11
EGL headers including X headers has traditionally been problematic due
to getting macros for Status, None, etc.
In most cases this is not an issue anymore because on embedded one will
almost always use a driver targeting the framebuffer or DRM/KMS and
therefore the EGL headers do not pull in X dependencies.
Furthermore, Mesa supports MESA_EGL_NO_X11_HEADERS which we set, avoiding
the problem altogether with Mesa regardless of targeting X11 or KMS.
However, other drivers do not have this option. On i.MX6 for instance,
targeting X11 is problematic due to not having EGL_API_FB defined, which
in turn means the EGL headers pulls in X headers in order to be able to
define the native display and window types as Display and Window.
Try to play nice with this use case by reshuffling the includes and
undefining the problematic names.
Task-number: QTBUG-52928
Change-Id: I059f26b340b6e442e7296055915d18f5a1ce7a7f
Reviewed-by: Louai Al-Khanji <[email protected]>
18 files changed, 83 insertions, 21 deletions
diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri index f1e0d58a6d2..7ad0209e997 100644 --- a/src/platformsupport/eglconvenience/eglconvenience.pri +++ b/src/platformsupport/eglconvenience/eglconvenience.pri @@ -1,7 +1,8 @@ contains(QT_CONFIG,egl) { HEADERS += \ $$PWD/qeglconvenience_p.h \ - $$PWD/qeglstreamconvenience_p.h + $$PWD/qeglstreamconvenience_p.h \ + $$PWD/qt_egl_p.h SOURCES += \ $$PWD/qeglconvenience.cpp \ diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h index ec6f668cbac..027930d2c24 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h @@ -48,7 +48,7 @@ #include <QtGui/QSurfaceFormat> #include <QtCore/QVector> #include <QtCore/QSizeF> -#include <EGL/egl.h> +#include <QtPlatformSupport/private/qt_egl_p.h> QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h index 81fdab89015..a932762a678 100644 --- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h +++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h @@ -45,9 +45,9 @@ // We mean it. // -#include <EGL/egl.h> #include <qpa/qplatformoffscreensurface.h> #include <QtPlatformSupport/private/qeglplatformcontext_p.h> +#include <QtPlatformSupport/private/qt_egl_p.h> QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 41601272a38..666c5fa0f36 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -49,7 +49,7 @@ #include <qpa/qplatformwindow.h> #include <qpa/qplatformopenglcontext.h> #include <QtCore/QVariant> -#include <EGL/egl.h> +#include <QtPlatformSupport/private/qt_egl_p.h> QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h index 648b1295799..ac81c2ff0e2 100644 --- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h @@ -46,8 +46,7 @@ // #include <qglobal.h> -#include <EGL/egl.h> -#include <EGL/eglext.h> +#include <QtPlatformSupport/private/qt_egl_p.h> // This provides runtime EGLDevice/Output/Stream support even when eglext.h in // the sysroot is not up-to-date. diff --git a/src/platformsupport/eglconvenience/qt_egl_p.h b/src/platformsupport/eglconvenience/qt_egl_p.h new file mode 100644 index 00000000000..d03ac025885 --- /dev/null +++ b/src/platformsupport/eglconvenience/qt_egl_p.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_EGL_P_H +#define QT_EGL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <EGL/egl.h> +#include <EGL/eglext.h> + +#undef Status +#undef None +#undef Bool +#undef CursorShape +#undef KeyPress +#undef KeyRelease +#undef FocusIn +#undef FocusOut +#undef FontChange +#undef Expose +#undef Unsorted + +QT_BEGIN_NAMESPACE + +QT_END_NAMESPACE + +#endif // QT_EGL_P_H diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index db35338423e..bb638091f78 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp @@ -31,6 +31,7 @@ ** ****************************************************************************/ +#include "qeglfsglobal.h" #include <QtGui/QSurface> #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglpbuffer_p.h> diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/qeglfscontext.h index 906d11b3d1b..8da4c731b8b 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.h +++ b/src/plugins/platforms/eglfs/qeglfscontext.h @@ -34,9 +34,9 @@ #ifndef QEGLFSCONTEXT_H #define QEGLFSCONTEXT_H +#include "qeglfsglobal.h" #include <QtPlatformSupport/private/qeglplatformcontext_p.h> #include <QtCore/QVariant> -#include "qeglfsglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h index 5ec98b37d13..303810eb6e1 100644 --- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h @@ -45,13 +45,12 @@ // We mean it. // +#include "qeglfsglobal.h" #include <qpa/qplatformintegration.h> #include <qpa/qplatformscreen.h> #include <QtCore/QString> #include <QtGui/QSurfaceFormat> #include <QtGui/QImage> -#include <EGL/egl.h> -#include "qeglfsglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsglobal.h b/src/plugins/platforms/eglfs/qeglfsglobal.h index 9109f6be383..bd6e2082666 100644 --- a/src/plugins/platforms/eglfs/qeglfsglobal.h +++ b/src/plugins/platforms/eglfs/qeglfsglobal.h @@ -35,6 +35,7 @@ #define QEGLFSGLOBAL_H #include <qglobal.h> +#include <QtPlatformSupport/private/qt_egl_p.h> #ifdef QT_BUILD_EGL_DEVICE_LIB #define Q_EGLFS_EXPORT Q_DECL_EXPORT diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h index 3e4143918e0..5f19d492f8d 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks.h +++ b/src/plugins/platforms/eglfs/qeglfshooks.h @@ -34,8 +34,8 @@ #ifndef QEGLFSHOOKS_H #define QEGLFSHOOKS_H -#include "qeglfsdeviceintegration.h" #include "qeglfsglobal.h" +#include "qeglfsdeviceintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 35b27cba0bb..c226c0134ab 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -79,8 +79,6 @@ #include <QtPlatformHeaders/qeglfsfunctions.h> -#include <EGL/egl.h> - static void initResources() { #ifndef QT_NO_CURSOR diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 98c7ee9f78a..2edb287b1e7 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -34,12 +34,11 @@ #ifndef QEGLFSINTEGRATION_H #define QEGLFSINTEGRATION_H +#include "qeglfsglobal.h" #include <QtCore/QVariant> #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformscreen.h> -#include <EGL/egl.h> -#include "qeglfsglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h index 9b8eaacd51e..f20055b4e70 100644 --- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h +++ b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h @@ -34,9 +34,8 @@ #ifndef QEGLFSOFFSCREENWINDOW_H #define QEGLFSOFFSCREENWINDOW_H -#include <EGL/egl.h> -#include <qpa/qplatformoffscreensurface.h> #include "qeglfsglobal.h" +#include <qpa/qplatformoffscreensurface.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 8f1d87ea250..ea669bd5bcd 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -36,7 +36,6 @@ #include "qeglfsglobal.h" #include <QtCore/QPointer> -#include <EGL/egl.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index 806b21de0ac..2c396e8ef45 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -34,13 +34,12 @@ #ifndef QEGLFSWINDOW_H #define QEGLFSWINDOW_H +#include "qeglfsglobal.h" #include "qeglfsintegration.h" #include "qeglfsscreen.h" -#include "qeglfsglobal.h" #include <qpa/qplatformwindow.h> #include <QtPlatformSupport/private/qopenglcompositor_p.h> -#include <EGL/egl.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h index ec59cbc7c94..ce655462e4f 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h @@ -40,7 +40,7 @@ #include <QtGui/private/qcssparser_p.h> #include <QtGui/private/qtextengine_p.h> -#include <EGL/egl.h> +#include <QtPlatformSupport/private/qt_egl_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 94e17a2983d..1176ee10c99 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -59,7 +59,7 @@ #include <QtGui/private/qguiapplication_p.h> #ifdef XCB_USE_EGL -#include <EGL/egl.h> +#include <QtPlatformSupport/private/qt_egl_p.h> #endif #ifdef XCB_USE_XLIB |