blob: a1d813418f8aa76ce8486a3c21f77bf961712db0 [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:5714namespace {
15
16#if defined(OS_ANDROID)
17bool FieldIsInBlacklist(const char* current_value, std::string blacklist_str) {
18 std::vector<std::string> blacklist = base::SplitString(
19 blacklist_str, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
20 for (const std::string& value : blacklist) {
21 if (value == current_value)
22 return true;
23 }
24
25 return false;
26}
27#endif
28
29} // namespace
30
Maggie Chen1ecb0742018-11-28 07:27:3731#if defined(OS_ANDROID)
32// Use android AImageReader when playing videos with MediaPlayer.
33const base::Feature kAImageReaderMediaPlayer{"AImageReaderMediaPlayer",
34 base::FEATURE_DISABLED_BY_DEFAULT};
35
36// Use android SurfaceControl API for managing display compositor's buffer queue
37// and using overlays on Android.
38// Note that the feature only works with VizDisplayCompositor enabled.
39const base::Feature kAndroidSurfaceControl{"AndroidSurfaceControl",
40 base::FEATURE_DISABLED_BY_DEFAULT};
41#endif
ericrk41a1579e2017-02-10 20:56:2842
43// Enable GPU Rasterization by default. This can still be overridden by
44// --force-gpu-rasterization or --disable-gpu-rasterization.
Eric Karlba990bf2018-01-03 00:19:3545#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_CHROMEOS) || \
46 defined(OS_ANDROID)
47// DefaultEnableGpuRasterization has launched on Mac, Windows, ChromeOS, and
48// Android.
ericrk41a1579e2017-02-10 20:56:2849const base::Feature kDefaultEnableGpuRasterization{
50 "DefaultEnableGpuRasterization", base::FEATURE_ENABLED_BY_DEFAULT};
51#else
52const base::Feature kDefaultEnableGpuRasterization{
53 "DefaultEnableGpuRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
54#endif
55
Adrienne Walkerc87477e2018-06-06 22:28:2156// Enable out of process rasterization by default. This can still be overridden
57// by --enable-oop-rasterization or --disable-oop-rasterization.
58const base::Feature kDefaultEnableOopRasterization{
59 "DefaultEnableOopRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
60
Geoff Lang94cb9462017-10-25 21:54:0261// Use the passthrough command decoder by default. This can be overridden with
62// the --use-cmd-decoder=passthrough or --use-cmd-decoder=validating flags.
63const base::Feature kDefaultPassthroughCommandDecoder{
Sunny Sachanandani9456e9b2018-09-08 02:30:5364 "DefaultPassthroughCommandDecoder", base::FEATURE_DISABLED_BY_DEFAULT};
Geoff Lang94cb9462017-10-25 21:54:0265
Vikas Soni882982e12018-08-05 19:50:5866
Sunny Sachanandani729164b2018-08-10 00:45:1467// Overrides preferred overlay format to NV12 instead of YUY2.
68const base::Feature kDirectCompositionPreferNV12Overlays{
Sunny Sachanandani8f9ee582018-11-28 03:57:5169 "DirectCompositionPreferNV12Overlays", base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani729164b2018-08-10 00:45:1470
Maggie Chen132c38e52019-02-04 22:18:4771// Allow putting a video swapchain underneath the main swapchain, so overlays
72// can be used even if there are controls on top of the video. It can be
73// enabled only when overlay is supported.
74const base::Feature kDirectCompositionUnderlays{
Maggie Chen78bcd4912019-04-02 00:59:0875 "DirectCompositionUnderlays", base::FEATURE_ENABLED_BY_DEFAULT};
Maggie Chen132c38e52019-02-04 22:18:4776
Zhenyao Mocc6ea772019-04-25 22:33:5177// Allow GPU watchdog to keep waiting for ackowledgement if one is already
78// issued from the monitored thread.
79const base::Feature kGpuWatchdogNoTerminationAwaitingAcknowledge{
80 "GpuWatchdogNoTerminationAwaitingAcknowledge",
81 base::FEATURE_DISABLED_BY_DEFAULT};
82
Christopher Cameron4f7ce362019-04-26 02:21:3783#if defined(OS_MACOSX)
84// Enable use of Metal for OOP rasterization.
85const base::Feature kMetal{"Metal", base::FEATURE_DISABLED_BY_DEFAULT};
86#endif
87
Maggie Chen1ecb0742018-11-28 07:27:3788// Causes us to use the SharedImageManager, removing support for the old
89// mailbox system. Any consumers of the GPU process using the old mailbox
90// system will experience undefined results.
91const base::Feature kSharedImageManager{"SharedImageManager",
92 base::FEATURE_DISABLED_BY_DEFAULT};
93
94// For Windows only. Use overlay swapchain to present software protected videos
95// for all GPUs
96const base::Feature kUseDCOverlaysForSoftwareProtectedVideo{
97 "UseDCOverlaysForSoftwareProtectedVideo",
98 base::FEATURE_DISABLED_BY_DEFAULT};
99
Sunny Sachanandani8918dc62018-12-05 02:01:51100// Use decode swap chain created from compatible video decoder buffers.
101const base::Feature kDirectCompositionUseNV12DecodeSwapChain{
102 "DirectCompositionUseNV12DecodeSwapChain",
Sunny Sachanandani64418802019-04-22 23:00:08103 base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani8918dc62018-12-05 02:01:51104
Andres Calderon Jaramillo605253d2018-09-05 15:46:35105// Controls the decode acceleration of JPEG images (as opposed to camera
106// captures) in Chrome OS using the VA-API.
107// TODO(andrescj): remove or enable by default in Chrome OS once
108// https://crbug.com/868400 is resolved.
109const base::Feature kVaapiJpegImageDecodeAcceleration{
110 "VaapiJpegImageDecodeAcceleration", base::FEATURE_DISABLED_BY_DEFAULT};
111
Khushalb39ecde2019-03-06 00:28:56112#if defined(OS_ANDROID)
113bool IsAndroidSurfaceControlEnabled() {
Khushalcc93a502019-04-04 22:12:57114 if (!gl::SurfaceControl::IsSupported())
115 return false;
116
117 if (!base::FeatureList::IsEnabled(kAndroidSurfaceControl))
118 return false;
119
120 if (FieldIsInBlacklist(base::android::BuildInfo::GetInstance()->model(),
121 base::GetFieldTrialParamValueByFeature(
122 kAndroidSurfaceControl, "blacklisted_models"))) {
123 return false;
124 }
125
126 if (FieldIsInBlacklist(
127 base::android::BuildInfo::GetInstance()->android_build_id(),
128 base::GetFieldTrialParamValueByFeature(kAndroidSurfaceControl,
129 "blacklisted_build_ids"))) {
130 return false;
131 }
132
133 return true;
Khushalb39ecde2019-03-06 00:28:56134}
135#endif
136
ericrk41a1579e2017-02-10 20:56:28137} // namespace features