diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2013-12-08 19:58:37 -0800 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-16 02:59:49 +0100 |
| commit | 1b12c0608be2359baa2f96ae28b135a84abd388c (patch) | |
| tree | 2767974eb19dc2eaa94f5389cb0ed48e90256fb1 | |
| parent | d006e69da61bfddb8be9a400e4cb1c25542bb9d9 (diff) | |
Remove runtime detection of Neon on ARM CPUs
Now the only way to enable Neon support is to change the mkspec.
[ChangeLog][Important Behavior Changes] Qt no longer checks for
support for the Neon FPU on ARM platforms at runtime. Code optimized
for Neon must be enabled unconditionally at compile time by ensuring
the compiler supports Neon. You may need to edit your mkspec for that.
Task-number: QTBUG-30440
Change-Id: I4df9b2bf3cd022f8ed70f02f16878cb2cb3fe6fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| -rw-r--r-- | config.tests/unix/neon/neon.cpp | 51 | ||||
| -rw-r--r-- | config.tests/unix/neon/neon.pro | 4 | ||||
| -rwxr-xr-x | configure | 20 | ||||
| -rw-r--r-- | mkspecs/devices/linux-tegra2-g++/qmake.conf | 4 | ||||
| -rw-r--r-- | src/gui/image/image.pri | 4 | ||||
| -rw-r--r-- | src/gui/image/qimage_conversions.cpp | 13 | ||||
| -rw-r--r-- | src/gui/image/qjpeghandler.cpp | 2 | ||||
| -rw-r--r-- | src/gui/image/qpixmap_raster.cpp | 4 | ||||
| -rw-r--r-- | src/gui/painting/painting.pri | 6 | ||||
| -rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 56 |
10 files changed, 42 insertions, 122 deletions
diff --git a/config.tests/unix/neon/neon.cpp b/config.tests/unix/neon/neon.cpp deleted file mode 100644 index ccbb4763674..00000000000 --- a/config.tests/unix/neon/neon.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** 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 <arm_neon.h> - -int main(int, char**) -{ - int32x4_t null = vdupq_n_s32(0x0); - - int result; - vst1q_lane_s32(&result, null, 0); - return result; -} diff --git a/config.tests/unix/neon/neon.pro b/config.tests/unix/neon/neon.pro deleted file mode 100644 index efd608bd634..00000000000 --- a/config.tests/unix/neon/neon.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES = neon.cpp -CONFIG -= x11 qt -isEmpty(QMAKE_CFLAGS_NEON):error("This compiler does not support Neon") -else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_NEON diff --git a/configure b/configure index 6ec17fd2582..d14422becd5 100755 --- a/configure +++ b/configure @@ -1552,13 +1552,6 @@ while [ "$#" -gt 0 ]; do iwmmxt) CFG_IWMMXT="yes" ;; - neon) - if [ "$VAL" = "no" ]; then - CFG_NEON="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; mips_dsp) if [ "$VAL" = "no" ]; then CFG_MIPS_DSP="$VAL" @@ -2283,7 +2276,6 @@ Configure options: -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. -no-avx ............ Do not compile with use of AVX instructions. -no-avx2 ........... Do not compile with use of AVX2 instructions. - -no-neon ........... Do not compile with use of NEON instructions. -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions. -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions. @@ -4338,17 +4330,6 @@ if [ "$CFG_IWMMXT" = "yes" ]; then fi fi -# detect neon support -if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then - if compileTest unix/neon "neon"; then - CFG_NEON=yes - else - CFG_NEON=no - fi -elif [ "$CFG_ARCH" != "arm" ]; then - CFG_NEON=no -fi - # detect mips_dsp support if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSP}" = "auto" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dsp "mips_dsp" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then @@ -5799,7 +5780,6 @@ fi [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx" [ "$CFG_AVX2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx2" [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt" -[ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon" if [ "$CFG_ARCH" = "mips" ]; then [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp" [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2" diff --git a/mkspecs/devices/linux-tegra2-g++/qmake.conf b/mkspecs/devices/linux-tegra2-g++/qmake.conf index 320e1b8a211..adadc4d5b0c 100644 --- a/mkspecs/devices/linux-tegra2-g++/qmake.conf +++ b/mkspecs/devices/linux-tegra2-g++/qmake.conf @@ -6,9 +6,7 @@ # A typical configure line looks like this: # <path-to-qt-src>/configure -opensource -confirm-license -make libs -prefix /usr/local/Qt-5.0.0/Qt5-tegra2 # -device tegra2 -device-option CROSS_COMPILE=<path-to-crosstoolchain>/bin/arm-none-linux-gnueabi- \ -# -sysroot <path-to-rootfs> -no-neon - -# CAUTION: The Tegra2 chips don't support neon, make sure it will not be used (-no-neon) +# -sysroot <path-to-rootfs> include(../common/linux_device_pre.conf) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index ad860ef2db0..0745cc03022 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -78,7 +78,9 @@ contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri) contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri) # SIMD -NEON_SOURCES += image/qimage_neon.cpp +contains(QT_CPU_FEATURES.$$QT_ARCH, neon) { + SOURCES += image/qimage_neon.cpp +} contains(QT_CPU_FEATURES.$$QT_ARCH, sse2) { SOURCES += image/qimage_sse2.cpp SSSE3_SOURCES += image/qimage_ssse3.cpp diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 317ba45dacb..193ef59fcd7 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2132,14 +2132,11 @@ void qInitImageConversions() } #endif -#ifdef QT_COMPILER_SUPPORTS_NEON - if (qCpuHasFeature(NEON)) { - extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); - qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon; - qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon; - qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon; - return; - } +#ifdef __ARM_NEON__ + extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); + qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon; #endif } diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 3ca31030c53..5187f0e9b38 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -861,7 +861,7 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_avx(quint32 *dst, const QJpegHandler::QJpegHandler() : d(new QJpegHandlerPrivate(this)) { -#if defined(QT_COMPILER_SUPPORTS_NEON) +#if defined(__ARM_NEON__) // from qimage_neon.cpp if (qCpuHasFeature(NEON)) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index be63430a78e..37259adcd29 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -187,7 +187,7 @@ void QRasterPlatformPixmap::fill(const QColor &color) if (alpha != 255) { if (!image.hasAlphaChannel()) { QImage::Format toFormat; -#if !(defined(QT_COMPILER_SUPPORTS_NEON) || defined(__SSE2__)) +#if !(defined(__ARM_NEON__) || defined(__SSE2__)) if (image.format() == QImage::Format_RGB16) toFormat = QImage::Format_ARGB8565_Premultiplied; else if (image.format() == QImage::Format_RGB666) @@ -316,7 +316,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC QImage::Format opaqueFormat = QNativeImage::systemFormat(); QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied; -#if !defined(QT_COMPILER_SUPPORTS_NEON) && !defined(__SSE2__) +#if !defined(__ARM_NEON__) && !defined(__SSE2__) switch (opaqueFormat) { case QImage::Format_RGB16: alphaFormat = QImage::Format_ARGB8565_Premultiplied; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 271848ae731..6bf80eddbde 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -93,9 +93,9 @@ contains(QT_CPU_FEATURES.$$QT_ARCH, sse2) { } IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp -!ios { - NEON_SOURCES += painting/qdrawhelper_neon.cpp - NEON_HEADERS += painting/qdrawhelper_neon_p.h +!ios:contains(QT_CPU_FEATURES.$$QT_ARCH, neon) { + SOURCES += painting/qdrawhelper_neon.cpp + HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S } diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ae6a5e01e51..94ac62574ba 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6273,45 +6273,43 @@ void qInitDrawhelperAsm() } #endif // IWMMXT -#if defined(QT_COMPILER_SUPPORTS_NEON) && !defined(Q_OS_IOS) - if (features & NEON) { - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; +#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; #endif - qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; - qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; - qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; + qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; - functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; - functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; - destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; - destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; + functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; + destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; + destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; - qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; - qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; qt_memfill32 = qt_memfill32_neon; - extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, - int y, int x, int length); + extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, + int y, int x, int length); - qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; - } + qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; #endif #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) |
