diff options
author | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 22:05:49 +0000 |
---|---|---|
committer | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 22:05:49 +0000 |
commit | 8d2c15745a7118ae3dab7e20e046257a66fc46a5 (patch) | |
tree | acb13a4cd9b0babf055e35d790ad52f07f55da9c /webkit/gpu | |
parent | 18d0fb7f67bac43dfc16efd369b4e2999eaa2912 (diff) | |
download | chromium_src-8d2c15745a7118ae3dab7e20e046257a66fc46a5.zip chromium_src-8d2c15745a7118ae3dab7e20e046257a66fc46a5.tar.gz chromium_src-8d2c15745a7118ae3dab7e20e046257a66fc46a5.tar.bz2 |
Detect and expose loss of OpenGL context using GL_ARB_robustness.
This initial patch changes the Linux port to use
GLX_ARB_create_context_robustness when available, and tests
periodically whether the context has been lost after each draw call
and when making the context current. The detection of context loss
also works with EGL and ANGLE, although it always reports an unknown
reset status.
WebKit changes will follow which test the reset status and determine
what to do in response; for example, the policy might be to never
restore a WebGL context which was lost (due to a GPU reset) and which
was determined to be the guilty context.
Tested manually with WebGL stress tests and verified on Linux and
Windows that in at least some situations it is possible to detect
guilty contexts and shut down the associated WebGL application. Some
precision of this detection was recently lost and will need to be
fixed in following CLs. Also updated and ran GPU unit tests.
BUG=88106
TEST=none (tested manually; try servers)
Review URL: http://codereview.chromium.org/7331020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92429 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/gpu')
4 files changed, 16 insertions, 0 deletions
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 9a6f472..0b623cc 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -752,6 +752,7 @@ WebGraphicsContext3DInProcessCommandBufferImpl:: plugin_handle_(NULL), #endif // defined(OS_MACOSX) context_lost_callback_(0), + context_lost_reason_(GL_NO_ERROR), cached_width_(0), cached_height_(0), bound_fbo_(0) { @@ -1788,7 +1789,14 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::setContextLostCallback( context_lost_callback_ = cb; } +WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: + getGraphicsResetStatusARB() { + return context_lost_reason_; +} + void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { + // TODO(kbr): improve the precision here. + context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; if (context_lost_callback_) { context_lost_callback_->onContextLost(); } diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index 3b6aaa8..5e2df99 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -429,6 +429,7 @@ class WebGraphicsContext3DInProcessCommandBufferImpl virtual void setContextLostCallback( WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); + virtual WGC3Denum getGraphicsResetStatusARB(); private: // SwapBuffers callback. @@ -451,6 +452,7 @@ class WebGraphicsContext3DInProcessCommandBufferImpl gfx::PluginWindowHandle plugin_handle_; #endif WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; + WGC3Denum context_lost_reason_; WebKit::WebGraphicsContext3D::Attributes attributes_; int cached_width_, cached_height_; diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc index 300bd27..e7d5757 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc @@ -1573,6 +1573,11 @@ void WebGraphicsContext3DInProcessImpl::deleteTexture(WebGLId texture) { glDeleteTextures(1, &texture); } +WGC3Denum WebGraphicsContext3DInProcessImpl::getGraphicsResetStatusARB() { + // TODO(kbr): this implementation doesn't support lost contexts yet. + return GL_NO_ERROR; +} + bool WebGraphicsContext3DInProcessImpl::AngleCreateCompilers() { if (!ShInitialize()) return false; diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_impl.h index 304f9fb..aafff28 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.h +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.h @@ -407,6 +407,7 @@ class WebGraphicsContext3DInProcessImpl : public WebGraphicsContext3D { virtual void setContextLostCallback( WebGraphicsContext3D::WebGraphicsContextLostCallback* callback) {} + virtual WGC3Denum getGraphicsResetStatusARB(); private: // ANGLE related. |