blob: 55313057ce97b95ae6b9231660a3569fddc0fd19 [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)
16// Use android AImageReader when playing videos with MediaPlayer.
17const base::Feature kAImageReaderMediaPlayer{"AImageReaderMediaPlayer",
vikassoni81d7d8e2019-09-09 18:15:2118 base::FEATURE_ENABLED_BY_DEFAULT};
Maggie Chen1ecb0742018-11-28 07:27:3719
Khushal5fbf5a62019-12-06 20:51:3620// Used only by webview to disable SurfaceControl.
21const base::Feature kDisableSurfaceControlForWebview{
22 "DisableSurfaceControlForWebview", base::FEATURE_DISABLED_BY_DEFAULT};
Maggie Chen1ecb0742018-11-28 07:27:3723#endif
ericrk41a1579e2017-02-10 20:56:2824
25// Enable GPU Rasterization by default. This can still be overridden by
26// --force-gpu-rasterization or --disable-gpu-rasterization.
Eric Karlba990bf2018-01-03 00:19:3527#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_CHROMEOS) || \
Sergey Ulanov54c279422019-05-14 01:08:0428 defined(OS_ANDROID) || defined(OS_FUCHSIA)
Eric Karlba990bf2018-01-03 00:19:3529// DefaultEnableGpuRasterization has launched on Mac, Windows, ChromeOS, and
30// Android.
ericrk41a1579e2017-02-10 20:56:2831const base::Feature kDefaultEnableGpuRasterization{
32 "DefaultEnableGpuRasterization", base::FEATURE_ENABLED_BY_DEFAULT};
33#else
34const base::Feature kDefaultEnableGpuRasterization{
35 "DefaultEnableGpuRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
36#endif
37
Adrienne Walkerc87477e2018-06-06 22:28:2138// Enable out of process rasterization by default. This can still be overridden
39// by --enable-oop-rasterization or --disable-oop-rasterization.
Khushalab2fcdc2019-11-26 02:21:1240#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
Khushal9c368112019-10-29 18:15:4641const base::Feature kDefaultEnableOopRasterization{
42 "DefaultEnableOopRasterization", base::FEATURE_ENABLED_BY_DEFAULT};
43#else
Adrienne Walkerc87477e2018-06-06 22:28:2144const base::Feature kDefaultEnableOopRasterization{
45 "DefaultEnableOopRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
Khushal9c368112019-10-29 18:15:4646#endif
Adrienne Walkerc87477e2018-06-06 22:28:2147
Maggie Chen132c38e52019-02-04 22:18:4748// Allow putting a video swapchain underneath the main swapchain, so overlays
49// can be used even if there are controls on top of the video. It can be
50// enabled only when overlay is supported.
51const base::Feature kDirectCompositionUnderlays{
Maggie Chen78bcd4912019-04-02 00:59:0852 "DirectCompositionUnderlays", base::FEATURE_ENABLED_BY_DEFAULT};
Maggie Chen132c38e52019-02-04 22:18:4753
Sunny Sachanandani35c727c2019-07-09 13:12:5254#if defined(OS_WIN)
55// Use a high priority for GPU process on Windows.
56const base::Feature kGpuProcessHighPriorityWin{
Sunny Sachanandani16944252019-12-04 03:40:4957 "GpuProcessHighPriorityWin", base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani35c727c2019-07-09 13:12:5258#endif
59
Sunny Sachanandani5cd10e962019-06-13 22:55:3260// Use ThreadPriority::DISPLAY for GPU main, viz compositor and IO threads.
Sunny Sachanandani16944252019-12-04 03:40:4961#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
Sunny Sachanandani5cd10e962019-06-13 22:55:3262const base::Feature kGpuUseDisplayThreadPriority{
63 "GpuUseDisplayThreadPriority", base::FEATURE_ENABLED_BY_DEFAULT};
64#else
65const base::Feature kGpuUseDisplayThreadPriority{
66 "GpuUseDisplayThreadPriority", base::FEATURE_DISABLED_BY_DEFAULT};
67#endif
68
Maggie Chen3590ec22019-06-14 00:28:0969// Gpu watchdog V2 to simplify the logic and reduce GPU hangs
70const base::Feature kGpuWatchdogV2{"GpuWatchdogV2",
71 base::FEATURE_DISABLED_BY_DEFAULT};
72
Maggie Chend4da0952019-12-18 05:26:1273// Use a different set of watchdog timeouts on V1
74const base::Feature kGpuWatchdogV1NewTimeout{"GpuWatchdogV1NewTimeout",
75 base::FEATURE_ENABLED_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
Peng Huangdc3c68f42019-09-15 02:27:22108// Enable Vulkan graphics backend if --use-vulkan flag is not used. Otherwise
109// --use-vulkan will be followed.
110const base::Feature kVulkan{"Vulkan", base::FEATURE_DISABLED_BY_DEFAULT};
111
Vikas Soni47f216ac2020-01-17 19:21:13112// Used to enable shared image mailbox and disable legacy texture mailbox on
113// webview.
114const base::Feature kEnableSharedImageForWebview{
115 "EnableSharedImageForWebview", base::FEATURE_ENABLED_BY_DEFAULT};
116
Khushalb39ecde2019-03-06 00:28:56117#if defined(OS_ANDROID)
118bool IsAndroidSurfaceControlEnabled() {
Khushal5fbf5a62019-12-06 20:51:36119 if (base::FeatureList::IsEnabled(kDisableSurfaceControlForWebview))
Khushalcc93a502019-04-04 22:12:57120 return false;
121
Khushal5fbf5a62019-12-06 20:51:36122 return gl::SurfaceControl::IsSupported();
Khushalb39ecde2019-03-06 00:28:56123}
124#endif
125
ericrk41a1579e2017-02-10 20:56:28126} // namespace features