summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-12-08 19:23:23 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-16 02:59:52 +0100
commit01c59ac857927043e49d4725062faea715ed49a3 (patch)
treeaf7b6b72dbf0fe32757eb7a32d1f7301a6b69062
parent1b12c0608be2359baa2f96ae28b135a84abd388c (diff)
Make qt_memfill{16,32} unconditional
These two functions used to cause a runtime detection of the CPU features in order to improve their performance. Since the last two commits, there's no runtime detection of either SSE2 or Neon support, so there's no point in attempting runtime detection. Task-number: QTBUG-30440 Change-Id: I54fe92787c983003c2cc867ee636daec30063033 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
-rw-r--r--src/gui/painting/qdrawhelper.cpp44
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_p.h5
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp8
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h4
5 files changed, 23 insertions, 40 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 94ac62574b..141688b826 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6178,33 +6178,32 @@ inline void qt_memfill_template(quint16 *dest, quint16 value, int count)
}
#endif
-static void qt_memfill_quint16(quint16 *dest, quint16 color, int count)
+#if !defined(__SSE2__)
+void qt_memfill16(quint16 *dest, quint16 color, int count)
{
qt_memfill_template<quint16>(dest, color, count);
}
-
-typedef void (*qt_memfill32_func)(quint32 *dest, quint32 value, int count);
-typedef void (*qt_memfill16_func)(quint16 *dest, quint16 value, int count);
-static void qt_memfill32_setup(quint32 *dest, quint32 value, int count);
-static void qt_memfill16_setup(quint16 *dest, quint16 value, int count);
-
-qt_memfill32_func qt_memfill32 = qt_memfill32_setup;
-qt_memfill16_func qt_memfill16 = qt_memfill16_setup;
+#endif
+#if !defined(__SSE2__) && !defined(__ARM_NEON__)
+void qt_memfill32(quint32 *dest, quint32 color, int count)
+{
+# ifdef QT_COMPILER_SUPPORTS_MIPS_DSP
+ extern "C" qt_memfill32_asm_mips_dsp(quint32 *, quint32, int);
+ qt_memfill32_asm_mips_dsp(dest, color, count);
+# else
+ qt_memfill_template<quint32>(dest, color, count);
+# endif
+}
+#endif
void qInitDrawhelperAsm()
{
-
- qt_memfill32 = qt_memfill_template<quint32>;
- qt_memfill16 = qt_memfill_quint16; //qt_memfill_template<quint16>;
-
CompositionFunction *functionForModeAsm = 0;
CompositionFunctionSolid *functionForModeSolidAsm = 0;
const uint features = qCpuFeatures();
Q_UNUSED(features);
#ifdef __SSE2__
- qt_memfill32 = qt_memfill32_sse2;
- qt_memfill16 = qt_memfill16_sse2;
qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_sse2;
qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2;
qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
@@ -6304,7 +6303,6 @@ void qInitDrawhelperAsm()
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);
@@ -6333,8 +6331,6 @@ void qInitDrawhelperAsm()
functionForModeSolid_C[QPainter::CompositionMode_Xor] = comp_func_solid_XOR_mips_dsp;
functionForModeSolid_C[QPainter::CompositionMode_SourceOut] = comp_func_solid_SourceOut_mips_dsp;
- qt_memfill32 = qt_memfill32_asm_mips_dsp;
-
qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp;
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp;
qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp;
@@ -6360,16 +6356,4 @@ void qInitDrawhelperAsm()
functionForMode = functionForModeAsm;
}
-static void qt_memfill32_setup(quint32 *dest, quint32 value, int count)
-{
- qInitDrawhelperAsm();
- qt_memfill32(dest, value, count);
-}
-
-static void qt_memfill16_setup(quint16 *dest, quint16 value, int count)
-{
- qInitDrawhelperAsm();
- qt_memfill16(dest, value, count);
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 541b3ef619..3ab445aa60 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
-void qt_memfill32_neon(quint32 *dest, quint32 value, int count)
+void qt_memfill32(quint32 *dest, quint32 value, int count)
{
const int epilogueSize = count % 16;
if (count >= 16) {
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 418294c56d..6af4aa4943 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -171,6 +171,8 @@ extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3];
extern DrawHelper qDrawHelper[QImage::NImageFormats];
void qBlendTexture(int count, const QSpan *spans, void *userData);
+extern void qt_memfill32(quint32 *dest, quint32 value, int count);
+extern void qt_memfill16(quint16 *dest, quint16 value, int count);
typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha);
typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
@@ -386,8 +388,6 @@ static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
return (b * b) - (4 * a * c);
}
-extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
-
template <class RadialFetchFunc> Q_STATIC_TEMPLATE_FUNCTION
const uint * QT_FASTCALL qt_fetch_radial_gradient_template(uint *buffer, const Operator *op, const QSpanData *data,
int y, int x, int length)
@@ -726,7 +726,6 @@ template<> inline void qt_memfill(quint32 *dest, quint32 color, int count)
template<> inline void qt_memfill(quint16 *dest, quint16 color, int count)
{
- extern void (*qt_memfill16)(quint16 *dest, quint16 value, int count);
qt_memfill16(dest, color, count);
}
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index a9dc5a7fb7..d11ba0b26c 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -238,7 +238,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u
}
}
-void qt_memfill32_sse2(quint32 *dest, quint32 value, int count)
+void qt_memfill32(quint32 *dest, quint32 value, int count)
{
if (count < 7) {
switch (count) {
@@ -285,7 +285,7 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count)
void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
- qt_memfill32_sse2(destPixels, color, length);
+ qt_memfill32(destPixels, color, length);
} else {
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
@@ -397,7 +397,7 @@ CompositionFunction qt_functionForMode_SSE2[numCompositionFunctions] = {
};
#endif
-void qt_memfill16_sse2(quint16 *dest, quint16 value, int count)
+void qt_memfill16(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
switch (count) {
@@ -413,7 +413,7 @@ void qt_memfill16_sse2(quint16 *dest, quint16 value, int count)
}
const quint32 value32 = (value << 16) | value;
- qt_memfill32_sse2(reinterpret_cast<quint32*>(dest), value32, count / 2);
+ qt_memfill32(reinterpret_cast<quint32*>(dest), value32, count / 2);
if (count & 0x1)
dest[count - 1] = value;
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index 4458d11903..699c586cb0 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -58,8 +58,8 @@
QT_BEGIN_NAMESPACE
#ifdef __SSE2__
-void qt_memfill32_sse2(quint32 *dest, quint32 value, int count);
-void qt_memfill16_sse2(quint16 *dest, quint16 value, int count);
+void qt_memfill32(quint32 *dest, quint32 value, int count);
+void qt_memfill16(quint16 *dest, quint16 value, int count);
void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,
quint32 color,
const uchar *src, int width, int height, int stride);