summaryrefslogtreecommitdiffstats
path: root/src/gui/egl
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-05-10 13:12:30 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-05-10 13:12:30 (GMT)
commit395508f4700bb72c120e0f9e8a19ffa69a7c5d88 (patch)
tree92efbecc98b018cfc617aab2c4811f921becd79c /src/gui/egl
parent6f39ecdabdae9b2132729a2a9940e5febaa420d2 (diff)
parent03f8f1df0d88f5ffe0b3120cffce614cbeefdb70 (diff)
downloadQt-395508f4700bb72c120e0f9e8a19ffa69a7c5d88.zip
Qt-395508f4700bb72c120e0f9e8a19ffa69a7c5d88.tar.gz
Qt-395508f4700bb72c120e0f9e8a19ffa69a7c5d88.tar.bz2
Merge remote branch 'qt/4.7' into lighthouse-4.7
Conflicts: src/gui/egl/egl.pri src/gui/painting/qwindowsurface_p.h
Diffstat (limited to 'src/gui/egl')
-rw-r--r--src/gui/egl/egl.pri52
-rw-r--r--src/gui/egl/qegl_p.h34
-rw-r--r--src/gui/egl/qegl_stub.cpp284
-rw-r--r--src/gui/egl/qeglproperties_stub.cpp148
4 files changed, 492 insertions, 26 deletions
diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri
index 47032d5..595d135 100644
--- a/src/gui/egl/egl.pri
+++ b/src/gui/egl/egl.pri
@@ -1,28 +1,34 @@
-CONFIG += egl
+contains(QT_CONFIG, egl): {
+ CONFIG += egl
-HEADERS += \
- egl/qegl_p.h \
- egl/qeglcontext_p.h \
- egl/qeglproperties_p.h
+ HEADERS += \
+ egl/qegl_p.h \
+ egl/qeglcontext_p.h \
+ egl/qeglproperties_p.h
-SOURCES += \
- egl/qegl.cpp \
- egl/qeglproperties.cpp
+ SOURCES += \
+ egl/qegl.cpp \
+ egl/qeglproperties.cpp
-wince*: SOURCES += egl/qegl_wince.cpp
+ wince*: SOURCES += egl/qegl_wince.cpp
-unix {
- embedded {
- SOURCES += egl/qegl_qws.cpp
- } else {
- embedded_lite {
- SOURCES += egl/qegl_lite.cpp
- } else {
- symbian {
- SOURCES += egl/qegl_symbian.cpp
- } else {
- SOURCES += egl/qegl_x11.cpp
- }
- }
- }
+ unix {
+ embedded {
+ SOURCES += egl/qegl_qws.cpp
+ } else {
+ embedded_lite {
+ SOURCES += egl/qegl_lite.cpp
+ } else {
+ symbian {
+ SOURCES += egl/qegl_symbian.cpp
+ } else {
+ SOURCES += egl/qegl_x11.cpp
+ }
+ }
+ }
+ }
+} else:symbian {
+ DEFINES += QT_NO_EGL
+ SOURCES += egl/qegl_stub.cpp
+ SOURCES += egl/qeglproperties_stub.cpp
}
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 83bdb5e..4fc1338 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -55,6 +55,7 @@
QT_BEGIN_INCLUDE_NAMESPACE
+#ifndef QT_NO_EGL
#if defined(QT_OPENGL_ES_2)
# include <GLES2/gl2.h>
#endif
@@ -64,6 +65,23 @@ QT_BEGIN_INCLUDE_NAMESPACE
#else
# include <EGL/egl.h>
#endif
+#else
+
+//types from egltypes.h for compiling stub without EGL headers
+typedef int EGLBoolean;
+typedef int EGLint;
+typedef int EGLenum;
+typedef int NativeDisplayType;
+typedef void* NativeWindowType;
+typedef void* NativePixmapType;
+typedef int EGLDisplay;
+typedef int EGLConfig;
+typedef int EGLSurface;
+typedef int EGLContext;
+typedef int EGLClientBuffer;
+#define EGL_NONE 0x3038 /* Attrib list terminator */
+
+#endif
#if defined(Q_WS_X11)
// If <EGL/egl.h> included <X11/Xlib.h>, then the global namespace
@@ -136,7 +154,13 @@ QT_BEGIN_NAMESPACE
// Declare/define the bits of EGL_KHR_image_base we need:
#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
+#ifdef Q_OS_SYMBIAN
+//symbian version of eglext.h differs from the khronos reference
+typedef int EGLImageKHR;
+#else
typedef void *EGLImageKHR;
+#endif
+
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
#define EGL_KHR_image_base
@@ -169,7 +193,7 @@ namespace QEgl {
Translucent = 0x01,
Renderable = 0x02 // Config will be compatable with the paint engines (VG or GL)
};
- Q_DECLARE_FLAGS(ConfigOptions, ConfigOption);
+ Q_DECLARE_FLAGS(ConfigOptions, ConfigOption)
// Most of the time we use the same config for things like widgets & pixmaps, so rather than
// go through the eglChooseConfig loop every time, we use defaultConfig, which will return
@@ -182,7 +206,11 @@ namespace QEgl {
Q_GUI_EXPORT void dumpAllConfigs();
+#ifdef QT_NO_EGL
+ Q_GUI_EXPORT QString errorString(EGLint code = 0);
+#else
Q_GUI_EXPORT QString errorString(EGLint code = eglGetError());
+#endif
Q_GUI_EXPORT QString extensions();
Q_GUI_EXPORT bool hasExtension(const char* extensionName);
@@ -200,9 +228,9 @@ namespace QEgl {
#ifdef Q_WS_X11
Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config);
#endif
-};
+}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QEgl::ConfigOptions);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QEgl::ConfigOptions)
QT_END_NAMESPACE
diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp
new file mode 100644
index 0000000..86a7aab
--- /dev/null
+++ b/src/gui/egl/qegl_stub.cpp
@@ -0,0 +1,284 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qpaintdevice.h>
+#include <QtGui/qpixmap.h>
+#include <QtGui/qwidget.h>
+#include <QtCore/qdebug.h>
+
+#include "qegl_p.h"
+#include "qeglcontext_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+static void noegl(const char *fn)
+{
+ qWarning() << fn << " called, but Qt configured without EGL" << endl;
+}
+
+#define NOEGL noegl(__FUNCTION__);
+
+QEglContext::QEglContext()
+ : apiType(QEgl::OpenGL)
+ , ctx(0)
+ , cfg(QEGL_NO_CONFIG)
+ , currentSurface(0)
+ , current(false)
+ , ownsContext(true)
+ , sharing(false)
+{
+ NOEGL
+}
+
+QEglContext::~QEglContext()
+{
+ NOEGL
+}
+
+bool QEglContext::isValid() const
+{
+ NOEGL
+ return false;
+}
+
+bool QEglContext::isCurrent() const
+{
+ NOEGL
+ return false;
+}
+
+EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
+{
+ Q_UNUSED(devType)
+ Q_UNUSED(api)
+ Q_UNUSED(options)
+ NOEGL
+ return QEGL_NO_CONFIG;
+}
+
+
+// Choose a configuration that matches "properties".
+EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match)
+{
+ Q_UNUSED(properties)
+ Q_UNUSED(match)
+ NOEGL
+ return QEGL_NO_CONFIG;
+}
+
+bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match)
+{
+ Q_UNUSED(properties)
+ Q_UNUSED(match)
+ NOEGL
+ return false;
+}
+
+EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties)
+{
+ Q_UNUSED(device)
+ Q_UNUSED(properties)
+ NOEGL
+ return 0;
+}
+
+
+// Create the EGLContext.
+bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties)
+{
+ Q_UNUSED(shareContext)
+ Q_UNUSED(properties)
+ NOEGL
+ return false;
+}
+
+// Destroy an EGL surface object. If it was current on this context
+// then call doneCurrent() for it first.
+void QEglContext::destroySurface(EGLSurface surface)
+{
+ Q_UNUSED(surface)
+ NOEGL
+}
+
+// Destroy the context. Note: this does not destroy the surface.
+void QEglContext::destroyContext()
+{
+ NOEGL
+}
+
+bool QEglContext::makeCurrent(EGLSurface surface)
+{
+ Q_UNUSED(surface)
+ NOEGL
+ return false;
+}
+
+bool QEglContext::doneCurrent()
+{
+ NOEGL
+ return false;
+}
+
+// Act as though doneCurrent() was called, but keep the context
+// and the surface active for the moment. This allows makeCurrent()
+// to skip a call to eglMakeCurrent() if we are using the same
+// surface as the last set of painting operations. We leave the
+// currentContext() pointer as-is for now.
+bool QEglContext::lazyDoneCurrent()
+{
+ NOEGL
+ return false;
+}
+
+bool QEglContext::swapBuffers(EGLSurface surface)
+{
+ Q_UNUSED(surface)
+ NOEGL
+ return false;
+}
+
+int QEglContext::configAttrib(int name) const
+{
+ Q_UNUSED(name)
+ NOEGL
+ return 0;
+}
+
+EGLDisplay QEgl::display()
+{
+ NOEGL
+ return 0;
+}
+
+EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
+{
+ Q_UNUSED(dpy)
+ Q_UNUSED(ctx)
+ Q_UNUSED(target)
+ Q_UNUSED(buffer)
+ Q_UNUSED(attrib_list)
+ NOEGL
+ return 0;
+}
+
+EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
+{
+ Q_UNUSED(dpy)
+ Q_UNUSED(img)
+ NOEGL
+ return 0;
+}
+
+
+#ifndef Q_WS_X11
+EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
+{
+ Q_UNUSED(device)
+ Q_UNUSED(cfg)
+ Q_UNUSED(properties)
+ NOEGL
+ return 0;
+}
+#endif
+
+
+// Return the error string associated with a specific code.
+QString QEgl::errorString(EGLint code)
+{
+ Q_UNUSED(code)
+ NOEGL
+ return QString();
+}
+
+// Dump all of the EGL configurations supported by the system.
+void QEgl::dumpAllConfigs()
+{
+ NOEGL
+}
+
+QString QEgl::extensions()
+{
+ NOEGL
+ return QString();
+}
+
+bool QEgl::hasExtension(const char* extensionName)
+{
+ Q_UNUSED(extensionName)
+ NOEGL
+ return false;
+}
+
+QEglContext *QEglContext::currentContext(QEgl::API api)
+{
+ Q_UNUSED(api)
+ NOEGL
+ return false;
+}
+
+void QEglContext::setCurrentContext(QEgl::API api, QEglContext *context)
+{
+ Q_UNUSED(api)
+ Q_UNUSED(context)
+ NOEGL
+}
+
+EGLNativeDisplayType QEgl::nativeDisplay()
+{
+ NOEGL
+ return 0;
+}
+
+EGLNativeWindowType QEgl::nativeWindow(QWidget* widget)
+{
+ Q_UNUSED(widget)
+ NOEGL
+ return (EGLNativeWindowType)0;
+}
+
+EGLNativePixmapType QEgl::nativePixmap(QPixmap*)
+{
+ NOEGL
+ return (EGLNativePixmapType)0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/egl/qeglproperties_stub.cpp b/src/gui/egl/qeglproperties_stub.cpp
new file mode 100644
index 0000000..2012ebd
--- /dev/null
+++ b/src/gui/egl/qeglproperties_stub.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
+
+#include "qeglproperties_p.h"
+#include "qeglcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+static void noegl(const char *fn)
+{
+ qWarning() << fn << " called, but Qt configured without EGL" << endl;
+}
+
+#define NOEGL noegl(__FUNCTION__);
+
+// Initialize a property block.
+QEglProperties::QEglProperties()
+{
+ NOEGL
+}
+
+QEglProperties::QEglProperties(EGLConfig cfg)
+{
+ Q_UNUSED(cfg)
+ NOEGL
+}
+
+// Fetch the current value associated with a property.
+int QEglProperties::value(int name) const
+{
+ Q_UNUSED(name)
+ NOEGL
+ return 0;
+}
+
+// Set the value associated with a property, replacing an existing
+// value if there is one.
+void QEglProperties::setValue(int name, int value)
+{
+ Q_UNUSED(name)
+ Q_UNUSED(value)
+ NOEGL
+}
+
+// Remove a property value. Returns false if the property is not present.
+bool QEglProperties::removeValue(int name)
+{
+ Q_UNUSED(name)
+ NOEGL
+ return false;
+}
+
+void QEglProperties::setDeviceType(int devType)
+{
+ Q_UNUSED(devType)
+ NOEGL
+}
+
+
+// Sets the red, green, blue, and alpha sizes based on a pixel format.
+// Normally used to match a configuration request to the screen format.
+void QEglProperties::setPixelFormat(QImage::Format pixelFormat)
+{
+ Q_UNUSED(pixelFormat)
+ NOEGL
+
+}
+
+void QEglProperties::setRenderableType(QEgl::API api)
+{
+ Q_UNUSED(api);
+ NOEGL
+}
+
+// Reduce the complexity of a configuration request to ask for less
+// because the previous request did not result in success. Returns
+// true if the complexity was reduced, or false if no further
+// reductions in complexity are possible.
+bool QEglProperties::reduceConfiguration()
+{
+ NOEGL
+ return false;
+}
+
+static void addTag(QString& str, const QString& tag)
+{
+ Q_UNUSED(str)
+ Q_UNUSED(tag)
+ NOEGL
+}
+
+// Convert a property list to a string suitable for debug output.
+QString QEglProperties::toString() const
+{
+ NOEGL
+ return QString();
+}
+
+void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
+{
+ Q_UNUSED(dev)
+ NOEGL
+}
+
+QT_END_NAMESPACE
+
+