Introduce new platform capability ThreadedOpenGL.

Lets the platform plugin advertise whether it's safe to use OpenGL from
a different thread. With XCB we only advertise this if we have a
reasonably new XCB libary, as older versions suffer from the
xcb_wait_for_reply() blocking bug, which cause GL rendering in a
separate to stall when using Mesa drivers.

Change-Id: I4829df7e583a1c8aed218ae13a159d21266cc594
Reviewed-on: http://codereview.qt.nokia.com/3613
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Samuel Rødal 2011-08-25 20:19:44 +02:00 committed by Lars Knoll
parent 794c81c1ea
commit 5a23825f01
7 changed files with 18 additions and 1 deletions

View File

@ -69,7 +69,8 @@ class Q_GUI_EXPORT QPlatformIntegration
public:
enum Capability {
ThreadedPixmaps = 1,
OpenGL = 2
OpenGL = 2,
ThreadedOpenGL = 3
};
virtual ~QPlatformIntegration() { }

View File

@ -103,6 +103,7 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
switch (cap) {
case ThreadedPixmaps: return true;
case OpenGL : return true;
case ThreadedOpenGL : return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}

View File

@ -70,6 +70,8 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
{
switch (cap) {
case ThreadedPixmaps: return true;
case OpenGL: return true;
case ThreadedOpenGL: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}

View File

@ -86,6 +86,7 @@ bool QKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const
switch (cap) {
case ThreadedPixmaps: return true;
case OpenGL: return true;
case ThreadedOpenGL: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}

View File

@ -89,6 +89,8 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
#else
return false;
#endif
case ThreadedOpenGL:
return hasCapability(OpenGL);
default: return QPlatformIntegration::hasCapability(cap);
}
}

View File

@ -167,6 +167,10 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
switch (cap) {
case ThreadedPixmaps:
return true;
case OpenGL:
return true;
case ThreadedOpenGL:
return true;
default:
return QPlatformIntegration::hasCapability(cap);
}

View File

@ -159,6 +159,12 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
switch (cap) {
case ThreadedPixmaps: return true;
case OpenGL: return true;
case ThreadedOpenGL:
#ifdef XCB_POLL_FOR_QUEUED_EVENT
return true;
#else
return false;
#endif
default: return QPlatformIntegration::hasCapability(cap);
}
}