Commit 047ba2f8 authored by Alexis Hetu's avatar Alexis Hetu Committed by Commit Bot

Reland "Switching all ui/gl dependent tests to SwiftShader"

This is a reland of 9f1eb0ba

The only change from the original cl is in cc/test/layer_tree_test.cc,
so TBRing reviewers who approved other parts of this cl.
TBR=dcastagna@chromium.org,piman@chromium.org,ericrk@chromium.org

Original change's description:
> Switching all ui/gl dependent tests to SwiftShader
>
> This cl's switches cc_unittests and viz_unittests from OSMesa
> to SwiftShader and fixes other issues related to that change.
>
> Bug chromium:848035
>
> Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
> Change-Id: Ib1b58e02d4df4a687ef7be57284c06097bdeca94
> Reviewed-on: https://chromium-review.googlesource.com/1070490
> Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Reviewed-by: Antoine Labour <piman@chromium.org>
> Reviewed-by: Eric Karl <ericrk@chromium.org>
> Commit-Queue: Alexis Hétu <sugoi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#572442}

Change-Id: I85f723ed8a8f7d981a9652cd7979c54d0f1248ae
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Reviewed-on: https://chromium-review.googlesource.com/1125899
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Reviewed-by: default avatarAlexis Hétu <sugoi@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572623}
parent d7925401
...@@ -167,10 +167,8 @@ TEST_F(TransferCacheTest, RawMemoryTransfer) { ...@@ -167,10 +167,8 @@ TEST_F(TransferCacheTest, RawMemoryTransfer) {
} }
TEST_F(TransferCacheTest, ImageMemoryTransfer) { TEST_F(TransferCacheTest, ImageMemoryTransfer) {
// TODO(ericrk): This test doesn't work on Android. crbug.com/777628 // TODO(ericrk): This test doesn't work. crbug.com/859619
#if defined(OS_ANDROID)
return; return;
#endif
auto* service_cache = ServiceTransferCache(); auto* service_cache = ServiceTransferCache();
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "cc/animation/animation_host.h" #include "cc/animation/animation_host.h"
#include "cc/animation/keyframe_effect.h" #include "cc/animation/keyframe_effect.h"
#include "cc/animation/keyframe_model.h" #include "cc/animation/keyframe_model.h"
...@@ -612,7 +613,22 @@ LayerTreeTest::LayerTreeTest() ...@@ -612,7 +613,22 @@ LayerTreeTest::LayerTreeTest()
// specified (for running in a debugger). // specified (for running in a debugger).
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kCCLayerTreeTestNoTimeout)) if (!command_line->HasSwitch(switches::kCCLayerTreeTestNoTimeout))
timeout_seconds_ = 5; #if defined(THREAD_SANITIZER)
// SwiftShader is a multi-threaded renderer and TSAN takes a lot longer to
// run tests when using SwiftShader
timeout_seconds_ = 35;
#elif defined(OS_WIN) && defined(_DEBUG)
// Debug builds on Windows are much slower than on other platforms, possibly
// because Windows uses separate debug versions of the C Run-Time Library
// for debug builds, whereas other platforms use the same system libraries
// for debug and release builds.
timeout_seconds_ = 25;
#elif defined(ADDRESS_SANITIZER) || defined(_DEBUG)
// ASAN and Debug builds are slower than release builds, as expected
timeout_seconds_ = 12;
#else
timeout_seconds_ = 6;
#endif
if (command_line->HasSwitch(switches::kCCLayerTreeTestLongTimeout)) if (command_line->HasSwitch(switches::kCCLayerTreeTestLongTimeout))
timeout_seconds_ = 5 * 60; timeout_seconds_ = 5 * 60;
} }
......
...@@ -320,9 +320,12 @@ TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, ...@@ -320,9 +320,12 @@ TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest,
large_error_allowed, large_error_allowed,
small_error_allowed); small_error_allowed);
RunPixelResourceTest(background, base::FilePath image_name =
base::FilePath( (test_case_ == GPU)
FILE_PATH_LITERAL("mask_of_background_filter.png"))); ? base::FilePath(
FILE_PATH_LITERAL("mask_of_background_filter_gpu.png"))
: base::FilePath(FILE_PATH_LITERAL("mask_of_background_filter.png"));
RunPixelResourceTest(background, image_name);
} }
TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest,
...@@ -674,9 +677,13 @@ TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircle) { ...@@ -674,9 +677,13 @@ TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircle) {
mask_layer->SetBlendMode(SkBlendMode::kDstIn); mask_layer->SetBlendMode(SkBlendMode::kDstIn);
mask_isolation->AddChild(mask_layer); mask_isolation->AddChild(mask_layer);
RunPixelResourceTest( base::FilePath image_name =
root, (test_type_ == PIXEL_TEST_SOFTWARE)
base::FilePath(FILE_PATH_LITERAL("mask_as_blending_rotated_circle.png"))); ? base::FilePath(
FILE_PATH_LITERAL("mask_as_blending_rotated_circle.png"))
: base::FilePath(
FILE_PATH_LITERAL("mask_as_blending_rotated_circle_gl.png"));
RunPixelResourceTest(root, image_name);
} }
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircleUnderflow) { TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircleUnderflow) {
...@@ -717,9 +724,13 @@ TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircleUnderflow) { ...@@ -717,9 +724,13 @@ TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircleUnderflow) {
mask_layer->SetBlendMode(SkBlendMode::kDstIn); mask_layer->SetBlendMode(SkBlendMode::kDstIn);
mask_isolation->AddChild(mask_layer); mask_isolation->AddChild(mask_layer);
RunPixelResourceTest(root, base::FilePath image_name =
base::FilePath(FILE_PATH_LITERAL( (test_type_ == PIXEL_TEST_SOFTWARE)
"mask_as_blending_rotated_circle_underflow.png"))); ? base::FilePath(FILE_PATH_LITERAL(
"mask_as_blending_rotated_circle_underflow.png"))
: base::FilePath(FILE_PATH_LITERAL(
"mask_as_blending_rotated_circle_underflow_gl.png"));
RunPixelResourceTest(root, image_name);
} }
TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest,
......
...@@ -2287,7 +2287,7 @@ TYPED_TEST(RendererPixelTest, EnlargedRenderPassTextureWithAntiAliasing) { ...@@ -2287,7 +2287,7 @@ TYPED_TEST(RendererPixelTest, EnlargedRenderPassTextureWithAntiAliasing) {
EXPECT_TRUE(this->RunPixelTest( EXPECT_TRUE(this->RunPixelTest(
&pass_list, &pass_list,
base::FilePath(FILE_PATH_LITERAL("blue_yellow_anti_aliasing.png")), base::FilePath(FILE_PATH_LITERAL("blue_yellow_anti_aliasing.png")),
cc::FuzzyPixelComparator(true, 100.f, 0.f, 5.f, 5, 0))); cc::FuzzyPixelComparator(true, 100.f, 0.f, 5.f, 7, 0)));
} }
// This tests the case where we have a RenderPass with a mask, but the quad // This tests the case where we have a RenderPass with a mask, but the quad
......
components/viz/test/data/axis_aligned.png

672 Bytes | W: | H:

components/viz/test/data/axis_aligned.png

670 Bytes | W: | H:

components/viz/test/data/axis_aligned.png
components/viz/test/data/axis_aligned.png
components/viz/test/data/axis_aligned.png
components/viz/test/data/axis_aligned.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -301,6 +301,15 @@ GpuVideoAcceleratorFactoriesImpl::VideoFrameOutputFormat(size_t bit_depth) { ...@@ -301,6 +301,15 @@ GpuVideoAcceleratorFactoriesImpl::VideoFrameOutputFormat(size_t bit_depth) {
DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(task_runner_->BelongsToCurrentThread());
if (CheckContextLost()) if (CheckContextLost())
return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED;
#if defined(OS_CHROMEOS) && defined(USE_OZONE)
// TODO(sugoi): This configuration is currently used only for testing ChromeOS
// on Linux and doesn't support hardware acceleration. OSMesa did not support
// any hardware acceleration here, so this was never an issue, but SwiftShader
// revealed this issue. See https://crbug.com/859946
if (gpu_channel_host_->gpu_info().gl_renderer.find("SwiftShader") !=
std::string::npos)
return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED;
#endif
auto capabilities = context_provider_->ContextCapabilities(); auto capabilities = context_provider_->ContextCapabilities();
if (bit_depth > 8) { if (bit_depth > 8) {
// If high bit depth rendering is enabled, bail here, otherwise try and use // If high bit depth rendering is enabled, bail here, otherwise try and use
......
...@@ -12,8 +12,7 @@ import("//testing/test.gni") ...@@ -12,8 +12,7 @@ import("//testing/test.gni")
declare_args() { declare_args() {
enable_swiftshader = enable_swiftshader =
(is_win || (is_linux && use_x11) || (is_mac && use_egl) || (is_win || (is_linux && use_x11) || (is_mac && use_egl) || is_chromeos) &&
(is_chromeos && ozone_platform_x11)) &&
(target_cpu == "x86" || target_cpu == "x64") (target_cpu == "x86" || target_cpu == "x64")
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "ui/gl/gl_bindings.h" #include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_features.h"
#include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_version_info.h" #include "ui/gl/gl_version_info.h"
...@@ -121,9 +122,9 @@ GLImplementation GetNamedGLImplementation(const std::string& name) { ...@@ -121,9 +122,9 @@ GLImplementation GetNamedGLImplementation(const std::string& name) {
} }
GLImplementation GetSoftwareGLImplementation() { GLImplementation GetSoftwareGLImplementation() {
#if (defined(OS_WIN) || \ #if (BUILDFLAG(ENABLE_SWIFTSHADER) && \
(defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(USE_OZONE)) || \ (defined(OS_WIN) || defined(OS_LINUX) || \
(defined(OS_MACOSX) && defined(USE_EGL))) (defined(OS_MACOSX) && defined(USE_EGL))))
return kGLImplementationSwiftShaderGL; return kGLImplementationSwiftShaderGL;
#else #else
return kGLImplementationOSMesaGL; return kGLImplementationOSMesaGL;
......
...@@ -64,10 +64,7 @@ void InitializeOneOffHelper(bool init_extensions) { ...@@ -64,10 +64,7 @@ void InitializeOneOffHelper(bool init_extensions) {
GLImplementation impl = allowed_impls[0]; GLImplementation impl = allowed_impls[0];
if (use_software_gl) if (use_software_gl)
impl = kGLImplementationOSMesaGL; // FIXME(sugoi): change to impl = gl::GetSoftwareGLImplementation();
// gl::GetSoftwareGLImplementation() when
// SwiftShader is used for Layout Tests
// on all platforms
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