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 "content/common/gpu/gpu_channel.h" | 5 #include "content/common/gpu/gpu_channel.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 // Once we trigger a preemption, the maximum duration that we will wait | 63 // Once we trigger a preemption, the maximum duration that we will wait |
| 64 // before clearing the preemption. | 64 // before clearing the preemption. |
| 65 const int64 kMaxPreemptTimeMs = kVsyncIntervalMs; | 65 const int64 kMaxPreemptTimeMs = kVsyncIntervalMs; |
| 66 | 66 |
| 67 // Stop the preemption once the time for the longest pending IPC drops | 67 // Stop the preemption once the time for the longest pending IPC drops |
| 68 // below this threshold. | 68 // below this threshold. |
| 69 const int64 kStopPreemptThresholdMs = kVsyncIntervalMs; | 69 const int64 kStopPreemptThresholdMs = kVsyncIntervalMs; |
| 70 | 70 |
| 71 const uint32_t kOutOfOrderNumber = static_cast<uint32_t>(-1); | 71 const uint32_t kOutOfOrderNumber = static_cast<uint32_t>(-1); |
| 72 | 72 |
| 73 // Virtualize contexts by defualt on OS X to prevent performance regressions | |
| 74 // when enabling FCM. | |
| 75 // http://crbug.com/180463 | |
| 76 #if defined(OS_MACOSX) | |
| 77 const bool kUseVirtualizedGLContext = true; | |
| 78 #else | |
| 79 const bool kUseVirtualizedGLContext = false; | |
| 80 #endif | |
| 81 | |
| 73 } // anonymous namespace | 82 } // anonymous namespace |
| 74 | 83 |
| 75 struct GpuChannelMessage { | 84 struct GpuChannelMessage { |
| 76 uint32_t order_number; | 85 uint32_t order_number; |
| 77 base::TimeTicks time_received; | 86 base::TimeTicks time_received; |
| 78 IPC::Message message; | 87 IPC::Message message; |
| 79 | 88 |
| 80 // TODO(dyen): Temporary sync point data, remove once new sync point lands. | 89 // TODO(dyen): Temporary sync point data, remove once new sync point lands. |
| 81 bool retire_sync_point; | 90 bool retire_sync_point; |
| 82 uint32 sync_point_number; | 91 uint32 sync_point_number; |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 stream_priority == GpuStreamPriority::REAL_TIME) | 767 stream_priority == GpuStreamPriority::REAL_TIME) |
| 759 return CREATE_COMMAND_BUFFER_FAILED; | 768 return CREATE_COMMAND_BUFFER_FAILED; |
| 760 | 769 |
| 761 auto stream_it = streams_.find(stream_id); | 770 auto stream_it = streams_.find(stream_id); |
| 762 if (stream_it != streams_.end() && | 771 if (stream_it != streams_.end() && |
| 763 stream_priority != GpuStreamPriority::INHERIT && | 772 stream_priority != GpuStreamPriority::INHERIT && |
| 764 stream_priority != stream_it->second.priority()) { | 773 stream_priority != stream_it->second.priority()) { |
| 765 return CREATE_COMMAND_BUFFER_FAILED; | 774 return CREATE_COMMAND_BUFFER_FAILED; |
| 766 } | 775 } |
| 767 | 776 |
| 768 // Virtualize compositor contexts on OS X to prevent performance regressions | |
| 769 // when enabling FCM. | |
| 770 // http://crbug.com/180463 | |
| 771 bool use_virtualized_gl_context = false; | |
| 772 #if defined(OS_MACOSX) | |
| 773 use_virtualized_gl_context = true; | |
| 774 #endif | |
| 775 | |
| 776 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 777 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 777 this, task_runner_.get(), share_group, window, mailbox_manager_.get(), | 778 this, task_runner_.get(), share_group, window, mailbox_manager_.get(), |
| 778 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), | 779 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), |
| 779 gfx::Size(), disallowed_features_, init_params.attribs, | 780 gfx::Size(), disallowed_features_, init_params.attribs, |
| 780 init_params.gpu_preference, use_virtualized_gl_context, stream_id, | 781 init_params.gpu_preference, kUseVirtualizedGLContext, stream_id, route_id, |
| 781 route_id, surface_id, watchdog_, software_, init_params.active_url)); | 782 surface_id, watchdog_, software_, init_params.active_url)); |
| 782 | 783 |
| 783 if (preempted_flag_.get()) | 784 if (preempted_flag_.get()) |
| 784 stub->SetPreemptByFlag(preempted_flag_); | 785 stub->SetPreemptByFlag(preempted_flag_); |
| 785 | 786 |
| 786 if (!router_.AddRoute(route_id, stub.get())) { | 787 if (!router_.AddRoute(route_id, stub.get())) { |
| 787 DLOG(ERROR) << "GpuChannel::CreateViewCommandBuffer(): " | 788 DLOG(ERROR) << "GpuChannel::CreateViewCommandBuffer(): " |
| 788 "failed to add route"; | 789 "failed to add route"; |
| 789 return CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST; | 790 return CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST; |
| 790 } | 791 } |
| 791 | 792 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 stream_priority != GpuStreamPriority::INHERIT && | 1012 stream_priority != GpuStreamPriority::INHERIT && |
| 1012 stream_priority != stream_it->second.priority()) { | 1013 stream_priority != stream_it->second.priority()) { |
| 1013 *succeeded = false; | 1014 *succeeded = false; |
| 1014 return; | 1015 return; |
| 1015 } | 1016 } |
| 1016 | 1017 |
| 1017 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 1018 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 1018 this, task_runner_.get(), share_group, gfx::GLSurfaceHandle(), | 1019 this, task_runner_.get(), share_group, gfx::GLSurfaceHandle(), |
| 1019 mailbox_manager_.get(), subscription_ref_set_.get(), | 1020 mailbox_manager_.get(), subscription_ref_set_.get(), |
| 1020 pending_valuebuffer_state_.get(), size, disallowed_features_, | 1021 pending_valuebuffer_state_.get(), size, disallowed_features_, |
| 1021 init_params.attribs, init_params.gpu_preference, false, | 1022 init_params.attribs, init_params.gpu_preference, kUseVirtualizedGLContext, |
|
reveman
2015/09/18 14:51:35
Not sure exactly why non-virtualized contexts are
ccameron
2015/09/18 20:18:53
When we initially switched to virtualized contexts
| |
| 1022 init_params.stream_id, route_id, 0, watchdog_, software_, | 1023 init_params.stream_id, route_id, 0, watchdog_, software_, |
| 1023 init_params.active_url)); | 1024 init_params.active_url)); |
| 1024 | 1025 |
| 1025 if (preempted_flag_.get()) | 1026 if (preempted_flag_.get()) |
| 1026 stub->SetPreemptByFlag(preempted_flag_); | 1027 stub->SetPreemptByFlag(preempted_flag_); |
| 1027 | 1028 |
| 1028 if (!router_.AddRoute(route_id, stub.get())) { | 1029 if (!router_.AddRoute(route_id, stub.get())) { |
| 1029 DLOG(ERROR) << "GpuChannel::OnCreateOffscreenCommandBuffer(): " | 1030 DLOG(ERROR) << "GpuChannel::OnCreateOffscreenCommandBuffer(): " |
| 1030 "failed to add route"; | 1031 "failed to add route"; |
| 1031 *succeeded = false; | 1032 *succeeded = false; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1157 void GpuChannel::HandleUpdateValueState( | 1158 void GpuChannel::HandleUpdateValueState( |
| 1158 unsigned int target, const gpu::ValueState& state) { | 1159 unsigned int target, const gpu::ValueState& state) { |
| 1159 pending_valuebuffer_state_->UpdateState(target, state); | 1160 pending_valuebuffer_state_->UpdateState(target, state); |
| 1160 } | 1161 } |
| 1161 | 1162 |
| 1162 uint32_t GpuChannel::GetUnprocessedOrderNum() const { | 1163 uint32_t GpuChannel::GetUnprocessedOrderNum() const { |
| 1163 return message_queue_->GetUnprocessedOrderNum(); | 1164 return message_queue_->GetUnprocessedOrderNum(); |
| 1164 } | 1165 } |
| 1165 | 1166 |
| 1166 } // namespace content | 1167 } // namespace content |
| OLD | NEW |