Commit 3fb5ea6e authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

Don't disable viz on video chromecast builds with --disable-gpu

This should work like other platforms, and give a Viz process that
doesn't require a hardware GPU, e.g. for running tests on infra.

This fixes an infinite loop when --disable-gpu is passed in such builds,
where we try to start a GPU process but this is rejected by
GpuProcessStartAllowed() == false. This started happening (or at least
became severe enough to break our tests) after 966e62f6
("[scheduler] Enable prioritize until begin main frame by default.").

Change-Id: I67c4f819e0383950d1c876bc34b799fb794bd5e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2304154Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789655}
parent e49eafee
...@@ -2082,6 +2082,10 @@ jumbo_source_set("browser") { ...@@ -2082,6 +2082,10 @@ jumbo_source_set("browser") {
] ]
} }
if (is_chromecast) {
deps += [ "//chromecast:chromecast_buildflags" ]
}
if (is_chromecast && is_linux) { if (is_chromecast && is_linux) {
sources += [ sources += [
"tracing/cast_tracing_agent.cc", "tracing/cast_tracing_agent.cc",
......
include_rules = [ include_rules = [
"+chromecast/chromecast_buildflags.h",
"+components/metal_util", "+components/metal_util",
"+components/ui_devtools/buildflags.h", "+components/ui_devtools/buildflags.h",
] ]
......
...@@ -91,6 +91,9 @@ ...@@ -91,6 +91,9 @@
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "ui/display/win/screen_win.h" #include "ui/display/win/screen_win.h"
#endif // OS_WIN #endif // OS_WIN
#if BUILDFLAG(IS_CHROMECAST)
#include "chromecast/chromecast_buildflags.h"
#endif
namespace content { namespace content {
...@@ -563,8 +566,10 @@ void GpuDataManagerImplPrivate::InitializeGpuModes() { ...@@ -563,8 +566,10 @@ void GpuDataManagerImplPrivate::InitializeGpuModes() {
// Chomecast audio-only builds run with the flag --disable-gpu. The GPU // Chomecast audio-only builds run with the flag --disable-gpu. The GPU
// process should not be started in this case. // process should not be started in this case.
#if BUILDFLAG(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
#if BUILDFLAG(IS_CAST_AUDIO_ONLY)
fallback_modes_.clear(); fallback_modes_.clear();
fallback_modes_.push_back(gpu::GpuMode::DISABLED); fallback_modes_.push_back(gpu::GpuMode::DISABLED);
#endif
#elif defined(OS_ANDROID) || defined(OS_CHROMEOS) #elif defined(OS_ANDROID) || defined(OS_CHROMEOS)
CHECK(false) << "GPU acceleration is required on certain platforms!"; CHECK(false) << "GPU acceleration is required on certain platforms!";
#endif // IS_CHROMECAST #endif // IS_CHROMECAST
......
...@@ -26,6 +26,13 @@ ...@@ -26,6 +26,13 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h" #include "url/gurl.h"
#if BUILDFLAG(IS_CHROMECAST)
#include "chromecast/chromecast_buildflags.h"
#if BUILDFLAG(IS_CAST_AUDIO_ONLY)
#define CAST_AUDIO_ONLY
#endif
#endif
namespace content { namespace content {
namespace { namespace {
...@@ -292,7 +299,7 @@ TEST_F(GpuDataManagerImplPrivateTest, FallbackWithSwiftShaderDisabled) { ...@@ -292,7 +299,7 @@ TEST_F(GpuDataManagerImplPrivateTest, FallbackWithSwiftShaderDisabled) {
} }
#endif // !OS_FUCHSIA #endif // !OS_FUCHSIA
#if !BUILDFLAG(IS_CHROMECAST) #if !defined(CAST_AUDIO_ONLY)
TEST_F(GpuDataManagerImplPrivateTest, GpuStartsWithGpuDisabled) { TEST_F(GpuDataManagerImplPrivateTest, GpuStartsWithGpuDisabled) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableGpu); base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableGpu);
ScopedGpuDataManagerImplPrivate manager; ScopedGpuDataManagerImplPrivate manager;
...@@ -302,7 +309,7 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuStartsWithGpuDisabled) { ...@@ -302,7 +309,7 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuStartsWithGpuDisabled) {
#endif // !OS_ANDROID && !OS_CHROMEOS #endif // !OS_ANDROID && !OS_CHROMEOS
// Chromecast audio-only builds should not launch the GPU process. // Chromecast audio-only builds should not launch the GPU process.
#if BUILDFLAG(IS_CHROMECAST) #if defined(CAST_AUDIO_ONLY)
TEST_F(GpuDataManagerImplPrivateTest, ChromecastStartsWithGpuDisabled) { TEST_F(GpuDataManagerImplPrivateTest, ChromecastStartsWithGpuDisabled) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableGpu); base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableGpu);
ScopedGpuDataManagerImplPrivate manager; ScopedGpuDataManagerImplPrivate manager;
......
...@@ -2417,6 +2417,10 @@ test("content_unittests") { ...@@ -2417,6 +2417,10 @@ test("content_unittests") {
sources += [ "../browser/xr/service/xr_runtime_manager_unittest.cc" ] sources += [ "../browser/xr/service/xr_runtime_manager_unittest.cc" ]
deps += [ "//device/vr:vr_fakes" ] deps += [ "//device/vr:vr_fakes" ]
} }
if (is_chromecast) {
deps += [ "//chromecast:chromecast_buildflags" ]
}
} }
if (enable_nocompile_tests) { if (enable_nocompile_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