From 99b5a05cf2a83cceb361e510e935902a943885f8 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 2 Oct 2009 08:55:46 +1000 Subject: Remove unnecessary function definition: qt_qgl_egl_display() The qt_qgl_egl_display() function no longer exists. Reviewed-by: trustme --- src/opengl/qgl_p.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 9b09c7c..6b7e892 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -490,8 +490,6 @@ private: #ifdef Q_WS_QWS extern QPaintEngine* qt_qgl_paint_engine(); - -extern EGLDisplay qt_qgl_egl_display(); #endif bool qt_gl_preferGL2Engine(); -- cgit v0.12 From 6ca9ba3b67695e18c1c57176d5d8849547517199 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 2 Oct 2009 10:23:46 +1000 Subject: Remove unnecessary reference to QGLContextGroup::extensionFuncs() Reviewed-by: Andrew den Exter --- src/opengl/qgl_p.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 6b7e892..991c948 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -343,13 +343,11 @@ public: #ifdef Q_WS_WIN static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); } - static inline QGLExtensionFuncs& extensionFuncs(QGLContextGroup *ctx) { return ctx->extensionFuncs(); } #endif #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) static QGLExtensionFuncs qt_extensionFuncs; static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } - static inline QGLExtensionFuncs& extensionFuncs(QGLContextGroup *) { return qt_extensionFuncs; } #endif static void setCurrentContext(QGLContext *context); -- cgit v0.12 From 53b3a0572242d0a425e74848afba1293f195d29b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 2 Oct 2009 10:31:39 +1000 Subject: Fix support for 32-bit PowerVR screens with QGraphicsView When QGLWidget was used as a viewport for QGraphicsView, it was still treating the window surface as RGB16. Use the screen's actual pixel format. Also ensure that PvrEglWindowSurface::image() returns a non-null QImage if the drawable hasn't been created yet. Reviewed-by: trustme --- .../gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 3698afd..afee77e 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -157,18 +157,21 @@ QImage PvrEglWindowSurface::image() const void *data = pvrQwsGetRenderBuffer(drawable); if (data) { return QImage((uchar *)data, pvrRect.width, pvrRect.height, - pvrQwsGetStride(drawable), QImage::Format_RGB16); + pvrQwsGetStride(drawable), screen->pixelFormat()); } } - return QImage(); + return QImage(16, 16, screen->pixelFormat()); } QPaintDevice *PvrEglWindowSurface::paintDevice() { - // Return a dummy paint device because the widget itself - // cannot be painted to this way. + QGLWidget *glWidget = qobject_cast(window()); + if (glWidget) + return glWidget; + + // Should be a QGLWidget, but if not return a dummy paint device. if (!pdevice) - pdevice = new QImage(50, 50, QImage::Format_RGB16); + pdevice = new QImage(50, 50, screen->pixelFormat()); return pdevice; } -- cgit v0.12 From ad90350d0ba3971591554f871ec17544be414038 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 2 Oct 2009 11:38:10 +1000 Subject: Remove QHash overhead from QGLShareRegister Move the list of shared contexts from QGLShareRegister into QGLContextGroup. There is then no need for the QHash. Reviewed-by: trustme --- src/opengl/qgl.cpp | 40 ++++++++++++++++++---------------------- src/opengl/qgl_p.h | 8 ++------ 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 665290c..0402268 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4860,44 +4860,40 @@ void QGLShareRegister::addShare(const QGLContext *context, const QGLContext *sha return; // Make sure 'context' is not already shared with another group of contexts. - Q_ASSERT(reg.find(context->d_ptr->group) == reg.end()); Q_ASSERT(context->d_ptr->group->m_refs == 1); // Free 'context' group resources and make it use the same resources as 'share'. + QGLContextGroup *group = share->d_ptr->group; delete context->d_ptr->group; - context->d_ptr->group = share->d_ptr->group; - context->d_ptr->group->m_refs.ref(); + context->d_ptr->group = group; + group->m_refs.ref(); // Maintain a list of all the contexts in each group of sharing contexts. - SharingHash::iterator it = reg.find(share->d_ptr->group); - if (it == reg.end()) - it = reg.insert(share->d_ptr->group, ContextList() << share); - it.value() << context; + // The list is empty if the "share" context wasn't sharing already. + if (group->m_shares.isEmpty()) + group->m_shares.append(share); + group->m_shares.append(context); } QList QGLShareRegister::shares(const QGLContext *context) { - SharingHash::const_iterator it = reg.find(context->d_ptr->group); - if (it == reg.end()) - return ContextList(); - return it.value(); + return context->d_ptr->group->m_shares; } void QGLShareRegister::removeShare(const QGLContext *context) { - SharingHash::iterator it = reg.find(context->d_ptr->group); - if (it == reg.end()) + // Remove the context from the group. + QGLContextGroup *group = context->d_ptr->group; + if (group->m_shares.isEmpty()) return; - - int count = it.value().removeAll(context); - Q_ASSERT(count == 1); - Q_UNUSED(count); + group->m_shares.removeAll(context); // Update context group representative. - if (context->d_ptr->group->m_context == context) - context->d_ptr->group->m_context = it.value().first(); + Q_ASSERT(group->m_shares.size() != 0); + if (group->m_context == context) + group->m_context = group->m_shares[0]; - Q_ASSERT(it.value().size() != 0); - if (it.value().size() == 1) - reg.erase(it); + // If there is only one context left, then make the list empty. + if (group->m_shares.size() == 1) + group->m_shares.clear(); } QGLContextResource::QGLContextResource(FreeFunc f, QObject *parent) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 991c948..1957429 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -233,6 +233,7 @@ private: QGLExtensionFuncs m_extensionFuncs; const QGLContext *m_context; // context group's representative + QList m_shares; QAtomicInt m_refs; friend class QGLShareRegister; @@ -401,16 +402,11 @@ class Q_AUTOTEST_EXPORT QGLShareRegister { public: QGLShareRegister() {} - ~QGLShareRegister() { reg.clear(); } + ~QGLShareRegister() {} void addShare(const QGLContext *context, const QGLContext *share); QList shares(const QGLContext *context); void removeShare(const QGLContext *context); -private: - // Use a context's 'group' pointer to uniquely identify a group. - typedef QList ContextList; - typedef QHash SharingHash; - SharingHash reg; }; extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg(); -- cgit v0.12