Commit a69e152dcc704eff6b7e409ad1ed43f732e6be9c
- Diff rendering mode:
- inline
- side by side
src/gui/painting/qdrawhelper.cpp
(19 / 8)
|   | |||
| 7913 | 7913 | #endif | |
| 7914 | 7914 | } | |
| 7915 | 7915 | ||
| 7916 | #if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) | ||
| 7916 | #if (defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6)) || defined (Q_CC_GNU) | ||
| 7917 | 7917 | // Move these to qdrawhelper_arm.c when all | |
| 7918 | 7918 | // functions are implemented using arm assembly. | |
| 7919 | static CompositionFunctionSolid qt_functionForModeSolid_ARMv6[numCompositionFunctions] = { | ||
| 7919 | static CompositionFunctionSolid qt_functionForModeSolid_ARM[numCompositionFunctions] = { | ||
| 7920 | 7920 | comp_func_solid_SourceOver, | |
| 7921 | 7921 | comp_func_solid_DestinationOver, | |
| 7922 | 7922 | comp_func_solid_Clear, | |
| … | … | ||
| 7952 | 7952 | rasterop_solid_SourceAndNotDestination | |
| 7953 | 7953 | }; | |
| 7954 | 7954 | ||
| 7955 | static CompositionFunction qt_functionForMode_ARMv6[numCompositionFunctions] = { | ||
| 7955 | static CompositionFunction qt_functionForMode_ARM[numCompositionFunctions] = { | ||
| 7956 | #if QT_HAVE_ARMV6 | ||
| 7956 | 7957 | comp_func_SourceOver_armv6, | |
| 7958 | #else | ||
| 7959 | comp_func_SourceOver_arm, | ||
| 7960 | #endif | ||
| 7957 | 7961 | comp_func_DestinationOver, | |
| 7958 | 7962 | comp_func_Clear, | |
| 7963 | #if QT_HAVE_ARMV6 | ||
| 7959 | 7964 | comp_func_Source_armv6, | |
| 7965 | #else | ||
| 7966 | comp_func_Source, | ||
| 7967 | #endif | ||
| 7960 | 7968 | comp_func_Destination, | |
| 7961 | 7969 | comp_func_SourceIn, | |
| 7962 | 7970 | comp_func_DestinationIn, | |
| … | … | ||
| 7996 | 7996 | rasterop_SourceAndNotDestination | |
| 7997 | 7997 | }; | |
| 7998 | 7998 | ||
| 7999 | #if defined(Q_CC_RVCT) | ||
| 7999 | 8000 | static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userData) | |
| 8000 | 8001 | { | |
| 8001 | 8002 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | |
| 8002 | 8003 | ||
| 8003 | CompositionFunctionSolid func = qt_functionForModeSolid_ARMv6[data->rasterBuffer->compositionMode]; | ||
| 8004 | CompositionFunctionSolid func = qt_functionForModeSolid_ARM[data->rasterBuffer->compositionMode]; | ||
| 8004 | 8005 | while (count--) { | |
| 8005 | 8006 | uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | |
| 8006 | 8007 | func(target, spans->len, data->solid.color, spans->coverage); | |
| 8007 | 8008 | ++spans; | |
| 8008 | 8009 | } | |
| 8009 | 8010 | } | |
| 8011 | #endif | ||
| 8010 | 8012 | ||
| 8011 | 8013 | #endif // Q_CC_RVCT && QT_HAVE_ARMV6 | |
| 8012 | 8014 | ||
| … | … | ||
| 8128 | 8128 | ||
| 8129 | 8129 | #endif // QT_NO_DEBUG | |
| 8130 | 8130 | ||
| 8131 | // ARM optimized drawhing helpers. Currently this is used for GCC and RVCT | ||
| 8131 | 8132 | #if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) | |
| 8132 | 8133 | ||
| 8133 | 8134 | # if defined (Q_CC_RVCT) || defined(Q_CC_GNU) | |
| 8134 | 8135 | qt_memfill32 = qt_memfill32_arm; | |
| 8136 | |||
| 8137 | functionForModeAsm = qt_functionForMode_ARM; | ||
| 8138 | functionForModeSolidAsm = qt_functionForModeSolid_ARM; | ||
| 8135 | 8139 | # endif | |
| 8136 | 8140 | ||
| 8137 | # if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) | ||
| 8138 | functionForModeAsm = qt_functionForMode_ARMv6; | ||
| 8139 | functionForModeSolidAsm = qt_functionForModeSolid_ARMv6; | ||
| 8140 | 8141 | ||
| 8141 | |||
| 8142 | # if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) | ||
| 8142 | 8143 | qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6; | |
| 8143 | 8144 | ||
| 8144 | 8145 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; |
src/gui/painting/qdrawhelper_arm_gnu.cpp
(65 / 0)
|   | |||
| 87 | 87 | ); | |
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | static __attribute__((always_inline)) void preload(const uint *start) | ||
| 91 | { | ||
| 92 | #if defined(QT_ARM_HAS_PLD) | ||
| 93 | asm __volatile__("pld [%[addr]]\n" | ||
| 94 | : | ||
| 95 | : [addr] "r"(start)); | ||
| 96 | #endif | ||
| 97 | } | ||
| 98 | |||
| 99 | #define UNROLL_4_TIMES(block) block block block block | ||
| 100 | #define UNROLL_8_TIMES(block) UNROLL_4_TIMES(block) UNROLL_4_TIMES(block) | ||
| 101 | |||
| 102 | #define UNROLL_LOOP_WITH_PLD(block) \ | ||
| 103 | int i = 0; \ | ||
| 104 | int end = length & ~7; \ | ||
| 105 | while (i < end) { \ | ||
| 106 | preload(&src[i] + 32); \ | ||
| 107 | preload(&dest[i]+ 32); \ | ||
| 108 | UNROLL_8_TIMES(block) \ | ||
| 109 | } \ | ||
| 110 | preload(&src[i] + 32); \ | ||
| 111 | preload(&dest[i]+ 32); \ | ||
| 112 | while (i < length) { \ | ||
| 113 | block \ | ||
| 114 | } | ||
| 115 | |||
| 116 | |||
| 117 | // TODO: on Cortex-A8 this is 64. | ||
| 118 | static const uint L2CacheLineLength = 32; | ||
| 119 | static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint); | ||
| 120 | # define PRELOAD_INIT2(x,y) preload(x); preload(y); | ||
| 121 | // Two consecutive preloads stall, so space them out a bit by using different modulus. | ||
| 122 | // -- I could not verify this on a Cortex-A8 with the above UNROLL_LOOP_WITH_PLD | ||
| 123 | # define PRELOAD_COND2(x,y) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); \ | ||
| 124 | if (((uint)&y[i])%L2CacheLineLength == 16) preload(&y[i] + L2CacheLineLengthInInts); | ||
| 125 | void comp_func_SourceOver_arm(uint *dest, const uint *src, int length, uint const_alpha) | ||
| 126 | { | ||
| 127 | PRELOAD_INIT2(dest, src) | ||
| 128 | if (const_alpha == 255) { | ||
| 129 | UNROLL_LOOP_WITH_PLD( | ||
| 130 | { | ||
| 131 | if ((src[i] & 0xff000000) == 0x00000000) { | ||
| 132 | ; // nothing | ||
| 133 | } else if ((src[i] & 0xff000000) == 0xff000000) { | ||
| 134 | dest[i] = src[i]; | ||
| 135 | } else { | ||
| 136 | uint s = src[i]; | ||
| 137 | dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); | ||
| 138 | } | ||
| 139 | |||
| 140 | ++i; | ||
| 141 | }); | ||
| 142 | } else { | ||
| 143 | int i = 0; | ||
| 144 | while (i < length) { | ||
| 145 | uint s = BYTE_MUL(src[i], const_alpha); | ||
| 146 | dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); | ||
| 147 | PRELOAD_COND2(dest, src) | ||
| 148 | ++i; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | return; | ||
| 153 | } | ||
| 154 | |||
| 90 | 155 | #endif |
src/gui/painting/qdrawhelper_arm_p.h
(1 / 0)
|   | |||
| 99 | 99 | ||
| 100 | 100 | #if defined(Q_CC_RVCT) || defined(Q_CC_GNU) | |
| 101 | 101 | extern "C" void qt_memfill32_arm(quint32 *dest, quint32 value, int count); | |
| 102 | extern "C" void comp_func_SourceOver_arm(uint *dest, const uint *src, int length, uint const_alpha); | ||
| 102 | 103 | #endif | |
| 103 | 104 | ||
| 104 | 105 | #if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) |
Comments
Add a new comment:
Login or create an account to post a comment
Add your comment
Please log in to comment

