diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 21:53:38 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 21:53:38 +0000 |
commit | 0b7a2fff445beb2c5de1e2a632540a4107e00708 (patch) | |
tree | 759f7a9d489b6bf44c9f5de081d7bf335233028d /gpu | |
parent | 72ab1b792dbddfb680490153984b1865b725d8f4 (diff) | |
download | chromium_src-0b7a2fff445beb2c5de1e2a632540a4107e00708.zip chromium_src-0b7a2fff445beb2c5de1e2a632540a4107e00708.tar.gz chromium_src-0b7a2fff445beb2c5de1e2a632540a4107e00708.tar.bz2 |
Revert 87371 - Broke Compile - Support for glSetSurfaceCHROMIUM.
This command allows a previously created GPU surface to be made current for a command buffer. There are no surfaces registered at this point so this command is currently a no-op.
Review URL: http://codereview.chromium.org/7077001
TBR=apatrick@chromium.org
Review URL: http://codereview.chromium.org/7027008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
27 files changed, 50 insertions, 280 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 966d861..cf36ade 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -214,7 +214,6 @@ GL_APICALL void GL_APIENTRY glRequestExtensionCHROMIUM (const char* exte GL_APICALL void GL_APIENTRY glSetLatchCHROMIUM (GLuint latch_id); GL_APICALL void GL_APIENTRY glWaitLatchCHROMIUM (GLuint latch_id); GL_APICALL void GL_APIENTRY glRateLimitOffscreenContextCHROMIUM (void); -GL_APICALL void GL_APIENTRY glSetSurfaceCHROMIUM (GLint surface_id); """ # This is the list of all commmands that will be generated and their Id. @@ -420,7 +419,6 @@ _CMD_ID_TABLE = { 'RequestExtensionCHROMIUM': 450, 'SetLatchCHROMIUM': 451, 'WaitLatchCHROMIUM': 452, - 'SetSurfaceCHROMIUM': 453, } # This is a list of enum names and their valid values. It is used to map @@ -1492,11 +1490,6 @@ _FUNCTION_INFO = { 'decoder_func': 'DoReleaseShaderCompiler', 'unit_test': False, }, - 'SetSurfaceCHROMIUM': { - 'decoder_func': 'DoSetSurfaceCHROMIUM', - 'extension': True, - 'chromium': True, - }, 'ShaderBinary': {'type': 'Custom'}, 'ShaderSource': { 'type': 'Manual', diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 663d162..889a243 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -889,10 +889,6 @@ void GLES2RateLimitOffscreenContextCHROMIUM() { GPU_CLIENT_LOG("RateLimitOffscreenContextCHROMIUM" << "(" << ")"); gles2::GetGLContext()->RateLimitOffscreenContextCHROMIUM(); } -void GLES2SetSurfaceCHROMIUM(GLint surface_id) { - GPU_CLIENT_LOG("SetSurfaceCHROMIUM" << "(" << surface_id << ")"); - gles2::GetGLContext()->SetSurfaceCHROMIUM(surface_id); -} #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_C_LIB_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index c8deb23..e6568da 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -1227,10 +1227,5 @@ c.Init(latch_id); } - void SetSurfaceCHROMIUM(GLint surface_id) { - gles2::SetSurfaceCHROMIUM& c = GetCmdSpace<gles2::SetSurfaceCHROMIUM>(); - c.Init(surface_id); - } - #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc index 90825b09..78768dd 100644 --- a/gpu/command_buffer/client/gles2_demo.cc +++ b/gpu/command_buffer/client/gles2_demo.cc @@ -56,9 +56,7 @@ bool GLES2Demo::Setup(void* hwnd, int32 size) { if (!command_buffer->Initialize(size)) return NULL; - GpuScheduler* gpu_scheduler = new GpuScheduler(command_buffer.get(), - NULL, - NULL); + GpuScheduler* gpu_scheduler = new GpuScheduler(command_buffer.get(), NULL); if (!gpu_scheduler->Initialize(reinterpret_cast<HWND>(hwnd), gfx::Size(), gpu::gles2::DisallowedExtensions(), diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index f389920..97704a1 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -899,9 +899,5 @@ void WaitLatchCHROMIUM(GLuint latch_id) { void RateLimitOffscreenContextCHROMIUM(); -void SetSurfaceCHROMIUM(GLint surface_id) { - helper_->SetSurfaceCHROMIUM(surface_id); -} - #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index 67bbc36..0536887 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -8979,40 +8979,6 @@ COMPILE_ASSERT(offsetof(WaitLatchCHROMIUM, header) == 0, COMPILE_ASSERT(offsetof(WaitLatchCHROMIUM, latch_id) == 4, OffsetOf_WaitLatchCHROMIUM_latch_id_not_4); -struct SetSurfaceCHROMIUM { - typedef SetSurfaceCHROMIUM ValueType; - static const CommandId kCmdId = kSetSurfaceCHROMIUM; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _surface_id) { - SetHeader(); - surface_id = _surface_id; - } - - void* Set(void* cmd, GLint _surface_id) { - static_cast<ValueType*>(cmd)->Init(_surface_id); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - int32 surface_id; -}; - -COMPILE_ASSERT(sizeof(SetSurfaceCHROMIUM) == 8, - Sizeof_SetSurfaceCHROMIUM_is_not_8); -COMPILE_ASSERT(offsetof(SetSurfaceCHROMIUM, header) == 0, - OffsetOf_SetSurfaceCHROMIUM_header_not_0); -COMPILE_ASSERT(offsetof(SetSurfaceCHROMIUM, surface_id) == 4, - OffsetOf_SetSurfaceCHROMIUM_surface_id_not_4); - #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_AUTOGEN_H_ 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 0f18f94..77660e2 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -3534,18 +3534,5 @@ TEST(GLES2FormatTest, WaitLatchCHROMIUM) { EXPECT_EQ(static_cast<GLuint>(11), cmd.latch_id); } -TEST(GLES2FormatTest, SetSurfaceCHROMIUM) { - SetSurfaceCHROMIUM cmd = { { 0 } }; - void* next_cmd = cmd.Set( - &cmd, - static_cast<GLint>(11)); - EXPECT_EQ(static_cast<uint32>(SetSurfaceCHROMIUM::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<char*>(next_cmd), - reinterpret_cast<char*>(&cmd) + sizeof(cmd)); - EXPECT_EQ(static_cast<GLint>(11), cmd.surface_id); -} - #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_ diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h index 5a3dc2d..7566beb 100644 --- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h @@ -205,7 +205,6 @@ OP(RequestExtensionCHROMIUM) /* 450 */ \ OP(SetLatchCHROMIUM) /* 451 */ \ OP(WaitLatchCHROMIUM) /* 452 */ \ - OP(SetSurfaceCHROMIUM) /* 453 */ \ enum CommandId { kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index dec7c34..25b6696 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -34,7 +34,6 @@ #include "gpu/command_buffer/service/renderbuffer_manager.h" #include "gpu/command_buffer/service/shader_manager.h" #include "gpu/command_buffer/service/shader_translator.h" -#include "gpu/command_buffer/service/surface_manager.h" #include "gpu/command_buffer/service/texture_manager.h" #include "gpu/GLES2/gles2_command_buffer.h" #include "ui/gfx/gl/gl_context.h" @@ -662,8 +661,7 @@ bool VertexAttribManager::Enable(GLuint index, bool enable) { class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, public GLES2Decoder { public: - explicit GLES2DecoderImpl(SurfaceManager* surface_manager, - ContextGroup* group); + explicit GLES2DecoderImpl(ContextGroup* group); // Overridden from AsyncAPIInterface. virtual Error DoCommand(unsigned int command, @@ -674,8 +672,8 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, virtual const char* GetCommandName(unsigned int command_id) const; // Overridden from GLES2Decoder. - virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, - const scoped_refptr<gfx::GLContext>& context, + virtual bool Initialize(gfx::GLSurface* surface, + gfx::GLContext* context, const gfx::Size& size, const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, @@ -1231,8 +1229,6 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, void DoResizeCHROMIUM(GLuint width, GLuint height); - void DoSetSurfaceCHROMIUM(GLint surface_id); - // Gets the number of values that will be returned by glGetXXX. Returns // false if pname is unknown. bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); @@ -1343,12 +1339,9 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, #undef GLES2_CMD_OP - // Maps surface IDs to GLSurface. - gpu::SurfaceManager* surface_manager_; - // The GL context this decoder renders to on behalf of the client. - scoped_refptr<gfx::GLSurface> surface_; - scoped_refptr<gfx::GLContext> context_; + scoped_ptr<gfx::GLSurface> surface_; + scoped_ptr<gfx::GLContext> context_; // The ContextGroup for this decoder uses to track resources. ContextGroup::Ref group_; @@ -1774,15 +1767,12 @@ GLenum FrameBuffer::CheckStatus() { return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); } -GLES2Decoder* GLES2Decoder::Create(SurfaceManager* surface_manager, - ContextGroup* group) { - return new GLES2DecoderImpl(surface_manager, group); +GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { + return new GLES2DecoderImpl(group); } -GLES2DecoderImpl::GLES2DecoderImpl(SurfaceManager* surface_manager, - ContextGroup* group) +GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) : GLES2Decoder(), - surface_manager_(surface_manager), group_(ContextGroup::Ref(group ? group : new ContextGroup())), error_bits_(0), util_(0), // TODO(gman): Set to actual num compress texture formats. @@ -1841,8 +1831,8 @@ GLES2DecoderImpl::GLES2DecoderImpl(SurfaceManager* surface_manager, } bool GLES2DecoderImpl::Initialize( - const scoped_refptr<gfx::GLSurface>& surface, - const scoped_refptr<gfx::GLContext>& context, + gfx::GLSurface* surface, + gfx::GLContext* context, const gfx::Size& size, const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, @@ -1852,15 +1842,13 @@ bool GLES2DecoderImpl::Initialize( DCHECK(context); DCHECK(!context_.get()); - // Take ownership of the GLSurface. TODO(apatrick): once the parent / child - // context is retired, the decoder should not take an initial surface as - // an argument to this function. - // Maybe create a short lived offscreen GLSurface for the purpose of - // initializing the decoder's GLContext. - surface_ = surface; + // Take ownership of the GLSurface. TODO(apatrick): the decoder should not + // own the surface. It should be possible to freely switch the surface the + // context renders to. + surface_.reset(surface); // Take ownership of the GLContext. - context_ = context; + context_.reset(context); // Keep only a weak pointer to the parent so we don't unmap its client // frame buffer after it has been destroyed. @@ -2579,7 +2567,7 @@ void GLES2DecoderImpl::Destroy() { if (context_.get()) context_->Destroy(); - context_ = NULL; + context_.reset(); offscreen_target_frame_buffer_.reset(); offscreen_target_color_texture_.reset(); @@ -2639,14 +2627,6 @@ void GLES2DecoderImpl::DoResizeCHROMIUM(GLuint width, GLuint height) { } } -void GLES2DecoderImpl::DoSetSurfaceCHROMIUM(GLint surface_id) { - gfx::GLSurface* surface = surface_manager_->LookupSurface(surface_id); - if (!surface) - return; - - surface_ = surface; -} - const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { if (command_id > kStartPoint && command_id < kNumCommands) { return gles2::GetCommandName(static_cast<CommandId>(command_id)); @@ -6448,9 +6428,7 @@ error::Error GLES2DecoderImpl::HandleSetLatchCHROMIUM( if (!latch) { return error::kOutOfBounds; } - base::subtle::Atomic32 old = - base::subtle::NoBarrier_CompareAndSwap(latch, 0, 1); - DCHECK(old == 0); + base::subtle::NoBarrier_Store(latch, 1); if (!latch_callback_.is_null()) latch_callback_.Run(true); return error::kNoError; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index 699f85e..7236cc0 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -22,8 +22,6 @@ class GLSurface; namespace gpu { -class SurfaceManager; - namespace gles2 { class ContextGroup; @@ -42,8 +40,7 @@ class GLES2Decoder : public CommonDecoder { typedef error::Error Error; // Creates a decoder. - static GLES2Decoder* Create(SurfaceManager* surface_manager, - ContextGroup* group); + static GLES2Decoder* Create(ContextGroup* group); virtual ~GLES2Decoder(); @@ -71,8 +68,8 @@ class GLES2Decoder : public CommonDecoder { // parent's namespace. // Returns: // true if successful. - virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, - const scoped_refptr<gfx::GLContext>& context, + virtual bool Initialize(gfx::GLSurface* surface, + gfx::GLContext* context, const gfx::Size& size, const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index 9f7711a..2ae8a03 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h @@ -2600,12 +2600,5 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( return error::kNoError; } -error::Error GLES2DecoderImpl::HandleSetSurfaceCHROMIUM( - uint32 immediate_data_size, const gles2::SetSurfaceCHROMIUM& c) { - GLint surface_id = static_cast<GLint>(c.surface_id); - DoSetSurfaceCHROMIUM(surface_id); - return error::kNoError; -} - #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index f775625..425fdce 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -30,8 +30,8 @@ class MockGLES2Decoder : public GLES2Decoder { virtual ~MockGLES2Decoder(); MOCK_METHOD8(Initialize, - bool(const scoped_refptr<gfx::GLSurface>& surface, - const scoped_refptr<gfx::GLContext>& context, + bool(gfx::GLSurface* surface, + gfx::GLContext* context, const gfx::Size& size, const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index 274d495..298640a 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -16,7 +16,6 @@ #include "gpu/command_buffer/service/test_helper.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/gl/gl_implementation.h" -#include "ui/gfx/gl/gl_surface_stub.h" using ::gfx::MockGLInterface; using ::testing::_; @@ -2934,46 +2933,6 @@ TEST_F(GLES2DecoderTest, WaitLatch) { EXPECT_EQ(0, latches[kLastValidLatchId]); } -TEST_F(GLES2DecoderTest, SetSurfaceCHROMIUMChangesSurfaceForExistentSurface) { - const int kSurfaceId = 1; - scoped_refptr<gfx::GLSurfaceStub> surface(new gfx::GLSurfaceStub); - - EXPECT_CALL(*surface_manager_.get(), LookupSurface(kSurfaceId)) - .WillOnce(Return(surface.get())) - .RetiresOnSaturation(); - - SetSurfaceCHROMIUM cmd; - cmd.Init(kSurfaceId); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - - EXPECT_EQ(surface.get(), decoder_->GetGLSurface()); -} - -TEST_F(GLES2DecoderTest, - SetSurfaceCHROMIUMDoesNotChangeSurfaceWhenSurfaceDoesNotExist) { - const int kExistentSurfaceId = 1; - const int kNonexistentSurfaceId = 2; - scoped_refptr<gfx::GLSurfaceStub> surface(new gfx::GLSurfaceStub); - - EXPECT_CALL(*surface_manager_.get(), LookupSurface(kExistentSurfaceId)) - .WillOnce(Return(surface.get())) - .RetiresOnSaturation(); - - EXPECT_CALL(*surface_manager_.get(), LookupSurface(kNonexistentSurfaceId)) - .WillOnce(Return(static_cast<gfx::GLSurface*>(NULL))) - .RetiresOnSaturation(); - - SetSurfaceCHROMIUM cmd; - cmd.Init(kExistentSurfaceId); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - - cmd.Init(kNonexistentSurfaceId); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - - EXPECT_EQ(surface.get(), decoder_->GetGLSurface()); -} - - // TODO(gman): BufferData // TODO(gman): BufferDataImmediate 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 f046167..72cd0c3 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 @@ -10,14 +10,5 @@ // TODO(gman): WaitLatchCHROMIUM - -TEST_F(GLES2DecoderTest3, SetSurfaceCHROMIUMValidArgs) { - EXPECT_CALL(*gl_, SetSurfaceCHROMIUM(1)); - SpecializedSetup<SetSurfaceCHROMIUM, 0>(true); - SetSurfaceCHROMIUM cmd; - cmd.Init(1); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_ diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index 7dbc98c..a38ab8b 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -55,7 +55,6 @@ void GLES2DecoderTestBase::InitDecoder( const char* extensions, bool has_alpha_backbuffer) { gl_.reset(new StrictMock<MockGLInterface>()); ::gfx::GLInterface::SetGLInterface(gl_.get()); - surface_manager_.reset(new StrictMock<MockSurfaceManager>); group_ = ContextGroup::Ref(new ContextGroup()); InSequence sequence; @@ -134,7 +133,7 @@ void GLES2DecoderTestBase::InitDecoder( context_ = new gfx::GLContextStub; - decoder_.reset(GLES2Decoder::Create(surface_manager_.get(), group_.get())); + decoder_.reset(GLES2Decoder::Create(group_.get())); decoder_->Initialize( surface_, context_, surface_->GetSize(), DisallowedExtensions(), NULL, std::vector<int32>(), NULL, 0); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h index d939e4f8..dc195c8 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h @@ -16,7 +16,6 @@ #include "gpu/command_buffer/service/program_manager.h" #include "gpu/command_buffer/service/renderbuffer_manager.h" #include "gpu/command_buffer/service/shader_manager.h" -#include "gpu/command_buffer/service/surface_manager_mock.h" #include "gpu/command_buffer/service/texture_manager.h" #include "gpu/GLES2/gles2_command_buffer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -257,10 +256,9 @@ class GLES2DecoderTestBase : public testing::Test { // Use StrictMock to make 100% sure we know how GL will be called. scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; - scoped_refptr<gfx::GLSurfaceStub> surface_; - scoped_refptr<gfx::GLContextStub> context_; + gfx::GLSurfaceStub* surface_; + gfx::GLContextStub* context_; scoped_ptr<GLES2Decoder> decoder_; - scoped_ptr<MockSurfaceManager> surface_manager_; GLuint client_buffer_id_; GLuint client_framebuffer_id_; diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc index 151ff9a..4c54773 100644 --- a/gpu/command_buffer/service/gpu_scheduler.cc +++ b/gpu/command_buffer/service/gpu_scheduler.cc @@ -19,7 +19,6 @@ using ::base::SharedMemory; namespace gpu { GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, - SurfaceManager* surface_manager, gles2::ContextGroup* group) : command_buffer_(command_buffer), commands_per_update_(100), @@ -30,7 +29,7 @@ GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, #endif method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { DCHECK(command_buffer); - decoder_.reset(gles2::GLES2Decoder::Create(surface_manager, group)); + decoder_.reset(gles2::GLES2Decoder::Create(group)); decoder_->set_engine(this); } @@ -56,8 +55,8 @@ GpuScheduler::~GpuScheduler() { } bool GpuScheduler::InitializeCommon( - const scoped_refptr<gfx::GLSurface>& surface, - const scoped_refptr<gfx::GLContext>& context, + gfx::GLSurface* surface, + gfx::GLContext* context, const gfx::Size& size, const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, diff --git a/gpu/command_buffer/service/gpu_scheduler.h b/gpu/command_buffer/service/gpu_scheduler.h index d75beae..ebbcc88 100644 --- a/gpu/command_buffer/service/gpu_scheduler.h +++ b/gpu/command_buffer/service/gpu_scheduler.h @@ -40,9 +40,7 @@ class ContextGroup; class GpuScheduler : public CommandBufferEngine { public: // If a group is not passed in one will be created. - GpuScheduler(CommandBuffer* command_buffer, - SurfaceManager* surface_manager, - gles2::ContextGroup* group); + GpuScheduler(CommandBuffer* command_buffer, gles2::ContextGroup* group); // This constructor is for unit tests. GpuScheduler(CommandBuffer* command_buffer, @@ -141,8 +139,8 @@ class GpuScheduler : public CommandBufferEngine { protected: // Perform common initialization. Takes ownership of GLSurface and GLContext. bool InitializeCommon( - const scoped_refptr<gfx::GLSurface>& surface, - const scoped_refptr<gfx::GLContext>& context, + gfx::GLSurface* surface, + gfx::GLContext* context, const gfx::Size& size, const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, diff --git a/gpu/command_buffer/service/gpu_scheduler_linux.cc b/gpu/command_buffer/service/gpu_scheduler_linux.cc index f1d49da..3ed89e4 100644 --- a/gpu/command_buffer/service/gpu_scheduler_linux.cc +++ b/gpu/command_buffer/service/gpu_scheduler_linux.cc @@ -31,13 +31,13 @@ bool GpuScheduler::Initialize( } // Create either a view or pbuffer based GLSurface. - scoped_refptr<gfx::GLSurface> surface; + scoped_ptr<gfx::GLSurface> surface; if (window) { DCHECK(!parent_handle); - surface = gfx::GLSurface::CreateViewGLSurface(window); + surface.reset(gfx::GLSurface::CreateViewGLSurface(window)); } else { - surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); + surface.reset(gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1))); } if (!surface.get()) { @@ -47,7 +47,7 @@ bool GpuScheduler::Initialize( } // Create a GLContext and attach the surface. - scoped_refptr<gfx::GLContext> context( + scoped_ptr<gfx::GLContext> context( gfx::GLContext::CreateGLContext(parent_context, surface.get())); if (!context.get()) { LOG(ERROR) << "CreateGLContext failed.\n"; @@ -55,8 +55,8 @@ bool GpuScheduler::Initialize( return false; } - return InitializeCommon(surface, - context, + return InitializeCommon(surface.release(), + context.release(), size, disallowed_extensions, allowed_extensions, diff --git a/gpu/command_buffer/service/gpu_scheduler_mac.cc b/gpu/command_buffer/service/gpu_scheduler_mac.cc index 449a90f..1e323ec 100644 --- a/gpu/command_buffer/service/gpu_scheduler_mac.cc +++ b/gpu/command_buffer/service/gpu_scheduler_mac.cc @@ -29,7 +29,7 @@ bool GpuScheduler::Initialize( DCHECK(parent_context); } - scoped_refptr<gfx::GLSurface> surface( + scoped_ptr<gfx::GLSurface> surface( gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1))); if (!surface.get()) { LOG(ERROR) << "CreateOffscreenGLSurface failed.\n"; @@ -38,7 +38,7 @@ bool GpuScheduler::Initialize( } // Create a GLContext and attach the surface. - scoped_refptr<gfx::GLContext> context( + scoped_ptr<gfx::GLContext> context( gfx::GLContext::CreateGLContext(parent_context, surface.get())); if (!context.get()) { LOG(ERROR) << "CreateGLContext failed.\n"; @@ -66,8 +66,8 @@ bool GpuScheduler::Initialize( } } - return InitializeCommon(surface, - context, + return InitializeCommon(surface.release(), + context.release(), size, disallowed_extensions, allowed_extensions, diff --git a/gpu/command_buffer/service/gpu_scheduler_win.cc b/gpu/command_buffer/service/gpu_scheduler_win.cc index 81ab10b..a6dcc73 100644 --- a/gpu/command_buffer/service/gpu_scheduler_win.cc +++ b/gpu/command_buffer/service/gpu_scheduler_win.cc @@ -32,11 +32,11 @@ bool GpuScheduler::Initialize( } // Create either a view or pbuffer based GLSurface. - scoped_refptr<gfx::GLSurface> surface; + scoped_ptr<gfx::GLSurface> surface; if (window) { - surface = gfx::GLSurface::CreateViewGLSurface(window); + surface.reset(gfx::GLSurface::CreateViewGLSurface(window)); } else { - surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); + surface.reset(gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1))); } if (!surface.get()) { @@ -46,7 +46,7 @@ bool GpuScheduler::Initialize( } // Create a GLContext and attach the surface. - scoped_refptr<gfx::GLContext> context( + scoped_ptr<gfx::GLContext> context( gfx::GLContext::CreateGLContext(parent_context, surface.get())); if (!context.get()) { LOG(ERROR) << "CreateGLContext failed.\n"; @@ -54,8 +54,8 @@ bool GpuScheduler::Initialize( return false; } - return InitializeCommon(surface, - context, + return InitializeCommon(surface.release(), + context.release(), size, disallowed_extensions, allowed_extensions, diff --git a/gpu/command_buffer/service/surface_manager.cc b/gpu/command_buffer/service/surface_manager.cc deleted file mode 100644 index 2fca939..0000000 --- a/gpu/command_buffer/service/surface_manager.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "gpu/command_buffer/service/surface_manager.h" - -namespace gpu { - -SurfaceManager::SurfaceManager() { -} - -SurfaceManager::~SurfaceManager() { -} - -} // namespace gpu diff --git a/gpu/command_buffer/service/surface_manager.h b/gpu/command_buffer/service/surface_manager.h deleted file mode 100644 index 4caa4ac..0000000 --- a/gpu/command_buffer/service/surface_manager.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GPU_COMMAND_BUFFER_SERVICE_SURFACE_MANAGER_H_ -#define GPU_COMMAND_BUFFER_SERVICE_SURFACE_MANAGER_H_ - -#include "base/basictypes.h" - -namespace gfx { -class GLSurface; -} - -namespace gpu { - -// Interface used to get the GLSurface corresponding to an ID communicated -// through the command buffer. -class SurfaceManager { - public: - SurfaceManager(); - virtual ~SurfaceManager(); - - virtual gfx::GLSurface* LookupSurface(int id) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(SurfaceManager); -}; - -} // namespace gpu - -#endif // GPU_COMMAND_BUFFER_SERVICE_SURFACE_MANAGER_H_ diff --git a/gpu/command_buffer/service/surface_manager_mock.h b/gpu/command_buffer/service/surface_manager_mock.h deleted file mode 100644 index f707ed8..0000000 --- a/gpu/command_buffer/service/surface_manager_mock.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GPU_COMMAND_BUFFER_SERVICE_SURFACE_MANAGER_MOCK_H_ -#define GPU_COMMAND_BUFFER_SERVICE_SURFACE_MANAGER_MOCK_H_ - -#include "gpu/command_buffer/service/surface_manager.h" - -namespace gpu { - -class MockSurfaceManager : public SurfaceManager { - public: - MockSurfaceManager() {} - MOCK_METHOD1(LookupSurface, gfx::GLSurface*(int id)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockSurfaceManager); -}; - -} // namespace gpu - -#endif // GPU_COMMAND_BUFFER_SERVICE_SURFACE_MANAGER_MOCK_H_ diff --git a/gpu/demos/framework/window.cc b/gpu/demos/framework/window.cc index 4cbfbf6..a0eedcc 100644 --- a/gpu/demos/framework/window.cc +++ b/gpu/demos/framework/window.cc @@ -60,7 +60,7 @@ bool Window::CreateRenderContext(gfx::PluginWindowHandle hwnd) { } GpuScheduler* gpu_scheduler( - new GpuScheduler(command_buffer.get(), NULL, NULL)); + new GpuScheduler(command_buffer.get(), NULL)); if (!gpu_scheduler->Initialize(hwnd, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL, std::vector<int32>(), diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index 2308196..7bfded1 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -109,7 +109,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, using gpu::GpuScheduler; std::vector<int32> attribs; scoped_ptr<GpuScheduler> gpu_scheduler( - new GpuScheduler(command_buffer_.get(), NULL, NULL)); + new GpuScheduler(command_buffer_.get(), NULL)); if (!gpu_scheduler->Initialize( win, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL, attribs, NULL, 0)) diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index 0a5dd31..f59e6f9 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -226,8 +226,6 @@ 'command_buffer/service/shader_manager.cc', 'command_buffer/service/shader_translator.h', 'command_buffer/service/shader_translator.cc', - 'command_buffer/service/surface_manager.cc', - 'command_buffer/service/surface_manager.h', 'command_buffer/service/texture_manager.h', 'command_buffer/service/texture_manager.cc', ], @@ -295,7 +293,6 @@ 'command_buffer/service/renderbuffer_manager_unittest.cc', 'command_buffer/service/shader_manager_unittest.cc', 'command_buffer/service/shader_translator_unittest.cc', - 'command_buffer/service/surface_manager_mock.h', 'command_buffer/service/test_helper.cc', 'command_buffer/service/test_helper.h', 'command_buffer/service/texture_manager_unittest.cc', |