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.

This restores patch set 2 from the previously merged, and then reverted
commit. This here is safe since the egl.h include and the following undefs
are only done internally for eglfs and can have therefore no effect on
other code.

Task-number: QTBUG-52928
Change-Id: I383e783d5064dc8fb41f3ef56d2a4f4fcd31a6cf
Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io>
This commit is contained in:
Laszlo Agocs 2016-04-22 17:13:38 +02:00
parent bfa53e1c67
commit 6e401ebc47
11 changed files with 21 additions and 14 deletions

View File

@ -45,9 +45,9 @@
// We mean it.
//
#include <EGL/egl.h>
#include <qpa/qplatformoffscreensurface.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE

View File

@ -31,6 +31,7 @@
**
****************************************************************************/
#include "qeglfsglobal.h"
#include <QtGui/QSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>

View File

@ -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

View File

@ -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

View File

@ -42,4 +42,17 @@
#define Q_EGLFS_EXPORT Q_DECL_IMPORT
#endif
#include <EGL/egl.h>
#undef Status
#undef None
#undef Bool
#undef CursorShape
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef Expose
#undef Unsorted
#endif

View File

@ -34,8 +34,8 @@
#ifndef QEGLFSHOOKS_H
#define QEGLFSHOOKS_H
#include "qeglfsdeviceintegration.h"
#include "qeglfsglobal.h"
#include "qeglfsdeviceintegration.h"
QT_BEGIN_NAMESPACE

View File

@ -79,8 +79,6 @@
#include <QtPlatformHeaders/qeglfsfunctions.h>
#include <EGL/egl.h>
static void initResources()
{
#ifndef QT_NO_CURSOR

View File

@ -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

View File

@ -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

View File

@ -36,7 +36,6 @@
#include "qeglfsglobal.h"
#include <QtCore/QPointer>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE

View File

@ -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