diff options
author | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-13 01:07:32 +0000 |
---|---|---|
committer | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-13 01:07:32 +0000 |
commit | 31fe0b6c99296b4016019ede18204307fdae2ea8 (patch) | |
tree | e4ab2382cc52b21466caa732f73e8d86fb9c45a9 /gpu | |
parent | 01f07bf53b3ae7af8511cfb5437837a031f49487 (diff) | |
download | chromium_src-31fe0b6c99296b4016019ede18204307fdae2ea8.zip chromium_src-31fe0b6c99296b4016019ede18204307fdae2ea8.tar.gz chromium_src-31fe0b6c99296b4016019ede18204307fdae2ea8.tar.bz2 |
Implement GL_CHROMIUM_rate_limit_offscreen_context
+jamesr for OWNERS on content/renderer because nobody else on GPU has owners there. :s
BUG=81481
Review URL: http://codereview.chromium.org/6976012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85233 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/GLES2/gl2ext.h | 20 | ||||
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 10 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_c_lib_autogen.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.cc | 9 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.h | 1 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation_autogen.h | 2 | ||||
-rw-r--r-- | gpu/command_buffer/service/feature_info.cc | 1 |
7 files changed, 45 insertions, 2 deletions
diff --git a/gpu/GLES2/gl2ext.h b/gpu/GLES2/gl2ext.h index d9d64e0..8738f82 100644 --- a/gpu/GLES2/gl2ext.h +++ b/gpu/GLES2/gl2ext.h @@ -971,9 +971,27 @@ typedef void (GL_APIENTRYP PFNGLWaitLATCHCHROMIUM) (GLuint latch_id); #endif #endif +/* GL_CHROMIUM_rate_limit_offscreen_context */ +/* + * This extension will block if the calling context has gotten more than two + * glRateLimit calls ahead of the GPU process. This keeps the client in sync + * with the GPU without having to call swapbuffers, which has potentially + * undesirable side effects. + */ +#ifndef GL_CHROMIUM_rate_limit_offscreen_context +#define GL_CHROMIUM_rate_limit_offscreen_context 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glRateLimitOffscreenContextCHROMIUM GLES2_GET_FUN(RateLimitOffscreenContextCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glRateLimitOffscreenContextCHROMIUM (void); +#endif +#else +typedef void (GL_APIENTRYP PFNGLRATELIMITOFFSCREENCONTEXTCHROMIUM) (); +#endif +#endif + #ifdef __cplusplus } #endif #endif /* __gl2ext_h_ */ - diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index a955e00..cf36ade 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -213,6 +213,7 @@ GL_APICALL const GLchar* GL_APIENTRY glGetRequestableExtensionsCHROMIUM (void); GL_APICALL void GL_APIENTRY glRequestExtensionCHROMIUM (const char* extension); 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); """ # This is the list of all commmands that will be generated and their Id. @@ -1694,6 +1695,11 @@ _FUNCTION_INFO = { 'WaitLatchCHROMIUM': { 'type': 'Custom', }, + 'RateLimitOffscreenContextCHROMIUM': { + 'gen_cmd': False, + 'extension': True, + 'chromium': True, + }, } @@ -2225,9 +2231,11 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') impl_decl = func.GetInfo('impl_decl') + gen_cmd = func.GetInfo('gen_cmd') if (func.can_auto_generate and (impl_func == None or impl_func == True) and - (impl_decl == None or impl_decl == True)): + (impl_decl == None or impl_decl == True) and + (gen_cmd == None or gen_cmd == True)): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 9a75761..889a243 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -885,6 +885,10 @@ void GLES2WaitLatchCHROMIUM(GLuint latch_id) { GPU_CLIENT_LOG("WaitLatchCHROMIUM" << "(" << latch_id << ")"); gles2::GetGLContext()->WaitLatchCHROMIUM(latch_id); } +void GLES2RateLimitOffscreenContextCHROMIUM() { + GPU_CLIENT_LOG("RateLimitOffscreenContextCHROMIUM" << "(" << ")"); + gles2::GetGLContext()->RateLimitOffscreenContextCHROMIUM(); +} #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_C_LIB_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 3810919..7bd07b4 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -1712,5 +1712,14 @@ void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { helper_->SetBucketSize(kResultBucketId, 0); } +void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() { + // Wait if this would add too many rate limit tokens. + if (rate_limit_tokens_.size() == kMaxSwapBuffers) { + helper_->WaitForToken(rate_limit_tokens_.front()); + rate_limit_tokens_.pop(); + } + rate_limit_tokens_.push(helper_->InsertToken()); +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 36f7dee2..3c25116 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -299,6 +299,7 @@ class GLES2Implementation { std::string last_error_; std::queue<int32> swap_buffers_tokens_; + std::queue<int32> rate_limit_tokens_; // pack alignment as last set by glPixelStorei GLint pack_alignment_; diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index bb392b0..97704a1 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -897,5 +897,7 @@ void WaitLatchCHROMIUM(GLuint latch_id) { helper_->WaitLatchCHROMIUM(latch_id); } +void RateLimitOffscreenContextCHROMIUM(); + #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 3ed88ad..f6bf440 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -109,6 +109,7 @@ void FeatureInfo::AddFeatures(const char* desired_features) { AddExtensionString("GL_CHROMIUM_strict_attribs"); AddExtensionString("GL_CHROMIUM_latch"); AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); + AddExtensionString("GL_CHROMIUM_rate_limit_offscreen_context"); // Only turn this feature on if it is requested. Not by default. if (desired_features && ext.Desire("GL_CHROMIUM_webglsl")) { |