Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Side by Side Diff: cc/tiles/picture_layer_tiling.cc

Issue 2726343004: cc: Optimize decode scheduling for checker-images. (Closed)
Patch Set: tested Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/tiles/picture_layer_tiling.h" 5 #include "cc/tiles/picture_layer_tiling.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); 801 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index());
802 bool tile_is_visible = current_visible_rect_.Intersects(tile_bounds); 802 bool tile_is_visible = current_visible_rect_.Intersects(tile_bounds);
803 if (!tile_is_visible) 803 if (!tile_is_visible)
804 return false; 804 return false;
805 805
806 if (IsTileOccludedOnCurrentTree(tile)) 806 if (IsTileOccludedOnCurrentTree(tile))
807 return false; 807 return false;
808 return true; 808 return true;
809 } 809 }
810 810
811 bool PictureLayerTiling::ShouldDecodeCheckeredImagesForTile(
vmpstr 2017/04/18 00:20:00 None of the checks here really care if the tile is
Khushal 2017/04/19 06:16:41 Answered above.
812 const Tile* tile) const {
813 // If this is the pending tree and the tile is not occluded, it needs to be
814 // decoded for checker-images.
vmpstr 2017/04/18 00:20:00 Tile isn't "decoded", can you rephrase the comment
Khushal 2017/04/19 06:16:41 Done.
815 if (tree_ == PENDING_TREE)
816 return !IsTileOccludedOnCurrentTree(tile);
817
818 DCHECK_EQ(tree_, ACTIVE_TREE);
819 const PictureLayerTiling* pending_twin =
820 client_->GetPendingOrActiveTwinTiling(this);
821
822 // If we don't have a pending twin, the tiling may be evicted upon activation,
823 // or we may not have a pending tree. So use the occlusion on the current
vmpstr 2017/04/18 00:20:00 Can you elaborate on this?
Khushal 2017/04/19 06:16:41 The check is for making sure that we don't process
824 // tree.
825 // TODO(khushalsagar): If we have a pending tree but no twin tiling, this tile
826 // will get nuked on activation.
827 if (!pending_twin)
828 return !IsTileOccludedOnCurrentTree(tile);
829
830 // If the tile will be replaced upon activation, then we don't need to process
831 // it for checkered images. Since once the pending tree is activated, it is
832 // the new active tree's content that we will invalidate and replace once the
833 // decode finishes.
834 if (!TilingMatchesTileIndices(pending_twin) ||
835 pending_twin->TileAt(tile->tiling_i_index(), tile->tiling_j_index())) {
836 return false;
837 }
838
839 // Ask the pending twin if this tile will become occluded upon activation.
840 return !pending_twin->IsTileOccludedOnCurrentTree(tile);
841 }
vmpstr 2017/04/18 00:20:00 This function sounds very similar to RequiredForAc
Khushal 2017/04/19 06:16:41 Its similar to RequiredForActivation for the part
842
811 void PictureLayerTiling::UpdateRequiredStatesOnTile(Tile* tile) const { 843 void PictureLayerTiling::UpdateRequiredStatesOnTile(Tile* tile) const {
812 tile->set_required_for_activation(IsTileRequiredForActivation(tile)); 844 tile->set_required_for_activation(IsTileRequiredForActivation(tile));
813 tile->set_required_for_draw(IsTileRequiredForDraw(tile)); 845 tile->set_required_for_draw(IsTileRequiredForDraw(tile));
814 } 846 }
815 847
816 PrioritizedTile PictureLayerTiling::MakePrioritizedTile( 848 PrioritizedTile PictureLayerTiling::MakePrioritizedTile(
817 Tile* tile, 849 Tile* tile,
818 PriorityRectType priority_rect_type) const { 850 PriorityRectType priority_rect_type) const {
819 DCHECK(tile); 851 DCHECK(tile);
820 DCHECK(raster_source()->CoversRect(tile->enclosing_layer_rect())) 852 DCHECK(raster_source()->CoversRect(tile->enclosing_layer_rect()))
821 << "Recording rect: " 853 << "Recording rect: "
822 << EnclosingLayerRectFromContentsRect(tile->content_rect()).ToString(); 854 << EnclosingLayerRectFromContentsRect(tile->content_rect()).ToString();
823 855
824 UpdateRequiredStatesOnTile(tile); 856 UpdateRequiredStatesOnTile(tile);
825 const auto& tile_priority = ComputePriorityForTile(tile, priority_rect_type); 857 const auto& tile_priority = ComputePriorityForTile(tile, priority_rect_type);
826 DCHECK((!tile->required_for_activation() && !tile->required_for_draw()) || 858 DCHECK((!tile->required_for_activation() && !tile->required_for_draw()) ||
827 tile_priority.priority_bin == TilePriority::NOW || 859 tile_priority.priority_bin == TilePriority::NOW ||
828 !client_->HasValidTilePriorities()); 860 !client_->HasValidTilePriorities());
829 861
830 // Note that TileManager will consider this flag but may rasterize the tile 862 // Note that TileManager will consider this flag but may rasterize the tile
831 // anyway (if tile is required for activation for example). We should process 863 // anyway (if tile is required for activation for example). We should process
832 // the tile for images only if it's further than half of the skewport extent. 864 // the tile for images only if it's further than half of the skewport extent.
833 bool process_for_images_only = 865 bool process_for_images_only =
834 tile_priority.distance_to_visible > min_preraster_distance_ && 866 tile_priority.distance_to_visible > min_preraster_distance_ &&
835 (tile_priority.distance_to_visible > max_preraster_distance_ || 867 (tile_priority.distance_to_visible > max_preraster_distance_ ||
836 tile_priority.distance_to_visible > 868 tile_priority.distance_to_visible >
837 0.5f * max_skewport_extent_in_screen_space_); 869 0.5f * max_skewport_extent_in_screen_space_);
838 return PrioritizedTile(tile, this, tile_priority, IsTileOccluded(tile), 870 return PrioritizedTile(tile, this, tile_priority, IsTileOccluded(tile),
839 process_for_images_only); 871 process_for_images_only,
872 ShouldDecodeCheckeredImagesForTile(tile));
840 } 873 }
841 874
842 std::map<const Tile*, PrioritizedTile> 875 std::map<const Tile*, PrioritizedTile>
843 PictureLayerTiling::UpdateAndGetAllPrioritizedTilesForTesting() const { 876 PictureLayerTiling::UpdateAndGetAllPrioritizedTilesForTesting() const {
844 std::map<const Tile*, PrioritizedTile> result; 877 std::map<const Tile*, PrioritizedTile> result;
845 for (const auto& key_tile_pair : tiles_) { 878 for (const auto& key_tile_pair : tiles_) {
846 Tile* tile = key_tile_pair.second.get(); 879 Tile* tile = key_tile_pair.second.get();
847 PrioritizedTile prioritized_tile = 880 PrioritizedTile prioritized_tile =
848 MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile)); 881 MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile));
849 result.insert(std::make_pair(prioritized_tile.tile(), prioritized_tile)); 882 result.insert(std::make_pair(prioritized_tile.tile(), prioritized_tile));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 return ToEnclosingRect(raster_transform_.MapRect(gfx::RectF(layer_rect))); 982 return ToEnclosingRect(raster_transform_.MapRect(gfx::RectF(layer_rect)));
950 } 983 }
951 984
952 gfx::Rect PictureLayerTiling::EnclosingLayerRectFromContentsRect( 985 gfx::Rect PictureLayerTiling::EnclosingLayerRectFromContentsRect(
953 const gfx::Rect& contents_rect) const { 986 const gfx::Rect& contents_rect) const {
954 return ToEnclosingRect( 987 return ToEnclosingRect(
955 raster_transform_.InverseMapRect(gfx::RectF(contents_rect))); 988 raster_transform_.InverseMapRect(gfx::RectF(contents_rect)));
956 } 989 }
957 990
958 } // namespace cc 991 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698