summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-02-12 14:50:49 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-02-12 16:03:16 (GMT)
commitaf1f28a0d78deee31c5df0d7d042ae7671c8c34c (patch)
treee42d9effcddda6289afbeb4d9817db68467ce308 /src/opengl
parent040151b51780084f3a2b764bab7e2359677eb0b1 (diff)
downloadQt-af1f28a0d78deee31c5df0d7d042ae7671c8c34c.zip
Qt-af1f28a0d78deee31c5df0d7d042ae7671c8c34c.tar.gz
Qt-af1f28a0d78deee31c5df0d7d042ae7671c8c34c.tar.bz2
Cleanup QEglContext & EGLDisplays
This basicaly replaces display(), openDisplay() & defaultDisplay() methods with a single display() and nativeDisplay(), the latter being implemented in the platform-specific files and everything else being cross-platform code. Reviewed-By: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_qws.cpp5
-rw-r--r--src/opengl/qgl_wince.cpp5
-rw-r--r--src/opengl/qgl_x11egl.cpp13
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp9
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp15
5 files changed, 12 insertions, 35 deletions
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index d4adc8b..fd17a27 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -198,11 +198,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
// Construct the configuration we need for this surface.
QEglProperties configProps;
diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp
index 00a125a..f81115c 100644
--- a/src/opengl/qgl_wince.cpp
+++ b/src/opengl/qgl_wince.cpp
@@ -155,11 +155,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
// Construct the configuration we need for this surface.
QEglProperties configProps;
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 572834b..3d183ee 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -190,11 +190,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (d->eglContext == 0) {
d->eglContext = new QEglContext();
d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
// Construct the configuration we need for this surface.
QEglProperties configProps;
@@ -614,7 +609,7 @@ EGLConfig Q_OPENGL_EXPORT qt_chooseEGLConfigForPixmap(bool hasAlpha, bool readOn
EGLint configCount = 0;
do {
- eglChooseConfig(QEglContext::defaultDisplay(0), configAttribs.properties(), targetConfig, 1, &configCount);
+ eglChooseConfig(QEglContext::display(), configAttribs.properties(), targetConfig, 1, &configCount);
if (configCount > 0) {
// Got one
qDebug() << "Found an" << (hasAlpha ? "ARGB" : "RGB") << (readOnly ? "readonly" : "target" )
@@ -653,7 +648,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl
pixmapAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB);
EGLSurface pixmapSurface;
- pixmapSurface = eglCreatePixmapSurface(QEglContext::defaultDisplay(0),
+ pixmapSurface = eglCreatePixmapSurface(QEglContext::display(),
pixmapConfig,
(EGLNativePixmapType) pixmapData->handle(),
pixmapAttribs.properties());
@@ -762,7 +757,7 @@ void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd)
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
if (pixmapData->gl_surface) {
EGLBoolean success;
- success = eglDestroySurface(QEglContext::defaultDisplay(0), (EGLSurface)pixmapData->gl_surface);
+ success = eglDestroySurface(QEglContext::display(), (EGLSurface)pixmapData->gl_surface);
if (success == EGL_FALSE) {
qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: "
<< QEglContext::errorString(eglGetError());
@@ -777,7 +772,7 @@ void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd)
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
if (pixmapData->gl_surface) {
EGLBoolean success;
- success = eglReleaseTexImage(QEglContext::defaultDisplay(0),
+ success = eglReleaseTexImage(QEglContext::display(),
(EGLSurface)pixmapData->gl_surface,
EGL_BACK_BUFFER);
if (success == EGL_FALSE) {
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index ca19011..dbe919d 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -65,13 +65,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
ctx = new QEglContext();
ctx->setApi(QEgl::OpenGL);
- // Open the EGL display.
- if (!ctx->openDisplay(0)) {
- delete ctx;
- ctx = 0;
- return false;
- }
-
// Find the shared context.
QEglContext *shareContext = 0;
if (shareWidget && shareWidget->d_func()->glcx)
@@ -215,7 +208,7 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const
bool QGLPixelBuffer::hasOpenGLPbuffers()
{
// See if we have at least 1 configuration that matches the default format.
- EGLDisplay dpy = QEglContext::defaultDisplay(0);
+ EGLDisplay dpy = QEglContext::display();
if (dpy == EGL_NO_DISPLAY)
return false;
QEglProperties configProps;
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index 55aa1d0..229f75a 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -96,14 +96,14 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
#endif
EGL_NONE
};
- qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::defaultDisplay(0),
+ qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::display(),
argbConfig, 0, contextAttribs);
if (argbConfig == rgbConfig) {
// If the configs are the same, we can re-use the same context.
qPixmapRGBSharedEglContext = qPixmapARGBSharedEglContext;
} else {
- qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::defaultDisplay(0),
+ qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::display(),
rgbConfig, 0, contextAttribs);
}
@@ -114,7 +114,7 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!qt_createEGLSurfaceForPixmap(argbPixmapData, false))
break;
- haveX11Pixmaps = eglMakeCurrent(QEglContext::defaultDisplay(0),
+ haveX11Pixmaps = eglMakeCurrent(QEglContext::display(),
(EGLSurface)argbPixmapData->gl_surface,
(EGLSurface)argbPixmapData->gl_surface,
qPixmapARGBSharedEglContext);
@@ -134,7 +134,7 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!qt_createEGLSurfaceForPixmap(rgbPixmapData, false))
break;
- haveX11Pixmaps = eglMakeCurrent(QEglContext::defaultDisplay(0),
+ haveX11Pixmaps = eglMakeCurrent(QEglContext::display(),
(EGLSurface)rgbPixmapData->gl_surface,
(EGLSurface)rgbPixmapData->gl_surface,
qPixmapRGBSharedEglContext);
@@ -147,7 +147,7 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
} while (0);
if (qPixmapARGBSharedEglContext || qPixmapRGBSharedEglContext) {
- eglMakeCurrent(QEglContext::defaultDisplay(0),
+ eglMakeCurrent(QEglContext::display(),
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
@@ -167,12 +167,12 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!haveX11Pixmaps) {
// Clean up the context(s) if we can't use X11GL pixmaps
if (qPixmapARGBSharedEglContext != EGL_NO_CONTEXT)
- eglDestroyContext(QEglContext::defaultDisplay(0), qPixmapARGBSharedEglContext);
+ eglDestroyContext(QEglContext::display(), qPixmapARGBSharedEglContext);
if (qPixmapRGBSharedEglContext != qPixmapARGBSharedEglContext &&
qPixmapRGBSharedEglContext != EGL_NO_CONTEXT)
{
- eglDestroyContext(QEglContext::defaultDisplay(0), qPixmapRGBSharedEglContext);
+ eglDestroyContext(QEglContext::display(), qPixmapRGBSharedEglContext);
}
qPixmapRGBSharedEglContext = EGL_NO_CONTEXT;
qPixmapARGBSharedEglContext = EGL_NO_CONTEXT;
@@ -212,7 +212,6 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const
ctx = new QGLContext(glFormat());
if (ctx->d_func()->eglContext == 0)
ctx->d_func()->eglContext = new QEglContext();
- ctx->d_func()->eglContext->openDisplay(0); // ;-)
ctx->d_func()->eglContext->setApi(QEgl::OpenGL);
ctx->d_func()->eglContext->setContext(hasAlphaChannel() ? qPixmapARGBSharedEglContext
: qPixmapRGBSharedEglContext);