diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-02 07:07:37 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-02 07:07:37 +0000 |
commit | fff7cb34cf590dad0b3251fad94f5d8e0b2a734a (patch) | |
tree | 1e4b05f8635a5ad41527867a6142c7c228a163c4 /gpu | |
parent | a3216d6629ee0f00f0e46e2a5b26020006a2f4a0 (diff) | |
download | chromium_src-fff7cb34cf590dad0b3251fad94f5d8e0b2a734a.zip chromium_src-fff7cb34cf590dad0b3251fad94f5d8e0b2a734a.tar.gz chromium_src-fff7cb34cf590dad0b3251fad94f5d8e0b2a734a.tar.bz2 |
Move Insert/SignalSyncPoint() to GpuControl
This moves InsertSyncPoint() and SignalSyncPoint() to the gpu::GpuControl
interface to get a step closer to removing the WebGraphicsContext3D interface.
R=piman,sievers
Review URL: https://codereview.chromium.org/24925002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226412 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/client/client_test_helper.cc | 5 | ||||
-rw-r--r-- | gpu/command_buffer/client/client_test_helper.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_cmd_helper.h | 5 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.cc | 3 | ||||
-rw-r--r-- | gpu/command_buffer/common/command_buffer.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/common/gpu_control.h | 9 | ||||
-rw-r--r-- | gpu/command_buffer/service/command_buffer_service.cc | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/command_buffer_service.h | 1 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_control_service.cc | 10 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_control_service.h | 3 | ||||
-rw-r--r-- | gpu/command_buffer/service/in_process_command_buffer.cc | 21 | ||||
-rw-r--r-- | gpu/command_buffer/service/in_process_command_buffer.h | 6 |
12 files changed, 41 insertions, 35 deletions
diff --git a/gpu/command_buffer/client/client_test_helper.cc b/gpu/command_buffer/client/client_test_helper.cc index 31a91b2..9557fce 100644 --- a/gpu/command_buffer/client/client_test_helper.cc +++ b/gpu/command_buffer/client/client_test_helper.cc @@ -109,11 +109,6 @@ void MockCommandBufferBase::SetContextLostReason( state_.context_lost_reason = reason; } -uint32 MockCommandBufferBase::InsertSyncPoint() { - GPU_NOTREACHED(); - return 0; -} - // GCC requires these declarations, but MSVC requires they not be present #ifndef _MSC_VER const int32 MockCommandBufferBase::kTransferBufferBaseId; diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h index 3119578..6de4356 100644 --- a/gpu/command_buffer/client/client_test_helper.h +++ b/gpu/command_buffer/client/client_test_helper.h @@ -39,7 +39,6 @@ class MockCommandBufferBase : public CommandBuffer { virtual void SetToken(int32 token) OVERRIDE; virtual void SetParseError(error::Error error) OVERRIDE; virtual void SetContextLostReason(error::ContextLostReason reason) OVERRIDE; - virtual uint32 InsertSyncPoint() OVERRIDE; // Get's the Id of the next transfer buffer that will be returned // by CreateTransferBuffer. This is useful for testing expected ids. @@ -96,6 +95,9 @@ class MockClientGpuControl : public GpuControl { MOCK_METHOD1(DestroyGpuMemoryBuffer, void(int32 id)); MOCK_METHOD2(GenerateMailboxNames, bool(unsigned num, std::vector<gpu::Mailbox>* names)); + MOCK_METHOD0(InsertSyncPoint, uint32()); + MOCK_METHOD2(SignalSyncPoint, void(uint32 id, + const base::Closure& callback)); private: DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); diff --git a/gpu/command_buffer/client/gles2_cmd_helper.h b/gpu/command_buffer/client/gles2_cmd_helper.h index 7361a9b..052eeaa 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper.h +++ b/gpu/command_buffer/client/gles2_cmd_helper.h @@ -96,11 +96,6 @@ class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper { } } - GLuint InsertSyncPointCHROMIUM() { - CommandBufferHelper::Flush(); - return command_buffer()->InsertSyncPoint(); - } - private: DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper); }; diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index e467102..0d3f74c 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -3660,7 +3660,8 @@ void GLES2Implementation::WaitAsyncTexImage2DCHROMIUM(GLenum target) { GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); - return helper_->InsertSyncPointCHROMIUM(); + helper_->CommandBufferHelper::Flush(); + return gpu_control_->InsertSyncPoint(); } GLuint GLES2Implementation::CreateImageCHROMIUMHelper( diff --git a/gpu/command_buffer/common/command_buffer.h b/gpu/command_buffer/common/command_buffer.h index 3078bca..394ccf3 100644 --- a/gpu/command_buffer/common/command_buffer.h +++ b/gpu/command_buffer/common/command_buffer.h @@ -137,10 +137,6 @@ class GPU_EXPORT CommandBuffer { virtual error::Error GetLastError(); #endif - // Inserts a sync point, returning its ID. Sync point IDs are global and can - // be used for cross-context synchronization. - virtual uint32 InsertSyncPoint() = 0; - private: DISALLOW_COPY_AND_ASSIGN(CommandBuffer); }; diff --git a/gpu/command_buffer/common/gpu_control.h b/gpu/command_buffer/common/gpu_control.h index 61b5cb1..84a6373 100644 --- a/gpu/command_buffer/common/gpu_control.h +++ b/gpu/command_buffer/common/gpu_control.h @@ -7,6 +7,7 @@ #include <vector> +#include "base/callback.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/common/types.h" #include "gpu/gpu_export.h" @@ -41,6 +42,14 @@ class GPU_EXPORT GpuControl { virtual bool GenerateMailboxNames(unsigned num, std::vector<gpu::Mailbox>* names) = 0; + // Inserts a sync point, returning its ID. Sync point IDs are global and can + // be used for cross-context synchronization. + virtual uint32 InsertSyncPoint() = 0; + + // Runs |callback| when a sync point is reached. + virtual void SignalSyncPoint(uint32 sync_point, + const base::Closure& callback) = 0; + private: DISALLOW_COPY_AND_ASSIGN(GpuControl); }; diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc index 1cd68f5..bae2d80 100644 --- a/gpu/command_buffer/service/command_buffer_service.cc +++ b/gpu/command_buffer/service/command_buffer_service.cc @@ -202,9 +202,4 @@ void CommandBufferService::SetParseErrorCallback( parse_error_callback_ = callback; } -uint32 CommandBufferService::InsertSyncPoint() { - NOTREACHED(); - return 0; -} - } // namespace gpu diff --git a/gpu/command_buffer/service/command_buffer_service.h b/gpu/command_buffer/service/command_buffer_service.h index 232bdc0..b1f8fa1 100644 --- a/gpu/command_buffer/service/command_buffer_service.h +++ b/gpu/command_buffer/service/command_buffer_service.h @@ -38,7 +38,6 @@ class GPU_EXPORT CommandBufferService : public CommandBuffer { virtual void SetToken(int32 token) OVERRIDE; virtual void SetParseError(error::Error error) OVERRIDE; virtual void SetContextLostReason(error::ContextLostReason) OVERRIDE; - virtual uint32 InsertSyncPoint() OVERRIDE; // Sets a callback that is called whenever the put offset is changed. When // called with sync==true, the callback must not return until some progress diff --git a/gpu/command_buffer/service/gpu_control_service.cc b/gpu/command_buffer/service/gpu_control_service.cc index 2a34b8c..4620667 100644 --- a/gpu/command_buffer/service/gpu_control_service.cc +++ b/gpu/command_buffer/service/gpu_control_service.cc @@ -65,6 +65,16 @@ void GpuControlService::DestroyGpuMemoryBuffer(int32 id) { gpu_memory_buffer_manager_->DestroyGpuMemoryBuffer(id); } +uint32 GpuControlService::InsertSyncPoint() { + NOTREACHED(); + return 0u; +} + +void GpuControlService::SignalSyncPoint(uint32 sync_point, + const base::Closure& callback) { + NOTREACHED(); +} + bool GpuControlService::RegisterGpuMemoryBuffer( int32 id, gfx::GpuMemoryBufferHandle buffer, diff --git a/gpu/command_buffer/service/gpu_control_service.h b/gpu/command_buffer/service/gpu_control_service.h index 1dce9d1..c5cad49 100644 --- a/gpu/command_buffer/service/gpu_control_service.h +++ b/gpu/command_buffer/service/gpu_control_service.h @@ -37,6 +37,9 @@ class GPU_EXPORT GpuControlService : public GpuControl { virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; virtual bool GenerateMailboxNames(unsigned num, std::vector<gpu::Mailbox>* names) OVERRIDE; + virtual uint32 InsertSyncPoint() OVERRIDE; + virtual void SignalSyncPoint(uint32 sync_point, + const base::Closure& callback) OVERRIDE; // Register an existing gpu memory buffer and get an ID that can be used // to identify it in the command buffer. diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc index cd5e8602..dec0893 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.cc +++ b/gpu/command_buffer/service/in_process_command_buffer.cc @@ -640,16 +640,6 @@ gpu::Buffer InProcessCommandBuffer::GetTransferBuffer(int32 id) { return gpu::Buffer(); } -uint32 InProcessCommandBuffer::InsertSyncPoint() { - NOTREACHED(); - return 0; -} -void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, - const base::Closure& callback) { - CheckSequencedThread(); - QueueTask(WrapCallback(callback)); -} - bool InProcessCommandBuffer::SupportsGpuMemoryBuffer() { return supports_gpu_memory_buffer_; } @@ -683,6 +673,17 @@ bool InProcessCommandBuffer::GenerateMailboxNames( return gpu_control_->GenerateMailboxNames(num, names); } +uint32 InProcessCommandBuffer::InsertSyncPoint() { + NOTREACHED(); + return 0; +} + +void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, + const base::Closure& callback) { + CheckSequencedThread(); + QueueTask(WrapCallback(callback)); +} + gpu::error::Error InProcessCommandBuffer::GetLastError() { CheckSequencedThread(); return last_state_.error; diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h index c736e8f..5685e315 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.h +++ b/gpu/command_buffer/service/in_process_command_buffer.h @@ -87,8 +87,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, const base::Closure& context_lost_callback, unsigned int share_group_id); void Destroy(); - void SignalSyncPoint(unsigned sync_point, - const base::Closure& callback); // CommandBuffer implementation: virtual bool Initialize() OVERRIDE; @@ -106,7 +104,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, virtual void SetParseError(gpu::error::Error error) OVERRIDE; virtual void SetContextLostReason( gpu::error::ContextLostReason reason) OVERRIDE; - virtual uint32 InsertSyncPoint() OVERRIDE; virtual gpu::error::Error GetLastError() OVERRIDE; // GpuControl implementation: @@ -119,6 +116,9 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; virtual bool GenerateMailboxNames(unsigned num, std::vector<gpu::Mailbox>* names) OVERRIDE; + virtual uint32 InsertSyncPoint() OVERRIDE; + virtual void SignalSyncPoint(uint32 sync_point, + const base::Closure& callback) OVERRIDE; // The serializer interface to the GPU service (i.e. thread). class SchedulerClient { |