blob: a4e6473a3f4597f73d3aa032c8a4e72c863988f7 [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
Christopher Cameron4f7ce362019-04-26 02:21:3773#if defined(OS_MACOSX)
74// Enable use of Metal for OOP rasterization.
75const base::Feature kMetal{"Metal", base::FEATURE_DISABLED_BY_DEFAULT};
76#endif
77
Maggie Chen1ecb0742018-11-28 07:27:3778// Causes us to use the SharedImageManager, removing support for the old
79// mailbox system. Any consumers of the GPU process using the old mailbox
80// system will experience undefined results.
81const base::Feature kSharedImageManager{"SharedImageManager",
82 base::FEATURE_DISABLED_BY_DEFAULT};
83
84// For Windows only. Use overlay swapchain to present software protected videos
85// for all GPUs
86const base::Feature kUseDCOverlaysForSoftwareProtectedVideo{
87 "UseDCOverlaysForSoftwareProtectedVideo",
88 base::FEATURE_DISABLED_BY_DEFAULT};
89
Andres Calderon Jaramillo605253d2018-09-05 15:46:3590// Controls the decode acceleration of JPEG images (as opposed to camera
91// captures) in Chrome OS using the VA-API.
92// TODO(andrescj): remove or enable by default in Chrome OS once
93// https://crbug.com/868400 is resolved.
94const base::Feature kVaapiJpegImageDecodeAcceleration{
95 "VaapiJpegImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT};
96
Gil Dekel8f4b5642019-07-27 05:27:4097// Controls the decode acceleration of WebP images in Chrome OS using the
98// VA-API.
99// TODO(gildekel): remove or enable by default in Chrome OS once
100// https://crbug.com/877694 is resolved.
101const base::Feature kVaapiWebPImageDecodeAcceleration{
102 "VaapiWebPImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT};
103
Sean Gilhulyc8018df2020-01-21 18:20:35104// Enable Vulkan graphics backend for compositing and rasterization. Defaults to
105// native implementation if --use-vulkan flag is not used. Otherwise
Peng Huangdc3c68f42019-09-15 02:27:22106// --use-vulkan will be followed.
107const base::Feature kVulkan{"Vulkan", base::FEATURE_DISABLED_BY_DEFAULT};
108
Sean Gilhulyc8018df2020-01-21 18:20:35109// Enable SkiaRenderer Dawn graphics backend. On Windows this will use D3D12,
110// and on Linux this will use Vulkan.
111const base::Feature kSkiaDawn{"SkiaDawn", base::FEATURE_DISABLED_BY_DEFAULT};
112
Vikas Soni47f216ac2020-01-17 19:21:13113// Used to enable shared image mailbox and disable legacy texture mailbox on
114// webview.
115const base::Feature kEnableSharedImageForWebview{
Vasiliy Telezhnikov4feb3e732020-02-28 00:43:30116 "EnableSharedImageForWebview", base::FEATURE_DISABLED_BY_DEFAULT};
Vikas Soni47f216ac2020-01-17 19:21:13117
Khushalb39ecde2019-03-06 00:28:56118#if defined(OS_ANDROID)
119bool IsAndroidSurfaceControlEnabled() {
Khushal5fbf5a62019-12-06 20:51:36120 if (base::FeatureList::IsEnabled(kDisableSurfaceControlForWebview))
Khushalcc93a502019-04-04 22:12:57121 return false;
122
Khushal5fbf5a62019-12-06 20:51:36123 return gl::SurfaceControl::IsSupported();
Khushalb39ecde2019-03-06 00:28:56124}
125#endif
126
ericrk41a1579e2017-02-10 20:56:28127} // namespace features