Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: gpu/ipc/in_process_command_buffer.cc

Issue 2440093003: WIP GPU scheduler + delayed activation / tile draw
Patch Set: SignalSyncToken -> IsFenceSyncReleased Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/in_process_command_buffer.h ('k') | gpu/ipc/service/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 gpu_thread_weak_ptr_, put_offset); 610 gpu_thread_weak_ptr_, put_offset);
611 QueueTask(false, task); 611 QueueTask(false, task);
612 612
613 flushed_fence_sync_release_ = next_fence_sync_release_ - 1; 613 flushed_fence_sync_release_ = next_fence_sync_release_ - 1;
614 } 614 }
615 615
616 void InProcessCommandBuffer::OrderingBarrier(int32_t put_offset) { 616 void InProcessCommandBuffer::OrderingBarrier(int32_t put_offset) {
617 Flush(put_offset); 617 Flush(put_offset);
618 } 618 }
619 619
620 void InProcessCommandBuffer::WaitForTokenInRange(int32_t start, int32_t end) { 620 CommandBuffer::State InProcessCommandBuffer::WaitForTokenInRange(int32_t start,
621 int32_t end) {
621 CheckSequencedThread(); 622 CheckSequencedThread();
622 while (!InRange(start, end, GetLastToken()) && 623 while (!InRange(start, end, GetLastToken()) &&
623 last_state_.error == gpu::error::kNoError) { 624 last_state_.error == gpu::error::kNoError) {
624 flush_event_.Wait(); 625 flush_event_.Wait();
625 } 626 }
627 return last_state_;
626 } 628 }
627 629
628 void InProcessCommandBuffer::WaitForGetOffsetInRange(int32_t start, 630 CommandBuffer::State InProcessCommandBuffer::WaitForGetOffsetInRange(
629 int32_t end) { 631 int32_t start,
632 int32_t end) {
630 CheckSequencedThread(); 633 CheckSequencedThread();
631 634
632 GetStateFast(); 635 GetStateFast();
633 while (!InRange(start, end, last_state_.get_offset) && 636 while (!InRange(start, end, last_state_.get_offset) &&
634 last_state_.error == gpu::error::kNoError) { 637 last_state_.error == gpu::error::kNoError) {
635 flush_event_.Wait(); 638 flush_event_.Wait();
636 GetStateFast(); 639 GetStateFast();
637 } 640 }
641 return last_state_;
638 } 642 }
639 643
640 void InProcessCommandBuffer::SetGetBuffer(int32_t shm_id) { 644 void InProcessCommandBuffer::SetGetBuffer(int32_t shm_id) {
641 CheckSequencedThread(); 645 CheckSequencedThread();
642 if (last_state_.error != gpu::error::kNoError) 646 if (last_state_.error != gpu::error::kNoError)
643 return; 647 return;
644 648
645 base::WaitableEvent completion( 649 base::WaitableEvent completion(
646 base::WaitableEvent::ResetPolicy::MANUAL, 650 base::WaitableEvent::ResetPolicy::MANUAL,
647 base::WaitableEvent::InitialState::NOT_SIGNALED); 651 base::WaitableEvent::InitialState::NOT_SIGNALED);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 } 1027 }
1024 1028
1025 bool InProcessCommandBuffer::IsFenceSyncFlushed(uint64_t release) { 1029 bool InProcessCommandBuffer::IsFenceSyncFlushed(uint64_t release) {
1026 return release <= flushed_fence_sync_release_; 1030 return release <= flushed_fence_sync_release_;
1027 } 1031 }
1028 1032
1029 bool InProcessCommandBuffer::IsFenceSyncFlushReceived(uint64_t release) { 1033 bool InProcessCommandBuffer::IsFenceSyncFlushReceived(uint64_t release) {
1030 return IsFenceSyncFlushed(release); 1034 return IsFenceSyncFlushed(release);
1031 } 1035 }
1032 1036
1037 bool InProcessCommandBuffer::IsFenceSyncReleased(uint64_t release) {
1038 State state = GetStateFast();
1039 return release <= state.release_count;
1040 }
1041
1033 void InProcessCommandBuffer::SignalSyncToken(const SyncToken& sync_token, 1042 void InProcessCommandBuffer::SignalSyncToken(const SyncToken& sync_token,
1034 const base::Closure& callback) { 1043 const base::Closure& callback) {
1035 CheckSequencedThread(); 1044 CheckSequencedThread();
1036 QueueTask( 1045 QueueTask(
1037 true, 1046 true,
1038 base::Bind(&InProcessCommandBuffer::SignalSyncTokenOnGpuThread, 1047 base::Bind(&InProcessCommandBuffer::SignalSyncTokenOnGpuThread,
1039 base::Unretained(this), sync_token, WrapCallback(callback))); 1048 base::Unretained(this), sync_token, WrapCallback(callback)));
1040 } 1049 }
1041 1050
1042 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( 1051 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken(
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 return wrapped_callback; 1182 return wrapped_callback;
1174 } 1183 }
1175 1184
1176 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, 1185 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback,
1177 uint32_t order_number) 1186 uint32_t order_number)
1178 : callback(callback), order_number(order_number) {} 1187 : callback(callback), order_number(order_number) {}
1179 1188
1180 InProcessCommandBuffer::GpuTask::~GpuTask() {} 1189 InProcessCommandBuffer::GpuTask::~GpuTask() {}
1181 1190
1182 } // namespace gpu 1191 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/in_process_command_buffer.h ('k') | gpu/ipc/service/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698