Commit cd0aa150 authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

[fuchsia] Enable ANGLE in web_engine (reland)

This is not currently compatible with --enforce-vulkan-protected-memory.
which forces all shared images to be protected, including canvas
resources.

Bug: 766360
TBR=sergeyu@chromium.org

Change-Id: I784d2fe690cdced6a733f85d6104fbbaf2532057
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2092871Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748208}
parent 91fd050e
......@@ -209,9 +209,6 @@ cr_fuchsia_package("web_engine") {
excluded_files = [
"lib/libswiftshader_libEGL.so",
"lib/libswiftshader_libGLESv2.so",
"lib/libEGL.so",
"lib/libGLESv2.so",
"lib/libfuchsia_egl.so",
]
}
......
......@@ -415,6 +415,26 @@ void ContextProviderImpl::Create(
return;
}
bool allow_protected_graphics =
web_engine_config.FindBoolPath("allow-protected-graphics")
.value_or(false);
bool force_protected_graphics =
web_engine_config.FindBoolPath("force-protected-graphics")
.value_or(false);
bool enable_protected_graphics =
(enable_drm && allow_protected_graphics) || force_protected_graphics;
if (enable_protected_graphics) {
launch_command.AppendSwitch(switches::kEnforceVulkanProtectedMemory);
launch_command.AppendSwitch(switches::kEnableProtectedVideoBuffers);
bool force_protected_video_buffers =
web_engine_config.FindBoolPath("force-protected-video-buffers")
.value_or(false);
if (force_protected_video_buffers) {
launch_command.AppendSwitch(switches::kForceProtectedVideoOutputBuffers);
}
}
if (enable_vulkan) {
if (is_headless) {
LOG(ERROR) << "VULKAN and HEADLESS features cannot be used together.";
......@@ -433,10 +453,18 @@ void ContextProviderImpl::Create(
// SkiaRenderer requires out-of-process rasterization be enabled.
launch_command.AppendSwitch(switches::kEnableOopRasterization);
// TODO(https://crbug.com/766360): Provide a no-op GL implementation until
// vANGLE is available.
launch_command.AppendSwitchASCII(switches::kUseGL,
gl::kGLImplementationStubName);
if (!enable_protected_graphics) {
launch_command.AppendSwitchASCII(switches::kUseGL,
gl::kGLImplementationANGLEName);
} else {
DLOG(WARNING) << "ANGLE is not compatible with "
<< switches::kEnforceVulkanProtectedMemory
<< ", disabling GL";
// TODO(crbug.com/1059010): Fix this; probably don't protect canvas
// resources.
launch_command.AppendSwitchASCII(switches::kUseGL,
gl::kGLImplementationDisabledName);
}
} else {
DLOG(ERROR) << "Disabling GPU acceleration.";
// Disable use of Vulkan GPU, and use of the software-GL rasterizer. The
......@@ -445,26 +473,6 @@ void ContextProviderImpl::Create(
launch_command.AppendSwitch(switches::kDisableSoftwareRasterizer);
}
bool allow_protected_graphics =
web_engine_config.FindBoolPath("allow-protected-graphics")
.value_or(false);
bool force_protected_graphics =
web_engine_config.FindBoolPath("force-protected-graphics")
.value_or(false);
bool enable_protected_graphics =
(enable_drm && allow_protected_graphics) || force_protected_graphics;
if (enable_protected_graphics) {
launch_command.AppendSwitch(switches::kEnforceVulkanProtectedMemory);
launch_command.AppendSwitch(switches::kEnableProtectedVideoBuffers);
bool force_protected_video_buffers =
web_engine_config.FindBoolPath("force-protected-video-buffers")
.value_or(false);
if (force_protected_video_buffers) {
launch_command.AppendSwitch(switches::kForceProtectedVideoOutputBuffers);
}
}
if (enable_widevine) {
launch_command.AppendSwitch(switches::kEnableWidevine);
}
......
......@@ -94,6 +94,7 @@ ScenicSurfaceFactory::GetAllowedGLImplementations() {
return std::vector<gl::GLImplementation>{
gl::kGLImplementationSwiftShaderGL,
gl::kGLImplementationEGLGLES2,
gl::kGLImplementationEGLANGLE,
gl::kGLImplementationStubGL,
};
}
......@@ -102,6 +103,7 @@ GLOzone* ScenicSurfaceFactory::GetGLOzone(gl::GLImplementation implementation) {
switch (implementation) {
case gl::kGLImplementationSwiftShaderGL:
case gl::kGLImplementationEGLGLES2:
case gl::kGLImplementationEGLANGLE:
return egl_implementation_.get();
default:
return nullptr;
......
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