OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 133 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); |
134 | 134 |
135 settings.initial_debug_state.SetRecordRenderingStats( | 135 settings.initial_debug_state.SetRecordRenderingStats( |
136 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 136 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
137 | 137 |
138 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 138 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
139 | 139 |
140 settings.renderer_settings.use_rgba_4444_textures = | 140 settings.renderer_settings.use_rgba_4444_textures = |
141 command_line->HasSwitch(switches::kUIEnableRGBA4444Textures); | 141 command_line->HasSwitch(switches::kUIEnableRGBA4444Textures); |
142 | 142 |
143 // Use PERSISTENT_MAP memory buffers to support partial tile raster for | 143 // UI compositor always uses partial raster if not using zero-copy. Zero copy |
144 // software raster into GpuMemoryBuffers. | 144 // doesn't currently support partial raster. |
145 gfx::BufferUsage usage = gfx::BufferUsage::PERSISTENT_MAP; | 145 settings.use_partial_raster = !settings.use_zero_copy; |
146 settings.use_persistent_map_for_gpu_memory_buffers = true; | 146 |
| 147 // Use PERSISTENT_MAP memory buffers to support partial tile raster if needed. |
| 148 gfx::BufferUsage usage = settings.use_partial_raster |
| 149 ? gfx::BufferUsage::PERSISTENT_MAP |
| 150 : gfx::BufferUsage::MAP; |
147 | 151 |
148 for (size_t format = 0; | 152 for (size_t format = 0; |
149 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { | 153 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { |
150 DCHECK_GT(settings.use_image_texture_targets.size(), format); | 154 DCHECK_GT(settings.use_image_texture_targets.size(), format); |
151 settings.use_image_texture_targets[format] = | 155 settings.use_image_texture_targets[format] = |
152 context_factory_->GetImageTextureTarget( | 156 context_factory_->GetImageTextureTarget( |
153 static_cast<gfx::BufferFormat>(format), usage); | 157 static_cast<gfx::BufferFormat>(format), usage); |
154 } | 158 } |
155 | 159 |
156 // Note: Only enable image decode tasks if we have more than one worker | 160 // Note: Only enable image decode tasks if we have more than one worker |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 observer_list_, | 491 observer_list_, |
488 OnCompositingLockStateChanged(this)); | 492 OnCompositingLockStateChanged(this)); |
489 } | 493 } |
490 | 494 |
491 void Compositor::CancelCompositorLock() { | 495 void Compositor::CancelCompositorLock() { |
492 if (compositor_lock_) | 496 if (compositor_lock_) |
493 compositor_lock_->CancelLock(); | 497 compositor_lock_->CancelLock(); |
494 } | 498 } |
495 | 499 |
496 } // namespace ui | 500 } // namespace ui |
OLD | NEW |