summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-04-13 12:51:51 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-04-14 12:51:50 (GMT)
commitb331a74b8fd71ba803e2cf2a9e0c49e1d3538f40 (patch)
tree84937c7c4908cfc444fe6645a9373248c69fc946 /src/opengl
parent9ad274406a0f893f9a595aac7031deac2b25afbd (diff)
downloadQt-b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40.zip
Qt-b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40.tar.gz
Qt-b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40.tar.bz2
Support building with desktop OpenGL managed via EGL
This mostly replaces lots of QT_OPENGL_ES defines with QT_NO_EGL instead. It also switches off EGL auto-detection by default. This is to make sure we default to using GLX on systems with both EGL and desktop OpenGL. If -opengl es1|es2 or -openvg is specified, then EGL auto-detection is switched back on (as a requirement. If configure auto-detects OpenGL ES it also switches on EGL auto-detection, but failue then just disables both EGL & OpenGL. As a side effect, this patch also fixes building Qt when both EGL and glx are avaliable, as they are in Mesa >= 7.8.0. Reviewed-by: Trond Task-number: QTBUG-9691
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/opengl.pro2
-rw-r--r--src/opengl/qgl.cpp8
-rw-r--r--src/opengl/qgl.h2
-rw-r--r--src/opengl/qgl_p.h10
-rw-r--r--src/opengl/qglpixelbuffer.cpp6
-rw-r--r--src/opengl/qglpixelbuffer_p.h12
6 files changed, 19 insertions, 21 deletions
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 9473343..15795d2 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -77,7 +77,7 @@ SOURCES += qgl.cpp \
}
x11 {
- contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) {
+ contains(QT_CONFIG, egl) {
SOURCES += qgl_x11egl.cpp \
qglpixelbuffer_egl.cpp \
qgl_egl.cpp \
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 5595e02..4e1a63c 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -49,7 +49,7 @@
#include "private/qpixmap_x11_p.h"
#define INT32 dummy_INT32
#define INT8 dummy_INT8
-#if !defined(QT_OPENGL_ES)
+#ifdef QT_NO_EGL
# include <GL/glx.h>
#endif
#undef INT32
@@ -1582,7 +1582,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
# endif
vi = 0;
#endif
-#if defined(QT_OPENGL_ES)
+#ifndef QT_NO_EGL
ownsEglContext = false;
eglContext = 0;
eglSurface = EGL_NO_SURFACE;
@@ -3950,7 +3950,7 @@ bool QGLWidget::event(QEvent *e)
}
}
-#if defined(QT_OPENGL_ES)
+#ifndef QT_NO_EGL
// A re-parent is likely to destroy the X11 window and re-create it. It is important
// that we free the EGL surface _before_ the winID changes - otherwise we can leak.
if (e->type() == QEvent::ParentAboutToChange)
@@ -4909,7 +4909,7 @@ void QGLWidget::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QM
}
#endif
-#if !defined(QT_OPENGL_ES_1)
+#ifndef QT_OPENGL_ES_1
Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_2_engine)
#endif
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 64f54a3..b1e2ede 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -376,7 +376,7 @@ protected:
#if defined(Q_WS_WIN)
virtual int choosePixelFormat(void* pfd, HDC pdc);
#endif
-#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
+#if defined(Q_WS_X11) && defined(QT_NO_EGL)
virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
virtual void* chooseVisual();
#endif
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 1f28b08..ee580a6 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -64,7 +64,7 @@
#include "qcache.h"
#include "qglpaintdevice_p.h"
-#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
+#ifndef QT_NO_EGL
#include <QtGui/private/qegl_p.h>
#endif
@@ -96,7 +96,7 @@ class QMacWindowChangeEvent;
class QWSGLWindowSurface;
#endif
-#if defined(QT_OPENGL_ES)
+#ifndef QT_NO_EGL
class QEglContext;
#endif
@@ -164,7 +164,7 @@ public:
#ifdef Q_WS_QWS
, wsurf(0)
#endif
-#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
+#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
, eglSurfaceWindowId(0)
#endif
{
@@ -194,7 +194,7 @@ public:
QGLContext *olcx;
#elif defined(Q_WS_X11)
QGLOverlayWidget *olw;
-#if defined(QT_OPENGL_ES)
+#ifndef QT_NO_EGL
void recreateEglSurface(bool force);
WId eglSurfaceWindowId;
#endif
@@ -344,7 +344,7 @@ public:
HBITMAP hbitmap;
HDC hbitmap_hdc;
#endif
-#if defined(QT_OPENGL_ES)
+#ifndef QT_NO_EGL
bool ownsEglContext;
QEglContext *eglContext;
EGLSurface eglSurface;
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index eca9550..9a8b243 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -137,14 +137,14 @@ void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &form
#if defined(Q_WS_WIN) && !defined(QT_OPENGL_ES)
qctx->d_func()->dc = dc;
qctx->d_func()->rc = ctx;
-#elif (defined(Q_WS_X11) && !defined(QT_OPENGL_ES))
+#elif (defined(Q_WS_X11) && defined(QT_NO_EGL))
qctx->d_func()->cx = ctx;
qctx->d_func()->pbuf = (void *) pbuf;
qctx->d_func()->vi = 0;
#elif defined(Q_WS_MAC)
qctx->d_func()->cx = ctx;
qctx->d_func()->vi = 0;
-#elif defined(QT_OPENGL_ES)
+#elif !defined(QT_NO_EGL)
qctx->d_func()->eglContext = ctx;
qctx->d_func()->eglSurface = pbuf;
#endif
@@ -254,7 +254,7 @@ bool QGLPixelBuffer::doneCurrent()
\sa size()
*/
-#if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && !defined(QT_OPENGL_ES)
+#if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && defined(QT_NO_EGL)
GLuint QGLPixelBuffer::generateDynamicTexture() const
{
Q_D(const QGLPixelBuffer);
diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h
index c85dc5a..2a1f671 100644
--- a/src/opengl/qglpixelbuffer_p.h
+++ b/src/opengl/qglpixelbuffer_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <private/qgl_p.h>
#include <private/qglpaintdevice_p.h>
-#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
+#if defined(Q_WS_X11) && defined(QT_NO_EGL)
#include <GL/glx.h>
// The below is needed to for compilation on HPUX, due to broken GLX
@@ -127,10 +127,8 @@ struct GLXFBConfig {
#elif defined(Q_WS_WIN)
DECLARE_HANDLE(HPBUFFERARB);
-#elif defined(QT_OPENGL_ES_2)
-#include <EGL/egl.h>
-#elif defined(QT_OPENGL_ES)
-#include <GLES/egl.h>
+#elif !defined(QT_NO_EGL)
+#include <QtGui/private/qegl_p.h>
#endif
QT_END_INCLUDE_NAMESPACE
@@ -174,7 +172,7 @@ public:
QPointer<QGLWidget> req_shareWidget;
QSize req_size;
-#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
+#if defined(Q_WS_X11) && defined(QT_NO_EGL)
GLXPbuffer pbuf;
GLXContext ctx;
#elif defined(Q_WS_WIN)
@@ -195,7 +193,7 @@ public:
AGLContext share_ctx;
# endif
#endif
-#if defined(QT_OPENGL_ES)
+#ifndef QT_NO_EGL
EGLSurface pbuf;
QEglContext *ctx;
int textureFormat;