Commit dc3c68f4 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Add Vulkan feature for finch

--use-vulkan flag is used, chrome will follow it, otherwise chrome will
use the new added Vulkan feature.

Bug: 1002487
Change-Id: I4d8d3674e0aa9831046810ec67edba21a9efd25a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795486Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696670}
parent b685eb0c
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_finch_features.h"
#include "skia/ext/image_operations.h" #include "skia/ext/image_operations.h"
#include "third_party/android_opengl/etc1/etc1.h" #include "third_party/android_opengl/etc1/etc1.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
...@@ -201,7 +202,8 @@ void ThumbnailCache::Put(TabId tab_id, ...@@ -201,7 +202,8 @@ void ThumbnailCache::Put(TabId tab_id,
// Vulkan does not yet support compressed texture uploads. Disable compression // Vulkan does not yet support compressed texture uploads. Disable compression
// and approximation when in experimental Vulkan mode. // and approximation when in experimental Vulkan mode.
// TODO(ericrk): Remove this restriction. https://crbug.com/906794 // TODO(ericrk): Remove this restriction. https://crbug.com/906794
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseVulkan)) { if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseVulkan) ||
base::FeatureList::IsEnabled(features::kVulkan)) {
return; return;
} }
......
...@@ -91,19 +91,6 @@ const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() { ...@@ -91,19 +91,6 @@ const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() {
gpu_preferences.enable_oop_rasterization_ddl = gpu_preferences.enable_oop_rasterization_ddl =
command_line->HasSwitch(switches::kEnableOopRasterizationDDL); command_line->HasSwitch(switches::kEnableOopRasterizationDDL);
if (command_line->HasSwitch(switches::kUseVulkan)) {
auto value = command_line->GetSwitchValueASCII(switches::kUseVulkan);
if (value.empty() || value == switches::kVulkanImplementationNameNative) {
gpu_preferences.use_vulkan = gpu::VulkanImplementationName::kNative;
} else if (value == switches::kVulkanImplementationNameSwiftshader) {
gpu_preferences.use_vulkan = gpu::VulkanImplementationName::kSwiftshader;
} else {
gpu_preferences.use_vulkan = gpu::VulkanImplementationName::kNone;
}
} else {
gpu_preferences.use_vulkan = gpu::VulkanImplementationName::kNone;
}
gpu_preferences.enforce_vulkan_protected_memory = gpu_preferences.enforce_vulkan_protected_memory =
command_line->HasSwitch(switches::kEnforceVulkanProtectedMemory); command_line->HasSwitch(switches::kEnforceVulkanProtectedMemory);
gpu_preferences.disable_vulkan_fallback_to_gl_for_testing = gpu_preferences.disable_vulkan_fallback_to_gl_for_testing =
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h" #include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_finch_features.h"
#include "ui/gl/gl_switches.h" #include "ui/gl/gl_switches.h"
#include "ui/gl/gl_utils.h" #include "ui/gl/gl_utils.h"
...@@ -155,6 +156,8 @@ GpuPreferences ParseGpuPreferences(const base::CommandLine* command_line) { ...@@ -155,6 +156,8 @@ GpuPreferences ParseGpuPreferences(const base::CommandLine* command_line) {
gpu_preferences.enable_webgpu = gpu_preferences.enable_webgpu =
command_line->HasSwitch(switches::kEnableUnsafeWebGPU); command_line->HasSwitch(switches::kEnableUnsafeWebGPU);
if (command_line->HasSwitch(switches::kUseVulkan)) { if (command_line->HasSwitch(switches::kUseVulkan)) {
DLOG_IF(ERROR, base::FeatureList::IsEnabled(features::kVulkan))
<< "--enabled-features=Vulkan is overrided by --use-vulkan.";
auto value = command_line->GetSwitchValueASCII(switches::kUseVulkan); auto value = command_line->GetSwitchValueASCII(switches::kUseVulkan);
if (value.empty() || value == switches::kVulkanImplementationNameNative) { if (value.empty() || value == switches::kVulkanImplementationNameNative) {
gpu_preferences.use_vulkan = VulkanImplementationName::kNative; gpu_preferences.use_vulkan = VulkanImplementationName::kNative;
...@@ -164,7 +167,9 @@ GpuPreferences ParseGpuPreferences(const base::CommandLine* command_line) { ...@@ -164,7 +167,9 @@ GpuPreferences ParseGpuPreferences(const base::CommandLine* command_line) {
gpu_preferences.use_vulkan = VulkanImplementationName::kNone; gpu_preferences.use_vulkan = VulkanImplementationName::kNone;
} }
} else { } else {
gpu_preferences.use_vulkan = VulkanImplementationName::kNone; gpu_preferences.use_vulkan = base::FeatureList::IsEnabled(features::kVulkan)
? gpu::VulkanImplementationName::kNative
: gpu::VulkanImplementationName::kNone;
} }
gpu_preferences.disable_vulkan_surface = gpu_preferences.disable_vulkan_surface =
command_line->HasSwitch(switches::kDisableVulkanSurface); command_line->HasSwitch(switches::kDisableVulkanSurface);
......
...@@ -120,6 +120,10 @@ const base::Feature kVaapiJpegImageDecodeAcceleration{ ...@@ -120,6 +120,10 @@ const base::Feature kVaapiJpegImageDecodeAcceleration{
const base::Feature kVaapiWebPImageDecodeAcceleration{ const base::Feature kVaapiWebPImageDecodeAcceleration{
"VaapiWebPImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT}; "VaapiWebPImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable Vulkan graphics backend if --use-vulkan flag is not used. Otherwise
// --use-vulkan will be followed.
const base::Feature kVulkan{"Vulkan", base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
bool IsAndroidSurfaceControlEnabled() { bool IsAndroidSurfaceControlEnabled() {
if (!gl::SurfaceControl::IsSupported()) if (!gl::SurfaceControl::IsSupported())
......
...@@ -50,6 +50,8 @@ GPU_EXPORT extern const base::Feature kVaapiJpegImageDecodeAcceleration; ...@@ -50,6 +50,8 @@ GPU_EXPORT extern const base::Feature kVaapiJpegImageDecodeAcceleration;
GPU_EXPORT extern const base::Feature kVaapiWebPImageDecodeAcceleration; GPU_EXPORT extern const base::Feature kVaapiWebPImageDecodeAcceleration;
GPU_EXPORT extern const base::Feature kVulkan;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
GPU_EXPORT bool IsAndroidSurfaceControlEnabled(); GPU_EXPORT bool IsAndroidSurfaceControlEnabled();
#endif #endif
......
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