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,15 +346,18 @@ class DiscardableImageGenerator {
else
rects->push_back(image_rect);
if (paint_image.IsLazyGenerated()) {
auto decoding_mode_it = decoding_mode_map_.find(paint_image.stable_id());
// Use the decoding mode if we don't have one yet, otherwise use the more
// conservative one of the two existing ones.
if (decoding_mode_it == decoding_mode_map_.end()) {
decoding_mode_map_[paint_image.stable_id()] = paint_image.decoding_mode();
decoding_mode_map_[paint_image.stable_id()] =
paint_image.decoding_mode();
} else {
decoding_mode_it->second = PaintImage::GetConservative(
decoding_mode_it->second, paint_image.decoding_mode());
}
}
if (paint_image.ShouldAnimate()) {
animated_images_metadata_.emplace_back(
......
......@@ -278,6 +278,9 @@ bool CheckerImageTracker::ShouldCheckerImage(const DrawImage& draw_image,
if (!enable_checker_imaging_)
return false;
if (!image.IsLazyGenerated())
return false;
// 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
// the image update is atomic for the frame.
......@@ -455,6 +458,9 @@ void CheckerImageTracker::ScheduleNextImageDecode() {
void CheckerImageTracker::UpdateImageDecodingHints(
base::flat_map<PaintImage::Id, PaintImage::DecodingMode>
decoding_mode_map) {
if (!enable_checker_imaging_)
return;
// Merge the |decoding_mode_map| with our member map, keeping the more
// conservative values.
// TODO(vmpstr): Figure out if and how do we clear this value to ensure that
......
......@@ -8230,6 +8230,11 @@ MULTI_THREAD_TEST_F(
class LayerTreeHostTestImageDecodingHints : public LayerTreeHostTest {
public:
void InitializeSettings(LayerTreeSettings* settings) override {
LayerTreeHostTest::InitializeSettings(settings);
settings->enable_checker_imaging = true;
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
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