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

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 782583003: List sync points to wait on in AsyncFlush message Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/in_process_command_buffer.cc
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 8836904ce9d6360344238f72a63b8d3cd23b5a4a..c6e54a5e66f70af96bfd8cf7662cb253b9d84665 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -133,6 +133,7 @@ class SyncPointManager {
bool IsSyncPointPassed(uint32 sync_point);
void WaitSyncPoint(uint32 sync_point);
+ bool WasSyncPointGenerated(uint32 sync_point);
private:
// This lock protects access to pending_sync_points_ and next_sync_point_ and
@@ -176,6 +177,11 @@ void SyncPointManager::WaitSyncPoint(uint32 sync_point) {
}
}
+bool SyncPointManager::WasSyncPointGenerated(uint32 sync_point) {
+ base::AutoLock lock(lock_);
+ return next_sync_point_ - 1 - sync_point < 0x80000000;
+}
+
base::LazyInstance<SyncPointManager> g_sync_point_manager =
LAZY_INSTANCE_INITIALIZER;
@@ -425,9 +431,6 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
decoder_->SetResizeCallback(base::Bind(
&InProcessCommandBuffer::OnResizeView, gpu_thread_weak_ptr_));
}
- decoder_->SetWaitSyncPointCallback(
- base::Bind(&InProcessCommandBuffer::WaitSyncPointOnGpuThread,
- base::Unretained(this)));
image_factory_ = params.image_factory;
params.capabilities->image = params.capabilities->image && image_factory_;
@@ -501,11 +504,16 @@ int32 InProcessCommandBuffer::GetLastToken() {
return last_state_.token;
}
-void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset) {
+void InProcessCommandBuffer::FlushOnGpuThread(
+ int32 put_offset,
+ const std::vector<uint32>& sync_points) {
CheckSequencedThread();
+ for (uint32 sync_point : sync_points) {
+ WaitSyncPointOnGpuThread(sync_point);
+ }
ScopedEvent handle_flush(&flush_event_);
base::AutoLock lock(command_buffer_lock_);
- command_buffer_->Flush(put_offset);
+ command_buffer_->Flush(put_offset, sync_points);
{
// Update state before signaling the flush event.
base::AutoLock lock(state_after_last_flush_lock_);
@@ -542,7 +550,8 @@ void InProcessCommandBuffer::ScheduleIdleWorkOnGpuThread() {
gpu_thread_weak_ptr_));
}
-void InProcessCommandBuffer::Flush(int32 put_offset) {
+void InProcessCommandBuffer::Flush(int32 put_offset,
+ const std::vector<uint32>& sync_points) {
CheckSequencedThread();
if (last_state_.error != gpu::error::kNoError)
return;
@@ -551,9 +560,15 @@ void InProcessCommandBuffer::Flush(int32 put_offset) {
return;
last_put_offset_ = put_offset;
- base::Closure task = base::Bind(&InProcessCommandBuffer::FlushOnGpuThread,
- gpu_thread_weak_ptr_,
- put_offset);
+ std::vector<uint32> sanitized_sync_points;
+ for (const int& sync_point : sync_points) {
+ if (g_sync_point_manager.Get().WasSyncPointGenerated(sync_point))
+ sanitized_sync_points.push_back(sync_point);
+ }
+
+ base::Closure task =
+ base::Bind(&InProcessCommandBuffer::FlushOnGpuThread,
+ gpu_thread_weak_ptr_, put_offset, sanitized_sync_points);
QueueTask(task);
}
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/service/sync_point_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698