Merge remote-tracking branch 'origin/5.12' into 5.13

Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
This commit is contained in:
Qt Forward Merge Bot 2019-08-08 01:00:08 +02:00
commit 2b38408cbc
14 changed files with 39 additions and 31 deletions

View File

@ -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;
}
}
/*!

View File

@ -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

View File

@ -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();
}

View File

@ -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()))

View File

@ -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.
*/
/*!

View File

@ -105,7 +105,8 @@ public:
AllGLFunctionsQueryable,
ApplicationIcon,
SwitchableWidgetComposition,
TopStackedNativeChildWindows
TopStackedNativeChildWindows,
OpenGLOnRasterSurface
};
virtual ~QPlatformIntegration() { }

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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

View File

@ -118,7 +118,6 @@ protected:
QOpenGLCompositorBackingStore *m_backingStore;
QOpenGLContext *m_rasterCompositingContext;
#endif
bool m_raster;
WId m_winId;
EGLSurface m_surface;

View File

@ -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);
}
}

View File

@ -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 &region, 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)

View File

@ -1,3 +0,0 @@
See qtbase/src/testlib/qtestblacklist.cpp for format
[connectToHost]
*

View File

@ -649,9 +649,6 @@ void tst_Http2::connectToHost()
eventLoop.exitLoop();
QCOMPARE(reply->error(), QNetworkReply::NoError);
QVERIFY(reply->isFinished());
// Nothing must be sent yet:
QVERIFY(!prefaceOK);
QVERIFY(!serverGotSettingsACK);
// Nothing received back:
QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull());
QCOMPARE(reply->readAll().size(), 0);