Commit 6f72fc63 authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

[viz + Ash] Make --show-aggregated-damage dynamic and add it to HUD overlay.

This Cl moves show_aggregated_damage from RendererSettings to
DebugRendererSettings (thus making it dynamic) and adds checkbox for it
in Ash HUD settings.

Bug: 1106855
Change-Id: Id42dcd54476eac3d4b2c4339f4e6c7b4c38709f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315437Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791627}
parent a743788f
......@@ -119,6 +119,12 @@ HUDSettingsView::HUDSettingsView() {
&viz::DebugRendererSettings::show_dc_layer_debug_borders),
GetHandleClickCallback(
&viz::DebugRendererSettings::show_dc_layer_debug_borders)));
checkbox_handlers_.push_back(std::make_unique<HUDCheckboxHandler>(
add_checkbox(this, base::ASCIIToUTF16("Show aggregated damage")),
GetUpdateStateCallback(
&viz::DebugRendererSettings::show_aggregated_damage),
GetHandleClickCallback(
&viz::DebugRendererSettings::show_aggregated_damage)));
}
HUDSettingsView::~HUDSettingsView() = default;
......
......@@ -29,7 +29,6 @@ class VIZ_COMMON_EXPORT RendererSettings {
bool partial_swap_enabled = false;
bool should_clear_root_render_pass = true;
bool release_overlay_resources_after_gpu_query = false;
bool show_aggregated_damage = false;
bool use_skia_renderer = false;
bool allow_overlays = true;
bool dont_round_texture_sizes_for_pixel_tests = false;
......@@ -75,6 +74,7 @@ struct VIZ_COMMON_EXPORT DebugRendererSettings {
bool tint_composited_content = false;
bool show_overdraw_feedback = false;
bool show_dc_layer_debug_borders = false;
bool show_aggregated_damage = false;
};
} // namespace viz
......
......@@ -4,6 +4,8 @@
#include "components/viz/host/renderer_settings_creation.h"
#include <string>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/logging.h"
......@@ -59,8 +61,6 @@ RendererSettings CreateRendererSettings() {
#elif defined(OS_CHROMEOS)
renderer_settings.auto_resize_output_surface = false;
#endif
renderer_settings.show_aggregated_damage =
command_line->HasSwitch(switches::kShowAggregatedDamage);
renderer_settings.allow_antialiasing =
!command_line->HasSwitch(switches::kDisableCompositedAntialiasing);
renderer_settings.use_skia_renderer = features::IsUsingSkiaRenderer();
......@@ -109,6 +109,8 @@ DebugRendererSettings CreateDefaultDebugRendererSettings() {
command_line->HasSwitch(switches::kShowOverdrawFeedback);
result.show_dc_layer_debug_borders =
command_line->HasSwitch(switches::kShowDCLayerDebugBorders);
result.show_aggregated_damage =
command_line->HasSwitch(switches::kShowAggregatedDamage);
return result;
}
......
......@@ -565,8 +565,6 @@ void Display::InitializeRenderer(bool enable_shared_images) {
aggregator_ = std::make_unique<SurfaceAggregator>(
surface_manager_, resource_provider_.get(), output_partial_list,
overlay_processor_->NeedsSurfaceOccludingDamageRect());
if (settings_.show_aggregated_damage)
aggregator_->SetFrameAnnotator(std::make_unique<DamageFrameAnnotator>());
aggregator_->set_output_is_secure(output_is_secure_);
aggregator_->SetDisplayColorSpaces(display_color_spaces_);
......@@ -597,6 +595,14 @@ void Display::OnContextLost() {
bool Display::DrawAndSwap(base::TimeTicks expected_display_time) {
TRACE_EVENT0("viz", "Display::DrawAndSwap");
if (debug_settings_->show_aggregated_damage !=
aggregator_->HasFrameAnnotator()) {
if (debug_settings_->show_aggregated_damage) {
aggregator_->SetFrameAnnotator(std::make_unique<DamageFrameAnnotator>());
} else {
aggregator_->DestroyFrameAnnotator();
}
}
gpu::ScopedAllowScheduleGpuTask allow_schedule_gpu_task;
if (!current_surface_id_.is_valid()) {
......
......@@ -1841,12 +1841,21 @@ bool SurfaceAggregator::NotifySurfaceDamageAndCheckForDisplayDamage(
return false;
}
bool SurfaceAggregator::HasFrameAnnotator() const {
return !!frame_annotator_;
}
void SurfaceAggregator::SetFrameAnnotator(
std::unique_ptr<FrameAnnotator> frame_annotator) {
DCHECK(!frame_annotator_);
frame_annotator_ = std::move(frame_annotator);
}
void SurfaceAggregator::DestroyFrameAnnotator() {
DCHECK(frame_annotator_);
frame_annotator_.reset();
}
bool SurfaceAggregator::IsRootSurface(const Surface* surface) const {
return surface->surface_id() == root_surface_id_;
}
......
......@@ -85,7 +85,9 @@ class VIZ_SERVICE_EXPORT SurfaceAggregator {
bool NotifySurfaceDamageAndCheckForDisplayDamage(const SurfaceId& surface_id);
bool HasFrameAnnotator() const;
void SetFrameAnnotator(std::unique_ptr<FrameAnnotator> frame_annotator);
void DestroyFrameAnnotator();
private:
struct ClipData;
......
......@@ -16,7 +16,6 @@ struct RendererSettings {
bool partial_swap_enabled;
bool release_overlay_resources_after_gpu_query;
bool should_clear_root_render_pass;
bool show_aggregated_damage;
int32 slow_down_compositing_scale_factor;
bool use_skia_renderer;
bool record_sk_picture;
......@@ -38,4 +37,5 @@ struct DebugRendererSettings {
bool tint_composited_content;
bool show_overdraw_feedback;
bool show_dc_layer_debug_borders;
bool show_aggregated_damage;
};
......@@ -20,6 +20,7 @@ bool StructTraits<viz::mojom::DebugRendererSettingsDataView,
out->tint_composited_content = data.tint_composited_content();
out->show_overdraw_feedback = data.show_overdraw_feedback();
out->show_dc_layer_debug_borders = data.show_dc_layer_debug_borders();
out->show_aggregated_damage = data.show_aggregated_damage();
return true;
}
......@@ -34,7 +35,6 @@ bool StructTraits<viz::mojom::RendererSettingsDataView, viz::RendererSettings>::
out->should_clear_root_render_pass = data.should_clear_root_render_pass();
out->release_overlay_resources_after_gpu_query =
data.release_overlay_resources_after_gpu_query();
out->show_aggregated_damage = data.show_aggregated_damage();
out->highp_threshold_min = data.highp_threshold_min();
out->slow_down_compositing_scale_factor =
data.slow_down_compositing_scale_factor();
......
......@@ -33,6 +33,10 @@ struct StructTraits<viz::mojom::DebugRendererSettingsDataView,
return input.show_dc_layer_debug_borders;
}
static bool show_aggregated_damage(const viz::DebugRendererSettings& input) {
return input.show_aggregated_damage;
}
static bool Read(viz::mojom::DebugRendererSettingsDataView data,
viz::DebugRendererSettings* out);
};
......@@ -66,10 +70,6 @@ struct StructTraits<viz::mojom::RendererSettingsDataView,
return input.release_overlay_resources_after_gpu_query;
}
static bool show_aggregated_damage(const viz::RendererSettings& input) {
return input.show_aggregated_damage;
}
static int highp_threshold_min(const viz::RendererSettings& input) {
return input.highp_threshold_min;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment