diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-08-01 11:44:21 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-08-01 09:49:25 +0000 |
commit | 9a05d0e4db172168e429f30bc8ed62b695006490 (patch) | |
tree | 6a7a6b2f7e3410bb9ddc3ef9a200156f2bf623e1 /chromium/cc | |
parent | 6ec7b8da05d21a3878bd21c691b41e675d74bb1c (diff) | |
download | qtwebengine-chromium-9a05d0e4db172168e429f30bc8ed62b695006490.tar.gz |
BASELINE: Update Chromium to 60.0.3112.78
Change-Id: I58f9d14bddb9104a666b6ef869944111ee7eadb8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/cc')
-rw-r--r-- | chromium/cc/base/math_util.cc | 6 | ||||
-rw-r--r-- | chromium/cc/base/math_util.h | 3 | ||||
-rw-r--r-- | chromium/cc/ipc/cc_param_traits_macros.h | 1 | ||||
-rw-r--r-- | chromium/cc/ipc/struct_traits_unittest.cc | 4 | ||||
-rw-r--r-- | chromium/cc/ipc/transferable_resource.mojom | 3 | ||||
-rw-r--r-- | chromium/cc/ipc/transferable_resource_struct_traits.cc | 1 | ||||
-rw-r--r-- | chromium/cc/ipc/transferable_resource_struct_traits.h | 5 | ||||
-rw-r--r-- | chromium/cc/resources/resource_pool.cc | 13 | ||||
-rw-r--r-- | chromium/cc/resources/resource_pool.h | 2 | ||||
-rw-r--r-- | chromium/cc/resources/resource_provider.cc | 6 | ||||
-rw-r--r-- | chromium/cc/resources/shared_bitmap.cc | 5 | ||||
-rw-r--r-- | chromium/cc/resources/shared_bitmap.h | 8 | ||||
-rw-r--r-- | chromium/cc/resources/transferable_resource.cc | 1 | ||||
-rw-r--r-- | chromium/cc/resources/transferable_resource.h | 1 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_host_common.cc | 13 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_host_common_unittest.cc | 72 | ||||
-rw-r--r-- | chromium/cc/trees/property_tree.cc | 8 |
17 files changed, 122 insertions, 30 deletions
diff --git a/chromium/cc/base/math_util.cc b/chromium/cc/base/math_util.cc index 53dde152d57..5f7544c0510 100644 --- a/chromium/cc/base/math_util.cc +++ b/chromium/cc/base/math_util.cc @@ -7,7 +7,7 @@ #include <algorithm> #include <cmath> #include <limits> -#ifdef __SSE__ +#if defined(ARCH_CPU_X86_FAMILY) #include <xmmintrin.h> #endif @@ -810,7 +810,7 @@ gfx::Vector3dF MathUtil::GetYAxis(const gfx::Transform& transform) { } ScopedSubnormalFloatDisabler::ScopedSubnormalFloatDisabler() { -#ifdef __SSE__ +#if defined(ARCH_CPU_X86_FAMILY) // Turn on "subnormals are zero" and "flush to zero" CSR flags. orig_state_ = _mm_getcsr(); _mm_setcsr(orig_state_ | 0x8040); @@ -818,7 +818,7 @@ ScopedSubnormalFloatDisabler::ScopedSubnormalFloatDisabler() { } ScopedSubnormalFloatDisabler::~ScopedSubnormalFloatDisabler() { -#ifdef __SSE__ +#if defined(ARCH_CPU_X86_FAMILY) _mm_setcsr(orig_state_); #endif } diff --git a/chromium/cc/base/math_util.h b/chromium/cc/base/math_util.h index f2c3784b97b..bf3c1813380 100644 --- a/chromium/cc/base/math_util.h +++ b/chromium/cc/base/math_util.h @@ -11,6 +11,7 @@ #include <vector> #include "base/logging.h" +#include "build/build_config.h" #include "cc/base/base_export.h" #include "ui/gfx/geometry/box_f.h" #include "ui/gfx/geometry/point3_f.h" @@ -325,7 +326,7 @@ class CC_BASE_EXPORT ScopedSubnormalFloatDisabler { ~ScopedSubnormalFloatDisabler(); private: -#ifdef __SSE__ +#if defined(ARCH_CPU_X86_FAMILY) unsigned int orig_state_; #endif DISALLOW_COPY_AND_ASSIGN(ScopedSubnormalFloatDisabler); diff --git a/chromium/cc/ipc/cc_param_traits_macros.h b/chromium/cc/ipc/cc_param_traits_macros.h index 019a16e127d..4d8104a6a58 100644 --- a/chromium/cc/ipc/cc_param_traits_macros.h +++ b/chromium/cc/ipc/cc_param_traits_macros.h @@ -144,6 +144,7 @@ IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource) IPC_STRUCT_TRAITS_MEMBER(mailbox_holder) IPC_STRUCT_TRAITS_MEMBER(read_lock_fences_enabled) IPC_STRUCT_TRAITS_MEMBER(is_software) + IPC_STRUCT_TRAITS_MEMBER(shared_bitmap_sequence_number) IPC_STRUCT_TRAITS_MEMBER(is_overlay_candidate) IPC_STRUCT_TRAITS_MEMBER(color_space) #if defined(OS_ANDROID) diff --git a/chromium/cc/ipc/struct_traits_unittest.cc b/chromium/cc/ipc/struct_traits_unittest.cc index 40c402b3dc0..8318cd3dfe5 100644 --- a/chromium/cc/ipc/struct_traits_unittest.cc +++ b/chromium/cc/ipc/struct_traits_unittest.cc @@ -1155,6 +1155,7 @@ TEST_F(StructTraitsTest, TransferableResource) { const uint32_t texture_target = 1337; const bool read_lock_fences_enabled = true; const bool is_software = false; + const uint32_t shared_bitmap_sequence_number = 123456; const bool is_overlay_candidate = true; gpu::MailboxHolder mailbox_holder; @@ -1171,6 +1172,7 @@ TEST_F(StructTraitsTest, TransferableResource) { input.mailbox_holder = mailbox_holder; input.read_lock_fences_enabled = read_lock_fences_enabled; input.is_software = is_software; + input.shared_bitmap_sequence_number = shared_bitmap_sequence_number; input.is_overlay_candidate = is_overlay_candidate; mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); TransferableResource output; @@ -1185,6 +1187,8 @@ TEST_F(StructTraitsTest, TransferableResource) { output.mailbox_holder.texture_target); EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled); EXPECT_EQ(is_software, output.is_software); + EXPECT_EQ(shared_bitmap_sequence_number, + output.shared_bitmap_sequence_number); EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate); } diff --git a/chromium/cc/ipc/transferable_resource.mojom b/chromium/cc/ipc/transferable_resource.mojom index ea20a63f826..81696f65aaf 100644 --- a/chromium/cc/ipc/transferable_resource.mojom +++ b/chromium/cc/ipc/transferable_resource.mojom @@ -23,12 +23,13 @@ enum ResourceFormat { struct TransferableResource { uint32 id; ResourceFormat format; - gfx.mojom.BufferFormat buffer_format; + gfx.mojom.BufferFormat buffer_format; uint32 filter; gfx.mojom.Size size; gpu.mojom.MailboxHolder mailbox_holder; bool read_lock_fences_enabled; bool is_software; + uint32 shared_bitmap_sequence_number; bool is_overlay_candidate; bool is_backed_by_surface_texture; bool wants_promotion_hint; diff --git a/chromium/cc/ipc/transferable_resource_struct_traits.cc b/chromium/cc/ipc/transferable_resource_struct_traits.cc index ea6c56d3398..b9e9f4ad9fc 100644 --- a/chromium/cc/ipc/transferable_resource_struct_traits.cc +++ b/chromium/cc/ipc/transferable_resource_struct_traits.cc @@ -25,6 +25,7 @@ bool StructTraits<cc::mojom::TransferableResourceDataView, out->filter = data.filter(); out->read_lock_fences_enabled = data.read_lock_fences_enabled(); out->is_software = data.is_software(); + out->shared_bitmap_sequence_number = data.shared_bitmap_sequence_number(); out->is_overlay_candidate = data.is_overlay_candidate(); #if defined(OS_ANDROID) out->is_backed_by_surface_texture = data.is_backed_by_surface_texture(); diff --git a/chromium/cc/ipc/transferable_resource_struct_traits.h b/chromium/cc/ipc/transferable_resource_struct_traits.h index e9964c6fce3..526a7e1252f 100644 --- a/chromium/cc/ipc/transferable_resource_struct_traits.h +++ b/chromium/cc/ipc/transferable_resource_struct_traits.h @@ -50,6 +50,11 @@ struct StructTraits<cc::mojom::TransferableResourceDataView, return resource.is_software; } + static uint32_t shared_bitmap_sequence_number( + const cc::TransferableResource& resource) { + return resource.shared_bitmap_sequence_number; + } + static bool is_overlay_candidate(const cc::TransferableResource& resource) { return resource.is_overlay_candidate; } diff --git a/chromium/cc/resources/resource_pool.cc b/chromium/cc/resources/resource_pool.cc index 5ad2f6a5344..ad6b7faf850 100644 --- a/chromium/cc/resources/resource_pool.cc +++ b/chromium/cc/resources/resource_pool.cc @@ -15,6 +15,7 @@ #include "base/strings/stringprintf.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/memory_dump_manager.h" +#include "build/build_config.h" #include "cc/base/container_util.h" #include "cc/resources/resource_provider.h" #include "cc/resources/resource_util.h" @@ -99,6 +100,12 @@ ResourcePool::ResourcePool(ResourceProvider* resource_provider, base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( this, "cc::ResourcePool", task_runner_.get()); +#if defined(OS_ANDROID) + // TODO(ericrk): This feature appears to be causing visual corruption on + // certain android devices. Will investigate and re-enable. crbug.com/746931 + disallow_non_exact_reuse_ = true; +#endif + // Register this component with base::MemoryCoordinatorClientRegistry. base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); } @@ -118,6 +125,12 @@ ResourcePool::ResourcePool(ResourceProvider* resource_provider, base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( this, "cc::ResourcePool", task_runner_.get()); +#if defined(OS_ANDROID) + // TODO(ericrk): This feature appears to be causing visual corruption on + // certain android devices. Will investigate and re-enable. crbug.com/746931 + disallow_non_exact_reuse_ = true; +#endif + // Register this component with base::MemoryCoordinatorClientRegistry. base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); } diff --git a/chromium/cc/resources/resource_pool.h b/chromium/cc/resources/resource_pool.h index 33291874d26..18b4f5bdc20 100644 --- a/chromium/cc/resources/resource_pool.h +++ b/chromium/cc/resources/resource_pool.h @@ -193,7 +193,7 @@ class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider, scoped_refptr<base::SingleThreadTaskRunner> task_runner_; bool evict_expired_resources_pending_ = false; const base::TimeDelta resource_expiration_delay_; - const bool disallow_non_exact_reuse_ = false; + bool disallow_non_exact_reuse_ = false; base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; diff --git a/chromium/cc/resources/resource_provider.cc b/chromium/cc/resources/resource_provider.cc index 8d5a3fce7fe..002f10a63e1 100644 --- a/chromium/cc/resources/resource_provider.cc +++ b/chromium/cc/resources/resource_provider.cc @@ -1799,6 +1799,12 @@ void ResourceProvider::TransferResource(Resource* source, if (source->type == RESOURCE_TYPE_BITMAP) { resource->mailbox_holder.mailbox = source->shared_bitmap_id; resource->is_software = true; + if (source->shared_bitmap) { + resource->shared_bitmap_sequence_number = + source->shared_bitmap->sequence_number(); + } else { + resource->shared_bitmap_sequence_number = 0; + } } else { DCHECK(source->mailbox().IsValid()); DCHECK(source->mailbox().IsTexture()); diff --git a/chromium/cc/resources/shared_bitmap.cc b/chromium/cc/resources/shared_bitmap.cc index 2eb128af661..47bc4bf62b6 100644 --- a/chromium/cc/resources/shared_bitmap.cc +++ b/chromium/cc/resources/shared_bitmap.cc @@ -15,8 +15,9 @@ namespace cc { -SharedBitmap::SharedBitmap(uint8_t* pixels, const SharedBitmapId& id) - : pixels_(pixels), id_(id) {} +SharedBitmap::SharedBitmap(uint8_t* pixels, const SharedBitmapId& id, + uint32_t sequence_number) + : pixels_(pixels), id_(id), sequence_number_(sequence_number) {} SharedBitmap::~SharedBitmap() { } diff --git a/chromium/cc/resources/shared_bitmap.h b/chromium/cc/resources/shared_bitmap.h index 464ac5c6d4c..20be61f92e0 100644 --- a/chromium/cc/resources/shared_bitmap.h +++ b/chromium/cc/resources/shared_bitmap.h @@ -22,7 +22,8 @@ GetSharedBitmapGUIDForTracing(const SharedBitmapId& bitmap_id); class CC_EXPORT SharedBitmap { public: - SharedBitmap(uint8_t* pixels, const SharedBitmapId& id); + SharedBitmap(uint8_t* pixels, const SharedBitmapId& id, + uint32_t sequence_number); virtual ~SharedBitmap(); @@ -30,6 +31,10 @@ class CC_EXPORT SharedBitmap { const SharedBitmapId& id() { return id_; } + // The sequence number that ClientSharedBitmapManager assigned to this + // SharedBitmap. + uint32_t sequence_number() const { return sequence_number_; } + // Returns true if the size is valid and false otherwise. static bool SizeInBytes(const gfx::Size& size, size_t* size_in_bytes); // Dies with a CRASH() if the size can not be represented as a positive number @@ -46,6 +51,7 @@ class CC_EXPORT SharedBitmap { private: uint8_t* pixels_; SharedBitmapId id_; + const uint32_t sequence_number_; DISALLOW_COPY_AND_ASSIGN(SharedBitmap); }; diff --git a/chromium/cc/resources/transferable_resource.cc b/chromium/cc/resources/transferable_resource.cc index 65ac1f6ecfc..1c9fece21bf 100644 --- a/chromium/cc/resources/transferable_resource.cc +++ b/chromium/cc/resources/transferable_resource.cc @@ -14,6 +14,7 @@ TransferableResource::TransferableResource() filter(0), read_lock_fences_enabled(false), is_software(false), + shared_bitmap_sequence_number(0), #if defined(OS_ANDROID) is_backed_by_surface_texture(false), wants_promotion_hint(false), diff --git a/chromium/cc/resources/transferable_resource.h b/chromium/cc/resources/transferable_resource.h index baa40486f8c..2764787fb23 100644 --- a/chromium/cc/resources/transferable_resource.h +++ b/chromium/cc/resources/transferable_resource.h @@ -42,6 +42,7 @@ struct CC_EXPORT TransferableResource { gpu::MailboxHolder mailbox_holder; bool read_lock_fences_enabled; bool is_software; + uint32_t shared_bitmap_sequence_number; #if defined(OS_ANDROID) bool is_backed_by_surface_texture; bool wants_promotion_hint; diff --git a/chromium/cc/trees/layer_tree_host_common.cc b/chromium/cc/trees/layer_tree_host_common.cc index e289a34db08..c7349e828b7 100644 --- a/chromium/cc/trees/layer_tree_host_common.cc +++ b/chromium/cc/trees/layer_tree_host_common.cc @@ -263,10 +263,7 @@ int LayerTreeHostCommon::CalculateLayerJitter(LayerImpl* layer) { return jitter; } -enum PropertyTreeOption { - BUILD_PROPERTY_TREES_IF_NEEDED, - DONT_BUILD_PROPERTY_TREES -}; +enum PropertyTreeOption { BUILD_PROPERTY_TREES, DONT_BUILD_PROPERTY_TREES }; static void AddSurfaceToRenderSurfaceList( RenderSurfaceImpl* render_surface, @@ -494,11 +491,11 @@ void CalculateDrawPropertiesInternal( inputs->render_surface_list->clear(); const bool should_measure_property_tree_performance = - property_tree_option == BUILD_PROPERTY_TREES_IF_NEEDED; + property_tree_option == BUILD_PROPERTY_TREES; LayerImplList visible_layer_list; switch (property_tree_option) { - case BUILD_PROPERTY_TREES_IF_NEEDED: { + case BUILD_PROPERTY_TREES: { // The translation from layer to property trees is an intermediate // state. We will eventually get these data passed directly to the // compositor. @@ -665,7 +662,9 @@ void LayerTreeHostCommon::CalculateDrawProperties( void LayerTreeHostCommon::CalculateDrawPropertiesForTesting( CalcDrawPropsImplInputsForTesting* inputs) { - CalculateDrawPropertiesInternal(inputs, BUILD_PROPERTY_TREES_IF_NEEDED); + CalculateDrawPropertiesInternal(inputs, inputs->property_trees->needs_rebuild + ? BUILD_PROPERTY_TREES + : DONT_BUILD_PROPERTY_TREES); } PropertyTrees* GetPropertyTrees(Layer* layer) { diff --git a/chromium/cc/trees/layer_tree_host_common_unittest.cc b/chromium/cc/trees/layer_tree_host_common_unittest.cc index a26ee7f4559..639bab1206e 100644 --- a/chromium/cc/trees/layer_tree_host_common_unittest.cc +++ b/chromium/cc/trees/layer_tree_host_common_unittest.cc @@ -247,20 +247,6 @@ class LayerTreeHostCommonTestBase : public LayerTestCommon::LayerImplTest { update_layer_list_impl(), property_trees); } - void ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( - LayerImpl* root_layer) { - gfx::Size device_viewport_size = - gfx::Size(root_layer->bounds().width(), root_layer->bounds().height()); - render_surface_list_impl_.reset(new RenderSurfaceList); - - DCHECK(!root_layer->bounds().IsEmpty()); - LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root_layer, device_viewport_size, render_surface_list_impl_.get()); - inputs.can_adjust_raster_scales = true; - - LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); - } - void ExecuteCalculateDrawPropertiesWithoutAdjustingRasterScales( LayerImpl* root_layer) { gfx::Size device_viewport_size = @@ -10214,5 +10200,63 @@ TEST_F(LayerTreeHostCommonTest, CanAdjustRasterScaleTest) { EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); } +TEST_F(LayerTreeHostCommonTest, SurfaceContentsScaleChangeWithCopyRequestTest) { + LayerImpl* root = root_layer_for_testing(); + LayerImpl* scale_layer = AddChild<LayerImpl>(root); + LayerImpl* copy_layer = AddChild<LayerImpl>(scale_layer); + LayerImpl* clip_layer = AddChild<LayerImpl>(copy_layer); + LayerImpl* test_layer = AddChild<LayerImpl>(clip_layer); + + root->SetBounds(gfx::Size(150, 150)); + + scale_layer->SetBounds(gfx::Size(30, 30)); + gfx::Transform transform; + transform.Scale(5.f, 5.f); + scale_layer->test_properties()->transform = transform; + + // Need to persist the render surface after copy request is cleared. + copy_layer->test_properties()->force_render_surface = true; + copy_layer->test_properties()->copy_requests.push_back( + CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); + + clip_layer->SetDrawsContent(true); + clip_layer->SetMasksToBounds(true); + clip_layer->SetBounds(gfx::Size(10, 10)); + + test_layer->SetDrawsContent(true); + test_layer->SetMasksToBounds(true); + test_layer->SetBounds(gfx::Size(20, 20)); + + ExecuteCalculateDrawPropertiesWithoutAdjustingRasterScales(root); + + // Check surface with copy request draw properties. + EXPECT_EQ(gfx::Rect(50, 50), GetRenderSurface(copy_layer)->content_rect()); + EXPECT_EQ(gfx::Transform(), GetRenderSurface(copy_layer)->draw_transform()); + EXPECT_EQ(gfx::RectF(50.0f, 50.0f), + GetRenderSurface(copy_layer)->DrawableContentRect()); + + // Check test layer draw properties. + EXPECT_EQ(gfx::Rect(10, 10), test_layer->visible_layer_rect()); + EXPECT_EQ(transform, test_layer->DrawTransform()); + EXPECT_EQ(gfx::Rect(50, 50), test_layer->clip_rect()); + EXPECT_EQ(gfx::Rect(50, 50), test_layer->drawable_content_rect()); + + // Clear the copy request and call UpdateSurfaceContentsScale. + host_impl()->active_tree()->property_trees()->effect_tree.ClearCopyRequests(); + ExecuteCalculateDrawPropertiesWithoutAdjustingRasterScales(root); + + // Check surface draw properties without copy request. + EXPECT_EQ(gfx::Rect(10, 10), GetRenderSurface(copy_layer)->content_rect()); + EXPECT_EQ(transform, GetRenderSurface(copy_layer)->draw_transform()); + EXPECT_EQ(gfx::RectF(50.0f, 50.0f), + GetRenderSurface(copy_layer)->DrawableContentRect()); + + // Check test layer draw properties without copy request. + EXPECT_EQ(gfx::Rect(10, 10), test_layer->visible_layer_rect()); + EXPECT_EQ(gfx::Transform(), test_layer->DrawTransform()); + EXPECT_EQ(gfx::Rect(10, 10), test_layer->clip_rect()); + EXPECT_EQ(gfx::Rect(10, 10), test_layer->drawable_content_rect()); +} + } // namespace } // namespace cc diff --git a/chromium/cc/trees/property_tree.cc b/chromium/cc/trees/property_tree.cc index f450baa7067..ff214e50038 100644 --- a/chromium/cc/trees/property_tree.cc +++ b/chromium/cc/trees/property_tree.cc @@ -854,11 +854,19 @@ void EffectTree::UpdateSurfaceContentsScale(EffectNode* effect_node) { bool use_transform_for_contents_scale = property_trees()->can_adjust_raster_scales || effect_node->has_copy_request; + const gfx::Vector2dF old_scale = effect_node->surface_contents_scale; effect_node->surface_contents_scale = use_transform_for_contents_scale ? MathUtil::ComputeTransform2dScaleComponents( transform_tree.ToScreen(transform_node->id), layer_scale_factor) : gfx::Vector2dF(layer_scale_factor, layer_scale_factor); + + // If surface contents scale changes, draw transforms are no longer valid. + // Invalidates the draw transform cache and updates the clip for the surface. + if (old_scale != effect_node->surface_contents_scale) { + property_trees()->clip_tree.set_needs_update(true); + property_trees()->UpdateTransformTreeUpdateNumber(); + } } EffectNode* EffectTree::FindNodeFromElementId(ElementId id) { |