diff options
28 files changed, 124 insertions, 24 deletions
diff --git a/components/mus/gles2/command_buffer_local.cc b/components/mus/gles2/command_buffer_local.cc index 178de61..99b8018 100644 --- a/components/mus/gles2/command_buffer_local.cc +++ b/components/mus/gles2/command_buffer_local.cc @@ -228,6 +228,10 @@ uint64_t CommandBufferLocal::GetCommandBufferID() const { return command_buffer_id_; } +int32_t CommandBufferLocal::GetExtraCommandBufferData() const { + return 0; +} + uint64_t CommandBufferLocal::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } diff --git a/components/mus/gles2/command_buffer_local.h b/components/mus/gles2/command_buffer_local.h index 077cf06..7081109 100644 --- a/components/mus/gles2/command_buffer_local.h +++ b/components/mus/gles2/command_buffer_local.h @@ -73,6 +73,7 @@ class CommandBufferLocal : public gpu::GpuControl { bool IsGpuChannelLost() override; gpu::CommandBufferNamespace GetNamespaceID() const override; uint64_t GetCommandBufferID() const override; + int32_t GetExtraCommandBufferData() const override; uint64_t GenerateFenceSyncRelease() override; bool IsFenceSyncRelease(uint64_t release) override; bool IsFenceSyncFlushed(uint64_t release) override; diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index 47e20d1..22afb00 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc @@ -52,6 +52,7 @@ CommandBufferProxyImpl::CommandBufferProxyImpl(GpuChannelHost* channel, verified_fence_sync_release_(0), next_signal_id_(0) { DCHECK(channel); + DCHECK(stream_id); } CommandBufferProxyImpl::~CommandBufferProxyImpl() { @@ -449,7 +450,7 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer, if (image_fence_sync) { gpu::SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), - image_fence_sync); + GetExtraCommandBufferData(), image_fence_sync); // Force a synchronous IPC to validate sync token. channel_->ValidateFlushIDReachedServer(stream_id_, true); @@ -519,6 +520,10 @@ uint64_t CommandBufferProxyImpl::GetCommandBufferID() const { return command_buffer_id_; } +int32_t CommandBufferProxyImpl::GetExtraCommandBufferData() const { + return stream_id_; +} + uint64_t CommandBufferProxyImpl::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } @@ -577,8 +582,20 @@ bool CommandBufferProxyImpl::CanWaitUnverifiedSyncToken( // Can only wait on an unverified sync token if it is from the same channel. const uint64_t token_channel = sync_token->command_buffer_id() >> 32; const uint64_t channel = command_buffer_id_ >> 32; - return (sync_token->namespace_id() == gpu::CommandBufferNamespace::GPU_IO && - token_channel == channel); + if (sync_token->namespace_id() != gpu::CommandBufferNamespace::GPU_IO || + token_channel != channel) { + return false; + } + + // If waiting on a different stream, flush pending commands on that stream. + const int32_t release_stream_id = sync_token->extra_data_field(); + if (release_stream_id == 0) + return false; + + if (release_stream_id != stream_id_) + channel_->FlushPendingStream(release_stream_id); + + return true; } uint32 CommandBufferProxyImpl::InsertSyncPoint() { diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h index 047544a..b5468a7f 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.h +++ b/content/common/gpu/client/command_buffer_proxy_impl.h @@ -122,6 +122,7 @@ class CommandBufferProxyImpl bool IsGpuChannelLost() override; gpu::CommandBufferNamespace GetNamespaceID() const override; uint64_t GetCommandBufferID() const override; + int32_t GetExtraCommandBufferData() const override; uint64_t GenerateFenceSyncRelease() override; bool IsFenceSyncRelease(uint64_t release) override; bool IsFenceSyncFlushed(uint64_t release) override; diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc index 80dfe0a..652f93a 100644 --- a/content/common/gpu/client/gpu_channel_host.cc +++ b/content/common/gpu/client/gpu_channel_host.cc @@ -162,6 +162,17 @@ uint32_t GpuChannelHost::OrderingBarrier( return 0; } +void GpuChannelHost::FlushPendingStream(int32 stream_id) { + AutoLock lock(context_lock_); + auto flush_info_iter = stream_flush_info_.find(stream_id); + if (flush_info_iter == stream_flush_info_.end()) + return; + + StreamFlushInfo& flush_info = flush_info_iter->second; + if (flush_info.flush_pending) + InternalFlush(&flush_info); +} + void GpuChannelHost::InternalFlush(StreamFlushInfo* flush_info) { context_lock_.AssertAcquired(); DCHECK(flush_info); @@ -396,7 +407,10 @@ int32 GpuChannelHost::GenerateRouteID() { } int32 GpuChannelHost::GenerateStreamID() { - return next_stream_id_.GetNext(); + const int32 stream_id = next_stream_id_.GetNext(); + DCHECK_NE(0, stream_id); + DCHECK_NE(kDefaultStreamId, stream_id); + return stream_id; } uint32_t GpuChannelHost::ValidateFlushIDReachedServer(int32 stream_id, diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h index b5488ed9..d33c7c7 100644 --- a/content/common/gpu/client/gpu_channel_host.h +++ b/content/common/gpu/client/gpu_channel_host.h @@ -88,7 +88,7 @@ class GpuChannelHost : public IPC::Sender, base::WaitableEvent* shutdown_event, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); - static const int32 kDefaultStreamId = 0; + static const int32 kDefaultStreamId = -1; static const GpuStreamPriority kDefaultStreamPriority = GpuStreamPriority::NORMAL; @@ -116,6 +116,8 @@ class GpuChannelHost : public IPC::Sender, bool put_offset_changed, bool do_flush); + void FlushPendingStream(int32 stream_id); + // Create and connect to a command buffer in the GPU process. scoped_ptr<CommandBufferProxyImpl> CreateViewCommandBuffer( int32 surface_id, diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 86a3711..9dbe6b3 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -930,7 +930,7 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) { // We can simply use the global sync point number as the release count with // 0 for the command buffer ID (under normal circumstances 0 is invalid so // will not be used) until the old sync points are replaced. - gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, + gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 0, sync_point); mailbox_manager->PushTextureUpdates(sync_token); } @@ -986,7 +986,7 @@ void GpuCommandBufferStub::PullTextureUpdates( gpu::gles2::MailboxManager* mailbox_manager = context_group_->mailbox_manager(); if (mailbox_manager->UsesSync() && MakeCurrent()) { - gpu::SyncToken sync_token(namespace_id, command_buffer_id, release); + gpu::SyncToken sync_token(namespace_id, 0, command_buffer_id, release); mailbox_manager->PullTextureUpdates(sync_token); } } @@ -1044,7 +1044,7 @@ void GpuCommandBufferStub::OnFenceSyncRelease(uint64_t release) { gpu::gles2::MailboxManager* mailbox_manager = context_group_->mailbox_manager(); if (mailbox_manager->UsesSync() && MakeCurrent()) { - gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, + gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, command_buffer_id_, release); mailbox_manager->PushTextureUpdates(sync_token); } diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h index d682346..91ad50a 100644 --- a/gpu/command_buffer/client/client_test_helper.h +++ b/gpu/command_buffer/client/client_test_helper.h @@ -114,6 +114,7 @@ class MockClientGpuControl : public GpuControl { MOCK_METHOD0(IsGpuChannelLost, bool()); MOCK_CONST_METHOD0(GetNamespaceID, CommandBufferNamespace()); MOCK_CONST_METHOD0(GetCommandBufferID, uint64_t()); + MOCK_CONST_METHOD0(GetExtraCommandBufferData, int32_t()); MOCK_METHOD0(GenerateFenceSyncRelease, uint64_t()); MOCK_METHOD1(IsFenceSyncRelease, bool(uint64_t release)); MOCK_METHOD1(IsFenceSyncFlushed, bool(uint64_t release)); diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 7c7f99d..d77fa2c 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -5552,6 +5552,7 @@ void GLES2Implementation::GenSyncTokenCHROMIUM(GLuint64 fence_sync, // Copy the data over after setting the data to ensure alignment. SyncToken sync_token_data(gpu_control_->GetNamespaceID(), + gpu_control_->GetExtraCommandBufferData(), gpu_control_->GetCommandBufferID(), fence_sync); sync_token_data.SetVerifyFlush(); memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); @@ -5575,6 +5576,7 @@ void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, // Copy the data over after setting the data to ensure alignment. SyncToken sync_token_data(gpu_control_->GetNamespaceID(), + gpu_control_->GetExtraCommandBufferData(), gpu_control_->GetCommandBufferID(), fence_sync); memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); } diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc index ef2efeb..c59db58 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest.cc +++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc @@ -3782,6 +3782,8 @@ TEST_F(GLES2ImplementationTest, GenSyncTokenCHROMIUM) { .WillRepeatedly(testing::Return(kNamespaceId)); EXPECT_CALL(*gpu_control_, GetCommandBufferID()) .WillRepeatedly(testing::Return(kCommandBufferId)); + EXPECT_CALL(*gpu_control_, GetExtraCommandBufferData()) + .WillRepeatedly(testing::Return(0)); gl_->GenSyncTokenCHROMIUM(kFenceSync, nullptr); EXPECT_EQ(GL_INVALID_VALUE, CheckError()); @@ -3825,6 +3827,8 @@ TEST_F(GLES2ImplementationTest, GenUnverifiedSyncTokenCHROMIUM) { .WillRepeatedly(testing::Return(kNamespaceId)); EXPECT_CALL(*gpu_control_, GetCommandBufferID()) .WillRepeatedly(testing::Return(kCommandBufferId)); + EXPECT_CALL(*gpu_control_, GetExtraCommandBufferData()) + .WillRepeatedly(testing::Return(0)); gl_->GenUnverifiedSyncTokenCHROMIUM(kFenceSync, nullptr); EXPECT_EQ(GL_INVALID_VALUE, CheckError()); @@ -3872,6 +3876,8 @@ TEST_F(GLES2ImplementationTest, WaitSyncTokenCHROMIUM) { .WillOnce(testing::Return(kNamespaceId)); EXPECT_CALL(*gpu_control_, GetCommandBufferID()) .WillOnce(testing::Return(kCommandBufferId)); + EXPECT_CALL(*gpu_control_, GetExtraCommandBufferData()) + .WillOnce(testing::Return(0)); gl_->GenSyncTokenCHROMIUM(kFenceSync, sync_token); struct Cmds { @@ -3899,14 +3905,14 @@ TEST_F(GLES2ImplementationTest, WaitSyncTokenCHROMIUMErrors) { // Invalid sync tokens should produce no error and be a nop. ClearCommands(); - gpu::SyncToken invalid_sync_token(CommandBufferNamespace::INVALID, 0, 0); + gpu::SyncToken invalid_sync_token; gl_->WaitSyncTokenCHROMIUM(invalid_sync_token.GetConstData()); EXPECT_TRUE(NoCommandsWritten()); EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); // Unverified sync token should produce INVALID_OPERATION. ClearCommands(); - gpu::SyncToken unverified_sync_token(CommandBufferNamespace::GPU_IO, 0, 0); + gpu::SyncToken unverified_sync_token(CommandBufferNamespace::GPU_IO, 0, 0, 0); EXPECT_CALL(*gpu_control_, CanWaitUnverifiedSyncToken(_)) .WillOnce(testing::Return(false)); gl_->WaitSyncTokenCHROMIUM(unverified_sync_token.GetConstData()); diff --git a/gpu/command_buffer/client/gpu_control.h b/gpu/command_buffer/client/gpu_control.h index 9ce2db7..9e04d29 100644 --- a/gpu/command_buffer/client/gpu_control.h +++ b/gpu/command_buffer/client/gpu_control.h @@ -87,9 +87,13 @@ class GPU_EXPORT GpuControl { // The namespace and command buffer ID forms a unique pair for all existing // GpuControl (on client) and matches for the corresponding command buffer - // (on server) in a single server process. + // (on server) in a single server process. The extra command buffer data can + // be used for extra identification purposes. One usage is to store some + // extra field to identify unverified sync tokens for the implementation of + // the CanWaitUnverifiedSyncToken() function. virtual CommandBufferNamespace GetNamespaceID() const = 0; virtual uint64_t GetCommandBufferID() const = 0; + virtual int32_t GetExtraCommandBufferData() const = 0; // Fence Syncs use release counters at a context level, these fence syncs // need to be flushed before they can be shared with other contexts across diff --git a/gpu/command_buffer/common/constants.h b/gpu/command_buffer/common/constants.h index e227739..98c213f 100644 --- a/gpu/command_buffer/common/constants.h +++ b/gpu/command_buffer/common/constants.h @@ -67,7 +67,7 @@ const int32_t kCommandBufferSharedMemoryId = 4; const size_t kDefaultMaxProgramCacheMemoryBytes = 6 * 1024 * 1024; // Namespace used to separate various command buffer types. -enum CommandBufferNamespace { +enum CommandBufferNamespace : int8_t { INVALID = -1, GPU_IO, diff --git a/gpu/command_buffer/common/sync_token.h b/gpu/command_buffer/common/sync_token.h index 11af396..14f7256 100644 --- a/gpu/command_buffer/common/sync_token.h +++ b/gpu/command_buffer/common/sync_token.h @@ -26,6 +26,7 @@ struct GPU_EXPORT SyncToken { SyncToken() : verified_flush_(false), namespace_id_(CommandBufferNamespace::INVALID), + extra_data_field_(0), command_buffer_id_(0), release_count_(0) {} @@ -36,21 +37,26 @@ struct GPU_EXPORT SyncToken { : verified_flush_(sync_point ? true : false), namespace_id_(sync_point ? gpu::CommandBufferNamespace::OLD_SYNC_POINTS : gpu::CommandBufferNamespace::INVALID), + extra_data_field_(0), command_buffer_id_(0), release_count_(sync_point) {} SyncToken(CommandBufferNamespace namespace_id, + int32_t extra_data_field, uint64_t command_buffer_id, uint64_t release_count) : verified_flush_(false), namespace_id_(namespace_id), + extra_data_field_(extra_data_field), command_buffer_id_(command_buffer_id), release_count_(release_count) {} void Set(CommandBufferNamespace namespace_id, + int32_t extra_data_field, uint64_t command_buffer_id, uint64_t release_count) { namespace_id_ = namespace_id; + extra_data_field_ = extra_data_field; command_buffer_id_ = command_buffer_id; release_count_ = release_count; } @@ -58,6 +64,7 @@ struct GPU_EXPORT SyncToken { void Clear() { verified_flush_ = false; namespace_id_ = CommandBufferNamespace::INVALID; + extra_data_field_ = 0; command_buffer_id_ = 0; release_count_ = 0; } @@ -81,6 +88,12 @@ struct GPU_EXPORT SyncToken { uint64_t command_buffer_id() const { return command_buffer_id_; } uint64_t release_count() const { return release_count_; } + // This extra data field can be used by command buffers to add extra + // information to identify unverified sync tokens. The current purpose + // of this field is only for unverified sync tokens which only exist within + // the same process so this information will not survive cross-process IPCs. + int32_t extra_data_field() const { return extra_data_field_; } + bool operator<(const SyncToken& other) const { // TODO(dyen): Once all our compilers support c++11, we can replace this // long list of comparisons with std::tie(). @@ -94,6 +107,7 @@ struct GPU_EXPORT SyncToken { bool operator==(const SyncToken& other) const { return verified_flush_ == other.verified_flush() && namespace_id_ == other.namespace_id() && + extra_data_field_ == other.extra_data_field() && command_buffer_id_ == other.command_buffer_id() && release_count_ == other.release_count(); } @@ -103,6 +117,7 @@ struct GPU_EXPORT SyncToken { private: bool verified_flush_; CommandBufferNamespace namespace_id_; + int32_t extra_data_field_; uint64_t command_buffer_id_; uint64_t release_count_; }; diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc index 4931e30..12b0d15 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.cc +++ b/gpu/command_buffer/service/in_process_command_buffer.cc @@ -706,7 +706,8 @@ int32 InProcessCommandBuffer::CreateImage(ClientBuffer buffer, if (fence_sync) { flushed_fence_sync_release_ = fence_sync; - SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), fence_sync); + SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), + GetCommandBufferID(), fence_sync); sync_token.SetVerifyFlush(); gpu_memory_buffer_manager_->SetDestructionSyncToken(gpu_memory_buffer, sync_token); @@ -852,7 +853,8 @@ void InProcessCommandBuffer::RetireSyncPointOnGpuThread(uint32 sync_point) { // We can simply use the GPUIO namespace with 0 for the command buffer ID // (under normal circumstances 0 is invalid so will not be used) until // the old sync points are replaced. - SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, sync_point); + SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 0, + sync_point); mailbox_manager->PushTextureUpdates(sync_token); } } @@ -873,7 +875,7 @@ bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) { // We can simply use the GPUIO namespace with 0 for the command buffer ID // (under normal circumstances 0 is invalid so will not be used) until // the old sync points are replaced. - SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, sync_point); + SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 0, sync_point); mailbox_manager->PullTextureUpdates(sync_token); return true; } @@ -889,7 +891,8 @@ void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { make_current_success = MakeCurrent(); } if (make_current_success) { - SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), release); + SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), + GetCommandBufferID(), release); mailbox_manager->PushTextureUpdates(sync_token); } } @@ -922,7 +925,7 @@ bool InProcessCommandBuffer::WaitFenceSyncOnGpuThread( gles2::MailboxManager* mailbox_manager = decoder_->GetContextGroup()->mailbox_manager(); - SyncToken sync_token(namespace_id, command_buffer_id, release); + SyncToken sync_token(namespace_id, 0, command_buffer_id, release); mailbox_manager->PullTextureUpdates(sync_token); return true; } @@ -984,6 +987,10 @@ uint64_t InProcessCommandBuffer::GetCommandBufferID() const { return command_buffer_id_; } +int32_t InProcessCommandBuffer::GetExtraCommandBufferData() const { + return 0; +} + uint64_t InProcessCommandBuffer::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h index 5f2b644..91ecd74 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.h +++ b/gpu/command_buffer/service/in_process_command_buffer.h @@ -128,6 +128,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, bool IsGpuChannelLost() override; CommandBufferNamespace GetNamespaceID() const override; uint64_t GetCommandBufferID() const override; + int32_t GetExtraCommandBufferData() const override; uint64_t GenerateFenceSyncRelease() override; bool IsFenceSyncRelease(uint64_t release) override; bool IsFenceSyncFlushed(uint64_t release) override; diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc index 81979d0..e6ce523 100644 --- a/gpu/command_buffer/service/mailbox_manager_unittest.cc +++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc @@ -19,6 +19,7 @@ namespace gles2 { using namespace ::testing; static const SyncToken g_sync_token(gpu::CommandBufferNamespace::GPU_IO, + 0, 123, 0); diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc index 3053abd..d72994b 100644 --- a/gpu/command_buffer/tests/gl_manager.cc +++ b/gpu/command_buffer/tests/gl_manager.cc @@ -505,6 +505,10 @@ uint64_t GLManager::GetCommandBufferID() const { return command_buffer_id_; } +int32_t GLManager::GetExtraCommandBufferData() const { + return 0; +} + uint64_t GLManager::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } diff --git a/gpu/command_buffer/tests/gl_manager.h b/gpu/command_buffer/tests/gl_manager.h index 378bb69..3ae38ea 100644 --- a/gpu/command_buffer/tests/gl_manager.h +++ b/gpu/command_buffer/tests/gl_manager.h @@ -132,6 +132,7 @@ class GLManager : private GpuControl { bool IsGpuChannelLost() override; gpu::CommandBufferNamespace GetNamespaceID() const override; uint64_t GetCommandBufferID() const override; + int32_t GetExtraCommandBufferData() const override; uint64_t GenerateFenceSyncRelease() override; bool IsFenceSyncRelease(uint64_t release) override; bool IsFenceSyncFlushed(uint64_t release) override; diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index 3b20d81..f79a453 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -345,6 +345,10 @@ uint64_t Display::GetCommandBufferID() const { return 0; } +int32_t Display::GetExtraCommandBufferData() const { + return 0; +} + uint64_t Display::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h index da966bd..ffc96c4 100644 --- a/gpu/gles2_conform_support/egl/display.h +++ b/gpu/gles2_conform_support/egl/display.h @@ -98,6 +98,7 @@ class Display : private gpu::GpuControl { bool IsGpuChannelLost() override; gpu::CommandBufferNamespace GetNamespaceID() const override; uint64_t GetCommandBufferID() const override; + int32_t GetExtraCommandBufferData() const override; uint64_t GenerateFenceSyncRelease() override; bool IsFenceSyncRelease(uint64_t release) override; bool IsFenceSyncFlushed(uint64_t release) override; diff --git a/gpu/ipc/gpu_command_buffer_traits.cc b/gpu/ipc/gpu_command_buffer_traits.cc index a1932ee..faed0e2 100644 --- a/gpu/ipc/gpu_command_buffer_traits.cc +++ b/gpu/ipc/gpu_command_buffer_traits.cc @@ -79,7 +79,7 @@ bool ParamTraits<gpu::SyncToken>::Read(const Message* m, return false; } - p->Set(namespace_id, command_buffer_id, release_count); + p->Set(namespace_id, 0, command_buffer_id, release_count); if (p->HasData()) { if (!verified_flush) return false; diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc index ee2a454..157986f 100644 --- a/media/base/video_frame_unittest.cc +++ b/media/base/video_frame_unittest.cc @@ -269,7 +269,8 @@ static void TextureCallback(gpu::SyncToken* called_sync_token, // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is // destroyed with the default release sync point. TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) { - gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 1, 1); + gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 1, + 1); { scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( @@ -321,10 +322,10 @@ TEST(VideoFrame, mailbox[i].name[0] = 50 + 1; } - gpu::SyncToken sync_token(kNamespace, kCommandBufferId, 7); + gpu::SyncToken sync_token(kNamespace, 0, kCommandBufferId, 7); sync_token.SetVerifyFlush(); uint32 target = 9; - gpu::SyncToken release_sync_token(kNamespace, kCommandBufferId, 111); + gpu::SyncToken release_sync_token(kNamespace, 0, kCommandBufferId, 111); release_sync_token.SetVerifyFlush(); gpu::SyncToken called_sync_token; diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc index f0a32bd..f094454 100644 --- a/mojo/converters/surfaces/surfaces_type_converters.cc +++ b/mojo/converters/surfaces/surfaces_type_converters.cc @@ -547,8 +547,8 @@ gpu::SyncToken TypeConverter<gpu::SyncToken, SyncTokenPtr>::Convert( const SyncTokenPtr& input) { const gpu::CommandBufferNamespace namespace_id = static_cast<gpu::CommandBufferNamespace>(input->namespace_id); - gpu::SyncToken sync_token(namespace_id, input->command_buffer_id, - input->release_count); + gpu::SyncToken sync_token(namespace_id, 0, + input->command_buffer_id, input->release_count); if (input->verified_flush) sync_token.SetVerifyFlush(); diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc index 6e3e2a6..79f238a 100644 --- a/mojo/gles2/command_buffer_client_impl.cc +++ b/mojo/gles2/command_buffer_client_impl.cc @@ -413,6 +413,10 @@ uint64_t CommandBufferClientImpl::GetCommandBufferID() const { return sync_client_impl_->GetCommandBufferID(); } +int32_t CommandBufferClientImpl::GetExtraCommandBufferData() const { + return 0; +} + uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } diff --git a/mojo/gles2/command_buffer_client_impl.h b/mojo/gles2/command_buffer_client_impl.h index 92524f6..c9f92c9 100644 --- a/mojo/gles2/command_buffer_client_impl.h +++ b/mojo/gles2/command_buffer_client_impl.h @@ -75,6 +75,7 @@ class CommandBufferClientImpl bool IsGpuChannelLost() override; gpu::CommandBufferNamespace GetNamespaceID() const override; uint64_t GetCommandBufferID() const override; + int32_t GetExtraCommandBufferData() const override; uint64_t GenerateFenceSyncRelease() override; bool IsFenceSyncRelease(uint64_t release) override; bool IsFenceSyncFlushed(uint64_t release) override; diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc index a77433d..9fe1899 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -213,6 +213,10 @@ bool PpapiCommandBufferProxy::CanWaitUnverifiedSyncToken( return false; } +int32_t PpapiCommandBufferProxy::GetExtraCommandBufferData() const { + return 0; +} + uint32 PpapiCommandBufferProxy::InsertSyncPoint() { uint32 sync_point = 0; if (last_state_.error == gpu::error::kNoError) { diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h index fedb362..0242d4c 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -75,6 +75,7 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, void SignalSyncToken(const gpu::SyncToken& sync_token, const base::Closure& callback) override; bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; + int32_t GetExtraCommandBufferData() const override; private: bool Send(IPC::Message* msg); diff --git a/tools/ipc_fuzzer/fuzzer/fuzzer.cc b/tools/ipc_fuzzer/fuzzer/fuzzer.cc index d49c7bc..0435ead 100644 --- a/tools/ipc_fuzzer/fuzzer/fuzzer.cc +++ b/tools/ipc_fuzzer/fuzzer/fuzzer.cc @@ -1204,6 +1204,7 @@ struct FuzzTraits<gpu::SyncToken> { bool verified_flush = false; gpu::CommandBufferNamespace namespace_id = gpu::CommandBufferNamespace::INVALID; + int32_t extra_data_field = 0; uint64_t command_buffer_id = 0; uint64_t release_count = 0; @@ -1211,13 +1212,15 @@ struct FuzzTraits<gpu::SyncToken> { return false; if (!FuzzParam(&namespace_id, fuzzer)) return false; + if (!FuzzParam(&extra_data_field, fuzzer)) + return false; if (!FuzzParam(&command_buffer_id, fuzzer)) return false; if (!FuzzParam(&release_count, fuzzer)) return false; p->Clear(); - p->Set(namespace_id, command_buffer_id, release_count); + p->Set(namespace_id, extra_data_field, command_buffer_id, release_count); if (verified_flush) p->SetVerifyFlush(); return true; |