From c51c85dd3aa4a920f363e315ef4512f1d97401b3 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 2 Nov 2009 18:53:12 +0800 Subject: [PATCH] Port the qt_memfill_armv6 to GNU syntax Remove the armv6 suffix from the method name as it can be used on any armv4+ architecture. Add the GNU version of the same routine to the tree and buildsystem for a minor 6-10ms win... The symbian file might needs to be split up or get a #ifdef for ARMv6 and earlier code.. Read paint buffer with 217 frames /qtgraphics-cycler.trace, iterations: 3, frames: 217, min(ms): 11950, median(ms): 11951, stddev: 0.006832 %, max(fps): 18.158996 The routine is only using armv4+ instruction --- src/gui/painting/painting.pri | 2 + src/gui/painting/qdrawhelper.cpp | 12 +++- src/gui/painting/qdrawhelper_arm_gnu.cpp | 90 +++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_arm_p.h | 5 +- src/gui/painting/qdrawhelper_armv6_rvct.s | 4 +- 5 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 src/gui/painting/qdrawhelper_arm_gnu.cpp diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index c35c33a..9506dbb 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -380,6 +380,8 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } +SOURCES += painting/qdrawhelper_arm_gnu.cpp + contains(QT_CONFIG, zlib) { INCLUDEPATH += ../3rdparty/zlib } else:!contains(QT_CONFIG, no-zlib) { diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 68b73ad..2b65df6 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -8118,11 +8118,16 @@ void qInitDrawhelperAsm() #endif // QT_NO_DEBUG -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) +#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) + +# if defined (Q_CC_RVCT) || defined(Q_CC_GNU) + qt_memfill32 = qt_memfill32_arm; +# endif + +# if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) functionForModeAsm = qt_functionForMode_ARMv6; functionForModeSolidAsm = qt_functionForModeSolid_ARMv6; - qt_memfill32 = qt_memfill32_armv6; qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6; @@ -8130,7 +8135,8 @@ void qInitDrawhelperAsm() qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; -#endif // Q_CC_RVCT && QT_HAVE_ARMV6 +# endif // Q_CC_RVCT && QT_HAVE_ARMV6 +#endif // QT_ARCH_ARM if (functionForModeSolidAsm) { const int destinationMode = QPainter::CompositionMode_Destination; diff --git a/src/gui/painting/qdrawhelper_arm_gnu.cpp b/src/gui/painting/qdrawhelper_arm_gnu.cpp new file mode 100644 index 0000000..a366334 --- /dev/null +++ b/src/gui/painting/qdrawhelper_arm_gnu.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdrawhelper_arm_p.h" + +#include + +#if defined(Q_CC_GNU) && (defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6)) + +void qt_memfill32_arm(quint32 *dest, quint32 value, int count) +{ + asm __volatile__( + "mov r3, %[value]\n\t" + "mov r4, %[value]\n\t" + "mov r5, %[value]\n\t" + "mov r6, %[value]\n\t" + "mov r7, %[value]\n\t" + "mov r8, %[value]\n\t" + "mov r9, %[value]\n" + +"mfill_loop:\n\t" + "subs %[count], %[count], #32\n\t" + "stmgeia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "stmgeia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "stmgeia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "stmgeia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "bgt mfill_loop\n" +"mfill_remaining:\n\t" + "@ Fill up to 31 remaining pixels\n\t" + "@ Fill 16 pixels\n\t" + "tst %[count], #16\n\t" + "stmneia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "stmneia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "@ Fill 8 pixels\n\t" + "tst %[count], #8\n\t" + "stmneia %[dest]!, {%[value], r3, r4, r5, r6, r7, r8, r9}\n\t" + "@ Fill 4 pixels\n\t" + "tst %[count], #4\n\t" + "stmneia %[dest]!, {%[value], r3, r4, r5}\n\t" + "@ Fill 2 pixels\n\t" + "tst %[count], #2\n\t" + "stmneia %[dest]!, {%[value], r3}\n\t" + "@ Fill last one\n\t" + "tst %[count], #1\n\t" + "strne %[value], [%[dest]]\n\t" + : "=r" (dest), "=r" (count) + : [dest] "r" (dest), [value] "r" (value), [count] "r" (count) + : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r9", "cc" + ); +} + +#endif diff --git a/src/gui/painting/qdrawhelper_arm_p.h b/src/gui/painting/qdrawhelper_arm_p.h index b6f2ce6..b06501d 100644 --- a/src/gui/painting/qdrawhelper_arm_p.h +++ b/src/gui/painting/qdrawhelper_arm_p.h @@ -97,6 +97,10 @@ QT_BEGIN_NAMESPACE #define QT_ARM_HAS_PLD #endif +#if defined(Q_CC_RVCT) || defined(Q_CC_GNU) +extern "C" void qt_memfill32_arm(quint32 *dest, quint32 value, int count); +#endif + #if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) extern "C" void qt_blend_rgb32_on_rgb32_armv6(uchar *destPixels, int dbpl, @@ -109,7 +113,6 @@ extern "C" void qt_blend_argb32_on_argb32_armv6(uchar *destPixels, int dbpl, int w, int h, int const_alpha); -extern "C" void qt_memfill32_armv6(quint32 *dest, quint32 value, int count); extern "C" void comp_func_Source_armv6(uint *dest, const uint *src, int length, uint const_alpha); extern "C" void comp_func_SourceOver_armv6(uint *dest, const uint *src, int length, uint const_alpha); diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s index 4065815..64a1bee 100644 --- a/src/gui/painting/qdrawhelper_armv6_rvct.s +++ b/src/gui/painting/qdrawhelper_armv6_rvct.s @@ -56,7 +56,7 @@ INCLUDE qdrawhelper_armv6_rvct.inc ;----------------------------------------------------------------------------- -; qt_memfill32_armv6 +; qt_memfill32_arm ; ; @brief Not yet in use! ; @@ -65,7 +65,7 @@ ; @param count Count (r2) ; ;--------------------------------------------------------------------------- -qt_memfill32_armv6 Function +qt_memfill32_arm Function stmfd sp!, {r4-r12, r14} mov r3, r1 -- 1.6.1