Remove DefaultSharedContext from Lighthouse API.
authorSamuel Rødal <samuel.rodal@nokia.com>
Wed, 13 Apr 2011 06:49:52 +0000 (08:49 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Wed, 13 Apr 2011 07:45:00 +0000 (09:45 +0200)
QPlatformWindowFormat::setUseDefaultSharedContext was meant as a
convenience, but it adds complexity in the platform plugin
implementation, and can be implemented by the above layers using
QPlatformWindowFormat::setSharedContext.

Reviewed-by: Jørgen Lind
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h

index 89ba12b..d293019 100644 (file)
@@ -50,8 +50,6 @@
 #include <QtGui/QPlatformWindowFormat>
 #include <QtCore/QMutex>
 
-Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex)
-
 QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format)
     : QPlatformGLContext()
     , mEglDisplay(eglDisplay)
@@ -60,20 +58,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindo
     , mFormat(qt_qPlatformWindowFormatFromConfig(mEglDisplay,mConfig))
 {
     QPlatformGLContext *sharePlatformContext = 0;
-    if (format.useDefaultSharedContext()) {
-        if (!QPlatformGLContext::defaultSharedContext()) {
-            if (qt_defaultSharedContextMutex()->tryLock()){
-                createDefaultSharedContext(eglDisplay);
-                qt_defaultSharedContextMutex()->unlock();
-            } else {
-                qt_defaultSharedContextMutex()->lock(); //wait to the the shared context is created
-                qt_defaultSharedContextMutex()->unlock();
-            }
-        }
-        sharePlatformContext = QPlatformGLContext::defaultSharedContext();
-    } else {
-        sharePlatformContext = format.sharedGLContext();
-    }
+    sharePlatformContext = format.sharedGLContext();
     mFormat.setSharedContext(sharePlatformContext);
     EGLContext shareEGLContext = EGL_NO_CONTEXT;
     if (sharePlatformContext)
@@ -128,20 +113,6 @@ void *QWaylandGLContext::getProcAddress(const QString &string)
     return (void *) eglGetProcAddress(string.toLatin1().data());
 }
 
-void QWaylandGLContext::createDefaultSharedContext(EGLDisplay display)
-{
-    QVector<EGLint> eglContextAttrs;
-    eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
-    eglContextAttrs.append(2);
-    eglContextAttrs.append(EGL_NONE);
-
-    QWaylandGLContext *defaultSharedContext = new QWaylandGLContext;
-    defaultSharedContext->mEglDisplay = display;
-    defaultSharedContext->mContext = eglCreateContext(mEglDisplay,mConfig,
-                                                      EGL_NO_CONTEXT, eglContextAttrs.constData());
-    QPlatformGLContext::setDefaultSharedContext(defaultSharedContext);
-}
-
 void QWaylandGLContext::setEglSurface(EGLSurface surface)
 {
     doneCurrent();
index a3befdc..76caffa 100644 (file)
@@ -72,7 +72,6 @@ private:
     EGLConfig mConfig;
     QPlatformWindowFormat mFormat;
 
-    void createDefaultSharedContext(EGLDisplay eglDisplay);
     QWaylandGLContext();
 
 };