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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); | 122 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); |
123 settings.initial_debug_state.show_replica_screen_space_rects = | 123 settings.initial_debug_state.show_replica_screen_space_rects = |
124 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 124 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); |
125 | 125 |
126 settings.initial_debug_state.SetRecordRenderingStats( | 126 settings.initial_debug_state.SetRecordRenderingStats( |
127 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 127 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
128 | 128 |
129 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); | 129 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); |
130 settings.use_display_lists = IsUISlimmingPaintEnabled(); | 130 settings.use_display_lists = IsUISlimmingPaintEnabled(); |
131 settings.use_cached_picture_in_display_list = false; | 131 settings.use_cached_picture_in_display_list = false; |
132 | |
132 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 133 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
133 settings.use_one_copy = IsUIOneCopyEnabled(); | 134 settings.use_one_copy = IsUIOneCopyEnabled(); |
134 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); | 135 |
136 // TODO(reveman): We currently assume that the compositor will use BGRA_8888 | |
137 // if it's able to, and RGBA_8888 otherwise. Since we don't know what it will | |
138 // use we hardcode BGRA_8888 here for now. We should instead | |
139 // move decisions about GpuMemoryBuffer format to the browser embedder so we | |
140 // know it here, and pass that decision to the compositor for each usage. | |
141 // crbug.com/490362 | |
142 gfx::GpuMemoryBuffer::Format format = gfx::GpuMemoryBuffer::BGRA_8888; | |
143 gfx::GpuMemoryBuffer::Usage usage = gfx::GpuMemoryBuffer::MAP; | |
144 | |
145 // Use PERSISTENT_MAP memory buffers to support partial tile updates in the | |
146 // one-copy implementation. | |
147 if (IsUIOneCopyEnabled()) { | |
reveman
2015/05/22 17:15:13
What if IsUIZeroCopyEnabled() is also enabled? Wit
danakj
2015/05/26 19:02:52
If zero copy is enabled, then one copy is disabled
reveman
2015/05/26 20:12:37
Ah, didn't realize that we have checks inside thes
danakj
2015/05/26 20:17:37
But there's no point turning it on for zero copy i
danakj
2015/05/26 23:37:34
Done.
| |
148 usage = gfx::GpuMemoryBuffer::PERSISTENT_MAP; | |
149 settings.have_persistent_gpu_memory_buffers = true; | |
150 } | |
151 settings.use_image_texture_target = | |
152 context_factory_->GetImageTextureTarget(format, usage); | |
153 | |
135 // Note: gathering of pixel refs is only needed when using multiple | 154 // Note: gathering of pixel refs is only needed when using multiple |
136 // raster threads. | 155 // raster threads. |
137 settings.gather_pixel_refs = false; | 156 settings.gather_pixel_refs = false; |
138 | 157 |
139 settings.use_compositor_animation_timelines = | 158 settings.use_compositor_animation_timelines = |
140 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); | 159 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); |
141 | 160 |
142 base::TimeTicks before_create = base::TimeTicks::Now(); | 161 base::TimeTicks before_create = base::TimeTicks::Now(); |
143 | 162 |
144 cc::LayerTreeHost::InitParams params; | 163 cc::LayerTreeHost::InitParams params; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 observer_list_, | 450 observer_list_, |
432 OnCompositingLockStateChanged(this)); | 451 OnCompositingLockStateChanged(this)); |
433 } | 452 } |
434 | 453 |
435 void Compositor::CancelCompositorLock() { | 454 void Compositor::CancelCompositorLock() { |
436 if (compositor_lock_) | 455 if (compositor_lock_) |
437 compositor_lock_->CancelLock(); | 456 compositor_lock_->CancelLock(); |
438 } | 457 } |
439 | 458 |
440 } // namespace ui | 459 } // namespace ui |
OLD | NEW |