Commit e482c729 authored by Daniel Nicoara's avatar Daniel Nicoara Committed by Commit Bot

Fix cc_unittests pixeltests on ARM64

Floating point rounding errors on ARM64 is causing a few pixel tests to
have small variations from the base image. Define the fuzziness to have
them pass.

BUG=b:79372424
TEST=Ran cc_unittests on ARM64 device and verify they pass.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I47e7600313ea784723f1270ef7c6ea88e029e92c
Reviewed-on: https://chromium-review.googlesource.com/1055820
Commit-Queue: Daniel Nicoara <dnicoara@chromium.org>
Reviewed-by: default avatarenne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557999}
parent 025b53e1
...@@ -37,8 +37,8 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlur) { ...@@ -37,8 +37,8 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlur) {
2.f, SkBlurImageFilter::kClamp_TileMode)); 2.f, SkBlurImageFilter::kClamp_TileMode));
blur->SetBackgroundFilters(filters); blur->SetBackgroundFilters(filters);
#if defined(OS_WIN) #if defined(OS_WIN) || defined(ARCH_CPU_ARM64)
// Windows has 436 pixels off by 1: crbug.com/259915 // Windows and ARM64 have 436 pixels off by 1: crbug.com/259915
float percentage_pixels_large_error = 1.09f; // 436px / (200*200) float percentage_pixels_large_error = 1.09f; // 436px / (200*200)
float percentage_pixels_small_error = 0.0f; float percentage_pixels_small_error = 0.0f;
float average_error_allowed_in_bad_pixels = 1.f; float average_error_allowed_in_bad_pixels = 1.f;
...@@ -79,8 +79,8 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOutsets) { ...@@ -79,8 +79,8 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOutsets) {
5.f, SkBlurImageFilter::kClamp_TileMode)); 5.f, SkBlurImageFilter::kClamp_TileMode));
blur->SetBackgroundFilters(filters); blur->SetBackgroundFilters(filters);
#if defined(OS_WIN) || defined(_MIPS_ARCH_LOONGSON) #if defined(OS_WIN) || defined(_MIPS_ARCH_LOONGSON) || defined(ARCH_CPU_ARM64)
#if defined(OS_WIN) #if defined(OS_WIN) || defined(ARCH_CPU_ARM64)
// Windows has 5.9325% pixels by at most 2: crbug.com/259922 // Windows has 5.9325% pixels by at most 2: crbug.com/259922
float percentage_pixels_large_error = 6.0f; float percentage_pixels_large_error = 6.0f;
#else #else
...@@ -146,12 +146,17 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOffAxis) { ...@@ -146,12 +146,17 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOffAxis) {
2.f, SkBlurImageFilter::kClamp_TileMode)); 2.f, SkBlurImageFilter::kClamp_TileMode));
blur->SetBackgroundFilters(filters); blur->SetBackgroundFilters(filters);
#if defined(OS_WIN) || defined(ARCH_CPU_ARM64)
#if defined(OS_WIN) #if defined(OS_WIN)
// Windows has 116 pixels off by at most 2: crbug.com/225027 // Windows has 116 pixels off by at most 2: crbug.com/225027
float percentage_pixels_large_error = 0.3f; // 116px / (200*200), rounded up float percentage_pixels_large_error = 0.3f; // 116px / (200*200), rounded up
int large_error_allowed = 2;
#else
float percentage_pixels_large_error = 0.25f; // 96px / (200*200), rounded up
int large_error_allowed = 1;
#endif
float percentage_pixels_small_error = 0.0f; float percentage_pixels_small_error = 0.0f;
float average_error_allowed_in_bad_pixels = 1.f; float average_error_allowed_in_bad_pixels = 1.f;
int large_error_allowed = 2;
int small_error_allowed = 0; int small_error_allowed = 0;
pixel_comparator_.reset(new FuzzyPixelComparator( pixel_comparator_.reset(new FuzzyPixelComparator(
true, // discard_alpha true, // discard_alpha
...@@ -419,17 +424,21 @@ class ImageScaledBackgroundFilter : public LayerTreeHostFiltersPixelTest { ...@@ -419,17 +424,21 @@ class ImageScaledBackgroundFilter : public LayerTreeHostFiltersPixelTest {
filters.Append(FilterOperation::CreateGrayscaleFilter(1.0f)); filters.Append(FilterOperation::CreateGrayscaleFilter(1.0f));
filter->SetBackgroundFilters(filters); filter->SetBackgroundFilters(filters);
#if defined(OS_WIN) || defined(_MIPS_ARCH_LOONGSON) #if defined(OS_WIN) || defined(_MIPS_ARCH_LOONGSON) || defined(ARCH_CPU_ARM64)
#if defined(OS_WIN) #if defined(OS_WIN)
// Windows has 153 pixels off by at most 2: crbug.com/225027 // Windows has 153 pixels off by at most 2: crbug.com/225027
float percentage_pixels_large_error = 0.3825f; // 153px / (200*200) float percentage_pixels_large_error = 0.3825f; // 153px / (200*200)
#else int large_error_allowed = 2;
#elif defined(_MIPS_ARCH_LOONGSON)
// Loongson has 2 pixels off by at most 2: crbug.com/819075 // Loongson has 2 pixels off by at most 2: crbug.com/819075
float percentage_pixels_large_error = 0.005f; // 2px / (200*200) float percentage_pixels_large_error = 0.005f; // 2px / (200*200)
int large_error_allowed = 2;
#else
float percentage_pixels_large_error = 0.0325f; // 13px / (200*200)
int large_error_allowed = 1;
#endif #endif
float percentage_pixels_small_error = 0.0f; float percentage_pixels_small_error = 0.0f;
float average_error_allowed_in_bad_pixels = 1.f; float average_error_allowed_in_bad_pixels = 1.f;
int large_error_allowed = 2;
int small_error_allowed = 0; int small_error_allowed = 0;
pixel_comparator_.reset(new FuzzyPixelComparator( pixel_comparator_.reset(new FuzzyPixelComparator(
true, // discard_alpha true, // discard_alpha
...@@ -736,8 +745,8 @@ class RotatedDropShadowFilterTest : public LayerTreeHostFiltersPixelTest { ...@@ -736,8 +745,8 @@ class RotatedDropShadowFilterTest : public LayerTreeHostFiltersPixelTest {
background->AddChild(child); background->AddChild(child);
#if defined(OS_WIN) #if defined(OS_WIN) || defined(ARCH_CPU_ARM64)
// Windows has 3 pixels off by 1: crbug.com/259915 // Windows and ARM64 have 3 pixels off by 1: crbug.com/259915
float percentage_pixels_large_error = 0.00333334f; // 3px / (300*300) float percentage_pixels_large_error = 0.00333334f; // 3px / (300*300)
float percentage_pixels_small_error = 0.0f; float percentage_pixels_small_error = 0.0f;
float average_error_allowed_in_bad_pixels = 1.f; float average_error_allowed_in_bad_pixels = 1.f;
...@@ -951,9 +960,15 @@ class BlurFilterWithClip : public LayerTreeHostFiltersPixelTest { ...@@ -951,9 +960,15 @@ class BlurFilterWithClip : public LayerTreeHostFiltersPixelTest {
// Force the allocation a larger textures. // Force the allocation a larger textures.
set_enlarge_texture_amount(gfx::Size(50, 50)); set_enlarge_texture_amount(gfx::Size(50, 50));
#if defined(OS_WIN) || defined(ARCH_CPU_ARM64)
#if defined(OS_WIN) #if defined(OS_WIN)
// Windows has 1880 pixels off by 1: crbug.com/259915 // Windows has 1880 pixels off by 1: crbug.com/259915
float percentage_pixels_large_error = 4.7f; // 1880px / (200*200) float percentage_pixels_large_error = 4.7f; // 1880px / (200*200)
#else
// Differences in floating point calculation on ARM means a small percentage
// of pixels will have small differences.
float percentage_pixels_large_error = 2.76f; // 1104px / (200*200)
#endif
float percentage_pixels_small_error = 0.0f; float percentage_pixels_small_error = 0.0f;
float average_error_allowed_in_bad_pixels = 1.f; float average_error_allowed_in_bad_pixels = 1.f;
int large_error_allowed = 2; int large_error_allowed = 2;
......
...@@ -428,6 +428,14 @@ class LayerTreeHostMaskAsBlendingPixelTest ...@@ -428,6 +428,14 @@ class LayerTreeHostMaskAsBlendingPixelTest
average_error_allowed_in_bad_pixels = 3.5f; average_error_allowed_in_bad_pixels = 3.5f;
large_error_allowed = 15; large_error_allowed = 15;
small_error_allowed = 1; small_error_allowed = 1;
} else {
#if defined(ARCH_CPU_ARM64)
// Differences in floating point calculation on ARM means a small
// percentage of pixels will be off by 1.
percentage_pixels_error = 0.112f;
average_error_allowed_in_bad_pixels = 1.f;
large_error_allowed = 1;
#endif
} }
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>( pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment