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 | |
|
ccameron
2015/09/18 20:18:53
s/defualt/default
| |
| 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 scoped_refptr<GpuChannelMessageQueue> GpuChannelMessageQueue::Create( | 84 scoped_refptr<GpuChannelMessageQueue> GpuChannelMessageQueue::Create( |
| 76 const base::WeakPtr<GpuChannel>& gpu_channel, | 85 const base::WeakPtr<GpuChannel>& gpu_channel, |
| 77 base::SingleThreadTaskRunner* task_runner) { | 86 base::SingleThreadTaskRunner* task_runner) { |
| 78 return new GpuChannelMessageQueue(gpu_channel, task_runner); | 87 return new GpuChannelMessageQueue(gpu_channel, task_runner); |
| 79 } | 88 } |
| 80 | 89 |
| 81 GpuChannelMessageQueue::GpuChannelMessageQueue( | 90 GpuChannelMessageQueue::GpuChannelMessageQueue( |
| 82 const base::WeakPtr<GpuChannel>& gpu_channel, | 91 const base::WeakPtr<GpuChannel>& gpu_channel, |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 stream_priority == GpuStreamPriority::REAL_TIME) | 739 stream_priority == GpuStreamPriority::REAL_TIME) |
| 731 return CREATE_COMMAND_BUFFER_FAILED; | 740 return CREATE_COMMAND_BUFFER_FAILED; |
| 732 | 741 |
| 733 auto stream_it = streams_.find(stream_id); | 742 auto stream_it = streams_.find(stream_id); |
| 734 if (stream_it != streams_.end() && | 743 if (stream_it != streams_.end() && |
| 735 stream_priority != GpuStreamPriority::INHERIT && | 744 stream_priority != GpuStreamPriority::INHERIT && |
| 736 stream_priority != stream_it->second.priority()) { | 745 stream_priority != stream_it->second.priority()) { |
| 737 return CREATE_COMMAND_BUFFER_FAILED; | 746 return CREATE_COMMAND_BUFFER_FAILED; |
| 738 } | 747 } |
| 739 | 748 |
| 740 // Virtualize compositor contexts on OS X to prevent performance regressions | |
| 741 // when enabling FCM. | |
| 742 // http://crbug.com/180463 | |
| 743 bool use_virtualized_gl_context = false; | |
| 744 #if defined(OS_MACOSX) | |
| 745 use_virtualized_gl_context = true; | |
| 746 #endif | |
| 747 | |
| 748 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 749 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 749 this, task_runner_.get(), share_group, window, mailbox_manager_.get(), | 750 this, task_runner_.get(), share_group, window, mailbox_manager_.get(), |
| 750 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), | 751 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), |
| 751 gfx::Size(), disallowed_features_, init_params.attribs, | 752 gfx::Size(), disallowed_features_, init_params.attribs, |
| 752 init_params.gpu_preference, use_virtualized_gl_context, stream_id, | 753 init_params.gpu_preference, kUseVirtualizedGLContext, stream_id, route_id, |
| 753 route_id, surface_id, watchdog_, software_, init_params.active_url)); | 754 surface_id, watchdog_, software_, init_params.active_url)); |
| 754 | 755 |
| 755 if (preempted_flag_.get()) | 756 if (preempted_flag_.get()) |
| 756 stub->SetPreemptByFlag(preempted_flag_); | 757 stub->SetPreemptByFlag(preempted_flag_); |
| 757 | 758 |
| 758 if (!router_.AddRoute(route_id, stub.get())) { | 759 if (!router_.AddRoute(route_id, stub.get())) { |
| 759 DLOG(ERROR) << "GpuChannel::CreateViewCommandBuffer(): " | 760 DLOG(ERROR) << "GpuChannel::CreateViewCommandBuffer(): " |
| 760 "failed to add route"; | 761 "failed to add route"; |
| 761 return CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST; | 762 return CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST; |
| 762 } | 763 } |
| 763 | 764 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 954 stream_priority != GpuStreamPriority::INHERIT && | 955 stream_priority != GpuStreamPriority::INHERIT && |
| 955 stream_priority != stream_it->second.priority()) { | 956 stream_priority != stream_it->second.priority()) { |
| 956 *succeeded = false; | 957 *succeeded = false; |
| 957 return; | 958 return; |
| 958 } | 959 } |
| 959 | 960 |
| 960 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 961 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 961 this, task_runner_.get(), share_group, gfx::GLSurfaceHandle(), | 962 this, task_runner_.get(), share_group, gfx::GLSurfaceHandle(), |
| 962 mailbox_manager_.get(), subscription_ref_set_.get(), | 963 mailbox_manager_.get(), subscription_ref_set_.get(), |
| 963 pending_valuebuffer_state_.get(), size, disallowed_features_, | 964 pending_valuebuffer_state_.get(), size, disallowed_features_, |
| 964 init_params.attribs, init_params.gpu_preference, false, | 965 init_params.attribs, init_params.gpu_preference, kUseVirtualizedGLContext, |
| 965 init_params.stream_id, route_id, 0, watchdog_, software_, | 966 init_params.stream_id, route_id, 0, watchdog_, software_, |
| 966 init_params.active_url)); | 967 init_params.active_url)); |
| 967 | 968 |
| 968 if (preempted_flag_.get()) | 969 if (preempted_flag_.get()) |
| 969 stub->SetPreemptByFlag(preempted_flag_); | 970 stub->SetPreemptByFlag(preempted_flag_); |
| 970 | 971 |
| 971 if (!router_.AddRoute(route_id, stub.get())) { | 972 if (!router_.AddRoute(route_id, stub.get())) { |
| 972 DLOG(ERROR) << "GpuChannel::OnCreateOffscreenCommandBuffer(): " | 973 DLOG(ERROR) << "GpuChannel::OnCreateOffscreenCommandBuffer(): " |
| 973 "failed to add route"; | 974 "failed to add route"; |
| 974 *succeeded = false; | 975 *succeeded = false; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 } | 1084 } |
| 1084 } | 1085 } |
| 1085 } | 1086 } |
| 1086 | 1087 |
| 1087 void GpuChannel::HandleUpdateValueState( | 1088 void GpuChannel::HandleUpdateValueState( |
| 1088 unsigned int target, const gpu::ValueState& state) { | 1089 unsigned int target, const gpu::ValueState& state) { |
| 1089 pending_valuebuffer_state_->UpdateState(target, state); | 1090 pending_valuebuffer_state_->UpdateState(target, state); |
| 1090 } | 1091 } |
| 1091 | 1092 |
| 1092 } // namespace content | 1093 } // namespace content |
| OLD | NEW |