ARM Skia NEON patches - 20 - New improved BitmapProcState code

BitmapProcState: new factorised code

This one basically factorises the clamp and repeat transformations with
some performance improvements. It has the benefit of being faster, much
easier to maintain (nearly three times less code for more work
done :-)), and more complete (all persp transformations weren't optimised
in the previous version).

It also introduces the use of can_truncate_to_fixed_for_decal where
useful.

The effect on benchmarks ranges from a 5% penalty to a 25% gain on a
Cortex-A9 and from a 5% penalty to a 100% gain on a Cortex-A15.

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=
R=djsollen@google.com, mtklein@google.com, luisjoseromeroesclusa@hotmail.com, reed@google.com

Author: kevin.petit.arm@gmail.com

Review URL: https://codereview.chromium.org/23835006

Change-Id: Ifb1a610730548f6e487dbb60bebcf69150186ed1
git-svn-id: http://skia.googlecode.com/svn/trunk@13218 2bbb7eff-a529-9590-31e7-b0007b416f81
(cherry picked from commit 63a073d75decabc37d1120700571bf6385db6271)
ARM Skia NEON patches - 27 - S32A_D565_Blend

BlitRow565: new intrinsics version of S32A_D565_Blend

This new version is basically a rewrite of the existing code with
a few speed and accuracy improvements. There is a switch to enable
pixel perfect results at the cost of a (quite big) decrease of
performances (disabled in this patch).

Here are the benchmark results (speedup vs. existing code):

+-------+------------+------------+
| count | Cortex -A9 | Cortex-A15 |
+-------+------------+------------+
| 1     | +103.6%    | +12%       |
+-------+------------+------------+
| 2     | +3.6%      | +21.6%     |
+-------+------------+------------+
| 4     | +0.8%      | -0.8%      |
+-------+------------+------------+
| 8     | +3.9%      | -1%        |
+-------+------------+------------+
| 16    | +14.7%     | +5.7%      |
+-------+------------+------------+
| 64    | +18.1%     | +13.2%     |
+-------+------------+------------+
| 256   | +16.3%     | +27.4%     |
+-------+------------+------------+
| 1024  | +78.2%     | +17.4%     |
+-------+------------+------------+

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com, halcanary@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/156113005

Change-Id: I92a1a6dfdb813b77ba05b245a3fdbb5e02458981
git-svn-id: http://skia.googlecode.com/svn/trunk@13438 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73454/
(cherry picked from commit d48151300a076257c4c3763d7b923c8f3d66501a)
ARM Skia NEON patches - 20bis - BitmapProcState accurracy

Use SkFractionalInt for some calculations to improve accuracy.

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:2175
NOTRY=true
R=djsollen@google.com, mtklein@google.com, hshi@chromium.org

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/167433002

Change-Id: I2452ff401cc584084f44ec3a27240aa564eb19bc
git-svn-id: http://skia.googlecode.com/svn/trunk@13518 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73455/
(cherry picked from commit 879a8b195a8c2ec27c3fe999435fdedd28136b4c)
ARM Skia NEON patches - 12 - S32_Blend

Blitrow32: S32_Blend fix and little speed improvement

- the results are now exactly similar as the C code
- the speed has improved, especially for small values of count

+-------+-----------+------------+
| count | Cortex-A9 | Cortex-A15 |
+-------+-----------+------------+
| 1     | +30%      | +18%       |
+-------+-----------+------------+
| 2     | 0         | 0          |
+-------+-----------+------------+
| 4     | - <1%     | +14%       |
+-------+-----------+------------+
| > 4   | -0.5..+5% | -0.5..+4%  |
+-------+-----------+------------+

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:

Committed: http://code.google.com/p/skia/source/detail?r=13532

R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/158973002

Change-Id: I75a4d2a31313664b4df057ea58821899646a1577
git-svn-id: http://skia.googlecode.com/svn/trunk@13543 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73456/
(cherry picked from commit bb53092e3778c457e3364b85738fb3f33ab11842)
ARM Skia NEON patches - 25 - S32A_D565_Opaque_Dither clean/bugfix/speed

BlitRow565: S32A_D565_Opaque_Dither: some improvements

    - Supports ARGB and ABGR
    - Less magic numbers
    - Reduced instruction count : 5-25% speedup
    - Fixed indentation, removed some commented and useless code

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/177963003

Change-Id: I4f6083372e653fda5224b0f74dc5affbaa4c8f8f
git-svn-id: http://skia.googlecode.com/svn/trunk@13577 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73457/
(cherry picked from commit 676e1dbc4a22a339b9c83d89416564cf6d327b51)
ARM Skia NEON patches - 22 - S32_D565_Blend

BlitRow565: new NEON version of S32_D565_Blend

This new implementation brings a good speedup in most cases and
gives exact results (removes one mismatch in gm).

Here are the benchmark results (speedup vs. existing S32A_D565_Blend):

+-------+-----------+------------+
| count | Cortex-A9 | Cortex-A15 |
+-------+-----------+------------+
| 1     | -26,7%    | -27,5%     |
+-------+-----------+------------+
| 2     | 0%        | +53%       |
+-------+-----------+------------+
| 4     | +38,3%    | +26,5%     |
+-------+-----------+------------+
| 8     | +10,9%    |  -4,5%     |
+-------+-----------+------------+
| 16    | +18,2%    | +1,6%      |
+-------+-----------+------------+
| 64    | +22,3%    | +8,75%     |
+-------+-----------+------------+
| 256   | +12,3%    | +11,2%     |
+-------+-----------+------------+
| 1024  | +79,2%    | +10,9%     |
+-------+-----------+------------+

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/181523002

Change-Id: I9307ea4ee185e0319aed20ef9708cef5552c561b
git-svn-id: http://skia.googlecode.com/svn/trunk@14103 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73458/
(cherry picked from commit d945a80b3f274559248c81605421ee92d61f8242)
ARM Skia NEON patches - 36 - Color32

Convert Color32 to intrinsics

This change is performance-neutral for high values of count and is
a big improvement for values smaller than 64.

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com, borenet@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/258173005

Change-Id: Id7173a61efc6ebf8812149d2084e2b27c07fec52
git-svn-id: http://skia.googlecode.com/svn/trunk@14435 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73459/
(cherry picked from commit 83864a61c4b009ee1f07abacb5a9e32a80bd4248)
Remove the unused SkCachePreload_arm

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/263553008

Change-Id: I7312ca230cd98ec335970c4f503b3b04d2ec7db3
git-svn-id: http://skia.googlecode.com/svn/trunk@14456 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73460/
(cherry picked from commit 528f38545384bb9668a952c260e1bd2dab36934b)
Always inline Filter_32_*_neon functions

The functions are rather performance critical and already marked
'inline'. However, Chrome for Android will not have these functions
inlined due to it being compiled with -Os and a small -finline-limit.

This avoids one call in the filtering functions.

Does not increase the library size.

BUG=chromium:363073
R=mtklein@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/280403005

Change-Id: I3a1191a3b6f0afe8c035ab0af745280883680efc
git-svn-id: http://skia.googlecode.com/svn/trunk@14709 2bbb7eff-a529-9590-31e7-b0007b416f81

Patchset: 1
http://review.cyanogenmod.org/#/c/73461/
(cherry picked from commit 6852456379f0e93fa4e67c24feff133756843633)
Fix SkBlitRow_opts_arm so that it works on ARM v4t.
Original Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=901208

R=reed@google.com, mtklein@google.com, reed1
BUG=skia:

Author: george@mozilla.com

Review URL: https://codereview.chromium.org/337853003

Change-Id: I822ef24123f2ae10815d99f25d07ee06e2c47af9

Patchset: 1
http://review.cyanogenmod.org/#/c/73462/
(cherry picked from commit 43dfa64e4a1e6ffd0eb7a982fbee65cb315e49fb)
Add optimization of Skia S32A_Opaque blitter

Adds optimization of Skia S32A_Opaque_BlitRow32 blitter using ARM NEON
instruction set. Special cases for when alpha is zero or opaque.
Improves performance platform wide.

Change-Id: I0ffeb23b128e61cfe581ad121f227631d2918686
Signed-off-by: Henrik Smiding <henrik.smiding@stericsson.com>
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>

Patchset: 1
http://review.cyanogenmod.org/#/c/73463/
(cherry picked from commit 45bc70981fd3e5fe0c842dff123666a318988653)
Add optimization of Skia S32A_Blend blitter

Adds optimization of Skia S32A_Blend_BlitRow32 blitter using ARM NEON
instruction set. Special cases for when pixel alpha is zero.
Improves performance platform wide.

Change-Id: I6c8bf8a9525838682206ebd139855354d6b3a563
Signed-off-by: Henrik Smiding <henrik.smiding@stericsson.com>
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>

Patchset: 1
http://review.cyanogenmod.org/#/c/73464/
(cherry picked from commit c093326e03b8a4a1c76ea137a24ed49137c6abf2)
Add optimized S32A_D565_Opaque_Dither blitter.

Adds optimization of Skia S32A_D565_Opaque_Dither blitter using
ARM NEON instruction set.
Improves performance in browser.
Change-Id: Ie20fb3cf3ad9a60f01b79e3ed2ddba7651bcf013
Signed-off-by: Henrik Smiding <henrik.smiding@stericsson.com>
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>

Patchset: 1
http://review.cyanogenmod.org/#/c/73465/
(cherry picked from commit fd11d4c89a92722ff4164cc7db31b1c49cdc33f6)
Modify sample buffer size for larger displays

BZ: 146848

Increases the intermediate buffer size for sample pixel indexes,
used in the sample proc function calls. If the operation is bigger
than the buffer it's split into multiple calls, creating overhead.
This would especially impact the performance of SIMD optimizations.

Change-Id: I44d0723cb26372050741e28fc14f676ddcd56d77
Category: aosp improvement
Domain: AOSP-Others
Origin: internal
Upstream-Candidate: yes
Signed-off-by: Henrik Smiding <henrik.smiding@intel.com>
Reviewed-on: https://android.intel.com/163478
Tested-by: sys_abtbuild <sys_abtbuild@intel.com>
Reviewed-by: Landberg, Joakim <joakim.landberg@intel.com>
Reviewed-by: Chen, HuaqiangX <huaqiangx.chen@intel.com>
Reviewed-by: Fagerstedt, Axel <axel.fagerstedt@intel.com>

Patchset: 1
http://review.cyanogenmod.org/#/c/73466/
(cherry picked from commit 300a2539509b4ce181411d820e72937d81a3040b)