summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-04-13 06:49:52 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-04-13 07:45:00 (GMT)
commit3ba6c3b7a4261147addc1d7fb06060dae7522691 (patch)
treecded7ec5f02e5f6ea082110185c6da2e03d514e9 /src
parent0108e888480e47e65d82d94e10a7c7c910e42d79 (diff)
downloadQt-3ba6c3b7a4261147addc1d7fb06060dae7522691.zip
Qt-3ba6c3b7a4261147addc1d7fb06060dae7522691.tar.gz
Qt-3ba6c3b7a4261147addc1d7fb06060dae7522691.tar.bz2
Remove DefaultSharedContext from Lighthouse API.
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
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformglcontext_qpa.cpp18
-rw-r--r--src/gui/kernel/qplatformglcontext_qpa.h5
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.cpp13
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.h11
-rw-r--r--src/opengl/qwindowsurface_gl.cpp14
-rw-r--r--src/opengl/qwindowsurface_gl_p.h4
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp5
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp1
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.cpp4
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.h4
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindow.cpp10
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp31
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h1
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp46
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h2
-rw-r--r--src/plugins/platforms/xlib/qglxintegration.cpp44
-rw-r--r--src/plugins/platforms/xlib/qglxintegration.h2
18 files changed, 18 insertions, 199 deletions
diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp
index 86740e8..1810532 100644
--- a/src/gui/kernel/qplatformglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformglcontext_qpa.cpp
@@ -125,24 +125,6 @@ QPlatformGLContext::~QPlatformGLContext()
}
-
-/*!
- Makes it possible to set the context which can be the default for making new contexts.
-*/
-void QPlatformGLContext::setDefaultSharedContext(QPlatformGLContext *sharedContext)
-{
- QPlatformGLContextPrivate::staticSharedContext = sharedContext;
-}
-
-/*!
- Default shared context is intended to be a globally awailable pointer to a context which can
- be used for sharing resources when creating new contexts. Its default value is 0;
-*/
-QPlatformGLContext *QPlatformGLContext::defaultSharedContext()
-{
- return QPlatformGLContextPrivate::staticSharedContext;
-}
-
/*!
Reimplement in subclass to do makeCurrent on native GL context
*/
diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h
index a680c85..28923a9 100644
--- a/src/gui/kernel/qplatformglcontext_qpa.h
+++ b/src/gui/kernel/qplatformglcontext_qpa.h
@@ -69,13 +69,10 @@ public:
virtual QPlatformWindowFormat platformWindowFormat() const = 0;
const static QPlatformGLContext *currentContext();
- static QPlatformGLContext *defaultSharedContext();
protected:
-
- static void setDefaultSharedContext(QPlatformGLContext *sharedContext);
-
QScopedPointer<QPlatformGLContextPrivate> d_ptr;
+
private:
//hack to make it work with QGLContext::CurrentContext
friend class QGLContext;
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp
index ddc6239..c165c85 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.cpp
+++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp
@@ -53,7 +53,7 @@ public:
, opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer
| QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering
| QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions
- | QPlatformWindowFormat::UseDefaultSharedContext | QPlatformWindowFormat::HasWindowSurface)
+ | QPlatformWindowFormat::HasWindowSurface)
, depthSize(-1)
, accumSize(-1)
, stencilSize(-1)
@@ -525,16 +525,6 @@ void QPlatformWindowFormat::setSampleBuffers(bool enable)
setOption(enable ? QPlatformWindowFormat::SampleBuffers : QPlatformWindowFormat::NoSampleBuffers);
}
-void QPlatformWindowFormat::setUseDefaultSharedContext(bool enable)
-{
- if (enable) {
- setOption(QPlatformWindowFormat::UseDefaultSharedContext);
- d->sharedContext = 0;
- } else {
- setOption(QPlatformWindowFormat::NoDefaultSharedContext);
- }
-}
-
/*!
Returns the number of samples per pixel when multisampling is
enabled. By default, the highest number of samples that is
@@ -613,7 +603,6 @@ QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const
void QPlatformWindowFormat::setSharedContext(QPlatformGLContext *context)
{
- setUseDefaultSharedContext(false);
d->sharedContext = context;
}
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h
index fa01a8a..ba21ba4 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.h
+++ b/src/gui/kernel/qplatformwindowformat_qpa.h
@@ -66,8 +66,7 @@ public:
HasOverlay = 0x0100,
SampleBuffers = 0x0200,
DeprecatedFunctions = 0x0400,
- UseDefaultSharedContext = 0x0800,
- HasWindowSurface = 0x1000,
+ HasWindowSurface = 0x0800,
SingleBuffer = DoubleBuffer << 16,
NoDepthBuffer = DepthBuffer << 16,
ColorIndex = Rgba << 16,
@@ -79,7 +78,6 @@ public:
NoOverlay = HasOverlay << 16,
NoSampleBuffers = SampleBuffers << 16,
NoDeprecatedFunctions = DeprecatedFunctions << 16,
- NoDefaultSharedContext = UseDefaultSharedContext << 16,
NoWindowSurface = HasWindowSurface << 16
};
@@ -149,8 +147,6 @@ public:
void setStereo(bool enable);
bool directRendering() const;
void setDirectRendering(bool enable);
- bool useDefaultSharedContext() const;
- void setUseDefaultSharedContext(bool enable);
bool hasWindowSurface() const;
void setWindowSurface(bool enable);
@@ -231,11 +227,6 @@ inline bool QPlatformWindowFormat::sampleBuffers() const
return testOption(QPlatformWindowFormat::SampleBuffers);
}
-inline bool QPlatformWindowFormat::useDefaultSharedContext() const
-{
- return testOption(QPlatformWindowFormat::UseDefaultSharedContext);
-}
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 681ab69..a6489a6 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -181,7 +181,6 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
//
// QGLWindowSurface
//
-#ifndef Q_WS_QPA
class QGLGlobalShareWidget
{
public:
@@ -257,22 +256,13 @@ void qt_destroy_gl_share_widget()
{
_qt_gl_share_widget()->destroy();
}
-#endif//Q_WS_QPA
const QGLContext *qt_gl_share_context()
{
-#ifdef Q_WS_QPA
- //make it possible to have an assesor to defaultSharedGLContext.
- const QPlatformGLContext *platformContext = QPlatformGLContext::defaultSharedContext();
- if (!platformContext)
- qDebug() << "Please implement a defaultSharedContext for your platformplugin";
- return QGLContext::fromPlatformGLContext(const_cast<QPlatformGLContext *>(platformContext));
-#else
QGLWidget *widget = qt_gl_share_widget();
if (widget)
return widget->context();
return 0;
-#endif
}
#ifdef QGL_USE_TEXTURE_POOL
@@ -405,7 +395,6 @@ QGLWindowSurface::~QGLWindowSurface()
delete d_ptr->fbo;
delete d_ptr;
-#ifndef Q_WS_QPA
if (QGLGlobalShareWidget::cleanedUp)
return;
@@ -426,7 +415,6 @@ QGLWindowSurface::~QGLWindowSurface()
qt_destroy_gl_share_widget();
}
#endif // QGL_USE_TEXTURE_POOL
-#endif // Q_WS_QPA
}
void QGLWindowSurface::deleted(QObject *object)
@@ -476,10 +464,8 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
ctx->create(qt_gl_share_context());
-#ifndef Q_WS_QPA
if (widget != qt_gl_share_widget())
++(_qt_gl_share_widget()->widgetRefCount);
-#endif
#ifndef QT_NO_EGL
static bool checkedForNOKSwapRegion = false;
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 67f9f41..a8d8381 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -66,12 +66,8 @@ class QRegion;
class QWidget;
struct QGLWindowSurfacePrivate;
-#ifdef Q_WS_QPA
-Q_OPENGL_EXPORT const QGLContext* qt_gl_share_context();
-#else
Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget();
Q_OPENGL_EXPORT void qt_destroy_gl_share_widget();
-#endif
class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice
{
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
index 9a2bc61..ae5215f 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
@@ -146,11 +146,6 @@ void* QEGLPlatformContext::getProcAddress(const QString& procName)
return (void *)eglGetProcAddress(qPrintable(procName));
}
-void QEGLPlatformContext::makeDefaultSharedContext()
-{
- setDefaultSharedContext(this);
-}
-
QPlatformWindowFormat QEGLPlatformContext::platformWindowFormat() const
{
return m_windowFormat;
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
index d688660..69835d7 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
@@ -56,8 +56,6 @@ public:
void swapBuffers();
void* getProcAddress(const QString& procName);
- void makeDefaultSharedContext();
-
QPlatformWindowFormat platformWindowFormat() const;
EGLContext eglContext() const;
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 2200d1d..b6f2805 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -203,7 +203,6 @@ void QEglFSScreen::createAndSetPlatformContext()
attribList[temp++] = EGL_NONE;
QEGLPlatformContext *platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API);
- platformContext->makeDefaultSharedContext();
m_platformContext = platformContext;
EGLint w,h; // screen size detection
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
index 35e744be..e98f322 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
@@ -122,7 +122,9 @@ QOpenKODEScreen::QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop
}
QOpenKODEIntegration::QOpenKODEIntegration()
- : mEventLoopIntegration(0), mFontDb(new QGenericUnixFontDatabase())
+ : mEventLoopIntegration(0)
+ , mFontDb(new QGenericUnixFontDatabase())
+ , mMainGlContext(0)
{
if (kdInitializeNV() == KD_ENOTINITIALIZED) {
qFatal("Did not manage to initialize openkode");
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h
index 7582e60..a788091 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.h
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.h
@@ -106,10 +106,14 @@ public:
static GLuint blitterProgram();
+ void setMainGLContext(QEGLPlatformContext *ctx) { mMainGlContext = ctx; }
+ void mainGLContext() const { return mMainGlContext; }
+
private:
QList<QPlatformScreen *> mScreens;
QOpenKODEEventLoopIntegration *mEventLoopIntegration;
QPlatformFontDatabase *mFontDb;
+ QEGLPlatformContext *mMainGlContext;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp
index 66530a5..d34dff8 100644
--- a/src/plugins/platforms/openkode/qopenkodewindow.cpp
+++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp
@@ -147,9 +147,9 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
}
+ QOpenKODEIntegration *integration = static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration());
-
- if (!isFullScreen || (isFullScreen && !QPlatformGLContext::defaultSharedContext())) {
+ if (!isFullScreen || (isFullScreen && !integration->mainGLContext())) {
if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) {
qErrnoWarning(kdGetError(), "Could not realize native window");
return;
@@ -158,9 +158,9 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData());
m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig,
m_eglContextAttrs.data(), surface, m_eglApi);
- m_platformGlContext->makeDefaultSharedContext();
+ integration->setMainGLContext(m_platformGLContext);
} else {
- m_platformGlContext = const_cast<QEGLPlatformContext *>(static_cast<const QEGLPlatformContext *>(QPlatformGLContext::defaultSharedContext()));
+ m_platformGlContext = integration->mainGLContext();
kdDestroyWindow(m_kdWindow);
m_kdWindow = 0;
}
@@ -169,7 +169,7 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
QOpenKODEWindow::~QOpenKODEWindow()
{
- if (m_platformGlContext != QPlatformGLContext::defaultSharedContext()) {
+ if (m_platformGlContext != static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration())) {
delete m_platformGlContext;
}
if (m_kdWindow)
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
index 89ba12b..d293019 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
@@ -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();
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h
index a3befdc..76caffa 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h
@@ -72,7 +72,6 @@ private:
EGLConfig mConfig;
QPlatformWindowFormat mFormat;
- void createDefaultSharedContext(EGLDisplay eglDisplay);
QWaylandGLContext();
};
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 19a9503..190221c 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -57,8 +57,6 @@
#include <dlfcn.h>
#endif
-QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive);
-
QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindowFormat &format)
: QPlatformGLContext()
, m_screen(screen)
@@ -67,20 +65,7 @@ QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindo
{
Q_XCB_NOOP(m_screen->connection());
const QPlatformGLContext *sharePlatformContext;
- if (format.useDefaultSharedContext()) {
- if (!QPlatformGLContext::defaultSharedContext()) {
- if (m_defaultSharedContextMutex.tryLock()){
- createDefaultSharedContext(screen);
- m_defaultSharedContextMutex.unlock();
- } else {
- m_defaultSharedContextMutex.lock(); //wait to the the shared context is created
- m_defaultSharedContextMutex.unlock();
- }
- }
- sharePlatformContext = QPlatformGLContext::defaultSharedContext();
- } else {
- sharePlatformContext = format.sharedGLContext();
- }
+ sharePlatformContext = format.sharedGLContext();
GLXContext shareGlxContext = 0;
if (sharePlatformContext)
shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext();
@@ -105,35 +90,6 @@ QGLXContext::~QGLXContext()
Q_XCB_NOOP(m_screen->connection());
}
-void QGLXContext::createDefaultSharedContext(QXcbScreen *screen)
-{
- Q_XCB_NOOP(screen->connection());
- int x = 0;
- int y = 0;
- int w = 3;
- int h = 3;
-
- QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat();
- GLXContext context;
- GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format);
- if (config) {
- XVisualInfo *visualInfo = glXGetVisualFromFBConfig(DISPLAY_FROM_XCB(screen), config);
- Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(screen), screen->root(), visualInfo->visual, AllocNone);
- XSetWindowAttributes a;
- a.colormap = cmap;
- Window sharedWindow = XCreateWindow(DISPLAY_FROM_XCB(screen), screen->root(), x, y, w, h,
- 0, visualInfo->depth, InputOutput, visualInfo->visual,
- CWColormap, &a);
-
- context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, TRUE);
- QPlatformGLContext *sharedContext = new QGLXContext(screen, sharedWindow, context);
- QPlatformGLContext::setDefaultSharedContext(sharedContext);
- } else {
- qWarning("Warning no shared context created");
- }
- Q_XCB_NOOP(screen->connection());
-}
-
void QGLXContext::makeCurrent()
{
Q_XCB_NOOP(m_screen->connection());
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 2e19cf2..99b72a0 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -73,8 +73,6 @@ private:
QPlatformWindowFormat m_windowFormat;
QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context);
- static QMutex m_defaultSharedContextMutex;
- static void createDefaultSharedContext(QXcbScreen *xd);
};
#endif
diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp
index 6746e22..7a0f36d 100644
--- a/src/plugins/platforms/xlib/qglxintegration.cpp
+++ b/src/plugins/platforms/xlib/qglxintegration.cpp
@@ -61,8 +61,6 @@
QT_BEGIN_NAMESPACE
-QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive);
-
QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format)
: QPlatformGLContext()
, m_screen(screen)
@@ -71,20 +69,7 @@ QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWind
{
const QPlatformGLContext *sharePlatformContext;
- if (format.useDefaultSharedContext()) {
- if (!QPlatformGLContext::defaultSharedContext()) {
- if (m_defaultSharedContextMutex.tryLock()){
- createDefaultSharedContext(screen);
- m_defaultSharedContextMutex.unlock();
- } else {
- m_defaultSharedContextMutex.lock(); //wait to the the shared context is created
- m_defaultSharedContextMutex.unlock();
- }
- }
- sharePlatformContext = QPlatformGLContext::defaultSharedContext();
- } else {
- sharePlatformContext = format.sharedGLContext();
- }
+ sharePlatformContext = format.sharedGLContext();
GLXContext shareGlxContext = 0;
if (sharePlatformContext)
shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext();
@@ -112,33 +97,6 @@ QGLXContext::~QGLXContext()
}
}
-void QGLXContext::createDefaultSharedContext(QXlibScreen *screen)
-{
- int x = 0;
- int y = 0;
- int w = 3;
- int h = 3;
-
- QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat();
- GLXContext context;
- GLXFBConfig config = qglx_findConfig(screen->display()->nativeDisplay(),screen->xScreenNumber(),format);
- if (config) {
- XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display()->nativeDisplay(),config);
- Colormap cmap = XCreateColormap(screen->display()->nativeDisplay(),screen->rootWindow(),visualInfo->visual,AllocNone);
- XSetWindowAttributes a;
- a.colormap = cmap;
- Window sharedWindow = XCreateWindow(screen->display()->nativeDisplay(), screen->rootWindow(),x, y, w, h,
- 0, visualInfo->depth, InputOutput, visualInfo->visual,
- CWColormap, &a);
-
- context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,0,TRUE);
- QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context);
- QPlatformGLContext::setDefaultSharedContext(sharedContext);
- } else {
- qWarning("Warning no shared context created");
- }
-}
-
void QGLXContext::makeCurrent()
{
QPlatformGLContext::makeCurrent();
diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h
index cf6b006..57c716b 100644
--- a/src/plugins/platforms/xlib/qglxintegration.h
+++ b/src/plugins/platforms/xlib/qglxintegration.h
@@ -76,8 +76,6 @@ private:
QPlatformWindowFormat m_windowFormat;
QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context);
- static QMutex m_defaultSharedContextMutex;
- static void createDefaultSharedContext(QXlibScreen *xd);
};
QT_END_NAMESPACE