Commit 34173c24 authored by Wez's avatar Wez Committed by Commit Bot

[Fuchsia] Disable fallback to SW compositing.

Previously WebEngine was falling back to SW compositing after 3
GPU process crashes. This is not desirable when Vulkan is enabled
because it may mask other issues. Also not all features work correctly
with SW compositing (e.g. it's not compatible with HW video decoder).

Also added --disable-software-rasterizer to disable SwiftShader as
we should never need to use it on Fuchsia.

Bug: 1021844
Change-Id: I3257d9f0372789849a2922b514e6b23e08a380e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854893
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713063}
parent f806791c
...@@ -966,10 +966,12 @@ gpu::GpuMode GpuDataManagerImplPrivate::GetGpuMode() const { ...@@ -966,10 +966,12 @@ gpu::GpuMode GpuDataManagerImplPrivate::GetGpuMode() const {
} }
void GpuDataManagerImplPrivate::FallBackToNextGpuMode() { void GpuDataManagerImplPrivate::FallBackToNextGpuMode() {
#if defined(OS_ANDROID) || defined(OS_CHROMEOS) #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_FUCHSIA)
// Android and Chrome OS can't switch to software compositing. If the GPU // Android and Chrome OS can't switch to software compositing. If the GPU
// process initialization fails or GPU process is too unstable then crash the // process initialization fails or GPU process is too unstable then crash the
// browser process to reset everything. // browser process to reset everything.
// On Fuchsia Vulkan must be used when it's enabled by the WebEngine embedder.
// Falling back to SW compositing in that case is not supported.
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
FatalGpuProcessLaunchFailureOnBackground(); FatalGpuProcessLaunchFailureOnBackground();
#endif #endif
......
...@@ -247,14 +247,20 @@ void ContextProviderImpl::Create( ...@@ -247,14 +247,20 @@ void ContextProviderImpl::Create(
} }
if (enable_vulkan) { if (enable_vulkan) {
DLOG(ERROR) << "Enabling Vulkan GPU acceleration.";
launch_command.AppendSwitch(switches::kUseVulkan); launch_command.AppendSwitch(switches::kUseVulkan);
launch_command.AppendSwitchASCII(switches::kEnableFeatures, launch_command.AppendSwitchASCII(switches::kEnableFeatures,
features::kUseSkiaRenderer.name); features::kUseSkiaRenderer.name);
launch_command.AppendSwitch(switches::kEnableOopRasterization); launch_command.AppendSwitch(switches::kEnableOopRasterization);
launch_command.AppendSwitch(switches::kDisableSoftwareRasterizer);
launch_command.AppendSwitchASCII(switches::kUseGL, launch_command.AppendSwitchASCII(switches::kUseGL,
gl::kGLImplementationStubName); gl::kGLImplementationStubName);
launch_command.AppendSwitchASCII(switches::kGrContextType, launch_command.AppendSwitchASCII(switches::kGrContextType,
switches::kGrContextTypeVulkan); switches::kGrContextTypeVulkan);
} else {
DLOG(ERROR) << "Disabling GPU acceleration.";
launch_command.AppendSwitch(switches::kDisableGpu);
launch_command.AppendSwitch(switches::kDisableSoftwareRasterizer);
} }
if (enable_widevine) { if (enable_widevine) {
......
...@@ -28,6 +28,20 @@ buildflag_header("buildflags") { ...@@ -28,6 +28,20 @@ buildflag_header("buildflags") {
visibility = [ ":*" ] visibility = [ ":*" ]
} }
# TODO(https://crbug.com/1021844): Remove this hack once we have Vulkan
# emulation available via AEMU.
source_set("detect_vulkan_hack") {
sources = [
"common/detect_vulkan_hack.cc",
"common/detect_vulkan_hack.h",
]
deps = [
"//gpu/vulkan",
"//third_party/fuchsia-sdk/sdk:web",
]
visibility = [ ":*" ]
}
# Files common to both cast_runner and web_runner targets. # Files common to both cast_runner and web_runner targets.
source_set("common") { source_set("common") {
sources = [ sources = [
...@@ -92,6 +106,7 @@ executable("cast_runner_exe") { ...@@ -92,6 +106,7 @@ executable("cast_runner_exe") {
":buildflags", ":buildflags",
":cast_runner_core", ":cast_runner_core",
":common", ":common",
":detect_vulkan_hack",
"//base", "//base",
"//fuchsia/base", "//fuchsia/base",
] ]
...@@ -206,6 +221,7 @@ executable("web_runner_exe") { ...@@ -206,6 +221,7 @@ executable("web_runner_exe") {
] ]
deps = [ deps = [
":common", ":common",
":detect_vulkan_hack",
"//base", "//base",
"//fuchsia/base", "//fuchsia/base",
] ]
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "fuchsia/base/init_logging.h" #include "fuchsia/base/init_logging.h"
#include "fuchsia/runners/buildflags.h" #include "fuchsia/runners/buildflags.h"
#include "fuchsia/runners/cast/cast_runner.h" #include "fuchsia/runners/cast/cast_runner.h"
#include "fuchsia/runners/common/detect_vulkan_hack.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO);
...@@ -31,6 +32,9 @@ int main(int argc, char** argv) { ...@@ -31,6 +32,9 @@ int main(int argc, char** argv) {
fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER | fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER |
fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM; fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM;
// Vulkan is not currently available in our integration test environment.
DisableVulkanIfUnavailable(&features);
if (!BUILDFLAG(ENABLE_SOFTWARE_VIDEO_DECODERS)) if (!BUILDFLAG(ENABLE_SOFTWARE_VIDEO_DECODERS))
features |= fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER_ONLY; features |= fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER_ONLY;
......
include_rules = [
"+gpu/vulkan",
]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "fuchsia/runners/common/detect_vulkan_hack.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
// Removes the VULKAN feature flag if Vulkan is not available on the host.
void DisableVulkanIfUnavailable(fuchsia::web::ContextFeatureFlags* features) {
gpu::VulkanFunctionPointers* vulkan_ptrs = gpu::GetVulkanFunctionPointers();
if (!vulkan_ptrs->BindUnassociatedFunctionPointers())
*features &= ~fuchsia::web::ContextFeatureFlags::VULKAN;
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FUCHSIA_RUNNERS_COMMON_DETECT_VULKAN_HACK_H_
#define FUCHSIA_RUNNERS_COMMON_DETECT_VULKAN_HACK_H_
#include <fuchsia/web/cpp/fidl.h>
// Removes the VULKAN feature flag if Vulkan is not available on the host.
// TODO(https://crbug.com/1021844): Remove this workaround once our test
// environment provides Vulkan.
void DisableVulkanIfUnavailable(fuchsia::web::ContextFeatureFlags* features);
#endif // FUCHSIA_RUNNERS_COMMON_DETECT_VULKAN_HACK_H_
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/single_thread_task_executor.h" #include "base/task/single_thread_task_executor.h"
#include "fuchsia/base/init_logging.h" #include "fuchsia/base/init_logging.h"
#include "fuchsia/runners/common/detect_vulkan_hack.h"
#include "fuchsia/runners/common/web_content_runner.h" #include "fuchsia/runners/common/web_content_runner.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
...@@ -22,17 +23,19 @@ int main(int argc, char** argv) { ...@@ -22,17 +23,19 @@ int main(int argc, char** argv) {
return 1; return 1;
} }
constexpr fuchsia::web::ContextFeatureFlags kWebRunnerFeatures = fuchsia::web::ContextFeatureFlags features =
fuchsia::web::ContextFeatureFlags::NETWORK | fuchsia::web::ContextFeatureFlags::NETWORK |
fuchsia::web::ContextFeatureFlags::AUDIO | fuchsia::web::ContextFeatureFlags::AUDIO |
fuchsia::web::ContextFeatureFlags::VULKAN | fuchsia::web::ContextFeatureFlags::VULKAN |
fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER | fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER |
fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM; fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM;
// Vulkan is not currently available in our integration test environment.
DisableVulkanIfUnavailable(&features);
WebContentRunner runner( WebContentRunner runner(
base::fuchsia::ComponentContextForCurrentProcess()->outgoing().get(), base::fuchsia::ComponentContextForCurrentProcess()->outgoing().get(),
base::BindOnce(&WebContentRunner::CreateDefaultWebContext, base::BindOnce(&WebContentRunner::CreateDefaultWebContext, features));
kWebRunnerFeatures));
base::fuchsia::ComponentContextForCurrentProcess() base::fuchsia::ComponentContextForCurrentProcess()
->outgoing() ->outgoing()
......
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