diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-13 06:49:52 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-13 07:45:00 (GMT) |
commit | 3ba6c3b7a4261147addc1d7fb06060dae7522691 (patch) | |
tree | cded7ec5f02e5f6ea082110185c6da2e03d514e9 /src/plugins/platforms/xcb | |
parent | 0108e888480e47e65d82d94e10a7c7c910e42d79 (diff) | |
download | Qt-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/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.cpp | 46 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.h | 2 |
2 files changed, 1 insertions, 47 deletions
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 |