ericrk | 41a1579e | 2017-02-10 20:56:28 | [diff] [blame] | 1 | // 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 | |
Khushal | b39ecde | 2019-03-06 00:28:56 | [diff] [blame] | 6 | #if defined(OS_ANDROID) |
Khushal | cc93a50 | 2019-04-04 22:12:57 | [diff] [blame] | 7 | #include "base/android/build_info.h" |
| 8 | #include "base/metrics/field_trial_params.h" |
| 9 | #include "base/strings/string_split.h" |
Khushal | b39ecde | 2019-03-06 00:28:56 | [diff] [blame] | 10 | #include "ui/gl/android/android_surface_control_compat.h" |
| 11 | #endif |
| 12 | |
ericrk | 41a1579e | 2017-02-10 20:56:28 | [diff] [blame] | 13 | namespace features { |
Khushal | cc93a50 | 2019-04-04 22:12:57 | [diff] [blame] | 14 | |
Maggie Chen | 1ecb074 | 2018-11-28 07:27:37 | [diff] [blame] | 15 | #if defined(OS_ANDROID) |
Khushal | 5fbf5a6 | 2019-12-06 20:51:36 | [diff] [blame] | 16 | // Used only by webview to disable SurfaceControl. |
| 17 | const base::Feature kDisableSurfaceControlForWebview{ |
| 18 | "DisableSurfaceControlForWebview", base::FEATURE_DISABLED_BY_DEFAULT}; |
Maggie Chen | 1ecb074 | 2018-11-28 07:27:37 | [diff] [blame] | 19 | #endif |
ericrk | 41a1579e | 2017-02-10 20:56:28 | [diff] [blame] | 20 | |
| 21 | // Enable GPU Rasterization by default. This can still be overridden by |
| 22 | // --force-gpu-rasterization or --disable-gpu-rasterization. |
Eric Karl | ba990bf | 2018-01-03 00:19:35 | [diff] [blame] | 23 | #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_CHROMEOS) || \ |
Sergey Ulanov | 54c27942 | 2019-05-14 01:08:04 | [diff] [blame] | 24 | defined(OS_ANDROID) || defined(OS_FUCHSIA) |
Eric Karl | ba990bf | 2018-01-03 00:19:35 | [diff] [blame] | 25 | // DefaultEnableGpuRasterization has launched on Mac, Windows, ChromeOS, and |
| 26 | // Android. |
ericrk | 41a1579e | 2017-02-10 20:56:28 | [diff] [blame] | 27 | const base::Feature kDefaultEnableGpuRasterization{ |
| 28 | "DefaultEnableGpuRasterization", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 29 | #else |
| 30 | const base::Feature kDefaultEnableGpuRasterization{ |
| 31 | "DefaultEnableGpuRasterization", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 32 | #endif |
| 33 | |
Adrienne Walker | c87477e | 2018-06-06 22:28:21 | [diff] [blame] | 34 | // Enable out of process rasterization by default. This can still be overridden |
| 35 | // by --enable-oop-rasterization or --disable-oop-rasterization. |
Khushal | ab2fcdc | 2019-11-26 02:21:12 | [diff] [blame] | 36 | #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX) |
Khushal | 9c36811 | 2019-10-29 18:15:46 | [diff] [blame] | 37 | const base::Feature kDefaultEnableOopRasterization{ |
| 38 | "DefaultEnableOopRasterization", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 39 | #else |
Adrienne Walker | c87477e | 2018-06-06 22:28:21 | [diff] [blame] | 40 | const base::Feature kDefaultEnableOopRasterization{ |
| 41 | "DefaultEnableOopRasterization", base::FEATURE_DISABLED_BY_DEFAULT}; |
Khushal | 9c36811 | 2019-10-29 18:15:46 | [diff] [blame] | 42 | #endif |
Adrienne Walker | c87477e | 2018-06-06 22:28:21 | [diff] [blame] | 43 | |
Maggie Chen | 132c38e5 | 2019-02-04 22:18:47 | [diff] [blame] | 44 | // 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. |
| 47 | const base::Feature kDirectCompositionUnderlays{ |
Maggie Chen | 78bcd491 | 2019-04-02 00:59:08 | [diff] [blame] | 48 | "DirectCompositionUnderlays", base::FEATURE_ENABLED_BY_DEFAULT}; |
Maggie Chen | 132c38e5 | 2019-02-04 22:18:47 | [diff] [blame] | 49 | |
Sunny Sachanandani | 35c727c | 2019-07-09 13:12:52 | [diff] [blame] | 50 | #if defined(OS_WIN) |
| 51 | // Use a high priority for GPU process on Windows. |
| 52 | const base::Feature kGpuProcessHighPriorityWin{ |
Sunny Sachanandani | 1694425 | 2019-12-04 03:40:49 | [diff] [blame] | 53 | "GpuProcessHighPriorityWin", base::FEATURE_ENABLED_BY_DEFAULT}; |
Sunny Sachanandani | 35c727c | 2019-07-09 13:12:52 | [diff] [blame] | 54 | #endif |
| 55 | |
Sunny Sachanandani | 5cd10e96 | 2019-06-13 22:55:32 | [diff] [blame] | 56 | // Use ThreadPriority::DISPLAY for GPU main, viz compositor and IO threads. |
Sunny Sachanandani | 1694425 | 2019-12-04 03:40:49 | [diff] [blame] | 57 | #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) |
Sunny Sachanandani | 5cd10e96 | 2019-06-13 22:55:32 | [diff] [blame] | 58 | const base::Feature kGpuUseDisplayThreadPriority{ |
| 59 | "GpuUseDisplayThreadPriority", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 60 | #else |
| 61 | const base::Feature kGpuUseDisplayThreadPriority{ |
| 62 | "GpuUseDisplayThreadPriority", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 63 | #endif |
| 64 | |
Maggie Chen | 3590ec2 | 2019-06-14 00:28:09 | [diff] [blame] | 65 | // Gpu watchdog V2 to simplify the logic and reduce GPU hangs |
| 66 | const base::Feature kGpuWatchdogV2{"GpuWatchdogV2", |
Maggie Chen | b6273fad | 2020-03-05 23:00:09 | [diff] [blame] | 67 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Maggie Chen | 3590ec2 | 2019-06-14 00:28:09 | [diff] [blame] | 68 | |
Maggie Chen | d4da095 | 2019-12-18 05:26:12 | [diff] [blame] | 69 | // Use a different set of watchdog timeouts on V1 |
| 70 | const base::Feature kGpuWatchdogV1NewTimeout{"GpuWatchdogV1NewTimeout", |
| 71 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 72 | |
Maggie Chen | 27c4b4b | 2020-03-10 16:04:20 | [diff] [blame] | 73 | // Use a different set of watchdog timeouts on V2 |
| 74 | const base::Feature kGpuWatchdogV2NewTimeout{"GpuWatchdogV2NewTimeout", |
| 75 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 76 | |
Christopher Cameron | 4f7ce36 | 2019-04-26 02:21:37 | [diff] [blame] | 77 | #if defined(OS_MACOSX) |
| 78 | // Enable use of Metal for OOP rasterization. |
| 79 | const base::Feature kMetal{"Metal", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 80 | #endif |
| 81 | |
Maggie Chen | 1ecb074 | 2018-11-28 07:27:37 | [diff] [blame] | 82 | // 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. |
| 85 | const 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 |
| 90 | const base::Feature kUseDCOverlaysForSoftwareProtectedVideo{ |
| 91 | "UseDCOverlaysForSoftwareProtectedVideo", |
| 92 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 93 | |
Andres Calderon Jaramillo | 605253d | 2018-09-05 15:46:35 | [diff] [blame] | 94 | // 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. |
| 98 | const base::Feature kVaapiJpegImageDecodeAcceleration{ |
| 99 | "VaapiJpegImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 100 | |
Gil Dekel | 8f4b564 | 2019-07-27 05:27:40 | [diff] [blame] | 101 | // 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. |
| 105 | const base::Feature kVaapiWebPImageDecodeAcceleration{ |
| 106 | "VaapiWebPImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 107 | |
Sean Gilhuly | c8018df | 2020-01-21 18:20:35 | [diff] [blame] | 108 | // Enable Vulkan graphics backend for compositing and rasterization. Defaults to |
| 109 | // native implementation if --use-vulkan flag is not used. Otherwise |
Peng Huang | dc3c68f4 | 2019-09-15 02:27:22 | [diff] [blame] | 110 | // --use-vulkan will be followed. |
| 111 | const base::Feature kVulkan{"Vulkan", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 112 | |
Sean Gilhuly | c8018df | 2020-01-21 18:20:35 | [diff] [blame] | 113 | // Enable SkiaRenderer Dawn graphics backend. On Windows this will use D3D12, |
| 114 | // and on Linux this will use Vulkan. |
| 115 | const base::Feature kSkiaDawn{"SkiaDawn", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 116 | |
Vikas Soni | 47f216ac | 2020-01-17 19:21:13 | [diff] [blame] | 117 | // Used to enable shared image mailbox and disable legacy texture mailbox on |
| 118 | // webview. |
| 119 | const base::Feature kEnableSharedImageForWebview{ |
Vasiliy Telezhnikov | 4feb3e73 | 2020-02-28 00:43:30 | [diff] [blame] | 120 | "EnableSharedImageForWebview", base::FEATURE_DISABLED_BY_DEFAULT}; |
Vikas Soni | 47f216ac | 2020-01-17 19:21:13 | [diff] [blame] | 121 | |
Khushal | b39ecde | 2019-03-06 00:28:56 | [diff] [blame] | 122 | #if defined(OS_ANDROID) |
| 123 | bool IsAndroidSurfaceControlEnabled() { |
Khushal | 5fbf5a6 | 2019-12-06 20:51:36 | [diff] [blame] | 124 | if (base::FeatureList::IsEnabled(kDisableSurfaceControlForWebview)) |
Khushal | cc93a50 | 2019-04-04 22:12:57 | [diff] [blame] | 125 | return false; |
| 126 | |
Khushal | 5fbf5a6 | 2019-12-06 20:51:36 | [diff] [blame] | 127 | return gl::SurfaceControl::IsSupported(); |
Khushal | b39ecde | 2019-03-06 00:28:56 | [diff] [blame] | 128 | } |
| 129 | #endif |
| 130 | |
ericrk | 41a1579e | 2017-02-10 20:56:28 | [diff] [blame] | 131 | } // namespace features |