diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-08 01:00:08 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-08 01:00:08 +0200 |
commit | 2b38408cbc23816034f087779d351f4db2ee4b1b (patch) | |
tree | c97a6881875331c7ef4b9aecf896434071382a46 /src | |
parent | 0ea7360eaa70c2b024a37b2ff9106531440cdee7 (diff) | |
parent | 36cc171b9314bf77fc84d4273dceb6264aef7134 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qmutexpool.cpp | 9 | ||||
-rw-r--r-- | src/corelib/thread/qmutexpool_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qsurface.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 1 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfswindow_p.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/wasm/qwasmintegration.cpp | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 24 |
12 files changed, 39 insertions, 25 deletions
diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 3f9e8da942..bb063b8ab6 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -104,7 +104,7 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) QMutexPool::~QMutexPool() { for (int index = 0; index < mutexes.count(); ++index) - delete mutexes[index].load(); + delete mutexes[index].loadAcquire(); } /*! @@ -129,9 +129,12 @@ QMutex *QMutexPool::createMutex(int index) { // mutex not created, create one QMutex *newMutex = new QMutex(recursionMode); - if (!mutexes[index].testAndSetRelease(0, newMutex)) + if (!mutexes[index].testAndSetRelease(nullptr, newMutex)) { delete newMutex; - return mutexes[index].load(); + return mutexes[index].loadAcquire(); + } else { + return newMutex; + } } /*! diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 89d006ac29..00710199b8 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -68,7 +68,7 @@ public: inline QMutex *get(const void *address) { int index = uint(quintptr(address)) % mutexes.count(); - QMutex *m = mutexes[index].load(); + QMutex *m = mutexes[index].loadAcquire(); if (m) return m; else diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index e56fe2c6ae..5c7642c26e 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -99,6 +99,8 @@ void qt_create_tls() return; static QBasicMutex mutex; QMutexLocker locker(&mutex); + if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES) + return; qt_current_thread_data_tls_index = TlsAlloc(); } diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index b677afc526..3d9f1309c9 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -976,11 +976,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (!surface->surfaceHandle()) return false; if (!surface->supportsOpenGL()) { -#ifndef Q_OS_WASM // ### work around the WASM platform plugin using QOpenGLContext with raster surfaces. - // see QTBUG-70076 qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface; return false; -#endif } if (!d->platformGLContext->makeCurrent(surface->surfaceHandle())) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 490cfc6178..b3d3db0751 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -244,6 +244,9 @@ QPlatformServices *QPlatformIntegration::services() const \value TopStackedNativeChildWindows The platform supports native child windows via QWindowContainer without having to punch a transparent hole in the backingstore. (since 5.10) + + \value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current + in combination with a QWindow of type RasterSurface. */ /*! diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 389b35dbc0..a3594042ce 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -105,7 +105,8 @@ public: AllGLFunctionsQueryable, ApplicationIcon, SwitchableWidgetComposition, - TopStackedNativeChildWindows + TopStackedNativeChildWindows, + OpenGLOnRasterSurface }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp index 415e64b39c..709f28d431 100644 --- a/src/gui/kernel/qsurface.cpp +++ b/src/gui/kernel/qsurface.cpp @@ -39,6 +39,8 @@ #include "qsurface.h" #include "qopenglcontext.h" +#include <qpa/qplatformintegration.h> +#include <QtGui/private/qguiapplication_p.h> QT_BEGIN_NAMESPACE @@ -103,6 +105,10 @@ QT_BEGIN_NAMESPACE bool QSurface::supportsOpenGL() const { SurfaceType type = surfaceType(); + if (type == RasterSurface) { + QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration(); + return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface); + } return type == OpenGLSurface || type == RasterGLSurface; } diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index c8a1ddf9b9..674f579b4f 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -265,6 +265,7 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons case RasterGLSurface: return false; #endif case WindowManagement: return false; + case OpenGLOnRasterSurface: return true; default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index c1d5af47aa..1fed182882 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -64,7 +64,6 @@ QEglFSWindow::QEglFSWindow(QWindow *w) m_backingStore(0), m_rasterCompositingContext(0), #endif - m_raster(false), m_winId(0), m_surface(EGL_NO_SURFACE), m_window(0), @@ -94,11 +93,6 @@ void QEglFSWindow::create() m_winId = newWId(); - // Save the original surface type before changing to OpenGLSurface. - m_raster = (window()->surfaceType() == QSurface::RasterSurface); - if (m_raster) // change to OpenGL, but not for RasterGLSurface - window()->setSurfaceType(QSurface::OpenGLSurface); - if (window()->type() == Qt::Desktop) { QRect fullscreenRect(QPoint(), screen()->availableGeometry().size()); QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect); @@ -329,7 +323,8 @@ QEglFSScreen *QEglFSWindow::screen() const bool QEglFSWindow::isRaster() const { - return m_raster || window()->surfaceType() == QSurface::RasterGLSurface; + const QWindow::SurfaceType type = window()->surfaceType(); + return type == QSurface::RasterSurface || type == QSurface::RasterGLSurface; } #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h index b0091e2a62..be2a0630d3 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h @@ -118,7 +118,6 @@ protected: QOpenGLCompositorBackingStore *m_backingStore; QOpenGLContext *m_rasterCompositingContext; #endif - bool m_raster; WId m_winId; EGLSurface m_surface; diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 116612c286..1e9f68027c 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -168,6 +168,7 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm case MultipleWindows: return true; case WindowManagement: return true; + case OpenGLOnRasterSurface: return true; default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 0481dffda8..c51527f8bc 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -76,6 +76,11 @@ extern QRegion qt_dirtyRegion(QWidget *); Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList) #endif +static bool hasPlatformWindow(QWidget *widget) +{ + return widget && widget->windowHandle() && widget->windowHandle()->handle(); +} + /** * Flushes the contents of the \a backingStore into the screen area of \a widget. * \a region is the region to be updated in \a widget coordinates. @@ -198,7 +203,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa QRegion paintRegion = toBePainted; QRect widgetRect = widget->rect(); - if (!widget->internalWinId()) { + if (!hasPlatformWindow(widget)) { QWidget *nativeParent = widget->nativeParentWidget(); const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0)); paintRegion.translate(offset); @@ -654,7 +659,7 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg } // Alien widgets. - if (!widget->internalWinId() && !widget->isWindow()) { + if (!hasPlatformWindow(widget) && !widget->isWindow()) { QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case). if (nativeParent == tlw) { if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) @@ -784,7 +789,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) destRect = destRect.translated(dx, dy).intersected(clipR); const QRect sourceRect(destRect.translated(-dx, -dy)); const QRect parentRect(rect & clipR); - const bool nativeWithTextureChild = textureChildSeen && q->internalWinId(); + const bool nativeWithTextureChild = textureChildSeen && hasPlatformWindow(q); const bool accelerateMove = accelEnv && isOpaque && !nativeWithTextureChild #if QT_CONFIG(graphicsview) @@ -952,9 +957,9 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo for (int i = 0; i < wd->children.size(); ++i) { QWidget *w = qobject_cast<QWidget *>(wd->children.at(i)); // Stop at native widgets but store them. Stop at hidden widgets too. - if (w && !w->isWindow() && w->internalWinId()) + if (w && !w->isWindow() && hasPlatformWindow(w)) nativeChildren->append(w); - if (w && !w->isWindow() && !w->internalWinId() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) + if (w && !w->isWindow() && !hasPlatformWindow(w) && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) findTextureWidgetsRecursively(tlw, w, widgetTextures, nativeChildren); } } @@ -985,7 +990,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) Q_ASSERT(!tl->isEmpty()); for (int i = 0; i < tl->count(); ++i) { QWidget *w = static_cast<QWidget *>(tl->source(i)); - if ((w->internalWinId() && w == widget) || (!w->internalWinId() && w->nativeParentWidget() == widget)) + if ((hasPlatformWindow(w) && w == widget) || (!hasPlatformWindow(w) && w->nativeParentWidget() == widget)) return tl; } } @@ -1096,7 +1101,8 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize) return; - if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped) + if (!exposedWidget || !hasPlatformWindow(exposedWidget) + || !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped) || !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) { return; } @@ -1269,8 +1275,8 @@ void QWidgetBackingStore::doSync() w->d_func()->sendPaintEvent(w->rect()); if (w != tlw) { QWidget *npw = w->nativeParentWidget(); - if (w->internalWinId() || (npw && npw != tlw)) { - if (!w->internalWinId()) + if (hasPlatformWindow(w) || (npw && npw != tlw)) { + if (!hasPlatformWindow(w)) w = npw; QWidgetPrivate *wPrivate = w->d_func(); if (!wPrivate->needsFlush) |