blob: c920171a041f073b8efc67ae2fba56ba12b72e25 [file] [log] [blame]
ericrk41a1579e2017-02-10 20:56:281// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4#include "gpu/config/gpu_finch_features.h"
5
Khushalb39ecde2019-03-06 00:28:566#if defined(OS_ANDROID)
Khushalcc93a502019-04-04 22:12:577#include "base/android/build_info.h"
8#include "base/metrics/field_trial_params.h"
9#include "base/strings/string_split.h"
Khushalb39ecde2019-03-06 00:28:5610#include "ui/gl/android/android_surface_control_compat.h"
11#endif
12
ericrk41a1579e2017-02-10 20:56:2813namespace features {
Khushalcc93a502019-04-04 22:12:5714
Maggie Chen1ecb0742018-11-28 07:27:3715#if defined(OS_ANDROID)
Khushal5fbf5a62019-12-06 20:51:3616// Used only by webview to disable SurfaceControl.
17const base::Feature kDisableSurfaceControlForWebview{
18 "DisableSurfaceControlForWebview", base::FEATURE_DISABLED_BY_DEFAULT};
Maggie Chen1ecb0742018-11-28 07:27:3719#endif
ericrk41a1579e2017-02-10 20:56:2820
21// Enable GPU Rasterization by default. This can still be overridden by
22// --force-gpu-rasterization or --disable-gpu-rasterization.
Eric Karlba990bf2018-01-03 00:19:3523#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_CHROMEOS) || \
Sergey Ulanov54c279422019-05-14 01:08:0424 defined(OS_ANDROID) || defined(OS_FUCHSIA)
Eric Karlba990bf2018-01-03 00:19:3525// DefaultEnableGpuRasterization has launched on Mac, Windows, ChromeOS, and
26// Android.
ericrk41a1579e2017-02-10 20:56:2827const base::Feature kDefaultEnableGpuRasterization{
28 "DefaultEnableGpuRasterization", base::FEATURE_ENABLED_BY_DEFAULT};
29#else
30const base::Feature kDefaultEnableGpuRasterization{
31 "DefaultEnableGpuRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
32#endif
33
Adrienne Walkerc87477e2018-06-06 22:28:2134// Enable out of process rasterization by default. This can still be overridden
35// by --enable-oop-rasterization or --disable-oop-rasterization.
Khushalab2fcdc2019-11-26 02:21:1236#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
Khushal9c368112019-10-29 18:15:4637const base::Feature kDefaultEnableOopRasterization{
38 "DefaultEnableOopRasterization", base::FEATURE_ENABLED_BY_DEFAULT};
39#else
Adrienne Walkerc87477e2018-06-06 22:28:2140const base::Feature kDefaultEnableOopRasterization{
41 "DefaultEnableOopRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
Khushal9c368112019-10-29 18:15:4642#endif
Adrienne Walkerc87477e2018-06-06 22:28:2143
Maggie Chen132c38e52019-02-04 22:18:4744// Allow putting a video swapchain underneath the main swapchain, so overlays
45// can be used even if there are controls on top of the video. It can be
46// enabled only when overlay is supported.
47const base::Feature kDirectCompositionUnderlays{
Maggie Chen78bcd4912019-04-02 00:59:0848 "DirectCompositionUnderlays", base::FEATURE_ENABLED_BY_DEFAULT};
Maggie Chen132c38e52019-02-04 22:18:4749
Sunny Sachanandani35c727c2019-07-09 13:12:5250#if defined(OS_WIN)
51// Use a high priority for GPU process on Windows.
52const base::Feature kGpuProcessHighPriorityWin{
Sunny Sachanandani16944252019-12-04 03:40:4953 "GpuProcessHighPriorityWin", base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani35c727c2019-07-09 13:12:5254#endif
55
Sunny Sachanandani5cd10e962019-06-13 22:55:3256// Use ThreadPriority::DISPLAY for GPU main, viz compositor and IO threads.
Sunny Sachanandani16944252019-12-04 03:40:4957#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
Sunny Sachanandani5cd10e962019-06-13 22:55:3258const base::Feature kGpuUseDisplayThreadPriority{
59 "GpuUseDisplayThreadPriority", base::FEATURE_ENABLED_BY_DEFAULT};
60#else
61const base::Feature kGpuUseDisplayThreadPriority{
62 "GpuUseDisplayThreadPriority", base::FEATURE_DISABLED_BY_DEFAULT};
63#endif
64
Maggie Chen3590ec22019-06-14 00:28:0965// Gpu watchdog V2 to simplify the logic and reduce GPU hangs
66const base::Feature kGpuWatchdogV2{"GpuWatchdogV2",
Maggie Chenb6273fad2020-03-05 23:00:0967 base::FEATURE_ENABLED_BY_DEFAULT};
Maggie Chen3590ec22019-06-14 00:28:0968
Maggie Chend4da0952019-12-18 05:26:1269// Use a different set of watchdog timeouts on V1
70const base::Feature kGpuWatchdogV1NewTimeout{"GpuWatchdogV1NewTimeout",
71 base::FEATURE_ENABLED_BY_DEFAULT};
72
Maggie Chen27c4b4b2020-03-10 16:04:2073// Use a different set of watchdog timeouts on V2
74const base::Feature kGpuWatchdogV2NewTimeout{"GpuWatchdogV2NewTimeout",
75 base::FEATURE_DISABLED_BY_DEFAULT};
76
Christopher Cameron4f7ce362019-04-26 02:21:3777#if defined(OS_MACOSX)
78// Enable use of Metal for OOP rasterization.
79const base::Feature kMetal{"Metal", base::FEATURE_DISABLED_BY_DEFAULT};
80#endif
81
Maggie Chen1ecb0742018-11-28 07:27:3782// Causes us to use the SharedImageManager, removing support for the old
83// mailbox system. Any consumers of the GPU process using the old mailbox
84// system will experience undefined results.
85const base::Feature kSharedImageManager{"SharedImageManager",
86 base::FEATURE_DISABLED_BY_DEFAULT};
87
88// For Windows only. Use overlay swapchain to present software protected videos
89// for all GPUs
90const base::Feature kUseDCOverlaysForSoftwareProtectedVideo{
91 "UseDCOverlaysForSoftwareProtectedVideo",
92 base::FEATURE_DISABLED_BY_DEFAULT};
93
Andres Calderon Jaramillo605253d2018-09-05 15:46:3594// Controls the decode acceleration of JPEG images (as opposed to camera
95// captures) in Chrome OS using the VA-API.
96// TODO(andrescj): remove or enable by default in Chrome OS once
97// https://crbug.com/868400 is resolved.
98const base::Feature kVaapiJpegImageDecodeAcceleration{
99 "VaapiJpegImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT};
100
Gil Dekel8f4b5642019-07-27 05:27:40101// Controls the decode acceleration of WebP images in Chrome OS using the
102// VA-API.
103// TODO(gildekel): remove or enable by default in Chrome OS once
104// https://crbug.com/877694 is resolved.
105const base::Feature kVaapiWebPImageDecodeAcceleration{
106 "VaapiWebPImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT};
107
Sean Gilhulyc8018df2020-01-21 18:20:35108// Enable Vulkan graphics backend for compositing and rasterization. Defaults to
109// native implementation if --use-vulkan flag is not used. Otherwise
Peng Huangdc3c68f42019-09-15 02:27:22110// --use-vulkan will be followed.
111const base::Feature kVulkan{"Vulkan", base::FEATURE_DISABLED_BY_DEFAULT};
112
Sean Gilhulyc8018df2020-01-21 18:20:35113// Enable SkiaRenderer Dawn graphics backend. On Windows this will use D3D12,
114// and on Linux this will use Vulkan.
115const base::Feature kSkiaDawn{"SkiaDawn", base::FEATURE_DISABLED_BY_DEFAULT};
116
Vikas Soni47f216ac2020-01-17 19:21:13117// Used to enable shared image mailbox and disable legacy texture mailbox on
118// webview.
119const base::Feature kEnableSharedImageForWebview{
Vasiliy Telezhnikov4feb3e732020-02-28 00:43:30120 "EnableSharedImageForWebview", base::FEATURE_DISABLED_BY_DEFAULT};
Vikas Soni47f216ac2020-01-17 19:21:13121
Khushalb39ecde2019-03-06 00:28:56122#if defined(OS_ANDROID)
123bool IsAndroidSurfaceControlEnabled() {
Khushal5fbf5a62019-12-06 20:51:36124 if (base::FeatureList::IsEnabled(kDisableSurfaceControlForWebview))
Khushalcc93a502019-04-04 22:12:57125 return false;
126
Khushal5fbf5a62019-12-06 20:51:36127 return gl::SurfaceControl::IsSupported();
Khushalb39ecde2019-03-06 00:28:56128}
129#endif
130
ericrk41a1579e2017-02-10 20:56:28131} // namespace features