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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 130 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); |
131 | 131 |
132 settings.initial_debug_state.SetRecordRenderingStats( | 132 settings.initial_debug_state.SetRecordRenderingStats( |
133 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 133 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
134 | 134 |
135 settings.use_display_lists = true; | 135 settings.use_display_lists = true; |
136 | 136 |
137 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 137 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
138 settings.use_one_copy = IsUIOneCopyEnabled(); | 138 settings.use_one_copy = IsUIOneCopyEnabled(); |
139 | 139 |
140 // TODO(reveman): We currently assume that the compositor will use BGRA_8888 | |
141 // if it's able to, and RGBA_8888 otherwise. Since we don't know what it will | |
142 // use we hardcode BGRA_8888 here for now. We should instead | |
143 // move decisions about GpuMemoryBuffer format to the browser embedder so we | |
144 // know it here, and pass that decision to the compositor for each usage. | |
145 // crbug.com/490362 | |
146 gfx::BufferFormat format = gfx::BufferFormat::BGRA_8888; | |
147 | |
148 // Use PERSISTENT_MAP memory buffers to support partial tile raster for | 140 // Use PERSISTENT_MAP memory buffers to support partial tile raster for |
149 // software raster into GpuMemoryBuffers. | 141 // software raster into GpuMemoryBuffers. |
150 gfx::BufferUsage usage = gfx::BufferUsage::PERSISTENT_MAP; | 142 gfx::BufferUsage usage = gfx::BufferUsage::PERSISTENT_MAP; |
151 settings.use_persistent_map_for_gpu_memory_buffers = true; | 143 settings.use_persistent_map_for_gpu_memory_buffers = true; |
152 | 144 |
153 settings.use_image_texture_target = | 145 for (size_t format = 0; |
154 context_factory_->GetImageTextureTarget(format, usage); | 146 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { |
| 147 DCHECK_GT(settings.use_image_texture_targets.size(), format); |
| 148 settings.use_image_texture_targets[format] = |
| 149 context_factory_->GetImageTextureTarget( |
| 150 static_cast<gfx::BufferFormat>(format), usage); |
| 151 } |
155 | 152 |
156 // Note: gathering of pixel refs is only needed when using multiple | 153 // Note: gathering of pixel refs is only needed when using multiple |
157 // raster threads. | 154 // raster threads. |
158 settings.gather_pixel_refs = false; | 155 settings.gather_pixel_refs = false; |
159 | 156 |
160 settings.use_compositor_animation_timelines = | 157 settings.use_compositor_animation_timelines = |
161 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); | 158 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); |
162 | 159 |
163 base::TimeTicks before_create = base::TimeTicks::Now(); | 160 base::TimeTicks before_create = base::TimeTicks::Now(); |
164 | 161 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 observer_list_, | 455 observer_list_, |
459 OnCompositingLockStateChanged(this)); | 456 OnCompositingLockStateChanged(this)); |
460 } | 457 } |
461 | 458 |
462 void Compositor::CancelCompositorLock() { | 459 void Compositor::CancelCompositorLock() { |
463 if (compositor_lock_) | 460 if (compositor_lock_) |
464 compositor_lock_->CancelLock(); | 461 compositor_lock_->CancelLock(); |
465 } | 462 } |
466 | 463 |
467 } // namespace ui | 464 } // namespace ui |
OLD | NEW |