summaryrefslogtreecommitdiff
path: root/chromium/components/viz/common
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/viz/common')
-rw-r--r--chromium/components/viz/common/BUILD.gn11
-rw-r--r--chromium/components/viz/common/display/de_jelly.cc6
-rw-r--r--chromium/components/viz/common/display/renderer_settings.h3
-rw-r--r--chromium/components/viz/common/features.cc63
-rw-r--r--chromium/components/viz/common/features.h27
-rw-r--r--chromium/components/viz/common/frame_sinks/begin_frame_source.h2
-rw-r--r--chromium/components/viz/common/frame_sinks/delay_based_time_source.cc5
-rw-r--r--chromium/components/viz/common/frame_sinks/delay_based_time_source.h2
-rw-r--r--chromium/components/viz/common/frame_sinks/delay_based_time_source_unittest.cc123
-rw-r--r--chromium/components/viz/common/gl_i420_converter.h2
-rw-r--r--chromium/components/viz/common/gl_nv12_converter.h2
-rw-r--r--chromium/components/viz/common/gl_scaler.h25
-rw-r--r--chromium/components/viz/common/gl_scaler_overscan_pixeltest.cc2
-rw-r--r--chromium/components/viz/common/gl_scaler_pixeltest.cc6
-rw-r--r--chromium/components/viz/common/gl_scaler_shader_pixeltest.cc6
-rw-r--r--chromium/components/viz/common/gpu/DEPS2
-rw-r--r--chromium/components/viz/common/gpu/dawn_context_provider.cc28
-rw-r--r--chromium/components/viz/common/gpu/dawn_context_provider.h6
-rw-r--r--chromium/components/viz/common/gpu/vulkan_in_process_context_provider.cc17
-rw-r--r--chromium/components/viz/common/hit_test/hit_test_region_list.h3
-rw-r--r--chromium/components/viz/common/quads/compositor_frame_metadata.h4
-rw-r--r--chromium/components/viz/common/quads/compositor_frame_metadata_unittest.cc8
-rw-r--r--chromium/components/viz/common/quads/compositor_frame_transition_directive.cc3
-rw-r--r--chromium/components/viz/common/quads/compositor_frame_transition_directive.h9
-rw-r--r--chromium/components/viz/common/quads/compositor_frame_transition_directive_unittest.cc4
-rw-r--r--chromium/components/viz/common/quads/draw_quad_unittest.cc17
-rw-r--r--chromium/components/viz/common/quads/render_pass_io.cc79
-rw-r--r--chromium/components/viz/common/quads/render_pass_io_unittest.cc14
-rw-r--r--chromium/components/viz/common/resources/DEPS2
-rw-r--r--chromium/components/viz/common/resources/bitmap_allocation.cc2
-rw-r--r--chromium/components/viz/common/resources/resource_format_utils.cc26
-rw-r--r--chromium/components/viz/common/resources/resource_format_utils.h12
-rw-r--r--chromium/components/viz/common/resources/transferable_resource.h8
-rw-r--r--chromium/components/viz/common/surfaces/region_capture_bounds.cc12
-rw-r--r--chromium/components/viz/common/surfaces/region_capture_bounds.h10
-rw-r--r--chromium/components/viz/common/switches.cc12
-rw-r--r--chromium/components/viz/common/switches.h4
-rw-r--r--chromium/components/viz/common/viz_utils.cc15
-rw-r--r--chromium/components/viz/common/viz_utils.h2
-rw-r--r--chromium/components/viz/common/yuv_readback_unittest.cc4
40 files changed, 338 insertions, 250 deletions
diff --git a/chromium/components/viz/common/BUILD.gn b/chromium/components/viz/common/BUILD.gn
index 45bc8029c53..7abb58d2112 100644
--- a/chromium/components/viz/common/BUILD.gn
+++ b/chromium/components/viz/common/BUILD.gn
@@ -38,10 +38,11 @@ viz_component("resource_format_utils") {
deps = [
"//base",
+ "//build:chromeos_buildflags",
"//cc/base:base",
"//gpu/vulkan:buildflags",
"//skia",
- "//third_party/dawn/src/dawn:dawncpp_headers",
+ "//third_party/dawn/include/dawn:cpp_headers",
"//ui/gfx:buffer_types",
"//ui/gfx/geometry:geometry",
]
@@ -133,14 +134,14 @@ if (skia_use_dawn) {
public_deps = [
"//skia",
- "//third_party/dawn/src/dawn:dawn_headers",
+ "//third_party/dawn/include/dawn:headers",
]
deps = [
"//base",
- "//third_party/dawn/src/dawn:dawn_proc",
- "//third_party/dawn/src/dawn:dawncpp",
- "//third_party/dawn/src/dawn_native",
+ "//third_party/dawn/src/dawn:cpp",
+ "//third_party/dawn/src/dawn:proc",
+ "//third_party/dawn/src/dawn/native",
]
}
}
diff --git a/chromium/components/viz/common/display/de_jelly.cc b/chromium/components/viz/common/display/de_jelly.cc
index 35126113986..8beb1493597 100644
--- a/chromium/components/viz/common/display/de_jelly.cc
+++ b/chromium/components/viz/common/display/de_jelly.cc
@@ -9,7 +9,7 @@
#include "components/viz/common/features.h"
#include "components/viz/common/switches.h"
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/time/time.h"
@@ -30,7 +30,7 @@ bool DeJellyActive() {
if (!DeJellyEnabled())
return false;
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
return Java_DeJellyUtils_useDeJelly(base::android::AttachCurrentThread());
#else
return true;
@@ -44,7 +44,7 @@ float DeJellyScreenWidth() {
if (!value.empty())
return std::atoi(value.c_str());
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
return Java_DeJellyUtils_screenWidth(base::android::AttachCurrentThread());
#else
return 1440.0f;
diff --git a/chromium/components/viz/common/display/renderer_settings.h b/chromium/components/viz/common/display/renderer_settings.h
index e58b4023652..d8e2bd1e55a 100644
--- a/chromium/components/viz/common/display/renderer_settings.h
+++ b/chromium/components/viz/common/display/renderer_settings.h
@@ -31,7 +31,6 @@ class VIZ_COMMON_EXPORT RendererSettings {
bool should_clear_root_render_pass = true;
bool release_overlay_resources_after_gpu_query = false;
bool use_skia_renderer = false;
- bool allow_overlays = true;
bool dont_round_texture_sizes_for_pixel_tests = false;
int highp_threshold_min = 0;
bool auto_resize_output_surface = true;
@@ -51,7 +50,7 @@ class VIZ_COMMON_EXPORT RendererSettings {
// split into multiple quads during occlusion culling.
int minimum_fragments_reduced = 128 * 128;
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// The screen size at renderer creation time.
gfx::Size initial_screen_size = gfx::Size(0, 0);
diff --git a/chromium/components/viz/common/features.cc b/chromium/components/viz/common/features.cc
index c23d8b7337b..f9334876646 100644
--- a/chromium/components/viz/common/features.cc
+++ b/chromium/components/viz/common/features.cc
@@ -10,6 +10,7 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/system/sys_info.h"
+#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/viz/common/delegated_ink_prediction_configuration.h"
#include "components/viz/common/switches.h"
@@ -18,7 +19,7 @@
#include "gpu/config/gpu_switches.h"
#include "media/media_buildflags.h"
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
@@ -48,17 +49,25 @@ const base::Feature kEnableOverlayPrioritization {
#endif
};
+const base::Feature kUseMultipleOverlays{"UseMultipleOverlays",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+const char kMaxOverlaysParam[] = "max_overlays";
+
const base::Feature kDelegatedCompositing{"DelegatedCompositing",
base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kVideoDetectorIgnoreNonVideos{
+ "VideoDetectorIgnoreNonVideos", base::FEATURE_ENABLED_BY_DEFAULT};
+
const base::Feature kSimpleFrameRateThrottling{
"SimpleFrameRateThrottling", base::FEATURE_DISABLED_BY_DEFAULT};
// Use the SkiaRenderer.
const base::Feature kUseSkiaRenderer {
"UseSkiaRenderer",
-#if defined(OS_WIN) || defined(OS_ANDROID) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
- defined(OS_LINUX) || defined(OS_FUCHSIA) || defined(OS_MAC)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || \
+ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || \
+ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_MAC)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
@@ -76,7 +85,7 @@ const base::Feature kDisableDeJelly{"DisableDeJelly",
const base::Feature kDynamicBufferQueueAllocation{
"DynamicBufferQueueAllocation", base::FEATURE_DISABLED_BY_DEFAULT};
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// When wide color gamut content from the web is encountered, promote our
// display to wide color gamut if supported.
const base::Feature kDynamicColorGamut{"DynamicColorGamut",
@@ -94,7 +103,7 @@ const base::Feature kVizFrameSubmissionForWebView{
const base::Feature kUsePreferredIntervalForVideo{
"UsePreferredIntervalForVideo",
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
@@ -106,7 +115,7 @@ const base::Feature kUsePreferredIntervalForVideo{
const base::Feature kUseRealBuffersForPageFlipTest{
"UseRealBuffersForPageFlipTest", base::FEATURE_ENABLED_BY_DEFAULT};
-#if defined(OS_FUCHSIA)
+#if BUILDFLAG(IS_FUCHSIA)
// Enables SkiaOutputDeviceBufferQueue instead of Vulkan swapchain on Fuchsia.
const base::Feature kUseSkiaOutputDeviceBufferQueue{
"UseSkiaOutputDeviceBufferQueue", base::FEATURE_ENABLED_BY_DEFAULT};
@@ -116,12 +125,12 @@ const base::Feature kUseSkiaOutputDeviceBufferQueue{
const base::Feature kWebRtcLogCapturePipeline{
"WebRtcLogCapturePipeline", base::FEATURE_DISABLED_BY_DEFAULT};
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
// Enables swap chains to call SetPresentDuration to request DWM/OS to reduce
// vsync.
const base::Feature kUseSetPresentDuration{"UseSetPresentDuration",
base::FEATURE_DISABLED_BY_DEFAULT};
-#endif // OS_WIN
+#endif // BUILDFLAG(IS_WIN)
// Enables platform supported delegated ink trails instead of Skia backed
// delegated ink trails.
@@ -133,7 +142,7 @@ const base::Feature kUsePlatformDelegatedInk{"UsePlatformDelegatedInk",
const base::Feature kWebViewVulkanIntermediateBuffer{
"WebViewVulkanIntermediateBuffer", base::FEATURE_DISABLED_BY_DEFAULT};
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// Hardcoded as disabled for WebView to have a different default for
// UseSurfaceLayerForVideo from chrome.
const base::Feature kUseSurfaceLayerForVideoDefault{
@@ -150,7 +159,7 @@ const base::Feature kUseRealVideoColorSpaceForDisplay{
// Browser to batch SurfaceSync calls sent to the Renderer for properties can
// change in close proximity to each other.
const base::Feature kSurfaceSyncThrottling{"SurfaceSyncThrottling",
- base::FEATURE_DISABLED_BY_DEFAULT};
+ base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kDrawPredictedInkPoint{"DrawPredictedInkPoint",
base::FEATURE_DISABLED_BY_DEFAULT};
@@ -171,7 +180,7 @@ const base::Feature kDynamicSchedulerForDraw{"DynamicSchedulerForDraw",
const base::Feature kDynamicSchedulerForClients{
"DynamicSchedulerForClients", base::FEATURE_DISABLED_BY_DEFAULT};
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
const base::Feature kMacCAOverlayQuad{"MacCAOverlayQuads",
base::FEATURE_DISABLED_BY_DEFAULT};
// The maximum supported overlay quad number on Mac CALayerOverlay.
@@ -215,7 +224,7 @@ bool IsSimpleFrameRateThrottlingEnabled() {
}
bool IsUsingSkiaRenderer() {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// We don't support KitKat. Check for it before looking at the feature flag
// so that KitKat doesn't show up in Control or Enabled experiment group.
if (base::android::BuildInfo::GetInstance()->sdk_int() <=
@@ -236,7 +245,7 @@ bool IsUsingSkiaRenderer() {
features::IsUsingVulkan();
}
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
bool IsDynamicColorGamutEnabled() {
if (viz::AlwaysUseWideColorGamut())
return false;
@@ -259,11 +268,6 @@ bool IsUsingPreferredIntervalForVideo() {
return base::FeatureList::IsEnabled(kUsePreferredIntervalForVideo);
}
-bool IsVizHitTestingDebugEnabled() {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableVizHitTestDebug);
-}
-
bool ShouldUseRealBuffersForPageFlipTest() {
return base::FeatureList::IsEnabled(kUseRealBuffersForPageFlipTest);
}
@@ -272,11 +276,11 @@ bool ShouldWebRtcLogCapturePipeline() {
return base::FeatureList::IsEnabled(kWebRtcLogCapturePipeline);
}
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
bool ShouldUseSetPresentDuration() {
return base::FeatureList::IsEnabled(kUseSetPresentDuration);
}
-#endif // OS_WIN
+#endif // BUILDFLAG(IS_WIN)
absl::optional<int> ShouldDrawPredictedInkPoints() {
if (!base::FeatureList::IsEnabled(kDrawPredictedInkPoint))
@@ -308,7 +312,7 @@ bool ShouldUsePlatformDelegatedInk() {
return base::FeatureList::IsEnabled(kUsePlatformDelegatedInk);
}
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
bool UseSurfaceLayerForVideo() {
// Allow enabling UseSurfaceLayerForVideo if webview is using surface control.
if (::features::IsAndroidSurfaceControlEnabled()) {
@@ -358,4 +362,21 @@ absl::optional<double> IsDynamicSchedulerEnabledForClients() {
return result;
}
+int MaxOverlaysConsidered() {
+ if (!IsOverlayPrioritizationEnabled()) {
+ return 1;
+ }
+
+ if (!base::FeatureList::IsEnabled(kUseMultipleOverlays)) {
+ return 1;
+ }
+
+ return base::GetFieldTrialParamByFeatureAsInt(kUseMultipleOverlays,
+ kMaxOverlaysParam, 2);
+}
+
+bool ShouldVideoDetectorIgnoreNonVideoFrames() {
+ return base::FeatureList::IsEnabled(kVideoDetectorIgnoreNonVideos);
+}
+
} // namespace features
diff --git a/chromium/components/viz/common/features.h b/chromium/components/viz/common/features.h
index ccee1a755bc..d31bf0209e3 100644
--- a/chromium/components/viz/common/features.h
+++ b/chromium/components/viz/common/features.h
@@ -23,9 +23,13 @@ VIZ_COMMON_EXPORT extern const base::Feature kAdpf;
VIZ_COMMON_EXPORT extern const base::FeatureParam<int> kAdpfTargetDurationMs;
VIZ_COMMON_EXPORT extern const base::Feature kEnableOverlayPrioritization;
VIZ_COMMON_EXPORT extern const base::Feature kUseSkiaRenderer;
+VIZ_COMMON_EXPORT extern const base::Feature kDelegatedCompositing;
VIZ_COMMON_EXPORT extern const base::Feature kRecordSkPicture;
VIZ_COMMON_EXPORT extern const base::Feature kDisableDeJelly;
-#if defined(OS_ANDROID)
+VIZ_COMMON_EXPORT extern const base::Feature kUseMultipleOverlays;
+VIZ_COMMON_EXPORT extern const char kMaxOverlaysParam[];
+VIZ_COMMON_EXPORT extern const base::Feature kVideoDetectorIgnoreNonVideos;
+#if BUILDFLAG(IS_ANDROID)
VIZ_COMMON_EXPORT extern const base::Feature kDynamicColorGamut;
#endif
VIZ_COMMON_EXPORT extern const base::Feature kDynamicBufferQueueAllocation;
@@ -33,22 +37,22 @@ VIZ_COMMON_EXPORT extern const base::Feature kFastSolidColorDraw;
VIZ_COMMON_EXPORT extern const base::Feature kVizFrameSubmissionForWebView;
VIZ_COMMON_EXPORT extern const base::Feature kUsePreferredIntervalForVideo;
VIZ_COMMON_EXPORT extern const base::Feature kUseRealBuffersForPageFlipTest;
-#if defined(OS_FUCHSIA)
+#if BUILDFLAG(IS_FUCHSIA)
VIZ_COMMON_EXPORT extern const base::Feature kUseSkiaOutputDeviceBufferQueue;
#endif
VIZ_COMMON_EXPORT extern const base::Feature kWebRtcLogCapturePipeline;
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
VIZ_COMMON_EXPORT extern const base::Feature kUseSetPresentDuration;
-#endif // OS_WIN
+#endif // BUILDFLAG(IS_WIN)
VIZ_COMMON_EXPORT extern const base::Feature kWebViewVulkanIntermediateBuffer;
VIZ_COMMON_EXPORT extern const base::Feature kUsePlatformDelegatedInk;
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
VIZ_COMMON_EXPORT extern const base::Feature kUseSurfaceLayerForVideoDefault;
#endif
VIZ_COMMON_EXPORT extern const base::Feature kSurfaceSyncThrottling;
VIZ_COMMON_EXPORT extern const base::Feature kDynamicSchedulerForDraw;
VIZ_COMMON_EXPORT extern const base::Feature kDynamicSchedulerForClients;
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
VIZ_COMMON_EXPORT extern const base::Feature kMacCAOverlayQuad;
VIZ_COMMON_EXPORT extern const base::FeatureParam<int> kMacCAOverlayQuadMaxNum;
#endif
@@ -67,7 +71,7 @@ VIZ_COMMON_EXPORT extern const char kPredictorLsq[];
VIZ_COMMON_EXPORT bool IsAdpfEnabled();
VIZ_COMMON_EXPORT bool IsClipPrewalkDamageEnabled();
VIZ_COMMON_EXPORT bool IsSimpleFrameRateThrottlingEnabled();
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
VIZ_COMMON_EXPORT bool IsDynamicColorGamutEnabled();
#endif
VIZ_COMMON_EXPORT bool IsOverlayPrioritizationEnabled();
@@ -77,22 +81,23 @@ VIZ_COMMON_EXPORT bool IsUsingFastPathForSolidColorQuad();
VIZ_COMMON_EXPORT bool IsUsingSkiaRenderer();
VIZ_COMMON_EXPORT bool IsUsingVizFrameSubmissionForWebView();
VIZ_COMMON_EXPORT bool IsUsingPreferredIntervalForVideo();
-VIZ_COMMON_EXPORT bool IsVizHitTestingDebugEnabled();
VIZ_COMMON_EXPORT bool ShouldUseRealBuffersForPageFlipTest();
VIZ_COMMON_EXPORT bool ShouldWebRtcLogCapturePipeline();
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
VIZ_COMMON_EXPORT bool ShouldUseSetPresentDuration();
-#endif // OS_WIN
+#endif // BUILDFLAG(IS_WIN)
VIZ_COMMON_EXPORT absl::optional<int> ShouldDrawPredictedInkPoints();
VIZ_COMMON_EXPORT std::string InkPredictor();
VIZ_COMMON_EXPORT bool ShouldUsePlatformDelegatedInk();
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
VIZ_COMMON_EXPORT bool UseSurfaceLayerForVideo();
VIZ_COMMON_EXPORT bool UseRealVideoColorSpaceForDisplay();
#endif
VIZ_COMMON_EXPORT bool IsSurfaceSyncThrottling();
VIZ_COMMON_EXPORT absl::optional<double> IsDynamicSchedulerEnabledForDraw();
VIZ_COMMON_EXPORT absl::optional<double> IsDynamicSchedulerEnabledForClients();
+VIZ_COMMON_EXPORT int MaxOverlaysConsidered();
+VIZ_COMMON_EXPORT bool ShouldVideoDetectorIgnoreNonVideoFrames();
} // namespace features
diff --git a/chromium/components/viz/common/frame_sinks/begin_frame_source.h b/chromium/components/viz/common/frame_sinks/begin_frame_source.h
index 5e9a0bc3e19..3b3ca2b8a48 100644
--- a/chromium/components/viz/common/frame_sinks/begin_frame_source.h
+++ b/chromium/components/viz/common/frame_sinks/begin_frame_source.h
@@ -428,7 +428,7 @@ class VIZ_COMMON_EXPORT ExternalBeginFrameSource : public BeginFrameSource {
void OnSetBeginFrameSourcePaused(bool paused);
void OnBeginFrame(const BeginFrameArgs& args);
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// Notifies when the refresh rate of the display is updated. |refresh_rate| is
// the rate in frames per second.
virtual void UpdateRefreshRate(float refresh_rate) {}
diff --git a/chromium/components/viz/common/frame_sinks/delay_based_time_source.cc b/chromium/components/viz/common/frame_sinks/delay_based_time_source.cc
index 8ab8e648fa3..bd5960014a2 100644
--- a/chromium/components/viz/common/frame_sinks/delay_based_time_source.cc
+++ b/chromium/components/viz/common/frame_sinks/delay_based_time_source.cc
@@ -46,7 +46,7 @@ void DelayBasedTimeSource::SetActive(bool active) {
if (active_) {
PostNextTickTask(Now());
} else {
- timer_.AbandonAndStop();
+ timer_.Stop();
last_tick_time_ = base::TimeTicks();
next_tick_time_ = base::TimeTicks();
}
@@ -157,7 +157,8 @@ void DelayBasedTimeSource::PostNextTickTask(base::TimeTicks now) {
next_tick_time_ += interval_;
DCHECK_GT(next_tick_time_, now);
}
- timer_.Start(FROM_HERE, next_tick_time_ - now, tick_closure_);
+ timer_.Start(FROM_HERE, next_tick_time_, tick_closure_,
+ base::ExactDeadline(true));
}
std::string DelayBasedTimeSource::TypeString() const {
diff --git a/chromium/components/viz/common/frame_sinks/delay_based_time_source.h b/chromium/components/viz/common/frame_sinks/delay_based_time_source.h
index 00c817aac65..82fc20a0e77 100644
--- a/chromium/components/viz/common/frame_sinks/delay_based_time_source.h
+++ b/chromium/components/viz/common/frame_sinks/delay_based_time_source.h
@@ -82,7 +82,7 @@ class VIZ_COMMON_EXPORT DelayBasedTimeSource {
raw_ptr<base::SingleThreadTaskRunner> task_runner_;
base::RepeatingClosure tick_closure_;
- base::OneShotTimer timer_;
+ base::DeadlineTimer timer_;
};
} // namespace viz
diff --git a/chromium/components/viz/common/frame_sinks/delay_based_time_source_unittest.cc b/chromium/components/viz/common/frame_sinks/delay_based_time_source_unittest.cc
index c0e84dd1571..c4a1329d12c 100644
--- a/chromium/components/viz/common/frame_sinks/delay_based_time_source_unittest.cc
+++ b/chromium/components/viz/common/frame_sinks/delay_based_time_source_unittest.cc
@@ -7,7 +7,7 @@
#include <stdint.h>
#include "base/test/simple_test_tick_clock.h"
-#include "base/test/test_simple_task_runner.h"
+#include "base/test/test_mock_time_task_runner.h"
#include "components/viz/test/fake_delay_based_time_source.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -21,30 +21,25 @@ base::TimeDelta Interval() {
class DelayBasedTimeSourceTest : public ::testing::Test {
protected:
void SetUp() override {
- now_src_ = std::make_unique<base::SimpleTestTickClock>();
- task_runner_ = base::MakeRefCounted<base::TestSimpleTaskRunner>();
+ task_runner_ = base::MakeRefCounted<base::TestMockTimeTaskRunner>();
delay_based_time_source_ = std::make_unique<FakeDelayBasedTimeSource>(
- now_src_.get(), task_runner_.get());
+ task_runner_->GetMockTickClock(), task_runner_.get());
delay_based_time_source_->SetClient(&client_);
}
void TearDown() override {
delay_based_time_source_.reset();
task_runner_ = nullptr;
- now_src_.reset();
}
- void SetNow(base::TimeTicks ticks) { now_src_->SetNowTicks(ticks); }
-
- base::TestSimpleTaskRunner* task_runner() { return task_runner_.get(); }
+ base::TestMockTimeTaskRunner* task_runner() { return task_runner_.get(); }
FakeDelayBasedTimeSource* timer() { return delay_based_time_source_.get(); }
FakeDelayBasedTimeSourceClient* client() { return &client_; }
- std::unique_ptr<base::SimpleTestTickClock> now_src_;
FakeDelayBasedTimeSourceClient client_;
- scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
+ scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
std::unique_ptr<FakeDelayBasedTimeSource> delay_based_time_source_;
};
@@ -54,8 +49,8 @@ TEST_F(DelayBasedTimeSourceTest, TaskPostedAndTickCalled) {
EXPECT_TRUE(timer()->Active());
EXPECT_TRUE(task_runner()->HasPendingTask());
- SetNow(timer()->Now() + base::Milliseconds(16));
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval());
+ task_runner()->RunUntilIdle();
EXPECT_TRUE(timer()->Active());
EXPECT_TRUE(client()->TickCalled());
}
@@ -65,7 +60,7 @@ TEST_F(DelayBasedTimeSourceTest, TickNotCalledWithTaskPosted) {
timer()->SetActive(true);
EXPECT_TRUE(task_runner()->HasPendingTask());
timer()->SetActive(false);
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_FALSE(client()->TickCalled());
}
@@ -82,7 +77,7 @@ TEST_F(DelayBasedTimeSourceTest, StartWhenRunningDoesntTick) {
timer()->SetTimebaseAndInterval(base::TimeTicks(), Interval());
timer()->SetActive(true);
EXPECT_TRUE(task_runner()->HasPendingTask());
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
task_runner()->ClearPendingTasks();
timer()->SetActive(true);
EXPECT_FALSE(task_runner()->HasPendingTask());
@@ -94,12 +89,12 @@ TEST_F(DelayBasedTimeSourceTest, NextDelaySaneWhenExactlyOnRequestedTime) {
timer()->SetTimebaseAndInterval(base::TimeTicks(), Interval());
timer()->SetActive(true);
// Run the first tick.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
- SetNow(timer()->Now() + Interval());
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval());
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -110,12 +105,12 @@ TEST_F(DelayBasedTimeSourceTest, NextDelaySaneWhenSlightlyAfterRequestedTime) {
timer()->SetTimebaseAndInterval(base::TimeTicks(), Interval());
timer()->SetActive(true);
// Run the first tick.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
- SetNow(timer()->Now() + Interval() + base::Microseconds(1));
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + base::Microseconds(1));
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -127,12 +122,12 @@ TEST_F(DelayBasedTimeSourceTest,
timer()->SetTimebaseAndInterval(base::TimeTicks(), Interval());
timer()->SetActive(true);
// Run the first tick.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
- SetNow(timer()->Now() + 2 * Interval());
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(2 * Interval());
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -144,12 +139,12 @@ TEST_F(DelayBasedTimeSourceTest,
timer()->SetTimebaseAndInterval(base::TimeTicks(), Interval());
timer()->SetActive(true);
// Run the first tick.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
- SetNow(timer()->Now() + 2 * Interval() + base::Microseconds(1));
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(2 * Interval() + base::Microseconds(1));
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -160,12 +155,12 @@ TEST_F(DelayBasedTimeSourceTest, NextDelaySaneWhenHalfAfterRequestedTime) {
timer()->SetTimebaseAndInterval(base::TimeTicks(), Interval());
timer()->SetActive(true);
// Run the first tick.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
- SetNow(timer()->Now() + Interval() + base::Milliseconds(8));
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + base::Milliseconds(8));
+ task_runner()->RunUntilIdle();
EXPECT_EQ(8, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -175,7 +170,7 @@ TEST_F(DelayBasedTimeSourceTest, JitteryRuntimeWithFutureTimebases) {
timer()->SetActive(true);
// Run the first tick.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
base::TimeTicks future_timebase = timer()->Now() + Interval() * 10;
@@ -186,29 +181,29 @@ TEST_F(DelayBasedTimeSourceTest, JitteryRuntimeWithFutureTimebases) {
// Tick with +1ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() + jitter1);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + jitter1);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(15, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with 0ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() - jitter1);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() - jitter1);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with -1ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() - jitter1);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() - jitter1);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(1, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with 0ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() + jitter1);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + jitter1);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
// 8 ms jitter
@@ -217,29 +212,29 @@ TEST_F(DelayBasedTimeSourceTest, JitteryRuntimeWithFutureTimebases) {
// Tick with +8ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() + jitter8);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + jitter8);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(8, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with 0ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() - jitter8);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() - jitter8);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with -8ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() - jitter8);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() - jitter8);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(8, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with 0ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() + jitter8);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + jitter8);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
// 15 ms jitter
@@ -248,29 +243,29 @@ TEST_F(DelayBasedTimeSourceTest, JitteryRuntimeWithFutureTimebases) {
// Tick with +15ms jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() + jitter15);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + jitter15);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(1, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with 0ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() - jitter15);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() - jitter15);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with -15ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() - jitter15);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() - jitter15);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(15, task_runner()->NextPendingTaskDelay().InMilliseconds());
// Tick with 0ms of jitter
future_timebase += Interval();
timer()->SetTimebaseAndInterval(future_timebase, Interval());
- SetNow(timer()->Now() + Interval() + jitter15);
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(Interval() + jitter15);
+ task_runner()->RunUntilIdle();
EXPECT_EQ(16, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -288,8 +283,8 @@ TEST_F(DelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise) {
total_frame_time += delay_ms / 1000.0;
// Run the callback exactly when asked
- SetNow(timer()->Now() + base::Milliseconds(delay_ms));
- task_runner()->RunPendingTasks();
+ task_runner()->AdvanceMockTickClock(base::Milliseconds(delay_ms));
+ task_runner()->RunUntilIdle();
}
double average_interval =
total_frame_time / static_cast<double>(num_iterations);
@@ -301,8 +296,8 @@ TEST_F(DelayBasedTimeSourceTest, TestDeactivateWhilePending) {
timer()->SetActive(true); // Should post a task.
timer()->SetActive(false);
// Should run the posted task without crashing.
- EXPECT_TRUE(task_runner()->HasPendingTask());
- task_runner()->RunPendingTasks();
+ EXPECT_FALSE(task_runner()->HasPendingTask());
+ task_runner()->RunUntilIdle();
}
TEST_F(DelayBasedTimeSourceTest,
@@ -311,17 +306,17 @@ TEST_F(DelayBasedTimeSourceTest,
// Should run the activate task, and pick up a new timebase.
timer()->SetActive(true);
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
// Stop the timer()
timer()->SetActive(false);
// Task will be pending anyway, run it
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
// Start the timer() again, but before the next tick time the timer()
// previously planned on using. That same tick time should still be targeted.
- SetNow(timer()->Now() + base::Milliseconds(4));
+ task_runner()->AdvanceMockTickClock(base::Milliseconds(4));
timer()->SetActive(true);
EXPECT_EQ(12, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
@@ -331,17 +326,17 @@ TEST_F(DelayBasedTimeSourceTest, TestDeactivateAndReactivateAfterNextTickTime) {
// Should run the activate task, and pick up a new timebase.
timer()->SetActive(true);
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
// Stop the timer().
timer()->SetActive(false);
// Task will be pending anyway, run it.
- task_runner()->RunPendingTasks();
+ task_runner()->RunUntilIdle();
// Start the timer() again, but before the next tick time the timer()
// previously planned on using. That same tick time should still be targeted.
- SetNow(timer()->Now() + base::Milliseconds(20));
+ task_runner()->AdvanceMockTickClock(base::Milliseconds(20));
timer()->SetActive(true);
EXPECT_EQ(13, task_runner()->NextPendingTaskDelay().InMilliseconds());
}
diff --git a/chromium/components/viz/common/gl_i420_converter.h b/chromium/components/viz/common/gl_i420_converter.h
index 147e21ca24a..6792ca8fdc8 100644
--- a/chromium/components/viz/common/gl_i420_converter.h
+++ b/chromium/components/viz/common/gl_i420_converter.h
@@ -92,7 +92,7 @@ class VIZ_COMMON_EXPORT GLI420Converter final : public ContextLostObserver {
// [Re]Configure the converter with the given |new_params|. Returns true on
// success, or false on failure. If |new_params| does not specify an
// |output_color_space|, it will be default to REC709.
- bool Configure(const Parameters& new_params) WARN_UNUSED_RESULT;
+ [[nodiscard]] bool Configure(const Parameters& new_params);
// Returns the currently-configured and resolved Parameters. Results are
// undefined if Configure() has never been called successfully.
diff --git a/chromium/components/viz/common/gl_nv12_converter.h b/chromium/components/viz/common/gl_nv12_converter.h
index 933c173fa0a..15c6944270f 100644
--- a/chromium/components/viz/common/gl_nv12_converter.h
+++ b/chromium/components/viz/common/gl_nv12_converter.h
@@ -85,7 +85,7 @@ class VIZ_COMMON_EXPORT GLNV12Converter final : public ContextLostObserver {
// [Re]Configure the converter with the given |new_params|. Returns true on
// success, or false on failure. If |new_params| does not specify an
// |output_color_space|, it will be default to REC709.
- bool Configure(const Parameters& new_params) WARN_UNUSED_RESULT;
+ [[nodiscard]] bool Configure(const Parameters& new_params);
// Returns the currently-configured and resolved Parameters. Results are
// undefined if Configure() has never been called successfully.
diff --git a/chromium/components/viz/common/gl_scaler.h b/chromium/components/viz/common/gl_scaler.h
index b1fd42fd6ef..99013e8cadf 100644
--- a/chromium/components/viz/common/gl_scaler.h
+++ b/chromium/components/viz/common/gl_scaler.h
@@ -15,7 +15,6 @@
#include <utility>
#include <vector>
-#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "components/viz/common/gpu/context_lost_observer.h"
@@ -224,7 +223,7 @@ class VIZ_COMMON_EXPORT GLScaler final : public ContextLostObserver {
// [Re]Configure the scaler with the given |new_params|. Returns true on
// success, or false on failure.
- bool Configure(const Parameters& new_params) WARN_UNUSED_RESULT;
+ [[nodiscard]] bool Configure(const Parameters& new_params);
// Returns the currently-configured and resolved Parameters. Note that these
// Parameters might not be exactly the same as those that were passed to
@@ -255,23 +254,23 @@ class VIZ_COMMON_EXPORT GLScaler final : public ContextLostObserver {
//
// Note that the |src_texture| will have the min/mag filter set to GL_LINEAR
// and wrap_s/t set to CLAMP_TO_EDGE in this call.
- bool Scale(GLuint src_texture,
- const gfx::Size& src_texture_size,
- const gfx::Vector2d& src_offset,
- GLuint dest_texture,
- const gfx::Rect& output_rect) WARN_UNUSED_RESULT {
+ [[nodiscard]] bool Scale(GLuint src_texture,
+ const gfx::Size& src_texture_size,
+ const gfx::Vector2d& src_offset,
+ GLuint dest_texture,
+ const gfx::Rect& output_rect) {
return ScaleToMultipleOutputs(src_texture, src_texture_size, src_offset,
dest_texture, 0, output_rect);
}
// Same as above, but for use cases where there are two output textures drawn
// (see Parameters::ExportFormat).
- bool ScaleToMultipleOutputs(GLuint src_texture,
- const gfx::Size& src_texture_size,
- const gfx::Vector2d& src_offset,
- GLuint dest_texture_0,
- GLuint dest_texture_1,
- const gfx::Rect& output_rect) WARN_UNUSED_RESULT;
+ [[nodiscard]] bool ScaleToMultipleOutputs(GLuint src_texture,
+ const gfx::Size& src_texture_size,
+ const gfx::Vector2d& src_offset,
+ GLuint dest_texture_0,
+ GLuint dest_texture_1,
+ const gfx::Rect& output_rect);
// Returns true if from:to represent the same scale ratio as that specified in
// |params|.
diff --git a/chromium/components/viz/common/gl_scaler_overscan_pixeltest.cc b/chromium/components/viz/common/gl_scaler_overscan_pixeltest.cc
index f43746c637e..bdf54c4ed09 100644
--- a/chromium/components/viz/common/gl_scaler_overscan_pixeltest.cc
+++ b/chromium/components/viz/common/gl_scaler_overscan_pixeltest.cc
@@ -405,7 +405,7 @@ TEST_F(GLScalerOverscanPixelTest, TwoByTwoTapBilinear) {
}
TEST_F(GLScalerOverscanPixelTest, BicubicUpscale) {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// Unfortunately, on our current Android bots, there are some inaccuracies
// introduced by the platform that seem to throw-off the pixel testing of the
// bicubic sampler.
diff --git a/chromium/components/viz/common/gl_scaler_pixeltest.cc b/chromium/components/viz/common/gl_scaler_pixeltest.cc
index 4b936560fa2..9c1df00fc82 100644
--- a/chromium/components/viz/common/gl_scaler_pixeltest.cc
+++ b/chromium/components/viz/common/gl_scaler_pixeltest.cc
@@ -23,7 +23,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_space.h"
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
@@ -101,7 +101,7 @@ class GLScalerPixelTest : public cc::PixelTest, public GLScalerTestUtil {
// Returns the amount of color error expected due to bugs in the current
// platform's bilinear texture sampler.
int GetBaselineColorDifference() const {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// Android seems to have texture sampling problems that are not at all seen
// on any of the desktop platforms. Also, versions before Marshmallow seem
// to have a much larger accuracy issues.
@@ -126,7 +126,7 @@ class GLScalerPixelTest : public cc::PixelTest, public GLScalerTestUtil {
}
bool IsAndroidMarshmallow() {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
return base::android::BuildInfo::GetInstance()->sdk_int() ==
base::android::SDK_VERSION_MARSHMALLOW;
#else
diff --git a/chromium/components/viz/common/gl_scaler_shader_pixeltest.cc b/chromium/components/viz/common/gl_scaler_shader_pixeltest.cc
index 2a2481560a7..e1e7b8c226d 100644
--- a/chromium/components/viz/common/gl_scaler_shader_pixeltest.cc
+++ b/chromium/components/viz/common/gl_scaler_shader_pixeltest.cc
@@ -23,7 +23,7 @@
#include "third_party/skia/include/core/SkRect.h"
#include "ui/gfx/color_transform.h"
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
@@ -342,7 +342,7 @@ class GLScalerShaderPixelTest
// values in the expected vs actual image comparisons, given the current test
// parameters and known platform-specific inaccuracy.
int GetMaxAllowedColorDifference() const {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// Android seems to have texture sampling and/or readback accuracy issues
// with these programs that are not at all seen on any of the desktop
// platforms. Also, versions before Marshmallow seem to have a much larger
@@ -360,7 +360,7 @@ class GLScalerShaderPixelTest
}
bool IsAndroidMarshmallow() {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
return base::android::BuildInfo::GetInstance()->sdk_int() ==
base::android::SDK_VERSION_MARSHMALLOW;
#else
diff --git a/chromium/components/viz/common/gpu/DEPS b/chromium/components/viz/common/gpu/DEPS
index 594f394068f..b2d4acb06c0 100644
--- a/chromium/components/viz/common/gpu/DEPS
+++ b/chromium/components/viz/common/gpu/DEPS
@@ -8,7 +8,7 @@ include_rules = [
"+gpu/config",
"+gpu/GLES2/gl2extchromium.h",
"+gpu/vulkan",
- "+third_party/dawn/src/include",
+ "+third_party/dawn/include",
"+third_party/khronos/GLES2/gl2.h",
"+third_party/skia/include/gpu",
"+third_party/vulkan_headers/include",
diff --git a/chromium/components/viz/common/gpu/dawn_context_provider.cc b/chromium/components/viz/common/gpu/dawn_context_provider.cc
index 181031501af..aaac79531bd 100644
--- a/chromium/components/viz/common/gpu/dawn_context_provider.cc
+++ b/chromium/components/viz/common/gpu/dawn_context_provider.cc
@@ -11,20 +11,20 @@
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "build/build_config.h"
-#include "third_party/dawn/src/include/dawn/dawn_proc.h"
+#include "third_party/dawn/include/dawn/dawn_proc.h"
namespace viz {
namespace {
-dawn_native::BackendType GetDefaultBackendType() {
-#if defined(OS_WIN)
- return dawn_native::BackendType::D3D12;
-#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
- return dawn_native::BackendType::Vulkan;
+wgpu::BackendType GetDefaultBackendType() {
+#if BUILDFLAG(IS_WIN)
+ return wgpu::BackendType::D3D12;
+#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ return wgpu::BackendType::Vulkan;
#else
NOTREACHED();
- return dawn_native::BackendType::Null;
+ return wgpu::BackendType::Null;
#endif
}
@@ -49,23 +49,25 @@ DawnContextProvider::DawnContextProvider() {
DawnContextProvider::~DawnContextProvider() = default;
-wgpu::Device DawnContextProvider::CreateDevice(dawn_native::BackendType type) {
+wgpu::Device DawnContextProvider::CreateDevice(wgpu::BackendType type) {
instance_.DiscoverDefaultAdapters();
- DawnProcTable backend_procs = dawn_native::GetProcs();
+ DawnProcTable backend_procs = dawn::native::GetProcs();
dawnProcSetProcs(&backend_procs);
// If a new toggle is added here, ForceDawnTogglesForSkia() which collects
// info for about:gpu should be updated as well.
// Disable validation in non-DCHECK builds.
- dawn_native::DawnDeviceDescriptor descriptor;
+ dawn::native::DawnDeviceDescriptor descriptor;
#if !DCHECK_IS_ON()
descriptor.forceEnabledToggles = {"skip_validation"};
#endif
- std::vector<dawn_native::Adapter> adapters = instance_.GetAdapters();
- for (dawn_native::Adapter adapter : adapters) {
- if (adapter.GetBackendType() == type)
+ std::vector<dawn::native::Adapter> adapters = instance_.GetAdapters();
+ for (dawn::native::Adapter adapter : adapters) {
+ wgpu::AdapterProperties properties;
+ adapter.GetProperties(&properties);
+ if (properties.backendType == type)
return adapter.CreateDevice(&descriptor);
}
return nullptr;
diff --git a/chromium/components/viz/common/gpu/dawn_context_provider.h b/chromium/components/viz/common/gpu/dawn_context_provider.h
index f360ad7dc1b..4ab8b25d656 100644
--- a/chromium/components/viz/common/gpu/dawn_context_provider.h
+++ b/chromium/components/viz/common/gpu/dawn_context_provider.h
@@ -8,7 +8,7 @@
#include <memory>
#include "components/viz/common/viz_dawn_context_provider_export.h"
-#include "third_party/dawn/src/include/dawn_native/DawnNative.h"
+#include "third_party/dawn/include/dawn/native/DawnNative.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/dawn/GrDawnTypes.h"
@@ -31,9 +31,9 @@ class VIZ_DAWN_CONTEXT_PROVIDER_EXPORT DawnContextProvider {
private:
DawnContextProvider();
- wgpu::Device CreateDevice(dawn_native::BackendType type);
+ wgpu::Device CreateDevice(wgpu::BackendType type);
- dawn_native::Instance instance_;
+ dawn::native::Instance instance_;
wgpu::Device device_;
sk_sp<GrDirectContext> gr_context_;
};
diff --git a/chromium/components/viz/common/gpu/vulkan_in_process_context_provider.cc b/chromium/components/viz/common/gpu/vulkan_in_process_context_provider.cc
index c2b5ef56e1a..38838e96eba 100644
--- a/chromium/components/viz/common/gpu/vulkan_in_process_context_provider.cc
+++ b/chromium/components/viz/common/gpu/vulkan_in_process_context_provider.cc
@@ -132,9 +132,24 @@ bool VulkanInProcessContextProvider::InitializeGrContext(
GrVkGetProc get_proc = [](const char* proc_name, VkInstance instance,
VkDevice device) {
if (device) {
- if (std::strcmp("vkCreateGraphicsPipelines", proc_name) == 0)
+ // Using vkQueue*Hook for all vkQueue* methods here to make both chrome
+ // side access and skia side access to the same queue thread safe.
+ // vkQueue*Hook routes all skia side access to the same
+ // VulkanFunctionPointers vkQueue* api which chrome uses and is under the
+ // lock.
+ if (std::strcmp("vkCreateGraphicsPipelines", proc_name) == 0) {
return reinterpret_cast<PFN_vkVoidFunction>(
&gpu::CreateGraphicsPipelinesHook);
+ } else if (std::strcmp("vkQueueSubmit", proc_name) == 0) {
+ return reinterpret_cast<PFN_vkVoidFunction>(
+ &gpu::VulkanQueueSubmitHook);
+ } else if (std::strcmp("vkQueueWaitIdle", proc_name) == 0) {
+ return reinterpret_cast<PFN_vkVoidFunction>(
+ &gpu::VulkanQueueWaitIdleHook);
+ } else if (std::strcmp("vkQueuePresentKHR", proc_name) == 0) {
+ return reinterpret_cast<PFN_vkVoidFunction>(
+ &gpu::VulkanQueuePresentKHRHook);
+ }
return vkGetDeviceProcAddr(device, proc_name);
}
return vkGetInstanceProcAddr(instance, proc_name);
diff --git a/chromium/components/viz/common/hit_test/hit_test_region_list.h b/chromium/components/viz/common/hit_test/hit_test_region_list.h
index e0d8f116811..0bfdab51d00 100644
--- a/chromium/components/viz/common/hit_test/hit_test_region_list.h
+++ b/chromium/components/viz/common/hit_test/hit_test_region_list.h
@@ -36,9 +36,6 @@ enum HitTestRegionFlags : uint32_t {
// Client hasn't submitted its own hit-test data yet.
kHitTestNotActive = 0x40,
-
- // Hit-test debugging is enabled.
- kHitTestDebug = 0x80,
};
// In viz hit testing surface layer, hit test regions are marked as kHitTestAsk
diff --git a/chromium/components/viz/common/quads/compositor_frame_metadata.h b/chromium/components/viz/common/quads/compositor_frame_metadata.h
index 9e6e5d5cd4f..acd850f3f9c 100644
--- a/chromium/components/viz/common/quads/compositor_frame_metadata.h
+++ b/chromium/components/viz/common/quads/compositor_frame_metadata.h
@@ -28,10 +28,10 @@
#include "ui/gfx/overlay_transform.h"
#include "ui/latency/latency_info.h"
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
#include "components/viz/common/quads/selection.h"
#include "ui/gfx/selection_bound.h"
-#endif // defined(OS_ANDROID)
+#endif // BUILDFLAG(IS_ANDROID)
namespace viz {
diff --git a/chromium/components/viz/common/quads/compositor_frame_metadata_unittest.cc b/chromium/components/viz/common/quads/compositor_frame_metadata_unittest.cc
index 27fcda0ecb9..7535e55e3b4 100644
--- a/chromium/components/viz/common/quads/compositor_frame_metadata_unittest.cc
+++ b/chromium/components/viz/common/quads/compositor_frame_metadata_unittest.cc
@@ -34,9 +34,6 @@ bool AreLatencyInfosEqual(const ui::LatencyInfo& a, const ui::LatencyInfo& b) {
return a.began() == b.began() && a.terminated() == b.terminated() &&
a.coalesced() == b.coalesced() && a.trace_id() == b.trace_id() &&
a.ukm_source_id() == b.ukm_source_id() &&
- std::abs(a.scroll_update_delta() - b.scroll_update_delta()) < 1e-6 &&
- std::abs(a.predicted_scroll_update_delta() -
- b.predicted_scroll_update_delta()) < 1e-6 &&
a.gesture_scroll_id() == b.gesture_scroll_id();
}
@@ -51,7 +48,8 @@ bool AreDelegatedInkMetadataEqual(const gfx::DelegatedInkMetadata& a,
bool AreTransitionDirectivesEqual(const CompositorFrameTransitionDirective& a,
const CompositorFrameTransitionDirective& b) {
return a.sequence_id() == b.sequence_id() && a.type() == b.type() &&
- a.effect() == b.effect();
+ a.effect() == b.effect() &&
+ a.is_renderer_driven_animation() == b.is_renderer_driven_animation();
}
TEST(CompositorFrameMetadata, Clone) {
@@ -86,7 +84,7 @@ TEST(CompositorFrameMetadata, Clone) {
gfx::PointF(88.8, 44.4), 1.f, SK_ColorRED,
base::TimeTicks() + base::Seconds(125), gfx::RectF(1, 2, 3, 4), true);
metadata.transition_directives.emplace_back(
- 4u, CompositorFrameTransitionDirective::Type::kSave,
+ 4u, CompositorFrameTransitionDirective::Type::kSave, true,
CompositorFrameTransitionDirective::Effect::kCoverUp);
CompositorFrameMetadata clone = metadata.Clone();
diff --git a/chromium/components/viz/common/quads/compositor_frame_transition_directive.cc b/chromium/components/viz/common/quads/compositor_frame_transition_directive.cc
index fe7ecadaa3f..57fa02cf0be 100644
--- a/chromium/components/viz/common/quads/compositor_frame_transition_directive.cc
+++ b/chromium/components/viz/common/quads/compositor_frame_transition_directive.cc
@@ -4,6 +4,7 @@
#include "components/viz/common/quads/compositor_frame_transition_directive.h"
+#include <string>
#include <utility>
#include "base/time/time.h"
@@ -22,11 +23,13 @@ CompositorFrameTransitionDirective::CompositorFrameTransitionDirective() =
CompositorFrameTransitionDirective::CompositorFrameTransitionDirective(
uint32_t sequence_id,
Type type,
+ bool is_renderer_driven_animation,
Effect effect,
const TransitionConfig& root_config,
std::vector<SharedElement> shared_elements)
: sequence_id_(sequence_id),
type_(type),
+ is_renderer_driven_animation_(is_renderer_driven_animation),
effect_(effect),
root_config_(root_config),
shared_elements_(std::move(shared_elements)) {}
diff --git a/chromium/components/viz/common/quads/compositor_frame_transition_directive.h b/chromium/components/viz/common/quads/compositor_frame_transition_directive.h
index 71975e7c05f..56b1258d0ce 100644
--- a/chromium/components/viz/common/quads/compositor_frame_transition_directive.h
+++ b/chromium/components/viz/common/quads/compositor_frame_transition_directive.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_VIZ_COMMON_QUADS_COMPOSITOR_FRAME_TRANSITION_DIRECTIVE_H_
#define COMPONENTS_VIZ_COMMON_QUADS_COMPOSITOR_FRAME_TRANSITION_DIRECTIVE_H_
+#include <string>
#include <vector>
#include "base/time/time.h"
@@ -105,6 +106,7 @@ class VIZ_COMMON_EXPORT CompositorFrameTransitionDirective {
CompositorFrameTransitionDirective(
uint32_t sequence_id,
Type type,
+ bool is_renderer_driven_animation = false,
Effect effect = Effect::kNone,
const TransitionConfig& root_config = TransitionConfig(),
std::vector<SharedElement> shared_elements = {});
@@ -133,11 +135,18 @@ class VIZ_COMMON_EXPORT CompositorFrameTransitionDirective {
return shared_elements_;
}
+ // Returns true if this is a directive for a renderer driven animation.
+ bool is_renderer_driven_animation() const {
+ return is_renderer_driven_animation_;
+ }
+
private:
uint32_t sequence_id_ = 0;
Type type_ = Type::kSave;
+ bool is_renderer_driven_animation_ = false;
+
Effect effect_ = Effect::kNone;
TransitionConfig root_config_;
diff --git a/chromium/components/viz/common/quads/compositor_frame_transition_directive_unittest.cc b/chromium/components/viz/common/quads/compositor_frame_transition_directive_unittest.cc
index 66e92a07170..465b48e2ba6 100644
--- a/chromium/components/viz/common/quads/compositor_frame_transition_directive_unittest.cc
+++ b/chromium/components/viz/common/quads/compositor_frame_transition_directive_unittest.cc
@@ -13,17 +13,19 @@ using Effect = CompositorFrameTransitionDirective::Effect;
using Type = CompositorFrameTransitionDirective::Type;
TEST(CompositorFrameTransitionDirective, GettersReflectParameters) {
- CompositorFrameTransitionDirective save_directive(1u, Type::kSave,
+ CompositorFrameTransitionDirective save_directive(1u, Type::kSave, true,
Effect::kCoverLeft);
EXPECT_EQ(1u, save_directive.sequence_id());
EXPECT_EQ(Type::kSave, save_directive.type());
EXPECT_EQ(Effect::kCoverLeft, save_directive.effect());
+ EXPECT_TRUE(save_directive.is_renderer_driven_animation());
CompositorFrameTransitionDirective animate_directive(2, Type::kAnimate);
EXPECT_EQ(2u, animate_directive.sequence_id());
EXPECT_EQ(Type::kAnimate, animate_directive.type());
+ EXPECT_FALSE(animate_directive.is_renderer_driven_animation());
}
} // namespace
diff --git a/chromium/components/viz/common/quads/draw_quad_unittest.cc b/chromium/components/viz/common/quads/draw_quad_unittest.cc
index 01b02f78787..8f0a24327e1 100644
--- a/chromium/components/viz/common/quads/draw_quad_unittest.cc
+++ b/chromium/components/viz/common/quads/draw_quad_unittest.cc
@@ -10,7 +10,6 @@
#include <memory>
#include "base/bind.h"
-#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/unguessable_token.h"
#include "cc/base/math_util.h"
@@ -115,18 +114,15 @@ void CompareDrawQuad(DrawQuad* quad, DrawQuad* copy) {
render_pass->CreateAndAppendSharedQuadState(); \
*copy_shared_state = *shared_state;
-#define QUAD_DATA \
- gfx::Rect quad_rect(30, 40, 50, 60); \
- gfx::Rect quad_visible_rect(40, 50, 30, 20); \
- ALLOW_UNUSED_LOCAL(quad_visible_rect); \
- bool needs_blending = true; \
- ALLOW_UNUSED_LOCAL(needs_blending);
+#define QUAD_DATA \
+ gfx::Rect quad_rect(30, 40, 50, 60); \
+ [[maybe_unused]] gfx::Rect quad_visible_rect(40, 50, 30, 20); \
+ [[maybe_unused]] bool needs_blending = true;
#define SETUP_AND_COPY_QUAD_NEW(Type, quad) \
DrawQuad* copy_new = render_pass->CopyFromAndAppendDrawQuad(quad_new); \
CompareDrawQuad(quad_new, copy_new); \
- const Type* copy_quad = Type::MaterialCast(copy_new); \
- ALLOW_UNUSED_LOCAL(copy_quad);
+ [[maybe_unused]] const Type* copy_quad = Type::MaterialCast(copy_new);
#define SETUP_AND_COPY_QUAD_ALL(Type, quad) \
DrawQuad* copy_all = render_pass->CopyFromAndAppendDrawQuad(quad_all); \
@@ -137,8 +133,7 @@ void CompareDrawQuad(DrawQuad* quad, DrawQuad* copy) {
DrawQuad* copy_new = \
render_pass->CopyFromAndAppendRenderPassDrawQuad(quad_new, a); \
CompareDrawQuad(quad_new, copy_new); \
- const Type* copy_quad = Type::MaterialCast(copy_new); \
- ALLOW_UNUSED_LOCAL(copy_quad);
+ [[maybe_unused]] const Type* copy_quad = Type::MaterialCast(copy_new);
#define SETUP_AND_COPY_QUAD_ALL_RP(Type, quad, a) \
DrawQuad* copy_all = \
diff --git a/chromium/components/viz/common/quads/render_pass_io.cc b/chromium/components/viz/common/quads/render_pass_io.cc
index 0dcd782ade7..1f2cb9e067f 100644
--- a/chromium/components/viz/common/quads/render_pass_io.cc
+++ b/chromium/components/viz/common/quads/render_pass_io.cc
@@ -208,14 +208,14 @@ bool FloatArrayFromList(const base::Value& list,
DCHECK_LT(0u, expected_count);
if (!list.is_list())
return false;
- size_t count = list.GetList().size();
+ size_t count = list.GetListDeprecated().size();
if (count != expected_count)
return false;
std::vector<double> double_data(count);
for (size_t ii = 0; ii < count; ++ii) {
- if (!list.GetList()[ii].is_double())
+ if (!list.GetListDeprecated()[ii].is_double())
return false;
- double_data[ii] = list.GetList()[ii].GetDouble();
+ double_data[ii] = list.GetListDeprecated()[ii].GetDouble();
}
for (size_t ii = 0; ii < count; ++ii)
data[ii] = static_cast<float>(double_data[ii]);
@@ -343,13 +343,13 @@ bool TransformFromList(const base::Value& list, gfx::Transform* transform) {
DCHECK(transform);
if (!list.is_list())
return false;
- if (list.GetList().size() != 16)
+ if (list.GetListDeprecated().size() != 16)
return false;
double data[16];
for (size_t ii = 0; ii < 16; ++ii) {
- if (!list.GetList()[ii].is_double())
+ if (!list.GetListDeprecated()[ii].is_double())
return false;
- data[ii] = list.GetList()[ii].GetDouble();
+ data[ii] = list.GetListDeprecated()[ii].GetDouble();
}
transform->matrix().setColMajord(data);
return true;
@@ -368,11 +368,11 @@ bool ShapeRectsFromList(const base::Value& list,
DCHECK(shape);
if (!list.is_list())
return false;
- size_t size = list.GetList().size();
+ size_t size = list.GetListDeprecated().size();
cc::FilterOperation::ShapeRects data;
data.resize(size);
for (size_t ii = 0; ii < size; ++ii) {
- if (!RectFromDict(list.GetList()[ii], &data[ii]))
+ if (!RectFromDict(list.GetListDeprecated()[ii], &data[ii]))
return false;
}
*shape = data;
@@ -564,9 +564,9 @@ bool FilterOperationsFromList(const base::Value& list,
if (!list.is_list())
return false;
cc::FilterOperations data;
- for (size_t ii = 0; ii < list.GetList().size(); ++ii) {
+ for (size_t ii = 0; ii < list.GetListDeprecated().size(); ++ii) {
cc::FilterOperation filter;
- if (!FilterOperationFromDict(list.GetList()[ii], &filter))
+ if (!FilterOperationFromDict(list.GetListDeprecated()[ii], &filter))
return false;
data.Append(filter);
}
@@ -590,7 +590,7 @@ const char* ColorSpacePrimaryIdToString(gfx::ColorSpace::PrimaryID id) {
MATCH_ENUM_CASE(PrimaryID, BT2020)
MATCH_ENUM_CASE(PrimaryID, SMPTEST428_1)
MATCH_ENUM_CASE(PrimaryID, SMPTEST431_2)
- MATCH_ENUM_CASE(PrimaryID, SMPTEST432_1)
+ MATCH_ENUM_CASE(PrimaryID, P3)
MATCH_ENUM_CASE(PrimaryID, XYZ_D50)
MATCH_ENUM_CASE(PrimaryID, ADOBE_RGB)
MATCH_ENUM_CASE(PrimaryID, APPLE_GENERIC_RGB)
@@ -615,13 +615,13 @@ const char* ColorSpaceTransferIdToString(gfx::ColorSpace::TransferID id) {
MATCH_ENUM_CASE(TransferID, LOG_SQRT)
MATCH_ENUM_CASE(TransferID, IEC61966_2_4)
MATCH_ENUM_CASE(TransferID, BT1361_ECG)
- MATCH_ENUM_CASE(TransferID, IEC61966_2_1)
+ MATCH_ENUM_CASE(TransferID, SRGB)
MATCH_ENUM_CASE(TransferID, BT2020_10)
MATCH_ENUM_CASE(TransferID, BT2020_12)
- MATCH_ENUM_CASE(TransferID, SMPTEST2084)
+ MATCH_ENUM_CASE(TransferID, PQ)
MATCH_ENUM_CASE(TransferID, SMPTEST428_1)
- MATCH_ENUM_CASE(TransferID, ARIB_STD_B67)
- MATCH_ENUM_CASE(TransferID, IEC61966_2_1_HDR)
+ MATCH_ENUM_CASE(TransferID, HLG)
+ MATCH_ENUM_CASE(TransferID, SRGB_HDR)
MATCH_ENUM_CASE(TransferID, LINEAR_HDR)
MATCH_ENUM_CASE(TransferID, CUSTOM)
MATCH_ENUM_CASE(TransferID, CUSTOM_HDR)
@@ -671,7 +671,7 @@ uint8_t StringToColorSpacePrimaryId(const std::string& token) {
MATCH_ENUM_CASE(PrimaryID, BT2020)
MATCH_ENUM_CASE(PrimaryID, SMPTEST428_1)
MATCH_ENUM_CASE(PrimaryID, SMPTEST431_2)
- MATCH_ENUM_CASE(PrimaryID, SMPTEST432_1)
+ MATCH_ENUM_CASE(PrimaryID, P3)
MATCH_ENUM_CASE(PrimaryID, XYZ_D50)
MATCH_ENUM_CASE(PrimaryID, ADOBE_RGB)
MATCH_ENUM_CASE(PrimaryID, APPLE_GENERIC_RGB)
@@ -695,13 +695,13 @@ uint8_t StringToColorSpaceTransferId(const std::string& token) {
MATCH_ENUM_CASE(TransferID, LOG_SQRT)
MATCH_ENUM_CASE(TransferID, IEC61966_2_4)
MATCH_ENUM_CASE(TransferID, BT1361_ECG)
- MATCH_ENUM_CASE(TransferID, IEC61966_2_1)
+ MATCH_ENUM_CASE(TransferID, SRGB)
MATCH_ENUM_CASE(TransferID, BT2020_10)
MATCH_ENUM_CASE(TransferID, BT2020_12)
- MATCH_ENUM_CASE(TransferID, SMPTEST2084)
+ MATCH_ENUM_CASE(TransferID, PQ)
MATCH_ENUM_CASE(TransferID, SMPTEST428_1)
- MATCH_ENUM_CASE(TransferID, ARIB_STD_B67)
- MATCH_ENUM_CASE(TransferID, IEC61966_2_1_HDR)
+ MATCH_ENUM_CASE(TransferID, HLG)
+ MATCH_ENUM_CASE(TransferID, SRGB_HDR)
MATCH_ENUM_CASE(TransferID, LINEAR_HDR)
MATCH_ENUM_CASE(TransferID, CUSTOM)
MATCH_ENUM_CASE(TransferID, CUSTOM_HDR)
@@ -862,7 +862,7 @@ bool DrawQuadResourcesFromList(const base::Value& list,
DCHECK(resources);
if (!list.is_list())
return false;
- size_t size = list.GetList().size();
+ size_t size = list.GetListDeprecated().size();
if (size == 0u) {
resources->count = 0u;
return true;
@@ -870,13 +870,13 @@ bool DrawQuadResourcesFromList(const base::Value& list,
if (size > DrawQuad::Resources::kMaxResourceIdCount)
return false;
for (size_t ii = 0; ii < size; ++ii) {
- if (!list.GetList()[ii].is_int())
+ if (!list.GetListDeprecated()[ii].is_int())
return false;
}
resources->count = static_cast<uint32_t>(size);
for (size_t ii = 0; ii < size; ++ii) {
- resources->ids[ii] = ResourceId(list.GetList()[ii].GetInt());
+ resources->ids[ii] = ResourceId(list.GetListDeprecated()[ii].GetInt());
}
return true;
}
@@ -1623,11 +1623,11 @@ bool VideoHoleDrawQuadFromDict(const base::Value& dict,
case DrawQuad::Material::NAME: \
NOTREACHED() << "Unexpected " << #NAME; \
break;
-#define GET_QUAD_FROM_DICT(NAME, TYPE) \
- case DrawQuad::Material::NAME: { \
- TYPE* quad = quads.AllocateAndConstruct<TYPE>(); \
- if (!TYPE##FromDict(list.GetList()[ii], common.value(), quad)) \
- return false; \
+#define GET_QUAD_FROM_DICT(NAME, TYPE) \
+ case DrawQuad::Material::NAME: { \
+ TYPE* quad = quads.AllocateAndConstruct<TYPE>(); \
+ if (!TYPE##FromDict(list.GetListDeprecated()[ii], common.value(), quad)) \
+ return false; \
} break;
bool QuadListFromList(const base::Value& list,
QuadList* quad_list,
@@ -1635,17 +1635,17 @@ bool QuadListFromList(const base::Value& list,
DCHECK(quad_list);
if (!list.is_list())
return false;
- size_t size = list.GetList().size();
+ size_t size = list.GetListDeprecated().size();
if (size == 0) {
quad_list->clear();
return true;
}
QuadList quads(size);
for (size_t ii = 0; ii < size; ++ii) {
- if (!list.GetList()[ii].is_dict())
+ if (!list.GetListDeprecated()[ii].is_dict())
return false;
- absl::optional<DrawQuadCommon> common =
- GetDrawQuadCommonFromDict(list.GetList()[ii], shared_quad_state_list);
+ absl::optional<DrawQuadCommon> common = GetDrawQuadCommonFromDict(
+ list.GetListDeprecated()[ii], shared_quad_state_list);
if (!common)
return false;
switch (common->material) {
@@ -1847,14 +1847,14 @@ bool SharedQuadStateListFromList(const base::Value& list,
DCHECK(shared_quad_state_list);
if (!list.is_list())
return false;
- size_t size = list.GetList().size();
+ size_t size = list.GetListDeprecated().size();
SharedQuadStateList states(alignof(SharedQuadState), sizeof(SharedQuadState),
size);
for (size_t ii = 0; ii < size; ++ii) {
- if (!list.GetList()[ii].is_dict())
+ if (!list.GetListDeprecated()[ii].is_dict())
return false;
SharedQuadState* sqs = states.AllocateAndConstruct<SharedQuadState>();
- if (!SharedQuadStateFromDict(list.GetList()[ii], sqs))
+ if (!SharedQuadStateFromDict(list.GetListDeprecated()[ii], sqs))
return false;
}
shared_quad_state_list->swap(states);
@@ -2123,9 +2123,9 @@ bool CompositorRenderPassListFromDict(
const base::Value* list = dict.FindListKey("render_pass_list");
if (!list || !list->is_list())
return false;
- for (size_t ii = 0; ii < list->GetList().size(); ++ii) {
+ for (size_t ii = 0; ii < list->GetListDeprecated().size(); ++ii) {
render_pass_list->push_back(
- CompositorRenderPassFromDict(list->GetList()[ii]));
+ CompositorRenderPassFromDict(list->GetListDeprecated()[ii]));
if (!(*render_pass_list)[ii].get()) {
render_pass_list->clear();
return false;
@@ -2177,7 +2177,8 @@ bool CompositorFrameFromDict(const base::Value& dict,
if (!referenced_surfaces || !referenced_surfaces->is_list()) {
return false;
}
- for (auto& referenced_surface_dict : referenced_surfaces->GetList()) {
+ for (auto& referenced_surface_dict :
+ referenced_surfaces->GetListDeprecated()) {
auto referenced_surface = SurfaceRangeFromDict(referenced_surface_dict);
if (!referenced_surface) {
return false;
@@ -2217,7 +2218,7 @@ bool FrameDataFromList(const base::Value& list,
if (!list.is_list()) {
return false;
}
- for (const auto& frame_data_dict : list.GetList()) {
+ for (const auto& frame_data_dict : list.GetListDeprecated()) {
FrameData frame_data;
auto* surface_id_dict = frame_data_dict.FindDictKey("surface_id");
if (!surface_id_dict) {
diff --git a/chromium/components/viz/common/quads/render_pass_io_unittest.cc b/chromium/components/viz/common/quads/render_pass_io_unittest.cc
index 3677c19cdbb..2bf17a37584 100644
--- a/chromium/components/viz/common/quads/render_pass_io_unittest.cc
+++ b/chromium/components/viz/common/quads/render_pass_io_unittest.cc
@@ -346,15 +346,17 @@ TEST(RenderPassIOTest, CompositorRenderPassList) {
// 'intersects_damage_under' in its CompositorRenderPassDrawQuad, I'm
// removing the field on dict1 for the exact comparison to work.
base::Value* list = dict1.FindListKey("render_pass_list");
- for (size_t i = 0; i < list->GetList().size(); ++i) {
- base::Value* quad_list = list->GetList()[i].FindListKey("quad_list");
+ for (size_t i = 0; i < list->GetListDeprecated().size(); ++i) {
+ base::Value* quad_list =
+ list->GetListDeprecated()[i].FindListKey("quad_list");
- for (size_t ii = 0; ii < quad_list->GetList().size(); ++ii) {
+ for (size_t ii = 0; ii < quad_list->GetListDeprecated().size(); ++ii) {
if (const base::Value* extra_value =
- quad_list->GetList()[ii].FindKey("intersects_damage_under")) {
+ quad_list->GetListDeprecated()[ii].FindKey(
+ "intersects_damage_under")) {
EXPECT_FALSE(extra_value->GetBool());
- ASSERT_TRUE(
- quad_list->GetList()[ii].RemoveKey("intersects_damage_under"));
+ ASSERT_TRUE(quad_list->GetListDeprecated()[ii].RemoveKey(
+ "intersects_damage_under"));
}
}
}
diff --git a/chromium/components/viz/common/resources/DEPS b/chromium/components/viz/common/resources/DEPS
index 173d9a999b3..9a0345721ee 100644
--- a/chromium/components/viz/common/resources/DEPS
+++ b/chromium/components/viz/common/resources/DEPS
@@ -11,7 +11,7 @@ include_rules = [
"+mojo/public/cpp/system/buffer.h",
"+mojo/public/cpp/system/platform_handle.h",
"+skia/buildflags.h",
- "+third_party/dawn/src/include",
+ "+third_party/dawn/include",
"+third_party/khronos/GLES2",
"+third_party/skia",
"+third_party/vulkan-deps/vulkan-headers/src",
diff --git a/chromium/components/viz/common/resources/bitmap_allocation.cc b/chromium/components/viz/common/resources/bitmap_allocation.cc
index 952bd26b0a7..d467789b22e 100644
--- a/chromium/components/viz/common/resources/bitmap_allocation.cc
+++ b/chromium/components/viz/common/resources/bitmap_allocation.cc
@@ -23,7 +23,7 @@ namespace {
void CollectMemoryUsageAndDie(const gfx::Size& size,
ResourceFormat format,
size_t alloc_size) {
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
DWORD last_error = GetLastError();
base::debug::Alias(&last_error);
#endif
diff --git a/chromium/components/viz/common/resources/resource_format_utils.cc b/chromium/components/viz/common/resources/resource_format_utils.cc
index fbd48109cf4..ba03a517dae 100644
--- a/chromium/components/viz/common/resources/resource_format_utils.cc
+++ b/chromium/components/viz/common/resources/resource_format_utils.cc
@@ -4,13 +4,16 @@
#include "components/viz/common/resources/resource_format_utils.h"
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <GLES2/gl2extchromium.h>
+
#include <ostream>
#include "base/check_op.h"
#include "base/cxx17_backports.h"
#include "base/notreached.h"
-#include "third_party/khronos/GLES2/gl2.h"
-#include "third_party/khronos/GLES2/gl2ext.h"
+#include "build/chromeos_buildflags.h"
#include "ui/gfx/buffer_types.h"
namespace viz {
@@ -110,6 +113,8 @@ ResourceFormat SkColorTypeToResourceFormat(SkColorType color_type) {
case kRGBA_F16Norm_SkColorType:
case kRGBA_F32_SkColorType:
case kSRGBA_8888_SkColorType:
+ // Default case is for new color types added to Skia
+ default:
break;
}
NOTREACHED();
@@ -350,7 +355,8 @@ bool IsResourceFormatCompressed(ResourceFormat format) {
return format == ETC1;
}
-unsigned int TextureStorageFormat(ResourceFormat format) {
+unsigned int TextureStorageFormat(ResourceFormat format,
+ bool use_angle_rgbx_format) {
switch (format) {
case RGBA_8888:
return GL_RGBA8_OES;
@@ -378,7 +384,8 @@ unsigned int TextureStorageFormat(ResourceFormat format) {
case RG16_EXT:
return GL_RG16_EXT;
case RGBX_8888:
- return GL_RGB8_OES;
+ case BGRX_8888:
+ return use_angle_rgbx_format ? GL_RGBX8_ANGLE : GL_RGB8_OES;
case ETC1:
return GL_ETC1_RGB8_OES;
case P010:
@@ -388,8 +395,6 @@ unsigned int TextureStorageFormat(ResourceFormat format) {
case YVU_420:
case YUV_420_BIPLANAR:
return GL_RGB8_OES;
- case BGRX_8888:
- return GL_RGB8_OES;
default:
break;
}
@@ -400,7 +405,13 @@ unsigned int TextureStorageFormat(ResourceFormat format) {
bool IsGpuMemoryBufferFormatSupported(ResourceFormat format) {
switch (format) {
case BGRA_8888:
+#if !BUILDFLAG(IS_CHROMEOS_LACROS)
+ // TODO(crbug.com/1307837): On ARM devices LaCrOS can't create RED_8
+ // GpuMemoryBuffer Objects with GBM device. This capability should be
+ // plumbed and known by clients requesting shared images as overlay
+ // candidate.
case RED_8:
+#endif
case R16_EXT:
case RGBA_4444:
case RGBA_8888:
@@ -413,6 +424,9 @@ bool IsGpuMemoryBufferFormatSupported(ResourceFormat format) {
case ETC1:
case ALPHA_8:
case LUMINANCE_8:
+#if BUILDFLAG(IS_CHROMEOS_LACROS)
+ case RED_8:
+#endif
case RGB_565:
case LUMINANCE_F16:
case BGR_565:
diff --git a/chromium/components/viz/common/resources/resource_format_utils.h b/chromium/components/viz/common/resources/resource_format_utils.h
index a61d552144d..255ebb6a260 100644
--- a/chromium/components/viz/common/resources/resource_format_utils.h
+++ b/chromium/components/viz/common/resources/resource_format_utils.h
@@ -10,8 +10,8 @@
#include "components/viz/common/viz_resource_format_export.h"
#include "gpu/vulkan/buildflags.h"
#include "skia/buildflags.h"
-#include "third_party/dawn/src/include/dawn/webgpu.h"
-#include "third_party/dawn/src/include/dawn/webgpu_cpp.h"
+#include "third_party/dawn/include/dawn/webgpu.h"
+#include "third_party/dawn/include/dawn/webgpu_cpp.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/gpu/GrTypes.h"
#include "ui/gfx/buffer_types.h"
@@ -47,8 +47,12 @@ VIZ_RESOURCE_FORMAT_EXPORT gfx::BufferFormat BufferFormat(
ResourceFormat format);
VIZ_RESOURCE_FORMAT_EXPORT bool IsResourceFormatCompressed(
ResourceFormat format);
+
+// |use_angle_rgbx_format| should be true when the GL_ANGLE_rgbx_internal_format
+// extension is available.
VIZ_RESOURCE_FORMAT_EXPORT unsigned int TextureStorageFormat(
- ResourceFormat format);
+ ResourceFormat format,
+ bool use_angle_rgbx_format);
// Returns whether the format can be used with GpuMemoryBuffer texture storage,
// allocated through TexStorage2DImageCHROMIUM.
@@ -76,7 +80,7 @@ VIZ_RESOURCE_FORMAT_EXPORT wgpu::TextureFormat ToDawnFormat(
VIZ_RESOURCE_FORMAT_EXPORT WGPUTextureFormat
ToWGPUFormat(ResourceFormat format);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
VIZ_RESOURCE_FORMAT_EXPORT unsigned int ToMTLPixelFormat(ResourceFormat format);
#endif
diff --git a/chromium/components/viz/common/resources/transferable_resource.h b/chromium/components/viz/common/resources/transferable_resource.h
index 8f9169161ee..0a360bc3ade 100644
--- a/chromium/components/viz/common/resources/transferable_resource.h
+++ b/chromium/components/viz/common/resources/transferable_resource.h
@@ -112,7 +112,7 @@ struct VIZ_COMMON_EXPORT TransferableResource {
// YCbCr info for resources backed by YCbCr Vulkan images.
absl::optional<gpu::VulkanYCbCrInfo> ycbcr_info;
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
// Indicates whether this resource may not be overlayed on Android, since
// it's not backed by a SurfaceView. This may be set in combination with
// |is_overlay_candidate|, to find out if switching the resource to a
@@ -125,7 +125,7 @@ struct VIZ_COMMON_EXPORT TransferableResource {
bool is_backed_by_surface_texture = false;
#endif
-#if defined(OS_ANDROID) || defined(OS_WIN)
+#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
// Indicates that this resource would like a promotion hint.
bool wants_promotion_hint = false;
#endif
@@ -139,10 +139,10 @@ struct VIZ_COMMON_EXPORT TransferableResource {
color_space == o.color_space && hdr_metadata == o.hdr_metadata &&
is_overlay_candidate == o.is_overlay_candidate &&
filter == o.filter &&
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
is_backed_by_surface_texture == o.is_backed_by_surface_texture &&
wants_promotion_hint == o.wants_promotion_hint &&
-#elif defined(OS_WIN)
+#elif BUILDFLAG(IS_WIN)
wants_promotion_hint == o.wants_promotion_hint &&
#endif
read_lock_fences_enabled == o.read_lock_fences_enabled;
diff --git a/chromium/components/viz/common/surfaces/region_capture_bounds.cc b/chromium/components/viz/common/surfaces/region_capture_bounds.cc
index 08074a402cf..36d9fb4fd2a 100644
--- a/chromium/components/viz/common/surfaces/region_capture_bounds.cc
+++ b/chromium/components/viz/common/surfaces/region_capture_bounds.cc
@@ -7,6 +7,8 @@
#include <sstream>
#include <utility>
+#include "base/no_destructor.h"
+
namespace viz {
RegionCaptureBounds::RegionCaptureBounds() = default;
@@ -21,11 +23,21 @@ RegionCaptureBounds& RegionCaptureBounds::operator=(
const RegionCaptureBounds&) = default;
RegionCaptureBounds::~RegionCaptureBounds() = default;
+// static
+const RegionCaptureBounds& RegionCaptureBounds::Empty() {
+ static base::NoDestructor<RegionCaptureBounds> kEmpty;
+ return *kEmpty;
+}
+
void RegionCaptureBounds::Set(const RegionCaptureCropId& crop_id,
const gfx::Rect& region) {
bounds_.insert_or_assign(crop_id, region);
}
+void RegionCaptureBounds::Reset() {
+ bounds_.clear();
+}
+
bool RegionCaptureBounds::operator==(const RegionCaptureBounds& rhs) const {
return bounds_ == rhs.bounds_;
}
diff --git a/chromium/components/viz/common/surfaces/region_capture_bounds.h b/chromium/components/viz/common/surfaces/region_capture_bounds.h
index 89be906bd43..27bfc80dd81 100644
--- a/chromium/components/viz/common/surfaces/region_capture_bounds.h
+++ b/chromium/components/viz/common/surfaces/region_capture_bounds.h
@@ -33,10 +33,20 @@ class VIZ_COMMON_EXPORT RegionCaptureBounds {
RegionCaptureBounds& operator=(const RegionCaptureBounds&);
~RegionCaptureBounds();
+ // Returns a reference to a global empty RegionCaptureBounds. This should only
+ // be used for functions that need to return a reference to a
+ // RegionCaptureBounds, not instead of the default constructor.
+ static const RegionCaptureBounds& Empty();
+
// We currently only support a single set of bounds for a given crop id.
// Multiple calls with the same crop id will update the bounds.
void Set(const RegionCaptureCropId& crop_id, const gfx::Rect& bounds);
+ bool IsEmpty() const { return bounds_.empty(); }
+
+ // Sets the bounds to empty.
+ void Reset();
+
const base::flat_map<RegionCaptureCropId, gfx::Rect>& bounds() const {
return bounds_;
}
diff --git a/chromium/components/viz/common/switches.cc b/chromium/components/viz/common/switches.cc
index 14db420e8f3..0e142fa1839 100644
--- a/chromium/components/viz/common/switches.cc
+++ b/chromium/components/viz/common/switches.cc
@@ -4,9 +4,13 @@
#include "components/viz/common/switches.h"
+#include <algorithm>
+#include <string>
+
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
+#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/viz/common/constants.h"
@@ -41,10 +45,7 @@ const char kEnableDeJelly[] = "enable-de-jelly";
// fullscreen overlay and use it as main framebuffer where possible.
const char kEnableHardwareOverlays[] = "enable-hardware-overlays";
-// Enables hit-test debug logging.
-const char kEnableVizHitTestDebug[] = "enable-viz-hit-test-debug";
-
-#if defined(OS_CHROMEOS)
+#if BUILDFLAG(IS_CHROMEOS)
// ChromeOS uses one of two VideoDecoder implementations based on SoC/board
// specific configurations that are signalled via this command line flag.
// TODO(b/159825227): remove when the "old" video decoder is fully launched.
@@ -96,7 +97,8 @@ absl::optional<uint32_t> GetDeadlineToSynchronizeSurfaces() {
int GetDocumentTransitionSlowDownFactor() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(kDocumentTransitionSlowdownFactor))
+ if (!command_line ||
+ !command_line->HasSwitch(kDocumentTransitionSlowdownFactor))
return 1;
auto factor_str =
diff --git a/chromium/components/viz/common/switches.h b/chromium/components/viz/common/switches.h
index 64490ee8275..6ac91e6a5f0 100644
--- a/chromium/components/viz/common/switches.h
+++ b/chromium/components/viz/common/switches.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/viz/common/viz_common_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@@ -21,9 +22,8 @@ VIZ_COMMON_EXPORT extern const char kDocumentTransitionSlowdownFactor[];
VIZ_COMMON_EXPORT extern const char kDoubleBufferCompositing[];
VIZ_COMMON_EXPORT extern const char kEnableDeJelly[];
VIZ_COMMON_EXPORT extern const char kEnableHardwareOverlays[];
-VIZ_COMMON_EXPORT extern const char kEnableVizHitTestDebug[];
-#if defined(OS_CHROMEOS)
+#if BUILDFLAG(IS_CHROMEOS)
VIZ_COMMON_EXPORT extern const char
kPlatformDisallowsChromeOSDirectVideoDecoder[];
#endif
diff --git a/chromium/components/viz/common/viz_utils.cc b/chromium/components/viz/common/viz_utils.cc
index 8d3aa5c45ca..4de5eb123a9 100644
--- a/chromium/components/viz/common/viz_utils.cc
+++ b/chromium/components/viz/common/viz_utils.cc
@@ -9,17 +9,18 @@
#include "base/command_line.h"
#include "base/system/sys_info.h"
+#include "build/build_config.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rrect_f.h"
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
#include <array>
#include <string>
#include "base/android/build_info.h"
#endif
-#if defined(OS_POSIX)
+#if BUILDFLAG(IS_POSIX)
#include <poll.h>
#include <sys/resource.h>
#endif
@@ -27,14 +28,14 @@
namespace viz {
bool PreferRGB565ResourcesForDisplay() {
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
return base::SysInfo::AmountOfPhysicalMemoryMB() <= 512;
#else
return false;
#endif
}
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
bool AlwaysUseWideColorGamut() {
// Full stack integration tests draw in sRGB and expect to read back in sRGB.
// WideColorGamut causes pixels to be drawn in P3, but read back doesn't tell
@@ -115,9 +116,9 @@ bool GatherFDStats(base::TimeDelta* delta_time_taken,
int* fd_max,
int* active_fd_count,
int* rlim_cur) {
-#if !defined(OS_POSIX)
+#if !BUILDFLAG(IS_POSIX)
return false;
-#else // defined(OS_POSIX)
+#else // BUILDFLAG(IS_POSIX)
// https://stackoverflow.com/questions/7976769/
// getting-count-of-current-used-file-descriptors-from-c-code
base::ElapsedTimer timer;
@@ -145,7 +146,7 @@ bool GatherFDStats(base::TimeDelta* delta_time_taken,
}
*delta_time_taken = timer.Elapsed();
return true;
-#endif // defined(OS_POSIX)
+#endif // BUILDFLAG(IS_POSIX)
}
} // namespace viz
diff --git a/chromium/components/viz/common/viz_utils.h b/chromium/components/viz/common/viz_utils.h
index b0ef766f78d..008f1224b8b 100644
--- a/chromium/components/viz/common/viz_utils.h
+++ b/chromium/components/viz/common/viz_utils.h
@@ -20,7 +20,7 @@ namespace viz {
VIZ_COMMON_EXPORT bool PreferRGB565ResourcesForDisplay();
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
VIZ_COMMON_EXPORT bool AlwaysUseWideColorGamut();
#endif
diff --git a/chromium/components/viz/common/yuv_readback_unittest.cc b/chromium/components/viz/common/yuv_readback_unittest.cc
index acb96fdbed1..5cf43adb162 100644
--- a/chromium/components/viz/common/yuv_readback_unittest.cc
+++ b/chromium/components/viz/common/yuv_readback_unittest.cc
@@ -25,7 +25,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#if !defined(OS_ANDROID)
+#if !BUILDFLAG(IS_ANDROID)
namespace viz {
@@ -113,7 +113,7 @@ class YUVReadbackTest : public testing::Test {
<< json_data;
CHECK(parsed_json.value->is_list());
- for (const base::Value& dict : parsed_json.value->GetList()) {
+ for (const base::Value& dict : parsed_json.value->GetListDeprecated()) {
CHECK(dict.is_dict());
const std::string* name = dict.FindStringPath("name");
CHECK(name);