mirror of https://github.com/qt/qtbase.git
Fix MIPS DSP configuration
The patch fixes a number of bugs in code, and removes dead logic clarifying that MIPS DSP, like ARM NEON, has no runtime detecton. Change-Id: If2f4eea68da5b2eaa80b8e9c8258206d8c1b7173 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
02cc57f4ed
commit
099f286870
|
@ -1,45 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 3 requirements
|
|
||||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 2.0 or (at your option) the GNU General
|
|
||||||
** Public license version 3 or any later version approved by the KDE Free
|
|
||||||
** Qt Foundation. The licenses are as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
||||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int main(int, char**)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
__builtin_mips_lhx(&result, 10);
|
|
||||||
return result;
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
SOURCES = mips_dsp.cpp
|
|
||||||
CONFIG -= x11 qt
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 3 requirements
|
|
||||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 2.0 or (at your option) the GNU General
|
|
||||||
** Public license version 3 or any later version approved by the KDE Free
|
|
||||||
** Qt Foundation. The licenses are as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
||||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int main(int, char**)
|
|
||||||
{
|
|
||||||
int result, tmp1, tmp2;
|
|
||||||
tmp1 = 10;
|
|
||||||
tmp2 = 20;
|
|
||||||
result = __builtin_mips_append (tmp1, tmp2, 10);
|
|
||||||
return result;
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
SOURCES = mips_dspr2.cpp
|
|
||||||
CONFIG -= x11 qt
|
|
|
@ -192,7 +192,7 @@
|
||||||
"detectPkgConfig": [ "cross_compile", "machineTuple" ],
|
"detectPkgConfig": [ "cross_compile", "machineTuple" ],
|
||||||
"library": [ "pkg-config" ],
|
"library": [ "pkg-config" ],
|
||||||
"getPkgConfigVariable": [ "pkg-config" ],
|
"getPkgConfigVariable": [ "pkg-config" ],
|
||||||
"neon": [ "architecture" ]
|
"subarch": [ "architecture" ]
|
||||||
},
|
},
|
||||||
|
|
||||||
"testTypeAliases": {
|
"testTypeAliases": {
|
||||||
|
@ -379,17 +379,18 @@
|
||||||
},
|
},
|
||||||
"mips_dsp": {
|
"mips_dsp": {
|
||||||
"label": "MIPS DSP instructions",
|
"label": "MIPS DSP instructions",
|
||||||
"type": "compile",
|
"type": "subarch",
|
||||||
"test": "unix/mips_dsp"
|
"subarch": "dsp"
|
||||||
},
|
},
|
||||||
"mips_dspr2": {
|
"mips_dspr2": {
|
||||||
"label": "MIPS DSPr2 instructions",
|
"label": "MIPS DSPr2 instructions",
|
||||||
"type": "compile",
|
"type": "subarch",
|
||||||
"test": "common/mips_dspr2"
|
"subarch": "dspr2"
|
||||||
},
|
},
|
||||||
"neon": {
|
"neon": {
|
||||||
"label": "NEON instructions",
|
"label": "NEON instructions",
|
||||||
"type": "neon"
|
"type": "subarch",
|
||||||
|
"subarch": "neon"
|
||||||
},
|
},
|
||||||
|
|
||||||
"mremap": {
|
"mremap": {
|
||||||
|
|
|
@ -369,8 +369,9 @@ defineTest(qtConfTest_detectPkgConfig) {
|
||||||
return(true)
|
return(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
defineTest(qtConfTest_neon) {
|
defineTest(qtConfTest_subarch) {
|
||||||
contains($${currentConfig}.tests.architecture.subarch, "neon"): return(true)
|
subarch = $$eval($${1}.subarch)
|
||||||
|
contains($${currentConfig}.tests.architecture.subarch, $${subarch}): return(true)
|
||||||
return(false)
|
return(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,8 @@ QMAKE_CFLAGS_AVX512VL += -mavx512vl
|
||||||
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
|
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
|
||||||
QMAKE_CFLAGS_AVX512VBMI += -mavx512vbmi
|
QMAKE_CFLAGS_AVX512VBMI += -mavx512vbmi
|
||||||
QMAKE_CFLAGS_NEON += -mfpu=neon
|
QMAKE_CFLAGS_NEON += -mfpu=neon
|
||||||
|
QMAKE_CFLAGS_MIPS_DSP += -mdsp
|
||||||
|
QMAKE_CFLAGS_MIPS_DSPR2 += -mdspr2
|
||||||
|
|
||||||
# Wrapper tools that understand .o/.a files with GIMPLE instead of machine code
|
# Wrapper tools that understand .o/.a files with GIMPLE instead of machine code
|
||||||
QMAKE_AR_LTCG = gcc-ar cqs
|
QMAKE_AR_LTCG = gcc-ar cqs
|
||||||
|
|
|
@ -156,6 +156,15 @@
|
||||||
# if !defined(__ARM_FEATURE_NEON) && defined(__ARM_NEON__)
|
# if !defined(__ARM_FEATURE_NEON) && defined(__ARM_NEON__)
|
||||||
# define __ARM_FEATURE_NEON // also support QT_COMPILER_SUPPORTS_HERE(NEON)
|
# define __ARM_FEATURE_NEON // also support QT_COMPILER_SUPPORTS_HERE(NEON)
|
||||||
# endif
|
# endif
|
||||||
|
#elif defined(Q_PROCESSOR_MIPS)
|
||||||
|
# define QT_COMPILER_SUPPORTS_HERE(x) (__ ## x ## __)
|
||||||
|
# define QT_FUNCTION_TARGET(x)
|
||||||
|
# if !defined(__MIPS_DSP__) && defined(__mips_dsp) && defined(Q_PROCESSOR_MIPS_32)
|
||||||
|
# define __MIPS_DSP__
|
||||||
|
# endif
|
||||||
|
# if !defined(__MIPS_DSPR2__) && defined(__mips_dspr2) && defined(Q_PROCESSOR_MIPS_32)
|
||||||
|
# define __MIPS_DSPR2__
|
||||||
|
# endif
|
||||||
#elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \
|
#elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \
|
||||||
|| (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \
|
|| (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \
|
||||||
&& !defined(QT_BOOTSTRAPPED)
|
&& !defined(QT_BOOTSTRAPPED)
|
||||||
|
|
|
@ -2984,8 +2984,7 @@ static void qInitImageConversions()
|
||||||
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon;
|
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
#if defined(__MIPS_DSPR2__)
|
||||||
if (qCpuHasFeature(DSPR2)) {
|
|
||||||
extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags);
|
extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags);
|
||||||
qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2;
|
qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2;
|
||||||
|
|
||||||
|
@ -2993,7 +2992,6 @@ static void qInitImageConversions()
|
||||||
qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_mips_dspr2;
|
qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_mips_dspr2;
|
||||||
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_mips_dspr2;
|
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_mips_dspr2;
|
||||||
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_mips_dspr2;
|
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_mips_dspr2;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1539,12 +1539,8 @@ static const uint *QT_FASTCALL fetchUntransformedRGB16(uint *buffer, const Opera
|
||||||
int length)
|
int length)
|
||||||
{
|
{
|
||||||
const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
|
const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
|
||||||
#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
|
||||||
qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
|
|
||||||
#else
|
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
buffer[i] = qConvertRgb16To32(scanLine[i]);
|
buffer[i] = qConvertRgb16To32(scanLine[i]);
|
||||||
#endif
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6030,7 +6026,7 @@ void qt_memfill16(quint16 *dest, quint16 color, int count)
|
||||||
qt_memfill_template<quint16>(dest, color, count);
|
qt_memfill_template<quint16>(dest, color, count);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__mips_dsp)
|
#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
|
||||||
void qt_memfill32(quint32 *dest, quint32 color, int count)
|
void qt_memfill32(quint32 *dest, quint32 color, int count)
|
||||||
{
|
{
|
||||||
qt_memfill_template<quint32>(dest, color, count);
|
qt_memfill_template<quint32>(dest, color, count);
|
||||||
|
@ -6222,11 +6218,9 @@ static void qInitDrawhelperFunctions()
|
||||||
qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon;
|
qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon;
|
||||||
qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon;
|
qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon;
|
||||||
#endif
|
#endif
|
||||||
|
#endif // defined(__ARM_NEON__)
|
||||||
|
|
||||||
#endif
|
#if defined(__MIPS_DSP__)
|
||||||
|
|
||||||
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
|
|
||||||
if (qCpuHasFeature(DSP) && qCpuHasFeature(DSPR2)) {
|
|
||||||
// Composition functions are all DSP r1
|
// Composition functions are all DSP r1
|
||||||
qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_asm_mips_dsp;
|
qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_asm_mips_dsp;
|
||||||
qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_mips_dsp;
|
qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_mips_dsp;
|
||||||
|
@ -6261,13 +6255,13 @@ static void qInitDrawhelperFunctions()
|
||||||
sourceFetchUntransformed[QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
|
sourceFetchUntransformed[QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
|
||||||
sourceFetchUntransformed[QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
|
sourceFetchUntransformed[QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
|
||||||
|
|
||||||
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
|
#if defined(__MIPS_DSPR2__)
|
||||||
qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
|
qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
|
||||||
|
sourceFetchUntransformed[QImage::Format_RGB16] = qt_fetchUntransformedRGB16_mips_dspr2;
|
||||||
#else
|
#else
|
||||||
qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dsp;
|
qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dsp;
|
||||||
#endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
#endif // defined(__MIPS_DSPR2__)
|
||||||
}
|
#endif // defined(__MIPS_DSP__)
|
||||||
#endif // QT_COMPILER_SUPPORTS_MIPS_DSP || QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure initialization if this object file is linked.
|
// Ensure initialization if this object file is linked.
|
||||||
|
|
|
@ -113,7 +113,7 @@ void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
#if defined(__MIPS_DSPR2__)
|
||||||
void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
|
void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
|
||||||
const uchar *srcPixels, int sbpl,
|
const uchar *srcPixels, int sbpl,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
|
@ -521,4 +521,17 @@ const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__MIPS_DSPR2__)
|
||||||
|
extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
|
||||||
|
|
||||||
|
const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
|
||||||
|
const QSpanData *data, int y, int x,
|
||||||
|
int length)
|
||||||
|
{
|
||||||
|
const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
|
||||||
|
qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
|
@ -192,12 +192,9 @@ const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (
|
||||||
const QSpanData *data,
|
const QSpanData *data,
|
||||||
int y, int x, int length);
|
int y, int x, int length);
|
||||||
|
|
||||||
#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
#if defined(__MIPS_DSPR2__)
|
||||||
|
|
||||||
extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
|
|
||||||
|
|
||||||
extern "C" void qt_blend_rgb16_on_rgb16_mips_dspr2_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
|
extern "C" void qt_blend_rgb16_on_rgb16_mips_dspr2_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
|
||||||
|
|
||||||
|
@ -206,7 +203,12 @@ void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
int const_alpha);
|
int const_alpha);
|
||||||
|
|
||||||
#endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2
|
const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
|
||||||
|
const QSpanData *data, int y, int x,
|
||||||
|
int length);
|
||||||
|
#endif // defined(__MIPS_DSPR2__)
|
||||||
|
|
||||||
|
#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue