| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 // CompositorFrameSink? | 1753 // CompositorFrameSink? |
| 1754 // For now just early out and leave things unchanged, we'll come back here | 1754 // For now just early out and leave things unchanged, we'll come back here |
| 1755 // when we get an CompositorFrameSink. | 1755 // when we get an CompositorFrameSink. |
| 1756 if (!compositor_frame_sink_) | 1756 if (!compositor_frame_sink_) |
| 1757 return false; | 1757 return false; |
| 1758 | 1758 |
| 1759 int requested_msaa_samples = RequestedMSAASampleCount(); | 1759 int requested_msaa_samples = RequestedMSAASampleCount(); |
| 1760 int max_msaa_samples = 0; | 1760 int max_msaa_samples = 0; |
| 1761 ContextProvider* compositor_context_provider = | 1761 ContextProvider* compositor_context_provider = |
| 1762 compositor_frame_sink_->context_provider(); | 1762 compositor_frame_sink_->context_provider(); |
| 1763 bool gpu_rasterization_enabled = false; |
| 1763 if (compositor_context_provider) { | 1764 if (compositor_context_provider) { |
| 1764 const auto& caps = compositor_context_provider->ContextCapabilities(); | 1765 const auto& caps = compositor_context_provider->ContextCapabilities(); |
| 1766 gpu_rasterization_enabled = caps.gpu_rasterization; |
| 1765 if (!caps.msaa_is_slow) | 1767 if (!caps.msaa_is_slow) |
| 1766 max_msaa_samples = caps.max_samples; | 1768 max_msaa_samples = caps.max_samples; |
| 1767 } | 1769 } |
| 1768 | 1770 |
| 1769 bool use_gpu = false; | 1771 bool use_gpu = false; |
| 1770 bool use_msaa = false; | 1772 bool use_msaa = false; |
| 1771 bool using_msaa_for_complex_content = | 1773 bool using_msaa_for_complex_content = |
| 1772 requested_msaa_samples > 0 && max_msaa_samples >= requested_msaa_samples; | 1774 requested_msaa_samples > 0 && max_msaa_samples >= requested_msaa_samples; |
| 1773 if (settings_.gpu_rasterization_forced) { | 1775 if (settings_.gpu_rasterization_forced) { |
| 1774 use_gpu = true; | 1776 use_gpu = true; |
| 1775 gpu_rasterization_status_ = GpuRasterizationStatus::ON_FORCED; | 1777 gpu_rasterization_status_ = GpuRasterizationStatus::ON_FORCED; |
| 1776 use_msaa = !content_is_suitable_for_gpu_rasterization_ && | 1778 use_msaa = !content_is_suitable_for_gpu_rasterization_ && |
| 1777 using_msaa_for_complex_content; | 1779 using_msaa_for_complex_content; |
| 1778 if (use_msaa) { | 1780 if (use_msaa) { |
| 1779 gpu_rasterization_status_ = GpuRasterizationStatus::MSAA_CONTENT; | 1781 gpu_rasterization_status_ = GpuRasterizationStatus::MSAA_CONTENT; |
| 1780 } | 1782 } |
| 1781 } else if (!settings_.gpu_rasterization_enabled) { | 1783 } else if (!gpu_rasterization_enabled) { |
| 1782 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_DEVICE; | 1784 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_DEVICE; |
| 1783 } else if (!has_gpu_rasterization_trigger_) { | 1785 } else if (!has_gpu_rasterization_trigger_) { |
| 1784 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_VIEWPORT; | 1786 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_VIEWPORT; |
| 1785 } else if (content_is_suitable_for_gpu_rasterization_) { | 1787 } else if (content_is_suitable_for_gpu_rasterization_) { |
| 1786 use_gpu = true; | 1788 use_gpu = true; |
| 1787 gpu_rasterization_status_ = GpuRasterizationStatus::ON; | 1789 gpu_rasterization_status_ = GpuRasterizationStatus::ON; |
| 1788 } else if (using_msaa_for_complex_content) { | 1790 } else if (using_msaa_for_complex_content) { |
| 1789 use_gpu = use_msaa = true; | 1791 use_gpu = use_msaa = true; |
| 1790 gpu_rasterization_status_ = GpuRasterizationStatus::MSAA_CONTENT; | 1792 gpu_rasterization_status_ = GpuRasterizationStatus::MSAA_CONTENT; |
| 1791 } else { | 1793 } else { |
| (...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4085 worker_context_visibility_ = | 4087 worker_context_visibility_ = |
| 4086 worker_context->CacheController()->ClientBecameVisible(); | 4088 worker_context->CacheController()->ClientBecameVisible(); |
| 4087 } else { | 4089 } else { |
| 4088 worker_context->CacheController()->ClientBecameNotVisible( | 4090 worker_context->CacheController()->ClientBecameNotVisible( |
| 4089 std::move(worker_context_visibility_)); | 4091 std::move(worker_context_visibility_)); |
| 4090 } | 4092 } |
| 4091 } | 4093 } |
| 4092 } | 4094 } |
| 4093 | 4095 |
| 4094 } // namespace cc | 4096 } // namespace cc |
| OLD | NEW |