Commit 28c5ad9b authored by Alexis Hetu's avatar Alexis Hetu Committed by Chromium LUCI CQ

Switch cc_unittests/viz_unittests to SwANGLE

This cl changes the software backend used for
running viz_unittests and cc_unittests from
SwiftShader GL to SwANGLE (ANGLE on SwiftShader
Vulkan). Other tests suites may be affected.

From this cl, performance expectations for test
runs will likely change. For example, cc_unittests
appears to run faster, while viz_unittests and
views_unittests appear to run slower. Note that
this is still using the validating command decoder,
and once the OOP Raster tests can run on the
passthrough command decoder, we'll be able to use
it and gain some performance on all these test runs.

Bug: chromium:1060139
Change-Id: Ia243f05f3e9f54dc6f6dfaa3041021fc28818b2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532042
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarJonah Ryan-Davis <jonahr@google.com>
Cr-Commit-Position: refs/heads/master@{#834246}
parent 8087b2f1
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/geometry/size_conversions.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h" #include "ui/gl/gl_switches.h"
namespace cc { namespace cc {
...@@ -970,6 +971,13 @@ void LayerTreeTest::RealEndTest() { ...@@ -970,6 +971,13 @@ void LayerTreeTest::RealEndTest() {
base::RunLoop::QuitCurrentWhenIdleDeprecated(); base::RunLoop::QuitCurrentWhenIdleDeprecated();
} }
bool LayerTreeTest::use_swangle() const {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
return (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) &&
(command_line->GetSwitchValueASCII(::switches::kUseANGLE) ==
gl::kANGLEImplementationSwiftShaderName);
}
void LayerTreeTest::DispatchAddNoDamageAnimation( void LayerTreeTest::DispatchAddNoDamageAnimation(
Animation* animation_to_receive_animation, Animation* animation_to_receive_animation,
double animation_duration) { double animation_duration) {
......
...@@ -229,6 +229,7 @@ class LayerTreeTest : public testing::Test, public TestHooks { ...@@ -229,6 +229,7 @@ class LayerTreeTest : public testing::Test, public TestHooks {
return false; return false;
#endif #endif
} }
bool use_swangle() const;
const viz::RendererType renderer_type_; const viz::RendererType renderer_type_;
......
...@@ -610,7 +610,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, ImageFilterScaled) { ...@@ -610,7 +610,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, ImageFilterScaled) {
RunPixelTest( RunPixelTest(
background, background,
base::FilePath(FILE_PATH_LITERAL("backdrop_filter_on_scaled_layer_.png")) base::FilePath(
(use_swangle() || use_skia_vulkan())
? FILE_PATH_LITERAL("backdrop_filter_on_scaled_layer_.png")
: FILE_PATH_LITERAL(
"backdrop_filter_on_scaled_layer_legacy_swiftshader_.png"))
.InsertBeforeExtensionASCII(GetRendererSuffix())); .InsertBeforeExtensionASCII(GetRendererSuffix()));
} }
...@@ -724,7 +728,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, ImageRenderSurfaceScaled) { ...@@ -724,7 +728,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, ImageRenderSurfaceScaled) {
RunPixelTest( RunPixelTest(
background, background,
base::FilePath(FILE_PATH_LITERAL("scaled_render_surface_layer_.png")) base::FilePath(
(use_swangle() || use_skia_vulkan())
? FILE_PATH_LITERAL("scaled_render_surface_layer_.png")
: FILE_PATH_LITERAL(
"scaled_render_surface_layer_legacy_swiftshader_.png"))
.InsertBeforeExtensionASCII(GetRendererSuffix())); .InsertBeforeExtensionASCII(GetRendererSuffix()));
} }
......
...@@ -173,14 +173,22 @@ TEST_P(LayerTreeHostScrollbarsPixelTest, MAYBE_HugeTransformScale) { ...@@ -173,14 +173,22 @@ TEST_P(LayerTreeHostScrollbarsPixelTest, MAYBE_HugeTransformScale) {
scale_transform.Scale(scale, scale); scale_transform.Scale(scale, scale);
layer->SetTransform(scale_transform); layer->SetTransform(scale_transform);
if (renderer_type_ == viz::RendererType::kSkiaGL || if (use_swangle() || use_skia_vulkan() ||
renderer_type_ == viz::RendererType::kSkiaGL ||
renderer_type_ == viz::RendererType::kSkiaDawn) renderer_type_ == viz::RendererType::kSkiaDawn)
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true); pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
RunPixelTest(background, RunPixelTest(
use_skia_vulkan() background,
? base::FilePath(FILE_PATH_LITERAL("spiral_64_scale_vk.png")) base::FilePath(
: base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png"))); use_swangle()
? (use_skia_vulkan() ? FILE_PATH_LITERAL("spiral_64_scale_vk.png")
: FILE_PATH_LITERAL("spiral_64_scale.png"))
: (use_skia_vulkan()
? FILE_PATH_LITERAL(
"spiral_64_scale_legacy_swiftshader_vk.png")
: FILE_PATH_LITERAL(
"spiral_64_scale_legacy_swiftshader.png"))));
} }
class LayerTreeHostOverlayScrollbarsPixelTest class LayerTreeHostOverlayScrollbarsPixelTest
......
components/viz/test/data/green_alpha.png

589 Bytes | W: | H:

components/viz/test/data/green_alpha.png

602 Bytes | W: | H:

components/viz/test/data/green_alpha.png
components/viz/test/data/green_alpha.png
components/viz/test/data/green_alpha.png
components/viz/test/data/green_alpha.png
  • 2-up
  • Swipe
  • Onion skin
components/viz/test/data/srgb_green_in_p3.png

593 Bytes | W: | H:

components/viz/test/data/srgb_green_in_p3.png

896 Bytes | W: | H:

components/viz/test/data/srgb_green_in_p3.png
components/viz/test/data/srgb_green_in_p3.png
components/viz/test/data/srgb_green_in_p3.png
components/viz/test/data/srgb_green_in_p3.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -66,9 +66,30 @@ void InitializeOneOffHelper(bool init_extensions) { ...@@ -66,9 +66,30 @@ void InitializeOneOffHelper(bool init_extensions) {
DCHECK(!allowed_impls.empty()); DCHECK(!allowed_impls.empty());
GLImplementation impl = allowed_impls[0]; GLImplementation impl = allowed_impls[0];
if (use_software_gl) if (use_software_gl) {
impl = gl::GetSoftwareGLImplementation(); impl = gl::GetSoftwareGLImplementation();
#if !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
#if defined(USE_OZONE)
if (!features::IsUsingOzonePlatform())
#endif
{
// If ANGLE is available use it with SwiftShader Vulkan instead of using
// SwiftShader GL
for (auto i : allowed_impls) {
if (i == kGLImplementationEGLANGLE) {
impl = kGLImplementationEGLANGLE;
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kUseANGLE, kANGLEImplementationSwiftShaderName);
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kUseCmdDecoder, kCmdDecoderValidatingName);
break;
}
}
}
#endif
}
DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
<< "kUseGL has not effect in tests"; << "kUseGL has not effect in tests";
......
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