Skip to content

Commit

Permalink
QNX: Add support for lgmon
Browse files Browse the repository at this point in the history
Added configure test, whether lgmon (liquid graphics performance monitor)
is available. The test is supposed to be positive only for internal
BlackBerry NDKs currently.
Added calls to initialize lgmon and to indicate when an app is ready for
user input.

Change-Id: I5cbc29fb38a86585dcebd14d462436deaa1998aa
Reviewed-by: Wolfgang Bremer <[email protected]>
Reviewed-by: Fabian Bumberger <[email protected]>
Reviewed-by: Rafael Roquetto <[email protected]>
Reviewed-by: Kevin Krammer <[email protected]>
  • Loading branch information
Bernd Weimer authored and The Qt Project committed Feb 14, 2014
1 parent 85e5765 commit fa8e6d5
Show file tree
Hide file tree
Showing 13 changed files with 250 additions and 11 deletions.
49 changes: 49 additions & 0 deletions config.tests/unix/lgmon/lgmon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/***************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include <lgmon.h>

int main(int, char **)
{
lgmon_supported(getpid());
return 0;
}

3 changes: 3 additions & 0 deletions config.tests/unix/lgmon/lgmon.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SOURCES = lgmon.cpp
CONFIG -= qt
LIBS += -llgmon
21 changes: 21 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ CFG_STACK_PROTECTOR_STRONG=auto
CFG_SLOG2=auto
CFG_PPS=auto
CFG_QNX_IMF=auto
CFG_LGMON=auto
CFG_SYSTEM_PROXIES=no

# Target architecture
Expand Down Expand Up @@ -1800,6 +1801,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
lgmon)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_LGMON="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
gtkstyle)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_QGTKSTYLE="$VAL"
Expand Down Expand Up @@ -2502,6 +2510,9 @@ QNX/Blackberry options:
-no-imf ............ Do not compile with imf support.
-imf ............... Compile with imf support.
-no-lgmon .......... Do not compile with lgmon support.
-lgmon ............. Compile with lgmon support.
MacOS/iOS options:
-Fstring ........... Add an explicit framework path.
Expand Down Expand Up @@ -4416,6 +4427,15 @@ if [ "$XPLATFORM_QNX" = "yes" ]; then
CFG_PPS=no
fi
fi

if [ "$CFG_LGMON" != "no" ]; then
if compileTest unix/lgmon "lgmon"; then
CFG_LGMON=yes
QMAKE_CONFIG="$QMAKE_CONFIG lgmon"
else
CFG_LGMON=no
fi
fi
fi

if [ "$CFG_ZLIB" = "auto" ]; then
Expand Down Expand Up @@ -6841,6 +6861,7 @@ if [ "$XPLATFORM_QNX" = "yes" ]; then
report_support " SLOG2 .................." "$CFG_SLOG2"
report_support " IMF ...................." "$CFG_QNX_IMF"
report_support " PPS ...................." "$CFG_PPS"
report_support " LGMON .................." "$CFG_LGMON"
fi
report_support " SQL drivers:"
report_support " DB2 .................." "$CFG_SQL_db2" plugin "plugin" yes "built into QtSql"
Expand Down
1 change: 1 addition & 0 deletions qtbase.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ unix {
(cd config.tests/unix/libjpeg && $(MAKE) distclean); \
(cd config.tests/unix/libpng && $(MAKE) distclean); \
(cd config.tests/unix/slog2 && $(MAKE) distclean); \
(cd config.tests/unix/lgmon && $(MAKE) distclean); \
(cd config.tests/x11/xcursor && $(MAKE) distclean); \
(cd config.tests/x11/xrender && $(MAKE) distclean); \
(cd config.tests/x11/xrandr && $(MAKE) distclean); \
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/platforms/qnx/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
**
** Copyright (C) 2011 - 2012 Research In Motion
** Copyright (C) 2011 - 2014 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
Expand Down Expand Up @@ -41,13 +41,16 @@

#include "main.h"
#include "qqnxintegration.h"
#include "qqnxlgmon.h"

QT_BEGIN_NAMESPACE

QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive))
if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive)) {
qqnxLgmonInit();
return new QQnxIntegration(paramList);
}

return 0;
}
Expand Down
9 changes: 8 additions & 1 deletion src/plugins/platforms/qnx/qnx.pro
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ HEADERS = main.h \
qqnxcursor.h \
qqnxrasterwindow.h \
qqnxscreeneventfilter.h \
qqnxglobal.h
qqnxglobal.h \
qqnxlgmon.h

CONFIG(qqnx_screeneventthread) {
DEFINES += QQNX_SCREENEVENTTHREAD
Expand Down Expand Up @@ -145,6 +146,12 @@ CONFIG(qqnx_pps) {
}
}

lgmon {
DEFINES += QQNX_LGMON
SOURCES += qqnxlgmon.cpp
LIBS += -llgmon
}

OTHER_FILES += qnx.json

QMAKE_CXXFLAGS += -I./private
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/platforms/qnx/qqnxeglwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Copyright (C) 2013 - 2014 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
Expand Down Expand Up @@ -135,8 +135,7 @@ void QQnxEglWindow::swapEGLBuffers()
if (eglResult != EGL_TRUE)
qFatal("QQNX: failed to swap EGL buffers, err=%d", eglGetError());

if (m_cover)
m_cover->updateCover();
windowPosted();
}

EGLSurface QQnxEglWindow::getSurface()
Expand Down
49 changes: 49 additions & 0 deletions src/plugins/platforms/qnx/qqnxlgmon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/***************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qqnxlgmon.h"

QT_BEGIN_NAMESPACE

bool qqnxLgmonFirstFrame = true;

QT_END_NAMESPACE

80 changes: 80 additions & 0 deletions src/plugins/platforms/qnx/qqnxlgmon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/***************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef QQNXLGMON_H
#define QQNXLGMON_H

#include <qglobal.h>

#if defined(QQNX_LGMON)
#include <lgmon.h>
#endif

QT_BEGIN_NAMESPACE

#if defined(QQNX_LGMON)

extern bool qqnxLgmonFirstFrame;

inline void qqnxLgmonInit()
{
lgmon_supported(getpid());
}

inline void qqnxLgmonFramePosted(bool isCover)
{
if (qqnxLgmonFirstFrame && !isCover) {
qqnxLgmonFirstFrame = false;
lgmon_app_ready_for_user_input(getpid());
}
}

#else

inline void qqnxLgmonInit() {}
inline void qqnxLgmonFramePosted(bool /*isCover*/) {}

#endif

QT_END_NAMESPACE

#endif // QQNXLGMON_H

5 changes: 2 additions & 3 deletions src/plugins/platforms/qnx/qqnxrasterwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Copyright (C) 2013 - 2014 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
Expand Down Expand Up @@ -123,8 +123,7 @@ void QQnxRasterWindow::post(const QRegion &dirty)
m_previousDirty = dirty;
m_scrolled = QRegion();

if (m_cover)
m_cover->updateCover();
windowPosted();
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/plugins/platforms/qnx/qqnxwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "qqnxwindow.h"
#include "qqnxintegration.h"
#include "qqnxscreen.h"
#include "qqnxlgmon.h"

#include <QUuid>

Expand Down Expand Up @@ -705,5 +706,12 @@ void QQnxWindow::applyWindowState()
}
}

void QQnxWindow::windowPosted()
{
if (m_cover)
m_cover->updateCover();

qqnxLgmonFramePosted(m_cover); // for performance measurements
}

QT_END_NAMESPACE
3 changes: 2 additions & 1 deletion src/plugins/platforms/qnx/qqnxwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ friend class QQnxScreen;
virtual void resetBuffers() = 0;

void initWindow();
void windowPosted();

screen_context_t m_screenContext;
QScopedPointer<QQnxAbstractCover> m_cover;

private:
void createWindowGroup();
Expand All @@ -137,6 +137,7 @@ friend class QQnxScreen;
QQnxScreen *m_screen;
QQnxWindow *m_parentWindow;
QList<QQnxWindow*> m_childWindows;
QScopedPointer<QQnxAbstractCover> m_cover;
bool m_visible;
bool m_exposed;
QRect m_unmaximizedGeometry;
Expand Down
Loading

0 comments on commit fa8e6d5

Please sign in to comment.