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

Unified Diff: components/mus/gles2/command_buffer_driver.cc

Issue 1460833002: gpu: Implement the new fence syncs in mojo command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years, 1 month 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 | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/gles2/command_buffer_driver.cc
diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc
index 649216a4fb71e8df6e476de135a9516d0c2d13f0..2157ef790e31542e818f117517b0a1b1392b82e2 100644
--- a/components/mus/gles2/command_buffer_driver.cc
+++ b/components/mus/gles2/command_buffer_driver.cc
@@ -4,6 +4,7 @@
#include "components/mus/gles2/command_buffer_driver.h"
+#include "base/atomic_sequence_num.h"
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/shared_memory.h"
@@ -35,10 +36,19 @@
namespace mus {
+namespace {
+
+base::StaticAtomicSequenceNumber g_next_command_buffer_id;
+
+}
+
CommandBufferDriver::Client::~Client() {}
CommandBufferDriver::CommandBufferDriver(scoped_refptr<GpuState> gpu_state)
- : client_(nullptr), gpu_state_(gpu_state), weak_factory_(this) {}
+ : command_buffer_id_(g_next_command_buffer_id.GetNext()),
+ client_(nullptr),
+ gpu_state_(gpu_state),
+ weak_factory_(this) {}
CommandBufferDriver::~CommandBufferDriver() {
DestroyDecoder();
@@ -56,7 +66,10 @@ void CommandBufferDriver::Initialize(
mojom::GpuCapabilitiesPtr capabilities =
success ? mojom::GpuCapabilities::From(decoder_->GetCapabilities())
: nullptr;
- sync_client_->DidInitialize(success, capabilities.Pass());
+ sync_client_->DidInitialize(success,
+ gpu::CommandBufferNamespace::MOJO,
+ command_buffer_id_,
+ capabilities.Pass());
}
bool CommandBufferDriver::MakeCurrent() {
@@ -113,6 +126,10 @@ bool CommandBufferDriver::DoInitialize(
decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get()));
scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(),
decoder_.get()));
+ sync_point_order_data_ = gpu::SyncPointOrderData::Create();
+ sync_point_client_ = gpu_state_->sync_point_manager()->CreateSyncPointClient(
+ sync_point_order_data_, gpu::CommandBufferNamespace::MOJO,
+ command_buffer_id_);
decoder_->set_engine(scheduler_.get());
decoder_->SetWaitSyncPointCallback(base::Bind(
&CommandBufferDriver::OnWaitSyncPoint, base::Unretained(this)));
@@ -299,12 +316,8 @@ bool CommandBufferDriver::OnWaitSyncPoint(uint32_t sync_point) {
}
void CommandBufferDriver::OnFenceSyncRelease(uint64_t release) {
- // TODO(dyen): Implement once CommandBufferID has been figured out and
- // we have a SyncPointClient. It would probably look like what is commented
- // out below:
- // if (!sync_point_client_->client_state()->IsFenceSyncReleased(release))
- // sync_point_client_->ReleaseFenceSync(release);
- NOTIMPLEMENTED();
+ if (!sync_point_client_->client_state()->IsFenceSyncReleased(release))
+ sync_point_client_->ReleaseFenceSync(release);
}
bool CommandBufferDriver::OnWaitFenceSync(
@@ -324,16 +337,13 @@ bool CommandBufferDriver::OnWaitFenceSync(
if (release_state->IsFenceSyncReleased(release))
return true;
- // TODO(dyen): Implement once CommandBufferID has been figured out and
- // we have a SyncPointClient. It would probably look like what is commented
- // out below:
- // scheduler_->SetScheduled(false);
- // sync_point_client_->Wait(
- // release_state.get(),
- // release,
- // base::Bind(&CommandBufferDriver::OnSyncPointRetired,
- // weak_factory_.GetWeakPtr()));
- NOTIMPLEMENTED();
+
+ scheduler_->SetScheduled(false);
+ sync_point_client_->Wait(
+ release_state.get(),
+ release,
+ base::Bind(&CommandBufferDriver::OnSyncPointRetired,
+ weak_factory_.GetWeakPtr()));
return scheduler_->scheduled();
}
« no previous file with comments | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698