Changeset 91112 in webkit
- Timestamp:
- Jul 15, 2011 2:22:45 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91105 r91112 1 2011-07-15 Kenneth Russell <kbr@google.com> 2 3 Don't restore WebGL context if it was guilty of a graphics reset 4 https://bugs.webkit.org/show_bug.cgi?id=64497 5 6 Reviewed by Stephen White. 7 8 Updated expectations for context-lost test and added comment about 9 the order of event delivery. Per the specification of the 10 WEBKIT_lose_context extension, the previous expectations were wrong. 11 12 * fast/canvas/webgl/context-lost-expected.txt: 13 * fast/canvas/webgl/context-lost.html: 14 1 15 2011-07-15 Adrienne Walker <enne@google.com> 2 16 -
trunk/LayoutTests/fast/canvas/webgl/context-lost-expected.txt
r91053 r91112 16 16 17 17 Lose context 18 PASS extension.loseContext() was expected value: NO_ERROR.19 20 18 Test lost context 21 19 PASS gl.isContextLost() is true … … 180 178 PASS gl.isTexture(texture) is false 181 179 PASS gl.getError() is gl.NO_ERROR 180 181 PASS extension.loseContext() was expected value: NO_ERROR. 182 182 183 PASS successfullyParsed is true 183 184 -
trunk/LayoutTests/fast/canvas/webgl/context-lost.html
r91053 r91112 60 60 debug(""); 61 61 debug("Lose context"); 62 63 // Note: this will cause the context to be lost, and the 64 // webglcontextlost event listener to be called, immediately. 62 65 shouldGenerateGLError(gl, gl.NO_ERROR, "extension.loseContext()"); 63 66 debug(""); … … 293 296 shouldBe("gl.getError()", "gl.NO_ERROR"); 294 297 298 debug(""); 299 295 300 finish(); 296 301 } -
trunk/Source/WebCore/ChangeLog
r91110 r91112 1 2011-07-15 Kenneth Russell <kbr@google.com> 2 3 Don't restore WebGL context if it was guilty of a graphics reset 4 https://bugs.webkit.org/show_bug.cgi?id=64497 5 6 Reviewed by Stephen White. 7 8 Use getGraphicsResetStatusARB already defined in Extensions3D to 9 determine why the context was lost, and respond to guilty context 10 notifications by forbidding restoration of the context. 11 12 It isn't currently possible to write an automated test for this. 13 We might consider extending the WEBKIT_lose_context extension to 14 allow a reason to be provided why the context was lost. It was 15 tested manually in Chromium on Windows and Linux with some test 16 cases that provoke actual graphics card resets. 17 18 * html/canvas/WebGLRenderingContext.cpp: 19 (WebCore::WebGLRenderingContext::WebGLRenderingContextRestoreTimer::fired): 20 (WebCore::WebGLRenderingContext::forceLostContext): 21 (WebCore::WebGLRenderingContext::maybeRestoreContext): 22 * html/canvas/WebGLRenderingContext.h: 23 1 24 2011-07-15 Chris Marrin <cmarrin@apple.com> 2 25 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r90180 r91112 340 340 void WebGLRenderingContext::WebGLRenderingContextRestoreTimer::fired() 341 341 { 342 // Timer is started when m_contextLost is false. It will first call 343 // onLostContext, which will set m_contextLost to true. Then it will keep 344 // calling restoreContext and reschedule itself until m_contextLost is back 345 // to false. 346 if (!m_context->m_contextLost) { 347 m_context->onLostContext(); 348 startOneShot(secondsBetweenRestoreAttempts); 349 } else { 350 // The rendering context is not restored if there is no handler for 351 // the context restored event. 352 if (!m_context->canvas()->hasEventListeners(eventNames().webglcontextrestoredEvent)) 353 return; 354 355 m_context->restoreContext(); 356 if (m_context->m_contextLost) 357 startOneShot(secondsBetweenRestoreAttempts); 358 } 342 m_context->maybeRestoreContext(); 359 343 } 360 344 … … 3941 3925 } 3942 3926 3943 m _restoreTimer.startOneShot(0);3927 maybeRestoreContext(); 3944 3928 } 3945 3929 … … 4795 4779 } 4796 4780 4781 void WebGLRenderingContext::maybeRestoreContext() 4782 { 4783 // Timer is started when m_contextLost is false. It will first call 4784 // onLostContext, which will set m_contextLost to true. Then it will keep 4785 // calling restoreContext and reschedule itself until m_contextLost is back 4786 // to false. 4787 bool shouldStartTimer = false; 4788 bool shouldAttemptRestoreNow = true; 4789 4790 if (!m_contextLost) { 4791 onLostContext(); 4792 shouldStartTimer = true; 4793 shouldAttemptRestoreNow = false; 4794 } 4795 4796 // The rendering context is not restored if there is no handler for 4797 // the context restored event. 4798 if (!canvas()->hasEventListeners(eventNames().webglcontextrestoredEvent)) 4799 return; 4800 4801 int contextLostReason = m_context->getExtensions()->getGraphicsResetStatusARB(); 4802 4803 switch (contextLostReason) { 4804 case GraphicsContext3D::NO_ERROR: 4805 // The GraphicsContext3D implementation might not fully 4806 // support GL_ARB_robustness semantics yet. Alternatively, the 4807 // WebGL WEBKIT_lose_context extension might have been used to 4808 // force a lost context. 4809 break; 4810 case Extensions3D::GUILTY_CONTEXT_RESET_ARB: 4811 // The rendering context is not restored if this context was 4812 // guilty of causing the graphics reset. 4813 printWarningToConsole("WARNING: WebGL content on the page caused the graphics card to reset; not restoring the context"); 4814 return; 4815 case Extensions3D::INNOCENT_CONTEXT_RESET_ARB: 4816 // Always allow the context to be restored. 4817 break; 4818 case Extensions3D::UNKNOWN_CONTEXT_RESET_ARB: 4819 // Warn. Ideally, prompt the user telling them that WebGL 4820 // content on the page might have caused the graphics card to 4821 // reset and ask them whether they want to continue running 4822 // the content. Only if they say "yes" should we start 4823 // attempting to restore the context. 4824 printWarningToConsole("WARNING: WebGL content on the page might have caused the graphics card to reset"); 4825 break; 4826 } 4827 4828 if (shouldAttemptRestoreNow) { 4829 restoreContext(); 4830 if (m_contextLost) 4831 shouldStartTimer = true; 4832 } 4833 4834 if (shouldStartTimer) 4835 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts); 4836 } 4837 4797 4838 WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity) 4798 4839 : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity])) -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r90180 r91112 611 611 void restoreStatesAfterVertexAttrib0Simulation(); 612 612 613 // Helper for restoration after context lost. 614 void maybeRestoreContext(); 615 613 616 friend class WebGLStateRestorer; 614 617 }; -
trunk/Source/WebKit/chromium/ChangeLog
r91107 r91112 1 2011-07-15 Kenneth Russell <kbr@google.com> 2 3 Don't restore WebGL context if it was guilty of a graphics reset 4 https://bugs.webkit.org/show_bug.cgi?id=64497 5 6 Reviewed by Stephen White. 7 8 Actually implement getGraphicsResetStatusARB rather than inferring 9 the status based on whether the context has been lost. 10 11 * public/WebGraphicsContext3D.h: 12 (WebKit::WebGraphicsContext3D::getGraphicsResetStatusARB): 13 * src/Extensions3DChromium.cpp: 14 (WebCore::Extensions3DChromium::getGraphicsResetStatusARB): 15 * src/GraphicsContext3DChromium.cpp: 16 * src/GraphicsContext3DInternal.h: 17 1 18 2011-07-15 Dan Bernstein <mitz@apple.com> 2 19 -
trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h
r90878 r91112 357 357 358 358 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) {} 359 // GL_ARB_robustness 360 // 361 // This entry point must provide slightly different semantics than 362 // the GL_ARB_robustness extension; specifically, the lost context 363 // state is sticky, rather than reported only once. 364 virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ } 359 365 }; 360 366 -
trunk/Source/WebKit/chromium/src/Extensions3DChromium.cpp
r86278 r91112 65 65 int Extensions3DChromium::getGraphicsResetStatusARB() 66 66 { 67 return m_internal->isContextLost() ? static_cast<int>(Extensions3D::UNKNOWN_CONTEXT_RESET_ARB) : static_cast<int>(GraphicsContext3D::NO_ERROR);67 return static_cast<int>(m_internal->getGraphicsResetStatusARB()); 68 68 } 69 69 -
trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
r90878 r91112 841 841 842 842 DELEGATE_TO_IMPL(rateLimitOffscreenContextCHROMIUM) 843 DELEGATE_TO_IMPL_R(getGraphicsResetStatusARB, GC3Denum) 843 844 844 845 //---------------------------------------------------------------------- -
trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h
r90872 r91112 293 293 void rateLimitOffscreenContextCHROMIUM(); 294 294 295 // GL_ARB_robustness 296 GC3Denum getGraphicsResetStatusARB(); 297 295 298 private: 296 299 OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
Note: See TracChangeset
for help on using the changeset viewer.