From 0b984e141bff9ae760efa0e81a9f106093552538 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 12 Aug 2019 10:58:06 +0200 Subject: Bound the scope of QTRY_LOOP_IMPL()'s local variable QTRY_IMPL() exercises QTRY_LOOP_IMPL() twice, once directly, the second time via QTRY_TIMEOUT_DEBUG_IMPL(); and QTRY_LOOP_IMPL() deliberately doesn't bound its scope (e.g. with the canonical do{...}while(0) trick) so that the latter can access its local variable. Unfortunately, this means the local's declaration in the second use of QTRY_LOOP_IMPL() shadows the first. So enclose the first in braces to bound the scope. Fixes: QTBUG-77297 Change-Id: I849bfe0b8abfb517ed3e783abf86c602163db137 Reviewed-by: Marc Mutz --- src/testlib/qtestcase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 5fed9d6bcc..6e865f1278 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -152,7 +152,7 @@ do {\ #define QTRY_IMPL(expr, timeout)\ const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \ const int qt_test_timeoutValue = timeout; \ - QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \ + { QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); } \ QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\ // Will try to wait for the expression to become true while allowing event processing -- cgit v1.2.3 From 63abcfcade946e64ea1c1213259cab8e2ad2df81 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 5 Aug 2019 13:11:22 +0200 Subject: Make our connection-level window half of a possible maximum Some servers seem to be unable to properly calculate our window size from a delta we send via WINDOW_UPDATE frame immediately after our client preface and the SETTINGS frame. The remote replies with a GOAWAY frame blaming flow control error. Guessing what's this magic number they use seems to be not feasible, we now use a half of what we had before. Fixes: QTBUG-77308 Change-Id: I41dacfd25a395a27003f330d01b6d8d60b8f407c Reviewed-by: Edward Welbourne Reviewed-by: Volker Hilsheimer --- src/network/access/http2/http2protocol_p.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/network/access/http2/http2protocol_p.h b/src/network/access/http2/http2protocol_p.h index f7a89859d3..7142d6f1fa 100644 --- a/src/network/access/http2/http2protocol_p.h +++ b/src/network/access/http2/http2protocol_p.h @@ -168,8 +168,10 @@ struct Q_AUTOTEST_EXPORT ProtocolParameters bool indexStrings = true; // This parameter is not negotiated via SETTINGS frames, so we have it - // as a member and will convey it to our peer as a WINDOW_UPDATE frame: - qint32 maxSessionReceiveWindowSize = Http2::maxSessionReceiveWindowSize; + // as a member and will convey it to our peer as a WINDOW_UPDATE frame. + // Note, some servers do not accept our WINDOW_UPDATE from the default + // 64 KB to the possible maximum. Let's use a half of it: + qint32 maxSessionReceiveWindowSize = Http2::maxSessionReceiveWindowSize / 2; // This is our default SETTINGS frame: // -- cgit v1.2.3 From 5322998a0ba80b1e095340245ddb00aaf5947be9 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 13 Aug 2019 12:11:40 +0200 Subject: Limit curve stroking threshold to reasonable range Avoid unreasonable threshold values for extremely wide pens, since that can lead to a very high processing cost. The rare usecases where this would make a noticeable difference will necessarily also be using scaling, and so is anyway depending on setting a suitable curve threshold manually. Fixes: QTBUG-77241 Change-Id: I27cea7d566d144389bb430739fde4f6033c4a28c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qstroker_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 59e4cc6a7b..7df766e9a3 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -209,7 +209,7 @@ public: QStroker(); ~QStroker(); - void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(width > 4 ? 1.0/width : 0.25); } + void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(qBound(0.025, 1.0/width, 0.25)); } qfixed strokeWidth() const { return m_strokeWidth; } void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); } -- cgit v1.2.3 From 4bab72368f84840134bebcb1f19fb7c8299ef7ba Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 8 Aug 2019 15:02:08 +0200 Subject: glx: Do not flood with warnings when reducing during config lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With things like sample count reducing a format (16 -> 8 -> 4 -> ...) and trying again is perfectly fine. There is no need to show warnings in this case. Even some of our own examples in qtdeclarative do a setSamples(16) which is rarely supported. These all show warnings since 8ec98fc2dc40237730f99af099dffe2920ef5bcc. Avoid this. Change-Id: Ice83d5720b02e92f77cfd63918c98ad222513b6a Reviewed-by: Christian Strømme --- src/platformsupport/glxconvenience/qglxconvenience.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp index 6bd73de8f3..ef413ba98d 100644 --- a/src/platformsupport/glxconvenience/qglxconvenience.cpp +++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp @@ -258,9 +258,11 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format qCDebug(lcGlx) << "qglx_findConfig: Found non-matching but compatible FBConfig"; return compatibleCandidate; } - qCWarning(lcGlx, "qglx_findConfig: Failed to finding matching FBConfig (%d %d %d %d)", requestedRed, requestedGreen, requestedBlue, requestedAlpha); } while (qglx_reduceFormat(&format)); + if (!config) + qCWarning(lcGlx) << "qglx_findConfig: Failed to finding matching FBConfig for" << format; + return config; } -- cgit v1.2.3 From 3d56572fe7c5111aa984e358d3c9a8c41ae87e56 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 2 Nov 2018 12:40:26 +0100 Subject: Include buildAbi() in the shader cache directory name Task-number: QTBUG-64697 Change-Id: I8b81bce94c50464105a9a43086b06b841e4b8551 Reviewed-by: Friedemann Kleint --- src/gui/opengl/qopenglprogrambinarycache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 7029cd5455..af48cdacc7 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -40,6 +40,7 @@ #include "qopenglprogrambinarycache_p.h" #include #include +#include #include #include #include @@ -102,7 +103,7 @@ static inline bool qt_ensureWritableDir(const QString &name) QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache() : m_cacheWritable(false) { - const QString subPath = QLatin1String("/qtshadercache/"); + const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + QLatin1Char('/'); const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); if (!sharedCachePath.isEmpty()) { m_cacheDir = sharedCachePath + subPath; -- cgit v1.2.3 From 1be4f6c32c9846a2343f94628ba9704cf22ec5b1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 5 Nov 2018 15:57:22 +0100 Subject: Avoid querying unknown RESET_NOTIFICATION_STRATEGY value on GL < 4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-55759 Change-Id: Ie2758859a6862a214691a5011761bf549a31a93e Reviewed-by: Christian Strømme --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 11 +++++++---- .../xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index e95eaef420..1063432dcc 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -876,10 +876,6 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() result.options |= QSurfaceFormat::DeprecatedFunctions; if (value & GL_CONTEXT_FLAG_DEBUG_BIT) result.options |= QSurfaceFormat::DebugContext; - value = 0; - QOpenGLStaticContext::opengl32.glGetIntegerv(RESET_NOTIFICATION_STRATEGY_ARB, &value); - if (value == LOSE_CONTEXT_ON_RESET_ARB) - result.options |= QSurfaceFormat::ResetNotification; if (result.version < 0x0302) return result; // v3.2 onwards: Profiles @@ -889,6 +885,13 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() result.profile = QSurfaceFormat::CoreProfile; else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) result.profile = QSurfaceFormat::CompatibilityProfile; + if (result.version < 0x0400) + return result; + // v4.0 onwards + value = 0; + QOpenGLStaticContext::opengl32.glGetIntegerv(RESET_NOTIFICATION_STRATEGY_ARB, &value); + if (value == LOSE_CONTEXT_ON_RESET_ARB) + result.options |= QSurfaceFormat::ResetNotification; return result; } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index f26f698e76..5e5fefca90 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -163,10 +163,12 @@ static void updateFormatFromContext(QSurfaceFormat &format) format.setOption(QSurfaceFormat::StereoBuffers); if (format.renderableType() == QSurfaceFormat::OpenGL) { - GLint value = 0; - glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &value); - if (value == GL_LOSE_CONTEXT_ON_RESET_ARB) - format.setOption(QSurfaceFormat::ResetNotification); + if (format.version() >= qMakePair(4, 0)) { + GLint value = 0; + glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &value); + if (value == GL_LOSE_CONTEXT_ON_RESET_ARB) + format.setOption(QSurfaceFormat::ResetNotification); + } if (format.version() < qMakePair(3, 0)) { format.setOption(QSurfaceFormat::DeprecatedFunctions); @@ -175,7 +177,7 @@ static void updateFormatFromContext(QSurfaceFormat &format) // Version 3.0 onwards - check if it includes deprecated functionality or is // a debug context - value = 0; + GLint value = 0; glGetIntegerv(GL_CONTEXT_FLAGS, &value); if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) format.setOption(QSurfaceFormat::DeprecatedFunctions); -- cgit v1.2.3 From 052ea993ad499c9065ac1180b706337ff8a0a2c7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Aug 2019 15:13:01 +0200 Subject: Add the detection of MSVC 2019 for QLibraryInfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie3ea1cdae60bf0d7dd89a0ab84146c8370559a29 Reviewed-by: Jörg Bornemann --- src/corelib/global/qlibraryinfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d19e54154e..c0a5369cdd 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -322,8 +322,10 @@ QLibraryInfo::buildDate() #elif defined(Q_CC_MSVC) # if _MSC_VER < 1910 # define COMPILER_STRING "MSVC 2015" -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1917 # define COMPILER_STRING "MSVC 2017" +# elif _MSC_VER < 2000 +# define COMPILER_STRING "MSVC 2019" # else # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER) # endif -- cgit v1.2.3 From 0d024bd0a63fa7a741f4f118a3b48806b695594f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 23 Apr 2019 22:08:30 -0700 Subject: QSysInfo: Use the Apple IOKit API to get the machine's UUID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns out that kern.uuid is not as unique as we thought. Googling for mine finds other instances of the same being used. Fixes: QTBUG-75371 Change-Id: I95ecabe2f50e450c991afffd159850cc975ec0da Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qglobal.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 555b04dcd5..01f534cc0f 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -88,6 +88,11 @@ # include #endif +#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE() +# include +# include +#endif + #ifdef Q_OS_UNIX #include #include @@ -2907,20 +2912,19 @@ enum { */ QByteArray QSysInfo::machineUniqueId() { -#ifdef Q_OS_BSD4 +#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE() + char uuid[UuidStringLen + 1]; + io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +#elif defined(Q_OS_BSD4) && defined(KERN_HOSTUUID) char uuid[UuidStringLen + 1]; size_t uuidlen = sizeof(uuid); -# ifdef KERN_HOSTUUID int name[] = { CTL_KERN, KERN_HOSTUUID }; if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) return QByteArray(uuid, uuidlen - 1); - -# else - // Darwin: no fixed value, we need to search by name - if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) - return QByteArray(uuid, uuidlen - 1); -# endif #elif defined(Q_OS_UNIX) // The modern name on Linux is /etc/machine-id, but that path is // unlikely to exist on non-Linux (non-systemd) systems. The old -- cgit v1.2.3