Chromium Code Reviews| 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::GpuMemoryBuffer::Format format = gfx::GpuMemoryBuffer::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::GpuMemoryBuffer::Usage usage = gfx::GpuMemoryBuffer::PERSISTENT_MAP; | 142 gfx::GpuMemoryBuffer::Usage usage = gfx::GpuMemoryBuffer::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; format < gfx::GpuMemoryBuffer::FORMAT_LAST + 1; |
| 154 context_factory_->GetImageTextureTarget(format, usage); | 146 format++) { |
| 147 settings.use_image_texture_targets[format] = | |
|
reveman
2015/07/27 17:07:15
nit: DCHECK_GT(settings.use_image_texture_targets.
| |
| 148 context_factory_->GetImageTextureTarget( | |
| 149 static_cast<gfx::GpuMemoryBuffer::Format>(format), usage); | |
| 150 } | |
| 155 | 151 |
| 156 // Note: gathering of pixel refs is only needed when using multiple | 152 // Note: gathering of pixel refs is only needed when using multiple |
| 157 // raster threads. | 153 // raster threads. |
| 158 settings.gather_pixel_refs = false; | 154 settings.gather_pixel_refs = false; |
| 159 | 155 |
| 160 settings.use_compositor_animation_timelines = | 156 settings.use_compositor_animation_timelines = |
| 161 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); | 157 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); |
| 162 | 158 |
| 163 base::TimeTicks before_create = base::TimeTicks::Now(); | 159 base::TimeTicks before_create = base::TimeTicks::Now(); |
| 164 | 160 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 observer_list_, | 454 observer_list_, |
| 459 OnCompositingLockStateChanged(this)); | 455 OnCompositingLockStateChanged(this)); |
| 460 } | 456 } |
| 461 | 457 |
| 462 void Compositor::CancelCompositorLock() { | 458 void Compositor::CancelCompositorLock() { |
| 463 if (compositor_lock_) | 459 if (compositor_lock_) |
| 464 compositor_lock_->CancelLock(); | 460 compositor_lock_->CancelLock(); |
| 465 } | 461 } |
| 466 | 462 |
| 467 } // namespace ui | 463 } // namespace ui |
| OLD | NEW |