diff options
author | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-26 02:05:07 +0000 |
---|---|---|
committer | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-26 02:05:07 +0000 |
commit | 729c0b4689ff2b37461dd90b36d2682f0177779f (patch) | |
tree | 27cd129511910d0886f2a99ef7d370ed40b63927 /gpu | |
parent | f22b94f4b86d1fb9f70ea006024d272c4350493f (diff) | |
download | chromium_src-729c0b4689ff2b37461dd90b36d2682f0177779f.zip chromium_src-729c0b4689ff2b37461dd90b36d2682f0177779f.tar.gz chromium_src-729c0b4689ff2b37461dd90b36d2682f0177779f.tar.bz2 |
Part 2/3 (GL) of adding with device scale factor to transport surfaces
Add a scale factor argument to glResizeCHROMIUM.
Pass the scale factor on to the resize callback in ImageTransportSurface,
and drop it on the floor there.
BUG=132714
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/15685003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
17 files changed, 45 insertions, 30 deletions
diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index d23191c..2568074 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h @@ -575,7 +575,8 @@ typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) ( #ifndef GL_CHROMIUM_resize #define GL_CHROMIUM_resize 1 #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glResizeCHROMIUM(GLuint width, GLuint height); +GL_APICALL void GL_APIENTRY glResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor); #endif typedef void (GL_APIENTRYP PFNGLRESIZECHROMIUMPROC) ( GLuint width, GLuint height); diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 6df6060..f617163 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -618,8 +618,8 @@ void* GLES2MapTexSubImage2DCHROMIUM( void GLES2UnmapTexSubImage2DCHROMIUM(const void* mem) { gles2::GetGLContext()->UnmapTexSubImage2DCHROMIUM(mem); } -void GLES2ResizeCHROMIUM(GLuint width, GLuint height) { - gles2::GetGLContext()->ResizeCHROMIUM(width, height); +void GLES2ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) { + gles2::GetGLContext()->ResizeCHROMIUM(width, height, scale_factor); } const GLchar* GLES2GetRequestableExtensionsCHROMIUM() { return gles2::GetGLContext()->GetRequestableExtensionsCHROMIUM(); diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 1a99879..a290365 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -1777,11 +1777,11 @@ } } - void ResizeCHROMIUM(GLuint width, GLuint height) { + void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) { gles2::cmds::ResizeCHROMIUM* c = GetCmdSpace<gles2::cmds::ResizeCHROMIUM>(); if (c) { - c->Init(width, height); + c->Init(width, height, scale_factor); } } diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 3837424..b64c67b 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -2867,11 +2867,12 @@ void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { CheckGLError(); } -void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height) { +void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height, + float scale_factor) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResizeCHROMIUM(" - << width << ", " << height << ")"); - helper_->ResizeCHROMIUM(width, height); + << width << ", " << height << ", " << scale_factor << ")"); + helper_->ResizeCHROMIUM(width, height, scale_factor); CheckGLError(); } diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 3123b59..b60730b 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -453,7 +453,8 @@ virtual void* MapTexSubImage2DCHROMIUM( virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) OVERRIDE; +virtual void ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index d783468..a93f8eb 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -1643,9 +1643,9 @@ TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { cmds::ResizeCHROMIUM cmd; }; Cmds expected; - expected.cmd.Init(1, 2); + expected.cmd.Init(1, 2, 3); - gl_->ResizeCHROMIUM(1, 2); + gl_->ResizeCHROMIUM(1, 2, 3); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index 0fca7e8..a933b81 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h @@ -260,7 +260,8 @@ virtual void* MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) = 0; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) = 0; +virtual void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) = + 0; virtual const GLchar* GetRequestableExtensionsCHROMIUM() = 0; virtual void RequestExtensionCHROMIUM(const char* extension) = 0; virtual void RateLimitOffscreenContextCHROMIUM() = 0; diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index 00c3a90..a16fe5d 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -288,7 +288,8 @@ virtual void* MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) OVERRIDE; +virtual void ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; 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 36ca9b8..ce4b53b 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h @@ -549,7 +549,7 @@ void* GLES2InterfaceStub::MapTexSubImage2DCHROMIUM( void GLES2InterfaceStub::UnmapTexSubImage2DCHROMIUM(const void* /* mem */) { } void GLES2InterfaceStub::ResizeCHROMIUM( - GLuint /* width */, GLuint /* height */) { + GLuint /* width */, GLuint /* height */, GLfloat /* scale_factor */) { } const GLchar* GLES2InterfaceStub::GetRequestableExtensionsCHROMIUM() { return 0; diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index 9888a5d..bef6ce8c 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -288,7 +288,8 @@ virtual void* MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) OVERRIDE; +virtual void ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; 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 40be4e9..a99a36a 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h @@ -1013,9 +1013,10 @@ void GLES2TraceImplementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { gl_->UnmapTexSubImage2DCHROMIUM(mem); } -void GLES2TraceImplementation::ResizeCHROMIUM(GLuint width, GLuint height) { +void GLES2TraceImplementation::ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ResizeCHROMIUM"); - gl_->ResizeCHROMIUM(width, height); + gl_->ResizeCHROMIUM(width, height, scale_factor); } const GLchar* GLES2TraceImplementation::GetRequestableExtensionsCHROMIUM() { diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index ec68be4..ef56e5a 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt @@ -182,7 +182,7 @@ GL_APICALL void* GL_APIENTRY glMapBufferSubDataCHROMIUM (GLuint target, G GL_APICALL void GL_APIENTRY glUnmapBufferSubDataCHROMIUM (const void* mem); GL_APICALL void* GL_APIENTRY glMapTexSubImage2DCHROMIUM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access); GL_APICALL void GL_APIENTRY glUnmapTexSubImage2DCHROMIUM (const void* mem); -GL_APICALL void GL_APIENTRY glResizeCHROMIUM (GLuint width, GLuint height); +GL_APICALL void GL_APIENTRY glResizeCHROMIUM (GLuint width, GLuint height, GLfloat scale_factor); GL_APICALL const GLchar* GL_APIENTRY glGetRequestableExtensionsCHROMIUM (void); GL_APICALL void GL_APIENTRY glRequestExtensionCHROMIUM (const char* extension); GL_APICALL void GL_APIENTRY glRateLimitOffscreenContextCHROMIUM (void); diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index 2e2b736..12fc743 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -9449,30 +9449,34 @@ struct ResizeCHROMIUM { header.SetCmd<ValueType>(); } - void Init(GLuint _width, GLuint _height) { + void Init(GLuint _width, GLuint _height, GLfloat _scale_factor) { SetHeader(); width = _width; height = _height; + scale_factor = _scale_factor; } - void* Set(void* cmd, GLuint _width, GLuint _height) { - static_cast<ValueType*>(cmd)->Init(_width, _height); + void* Set(void* cmd, GLuint _width, GLuint _height, GLfloat _scale_factor) { + static_cast<ValueType*>(cmd)->Init(_width, _height, _scale_factor); return NextCmdAddress<ValueType>(cmd); } gpu::CommandHeader header; uint32 width; uint32 height; + float scale_factor; }; -COMPILE_ASSERT(sizeof(ResizeCHROMIUM) == 12, - Sizeof_ResizeCHROMIUM_is_not_12); +COMPILE_ASSERT(sizeof(ResizeCHROMIUM) == 16, + Sizeof_ResizeCHROMIUM_is_not_16); COMPILE_ASSERT(offsetof(ResizeCHROMIUM, header) == 0, OffsetOf_ResizeCHROMIUM_header_not_0); COMPILE_ASSERT(offsetof(ResizeCHROMIUM, width) == 4, OffsetOf_ResizeCHROMIUM_width_not_4); COMPILE_ASSERT(offsetof(ResizeCHROMIUM, height) == 8, OffsetOf_ResizeCHROMIUM_height_not_8); +COMPILE_ASSERT(offsetof(ResizeCHROMIUM, scale_factor) == 12, + OffsetOf_ResizeCHROMIUM_scale_factor_not_12); struct GetRequestableExtensionsCHROMIUM { typedef GetRequestableExtensionsCHROMIUM ValueType; 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 e11bc47..b23b569 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -3706,12 +3706,14 @@ TEST_F(GLES2FormatTest, ResizeCHROMIUM) { void* next_cmd = cmd.Set( &cmd, static_cast<GLuint>(11), - static_cast<GLuint>(12)); + static_cast<GLuint>(12), + static_cast<GLfloat>(13)); EXPECT_EQ(static_cast<uint32>(cmds::ResizeCHROMIUM::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); EXPECT_EQ(static_cast<GLuint>(11), cmd.width); EXPECT_EQ(static_cast<GLuint>(12), cmd.height); + EXPECT_EQ(static_cast<GLfloat>(13), cmd.scale_factor); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd)); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index cdc83c8..2fad005 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -561,7 +561,7 @@ class GLES2DecoderImpl : public GLES2Decoder { virtual void PerformIdleWork() OVERRIDE; virtual void SetResizeCallback( - const base::Callback<void(gfx::Size)>& callback) OVERRIDE; + const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; virtual Logger* GetLogger() OVERRIDE; virtual ErrorState* GetErrorState() OVERRIDE; @@ -1626,7 +1626,7 @@ class GLES2DecoderImpl : public GLES2Decoder { scoped_ptr<VertexArrayManager> vertex_array_manager_; - base::Callback<void(gfx::Size)> resize_callback_; + base::Callback<void(gfx::Size, float)> resize_callback_; WaitSyncPointCallback wait_sync_point_callback_; @@ -3025,7 +3025,7 @@ void GLES2DecoderImpl::UpdateParentTextureInfo() { } void GLES2DecoderImpl::SetResizeCallback( - const base::Callback<void(gfx::Size)>& callback) { + const base::Callback<void(gfx::Size, float)>& callback) { resize_callback_ = callback; } @@ -3430,6 +3430,7 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( GLuint width = static_cast<GLuint>(c.width); GLuint height = static_cast<GLuint>(c.height); + GLfloat scale_factor = c.scale_factor; TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); width = std::max(1U, width); @@ -3450,7 +3451,7 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( } if (!resize_callback_.is_null()) { - resize_callback_.Run(gfx::Size(width, height)); + resize_callback_.Run(gfx::Size(width, height), scale_factor); DCHECK(context_->IsCurrent(surface_.get())); if (!context_->IsCurrent(surface_.get())) { LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index 14c82f0..86d4801 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -173,7 +173,7 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, // Sets a callback which is called when a glResizeCHROMIUM command // is processed. virtual void SetResizeCallback( - const base::Callback<void(gfx::Size)>& callback) = 0; + const base::Callback<void(gfx::Size, float)>& callback) = 0; virtual void SetStreamTextureManager(StreamTextureManager* manager) = 0; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index 12d1cbd..3f714bd 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -68,7 +68,8 @@ class MockGLES2Decoder : public GLES2Decoder { MOCK_CONST_METHOD1(RestoreTextureUnitBindings, void(unsigned unit)); MOCK_METHOD0(GetQueryManager, gpu::gles2::QueryManager*()); MOCK_METHOD0(GetVertexArrayManager, gpu::gles2::VertexArrayManager*()); - MOCK_METHOD1(SetResizeCallback, void(const base::Callback<void(gfx::Size)>&)); + MOCK_METHOD1( + SetResizeCallback, void(const base::Callback<void(gfx::Size, float)>&)); MOCK_METHOD1(SetStreamTextureManager, void(StreamTextureManager*)); MOCK_METHOD0(GetAsyncPixelTransferDelegate, AsyncPixelTransferDelegate*()); |