From 29d8159c4478a5275d2ea102daf270a91ed7e92e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 29 Jan 2016 10:43:35 +0100 Subject: Avoid repeated QByteArray creation when resolving opengl functions Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs Reviewed-by: Sean Harmer --- src/plugins/platforms/mirclient/qmirclientglcontext.cpp | 4 ++-- src/plugins/platforms/mirclient/qmirclientglcontext.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/mirclient') diff --git a/src/plugins/platforms/mirclient/qmirclientglcontext.cpp b/src/plugins/platforms/mirclient/qmirclientglcontext.cpp index e1e7727486..7a288af6ff 100644 --- a/src/plugins/platforms/mirclient/qmirclientglcontext.cpp +++ b/src/plugins/platforms/mirclient/qmirclientglcontext.cpp @@ -143,12 +143,12 @@ void QMirClientOpenGLContext::swapBuffers(QPlatformSurface* surface) ubuntuWindow->onSwapBuffersDone(); } -void (*QMirClientOpenGLContext::getProcAddress(const QByteArray& procName)) () +QFunctionPointer QMirClientOpenGLContext::getProcAddress(const char *procName) { #if defined(QT_NO_DEBUG) eglBindAPI(api_in_use()); #else ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); #endif - return eglGetProcAddress(procName.constData()); + return eglGetProcAddress(procName); } diff --git a/src/plugins/platforms/mirclient/qmirclientglcontext.h b/src/plugins/platforms/mirclient/qmirclientglcontext.h index 29c196ce5c..9278cc7beb 100644 --- a/src/plugins/platforms/mirclient/qmirclientglcontext.h +++ b/src/plugins/platforms/mirclient/qmirclientglcontext.h @@ -53,7 +53,7 @@ public: bool makeCurrent(QPlatformSurface* surface) override; void doneCurrent() override; bool isValid() const override { return mEglContext != EGL_NO_CONTEXT; } - void (*getProcAddress(const QByteArray& procName)) () override; + QFunctionPointer getProcAddress(const char *procName) override; EGLContext eglContext() const { return mEglContext; } -- cgit v1.2.3 From 5e9a5246fb688a33ff27bed010226595f579f23d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 2 Feb 2016 12:50:33 +0100 Subject: Ensure we can query all GL functions in all platform plugins This is required to simplify our code in the opengl classes and makes it possible to remove OS dependent code paths in Qt Gui. Change-Id: Ice09440840c86b2d6ac8d3955d273846695338d4 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/mirclient/qmirclientglcontext.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/mirclient') diff --git a/src/plugins/platforms/mirclient/qmirclientglcontext.cpp b/src/plugins/platforms/mirclient/qmirclientglcontext.cpp index 7a288af6ff..b1ca0b1f7c 100644 --- a/src/plugins/platforms/mirclient/qmirclientglcontext.cpp +++ b/src/plugins/platforms/mirclient/qmirclientglcontext.cpp @@ -40,6 +40,7 @@ #include "qmirclientlogging.h" #include #include +#include #if !defined(QT_NO_DEBUG) static void printOpenGLESConfig() { @@ -150,5 +151,8 @@ QFunctionPointer QMirClientOpenGLContext::getProcAddress(const char *procName) #else ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); #endif - return eglGetProcAddress(procName); + QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); + return proc; } -- cgit v1.2.3 From a28364bc1c7144b9c5c383cc5d18d62a68076a38 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:03:42 +0100 Subject: consistently put {qt,qml}_{module,plugin} at the end of project files this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/mirclient/mirclient.pro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/mirclient') diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 0851e8d719..4ea5593478 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,11 +1,6 @@ TARGET = mirclient TEMPLATE = lib -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = MirServerIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private dbus CONFIG += qpa/genericunixfontdatabase @@ -47,3 +42,8 @@ HEADERS = \ qmirclientscreen.h \ qmirclienttheme.h \ qmirclientwindow.h + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = MirServerIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) -- cgit v1.2.3 From fab4ac60c95ff3dc72339554c289a58f931f6649 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:04:28 +0100 Subject: remove redundant TEMPLATE assignment qt_plugin.prf does that already. Change-Id: Ia0329c3b508c86c2b71782a4e9744cfda528559a Reviewed-by: Simon Hausmann --- src/plugins/platforms/mirclient/mirclient.pro | 1 - 1 file changed, 1 deletion(-) (limited to 'src/plugins/platforms/mirclient') diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 4ea5593478..8c1ac02703 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,5 +1,4 @@ TARGET = mirclient -TEMPLATE = lib QT += core-private gui-private platformsupport-private dbus -- cgit v1.2.3 From cadfae0f9da2c458186b453138cf493b6efbb856 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:05:09 +0100 Subject: fix mir platform plugin name all platform plugins are supposed to start with a q. Change-Id: I4871cc553995aa68a09f8f045bdd378f5022cd87 Reviewed-by: Simon Hausmann Reviewed-by: aavit --- src/plugins/platforms/mirclient/mirclient.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/mirclient') diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 8c1ac02703..d5d35f1632 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,4 +1,4 @@ -TARGET = mirclient +TARGET = qmirclient QT += core-private gui-private platformsupport-private dbus -- cgit v1.2.3 From 6417bbde8565e0be2d049426b71e6fda538e4440 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 17 Oct 2015 17:48:34 +0200 Subject: QtBase (remainder): use printf-style qWarning/qDebug where possible (I) The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Had to fix broken qImDebug() definition. Instead of defining it as a nullary macro in the QT_NO_DEBUG case and as a variadic macro in the other, define it in both cases, as is customary, as a non-function macro so that overload selection works without requiring variadic macro support of the compiler. Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3 AMD64 builds. Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f Reviewed-by: Kai Koehne --- src/plugins/platforms/mirclient/qmirclientinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/mirclient') diff --git a/src/plugins/platforms/mirclient/qmirclientinput.cpp b/src/plugins/platforms/mirclient/qmirclientinput.cpp index addeda634c..3af714465b 100644 --- a/src/plugins/platforms/mirclient/qmirclientinput.cpp +++ b/src/plugins/platforms/mirclient/qmirclientinput.cpp @@ -214,7 +214,7 @@ void QMirClientInput::customEvent(QEvent* event) const MirEvent *nativeEvent = ubuntuEvent->nativeEvent; if ((ubuntuEvent->window == nullptr) || (ubuntuEvent->window->window() == nullptr)) { - qWarning() << "Attempted to deliver an event to a non-existent window, ignoring."; + qWarning("Attempted to deliver an event to a non-existent window, ignoring."); return; } -- cgit v1.2.3