OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/ipc/in_process_command_buffer.h" | 5 #include "gpu/ipc/in_process_command_buffer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 State state = command_buffer_->GetLastState(); | 551 State state = command_buffer_->GetLastState(); |
552 if (state.generation - last_state_.generation < 0x80000000U) | 552 if (state.generation - last_state_.generation < 0x80000000U) |
553 last_state_ = state; | 553 last_state_ = state; |
554 } | 554 } |
555 | 555 |
556 void InProcessCommandBuffer::FlushOnGpuThread(int32_t put_offset) { | 556 void InProcessCommandBuffer::FlushOnGpuThread(int32_t put_offset) { |
557 CheckSequencedThread(); | 557 CheckSequencedThread(); |
558 ScopedEvent handle_flush(&flush_event_); | 558 ScopedEvent handle_flush(&flush_event_); |
559 base::AutoLock lock(command_buffer_lock_); | 559 base::AutoLock lock(command_buffer_lock_); |
560 | 560 |
561 if (ui::LatencyInfo::Verify(latency_info_, | |
piman
2017/04/10 23:50:34
latency_info_ is written on another thread (withou
mfomitchev
2017/04/13 03:00:00
Done.
| |
562 "InProcessCommandBuffer::FlushOnGpuThread") && | |
563 !latency_info_callback_.is_null()) { | |
564 latency_info_callback_.Run(latency_info_); | |
565 } | |
566 latency_info_.clear(); | |
567 | |
561 command_buffer_->Flush(put_offset); | 568 command_buffer_->Flush(put_offset); |
562 // Update state before signaling the flush event. | 569 // Update state before signaling the flush event. |
563 UpdateLastStateOnGpuThread(); | 570 UpdateLastStateOnGpuThread(); |
564 | 571 |
565 // If we've processed all pending commands but still have pending queries, | 572 // If we've processed all pending commands but still have pending queries, |
566 // pump idle work until the query is passed. | 573 // pump idle work until the query is passed. |
567 if (put_offset == command_buffer_->GetLastState().get_offset && | 574 if (put_offset == command_buffer_->GetLastState().get_offset && |
568 (executor_->HasMoreIdleWork() || executor_->HasPendingQueries())) { | 575 (executor_->HasMoreIdleWork() || executor_->HasPendingQueries())) { |
569 ScheduleDelayedWorkOnGpuThread(); | 576 ScheduleDelayedWorkOnGpuThread(); |
570 } | 577 } |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
984 base::Unretained(this), sync_token, WrapCallback(callback))); | 991 base::Unretained(this), sync_token, WrapCallback(callback))); |
985 } | 992 } |
986 | 993 |
987 void InProcessCommandBuffer::WaitSyncTokenHint(const SyncToken& sync_token) {} | 994 void InProcessCommandBuffer::WaitSyncTokenHint(const SyncToken& sync_token) {} |
988 | 995 |
989 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( | 996 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( |
990 const SyncToken& sync_token) { | 997 const SyncToken& sync_token) { |
991 return sync_token.namespace_id() == GetNamespaceID(); | 998 return sync_token.namespace_id() == GetNamespaceID(); |
992 } | 999 } |
993 | 1000 |
1001 void InProcessCommandBuffer::AddLatencyInfo( | |
1002 const std::vector<ui::LatencyInfo>& latency_info) { | |
1003 latency_info_.insert(latency_info_.end(), latency_info.begin(), | |
1004 latency_info.end()); | |
1005 } | |
1006 | |
994 #if defined(OS_WIN) | 1007 #if defined(OS_WIN) |
995 void InProcessCommandBuffer::DidCreateAcceleratedSurfaceChildWindow( | 1008 void InProcessCommandBuffer::DidCreateAcceleratedSurfaceChildWindow( |
996 SurfaceHandle parent_window, | 1009 SurfaceHandle parent_window, |
997 SurfaceHandle child_window) { | 1010 SurfaceHandle child_window) { |
998 ::SetParent(child_window, parent_window); | 1011 ::SetParent(child_window, parent_window); |
999 } | 1012 } |
1000 #endif | 1013 #endif |
1001 | 1014 |
1002 void InProcessCommandBuffer::DidSwapBuffersComplete( | 1015 void InProcessCommandBuffer::DidSwapBuffersComplete( |
1003 SwapBuffersCompleteParams params) { | 1016 SwapBuffersCompleteParams params) { |
1004 if (!origin_task_runner_) { | 1017 if (!origin_task_runner_) { |
1005 DidSwapBuffersCompleteOnOriginThread(std::move(params)); | 1018 DidSwapBuffersCompleteOnOriginThread(std::move(params)); |
1006 return; | 1019 return; |
1007 } | 1020 } |
1008 origin_task_runner_->PostTask( | 1021 origin_task_runner_->PostTask( |
1009 FROM_HERE, | 1022 FROM_HERE, |
1010 base::Bind(&InProcessCommandBuffer::DidSwapBuffersCompleteOnOriginThread, | 1023 base::Bind(&InProcessCommandBuffer::DidSwapBuffersCompleteOnOriginThread, |
1011 client_thread_weak_ptr_, base::Passed(¶ms))); | 1024 client_thread_weak_ptr_, base::Passed(¶ms))); |
1012 } | 1025 } |
1013 | 1026 |
1014 const gles2::FeatureInfo* InProcessCommandBuffer::GetFeatureInfo() const { | 1027 const gles2::FeatureInfo* InProcessCommandBuffer::GetFeatureInfo() const { |
1015 return context_group_->feature_info(); | 1028 return context_group_->feature_info(); |
1016 } | 1029 } |
1017 | 1030 |
1018 void InProcessCommandBuffer::SetLatencyInfoCallback( | 1031 void InProcessCommandBuffer::SetLatencyInfoCallback( |
1019 const LatencyInfoCallback& callback) { | 1032 const LatencyInfoCallback& callback) { |
1020 // TODO(fsamuel): Implement this. | 1033 latency_info_callback_ = callback; |
1021 } | 1034 } |
1022 | 1035 |
1023 void InProcessCommandBuffer::UpdateVSyncParameters(base::TimeTicks timebase, | 1036 void InProcessCommandBuffer::UpdateVSyncParameters(base::TimeTicks timebase, |
1024 base::TimeDelta interval) { | 1037 base::TimeDelta interval) { |
1025 if (!origin_task_runner_) { | 1038 if (!origin_task_runner_) { |
1026 UpdateVSyncParametersOnOriginThread(timebase, interval); | 1039 UpdateVSyncParametersOnOriginThread(timebase, interval); |
1027 return; | 1040 return; |
1028 } | 1041 } |
1029 origin_task_runner_->PostTask( | 1042 origin_task_runner_->PostTask( |
1030 FROM_HERE, | 1043 FROM_HERE, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1124 return wrapped_callback; | 1137 return wrapped_callback; |
1125 } | 1138 } |
1126 | 1139 |
1127 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, | 1140 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, |
1128 uint32_t order_number) | 1141 uint32_t order_number) |
1129 : callback(callback), order_number(order_number) {} | 1142 : callback(callback), order_number(order_number) {} |
1130 | 1143 |
1131 InProcessCommandBuffer::GpuTask::~GpuTask() {} | 1144 InProcessCommandBuffer::GpuTask::~GpuTask() {} |
1132 | 1145 |
1133 } // namespace gpu | 1146 } // namespace gpu |
OLD | NEW |