Commit 0beb6ed5 authored by Khushal's avatar Khushal Committed by Commit Bot

cc: Don't track unnecessary checker-image data for UI compositor.

This change does a couple of things to ensure we don't track any
unnecessary data for checker-imaging:

1) During discardable image metadata generation, the decoding mode only
   needs to be tracked if the image is discardable.
2) We don't need to store any decoding mode metadata if checker-imaging
   is disabled.

R=ericrk@chromium.org

Bug: 1003886
Change-Id: I2802af3bcf69beb970b98a6c179032a72b588f2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973152
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726685}
parent a5e4fd56
...@@ -346,14 +346,17 @@ class DiscardableImageGenerator { ...@@ -346,14 +346,17 @@ class DiscardableImageGenerator {
else else
rects->push_back(image_rect); rects->push_back(image_rect);
auto decoding_mode_it = decoding_mode_map_.find(paint_image.stable_id()); if (paint_image.IsLazyGenerated()) {
// Use the decoding mode if we don't have one yet, otherwise use the more auto decoding_mode_it = decoding_mode_map_.find(paint_image.stable_id());
// conservative one of the two existing ones. // Use the decoding mode if we don't have one yet, otherwise use the more
if (decoding_mode_it == decoding_mode_map_.end()) { // conservative one of the two existing ones.
decoding_mode_map_[paint_image.stable_id()] = paint_image.decoding_mode(); if (decoding_mode_it == decoding_mode_map_.end()) {
} else { decoding_mode_map_[paint_image.stable_id()] =
decoding_mode_it->second = PaintImage::GetConservative( paint_image.decoding_mode();
decoding_mode_it->second, paint_image.decoding_mode()); } else {
decoding_mode_it->second = PaintImage::GetConservative(
decoding_mode_it->second, paint_image.decoding_mode());
}
} }
if (paint_image.ShouldAnimate()) { if (paint_image.ShouldAnimate()) {
......
...@@ -278,6 +278,9 @@ bool CheckerImageTracker::ShouldCheckerImage(const DrawImage& draw_image, ...@@ -278,6 +278,9 @@ bool CheckerImageTracker::ShouldCheckerImage(const DrawImage& draw_image,
if (!enable_checker_imaging_) if (!enable_checker_imaging_)
return false; return false;
if (!image.IsLazyGenerated())
return false;
// If the image was invalidated on the current sync tree and the tile is // If the image was invalidated on the current sync tree and the tile is
// for the active tree, continue checkering it on the active tree to ensure // for the active tree, continue checkering it on the active tree to ensure
// the image update is atomic for the frame. // the image update is atomic for the frame.
...@@ -455,6 +458,9 @@ void CheckerImageTracker::ScheduleNextImageDecode() { ...@@ -455,6 +458,9 @@ void CheckerImageTracker::ScheduleNextImageDecode() {
void CheckerImageTracker::UpdateImageDecodingHints( void CheckerImageTracker::UpdateImageDecodingHints(
base::flat_map<PaintImage::Id, PaintImage::DecodingMode> base::flat_map<PaintImage::Id, PaintImage::DecodingMode>
decoding_mode_map) { decoding_mode_map) {
if (!enable_checker_imaging_)
return;
// Merge the |decoding_mode_map| with our member map, keeping the more // Merge the |decoding_mode_map| with our member map, keeping the more
// conservative values. // conservative values.
// TODO(vmpstr): Figure out if and how do we clear this value to ensure that // TODO(vmpstr): Figure out if and how do we clear this value to ensure that
......
...@@ -8230,6 +8230,11 @@ MULTI_THREAD_TEST_F( ...@@ -8230,6 +8230,11 @@ MULTI_THREAD_TEST_F(
class LayerTreeHostTestImageDecodingHints : public LayerTreeHostTest { class LayerTreeHostTestImageDecodingHints : public LayerTreeHostTest {
public: public:
void InitializeSettings(LayerTreeSettings* settings) override {
LayerTreeHostTest::InitializeSettings(settings);
settings->enable_checker_imaging = true;
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); } void BeginTest() override { PostSetNeedsCommitToMainThread(); }
void SetupTree() override { void SetupTree() override {
......
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