diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-08 03:08:01 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-08 03:08:01 +0000 |
commit | b096d03b3a3c42789371afde33de83b8b9c2f131 (patch) | |
tree | f59685dff742251844f4a56f26dfe2f026d628ed /gpu | |
parent | 26eee511db49e180162ce56f99dc330488140192 (diff) | |
download | chromium_src-b096d03b3a3c42789371afde33de83b8b9c2f131.zip chromium_src-b096d03b3a3c42789371afde33de83b8b9c2f131.tar.gz chromium_src-b096d03b3a3c42789371afde33de83b8b9c2f131.tar.bz2 |
Move InsertSyncPoint to GLES2Interface
This is needed to allow Pepper to use mailboxes rather than parenting to
integrate with the compositor.
BUG=164095
Review URL: https://chromiumcodereview.appspot.com/12581004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
24 files changed, 72 insertions, 1 deletions
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h index f997f2f..c53d1ce 100644 --- a/gpu/GLES2/gl2chromium_autogen.h +++ b/gpu/GLES2/gl2chromium_autogen.h @@ -223,6 +223,7 @@ WaitAsyncTexImage2DCHROMIUM) #define glDiscardFramebufferEXT GLES2_GET_FUN(DiscardFramebufferEXT) #define glLoseContextCHROMIUM GLES2_GET_FUN(LoseContextCHROMIUM) +#define glInsertSyncPointCHROMIUM GLES2_GET_FUN(InsertSyncPointCHROMIUM) #define glWaitSyncPointCHROMIUM GLES2_GET_FUN(WaitSyncPointCHROMIUM) #endif // GPU_GLES2_GL2CHROMIUM_AUTOGEN_H_ diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index a408db7..af9b5d5 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -2327,6 +2327,12 @@ _FUNCTION_INFO = { 'extension': True, 'chromium': True, }, + 'InsertSyncPointCHROMIUM': { + 'type': 'HandWritten', + 'impl_func': False, + 'extension': True, + 'chromium': True, + }, 'WaitSyncPointCHROMIUM': { 'type': 'Custom', 'impl_func': True, diff --git a/gpu/command_buffer/client/client_test_helper.cc b/gpu/command_buffer/client/client_test_helper.cc index 20f30a1..cccfa3b 100644 --- a/gpu/command_buffer/client/client_test_helper.cc +++ b/gpu/command_buffer/client/client_test_helper.cc @@ -109,6 +109,11 @@ 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 06121da..dd656a2 100644 --- a/gpu/command_buffer/client/client_test_helper.h +++ b/gpu/command_buffer/client/client_test_helper.h @@ -38,6 +38,7 @@ 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. diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 8ed8d9d..08c3e90 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -722,6 +722,9 @@ void GLES2DiscardFramebufferEXT( void GLES2LoseContextCHROMIUM(GLenum current, GLenum other) { gles2::GetGLContext()->LoseContextCHROMIUM(current, other); } +GLuint GLES2InsertSyncPointCHROMIUM() { + return gles2::GetGLContext()->InsertSyncPointCHROMIUM(); +} void GLES2WaitSyncPointCHROMIUM(GLuint sync_point) { gles2::GetGLContext()->WaitSyncPointCHROMIUM(sync_point); } @@ -1062,6 +1065,8 @@ NameToFunc g_gles2_function_table[] = { glDiscardFramebufferEXT), }, { "glLoseContextCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( glLoseContextCHROMIUM), }, + { "glInsertSyncPointCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( + glInsertSyncPointCHROMIUM), }, { "glWaitSyncPointCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( glWaitSyncPointCHROMIUM), }, { NULL, NULL, }, diff --git a/gpu/command_buffer/client/gles2_cmd_helper.h b/gpu/command_buffer/client/gles2_cmd_helper.h index a7ab61d..521d864 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper.h +++ b/gpu/command_buffer/client/gles2_cmd_helper.h @@ -96,6 +96,11 @@ 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 e19911c..0da78bc 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -3447,6 +3447,12 @@ void GLES2Implementation::WaitAsyncTexImage2DCHROMIUM(GLenum target) { CheckGLError(); } +GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); + return helper_->InsertSyncPointCHROMIUM(); +} + // Include the auto-generated part of this file. We split this because it means // we can easily edit the non-auto generated parts right here in this file // instead of having to edit some template or the code generator. diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 1ad32d8..30e7834 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -526,6 +526,8 @@ virtual void DiscardFramebufferEXT( virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE; +virtual GLuint InsertSyncPointCHROMIUM() OVERRIDE; + virtual void WaitSyncPointCHROMIUM(GLuint sync_point) OVERRIDE; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index e2aa326..b573574 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -1786,6 +1786,7 @@ TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) { gl_->LoseContextCHROMIUM(1, 2); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +// TODO: Implement unit test for InsertSyncPointCHROMIUM TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) { struct Cmds { diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index 24bf6f0..ba55dce 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h @@ -304,6 +304,7 @@ virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) = 0; virtual void DiscardFramebufferEXT( GLenum target, GLsizei count, const GLenum* attachments) = 0; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) = 0; +virtual GLuint InsertSyncPointCHROMIUM() = 0; virtual void WaitSyncPointCHROMIUM(GLuint sync_point) = 0; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index af286b3..f374aef 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -335,6 +335,7 @@ virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) OVERRIDE; virtual void DiscardFramebufferEXT( GLenum target, GLsizei count, const GLenum* attachments) OVERRIDE; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE; +virtual GLuint InsertSyncPointCHROMIUM() OVERRIDE; virtual void WaitSyncPointCHROMIUM(GLuint sync_point) OVERRIDE; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h index 4add6c4..5a202e2 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h @@ -632,6 +632,9 @@ void GLES2InterfaceStub::DiscardFramebufferEXT( void GLES2InterfaceStub::LoseContextCHROMIUM( GLenum /* current */, GLenum /* other */) { } +GLuint GLES2InterfaceStub::InsertSyncPointCHROMIUM() { + return 0; +} void GLES2InterfaceStub::WaitSyncPointCHROMIUM(GLuint /* sync_point */) { } #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_IMPL_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index 6883771..f90a95d 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -335,6 +335,7 @@ virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) OVERRIDE; virtual void DiscardFramebufferEXT( GLenum target, GLsizei count, const GLenum* attachments) OVERRIDE; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE; +virtual GLuint InsertSyncPointCHROMIUM() OVERRIDE; virtual void WaitSyncPointCHROMIUM(GLuint sync_point) OVERRIDE; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h index a6bf01e..deca187 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h @@ -1170,6 +1170,11 @@ void GLES2TraceImplementation::LoseContextCHROMIUM( gl_->LoseContextCHROMIUM(current, other); } +GLuint GLES2TraceImplementation::InsertSyncPointCHROMIUM() { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::InsertSyncPointCHROMIUM"); + return gl_->InsertSyncPointCHROMIUM(); +} + void GLES2TraceImplementation::WaitSyncPointCHROMIUM(GLuint sync_point) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::WaitSyncPointCHROMIUM"); gl_->WaitSyncPointCHROMIUM(sync_point); diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index 661ffeb..8728294 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt @@ -208,6 +208,7 @@ GL_APICALL void GL_APIENTRY glAsyncTexImage2DCHROMIUM (GLenumTextureTarg GL_APICALL void GL_APIENTRY glWaitAsyncTexImage2DCHROMIUM (GLenumTextureTarget target); GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei count, const GLenum* attachments); GL_APICALL void GL_APIENTRY glLoseContextCHROMIUM (GLenum current, GLenum other); +GL_APICALL GLuint GL_APIENTRY glInsertSyncPointCHROMIUM (void); GL_APICALL void GL_APIENTRY glWaitSyncPointCHROMIUM (GLuint sync_point); diff --git a/gpu/command_buffer/common/command_buffer.h b/gpu/command_buffer/common/command_buffer.h index c2d8fd7..8c202ed 100644 --- a/gpu/command_buffer/common/command_buffer.h +++ b/gpu/command_buffer/common/command_buffer.h @@ -141,6 +141,10 @@ 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/command_buffer_mock.h b/gpu/command_buffer/common/command_buffer_mock.h index afce4f69..d02da47 100644 --- a/gpu/command_buffer/common/command_buffer_mock.h +++ b/gpu/command_buffer/common/command_buffer_mock.h @@ -36,6 +36,7 @@ class MockCommandBuffer : public CommandBuffer { MOCK_METHOD1(SetParseError, void(error::Error error)); MOCK_METHOD1(SetContextLostReason, void(error::ContextLostReason context_lost_reason)); + MOCK_METHOD0(InsertSyncPoint, uint32()); private: DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer); diff --git a/gpu/command_buffer/common/gles2_cmd_format.h b/gpu/command_buffer/common/gles2_cmd_format.h index cebb0d3..9491d98 100644 --- a/gpu/command_buffer/common/gles2_cmd_format.h +++ b/gpu/command_buffer/common/gles2_cmd_format.h @@ -540,6 +540,13 @@ COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_id) == 12, COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_offset) == 16, OffsetOf_GetUniformLocationBucket_location_shm_offset_not_16); +struct InsertSyncPointCHROMIUM { + typedef InsertSyncPointCHROMIUM ValueType; + static const CommandId kCmdId = kInsertSyncPointCHROMIUM; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + CommandHeader header; +}; + #pragma pack(pop) } // namespace cmd diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index bb47907..970215d 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -4442,6 +4442,7 @@ TEST_F(GLES2FormatTest, LoseContextCHROMIUM) { next_cmd, sizeof(cmd)); } +// TODO(gman): Write test for InsertSyncPointCHROMIUM TEST_F(GLES2FormatTest, WaitSyncPointCHROMIUM) { cmds::WaitSyncPointCHROMIUM& cmd = *GetBufferAs<cmds::WaitSyncPointCHROMIUM>(); diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h index 0c22a37..4a5efae 100644 --- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h @@ -249,7 +249,8 @@ OP(DiscardFramebufferEXT) /* 492 */ \ OP(DiscardFramebufferEXTImmediate) /* 493 */ \ OP(LoseContextCHROMIUM) /* 494 */ \ - OP(WaitSyncPointCHROMIUM) /* 495 */ \ + OP(InsertSyncPointCHROMIUM) /* 495 */ \ + OP(WaitSyncPointCHROMIUM) /* 496 */ \ enum CommandId { kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc index e9ef988..32cb354 100644 --- a/gpu/command_buffer/service/command_buffer_service.cc +++ b/gpu/command_buffer/service/command_buffer_service.cc @@ -200,4 +200,9 @@ 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 f0fa1d2..af3cb0c 100644 --- a/gpu/command_buffer/service/command_buffer_service.h +++ b/gpu/command_buffer/service/command_buffer_service.h @@ -38,6 +38,7 @@ 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/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 2486ac3..4544463 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -9075,6 +9075,11 @@ error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( return error::kLostContext; } +error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( + uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) { + return error::kUnknownCommand; +} + error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( uint32 immediate_data_size, const cmds::WaitSyncPointCHROMIUM& c) { if (wait_sync_point_callback_.is_null()) diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h index 6294b93..470dbcf 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h @@ -70,6 +70,8 @@ // TODO(gman): DiscardFramebufferEXTImmediate // TODO(gman): LoseContextCHROMIUM +// TODO(gman): InsertSyncPointCHROMIUM + // TODO(gman): WaitSyncPointCHROMIUM #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_ |