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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 10510013: GPU: Adding sync points for cross-channel synchronization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 6 months 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
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index f19ab61446661b70190cb9085ded4829083888a2..35f9a58ce5b10aab5f1053f70a692babf9f863ea 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -18,6 +18,7 @@
#include "content/common/gpu/gpu_messages.h"
#include "content/common/gpu/gpu_watchdog.h"
#include "content/common/gpu/image_transport_surface.h"
+#include "content/common/gpu/sync_point_manager.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "ui/gl/gl_bindings.h"
@@ -131,6 +132,10 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
OnDiscardBackbuffer)
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer,
OnEnsureBackbuffer)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint,
+ OnRetireSyncPoint)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_WaitSyncPoint,
+ OnWaitSyncPoint)
IPC_MESSAGE_HANDLER(
GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
OnSetClientHasMemoryAllocationChangedCallback)
@@ -200,6 +205,9 @@ void GpuCommandBufferStub::OnReschedule() {
}
void GpuCommandBufferStub::Destroy() {
+ while (!sync_points_.empty())
+ OnRetireSyncPoint(sync_points_.front());
+
// The scheduler has raw references to the decoder and the command buffer so
// destroy it before those.
scheduler_.reset();
@@ -608,6 +616,34 @@ void GpuCommandBufferStub::OnEnsureBackbuffer() {
surface_->SetBackbufferAllocation(true);
}
+void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) {
+ sync_points_.push_back(sync_point);
+}
+
+void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {
+ DCHECK(!sync_points_.empty() && sync_points_.front() == sync_point);
+ sync_points_.pop_front();
+ GpuChannelManager* manager = channel_->gpu_channel_manager();
+ manager->sync_point_manager()->RetireSyncPoint(sync_point);
+}
+
+void GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
+ if (!scheduler_.get())
+ return;
+ scheduler_->SetScheduled(false);
+ GpuChannelManager* manager = channel_->gpu_channel_manager();
+ manager->sync_point_manager()->AddSyncPointCallback(
+ sync_point,
+ base::Bind(&GpuCommandBufferStub::OnSyncPointRetired,
+ this->AsWeakPtr()));
+}
+
+void GpuCommandBufferStub::OnSyncPointRetired() {
+ if (!scheduler_.get())
+ return;
+ scheduler_->SetScheduled(true);
+}
+
void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback(
bool has_callback) {
TRACE_EVENT0(
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698