Changeset 180609 in webkit
- Timestamp:
- Feb 24, 2015 8:19:30 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r180608 r180609 1 2015-02-19 Roger Fong <roger_fong@apple.com> 2 3 WebGL: Destroy the GLContext if a GPU restart has been detected. 4 https://bugs.webkit.org/show_bug.cgi?id=141567. 5 <rdar://problem/18507496> 6 7 Reviewed by Dean Jackson. 8 9 * html/canvas/WebGLRenderingContextBase.cpp: 10 (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): 11 * platform/graphics/GraphicsContext3D.h: 12 (WebCore::GraphicsContext3D::setWebGLContext): 13 Keep track of which WebGLRenderingContext is associated with the current GraphicsContext3D. 14 * platform/graphics/mac/GraphicsContext3DMac.mm: 15 (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Helper method to check GPU status. 16 (WebCore::GraphicsContext3D::GraphicsContext3D): 17 Don’t immediately abort the GPU process when the restart status is kCGLCPGPURestartStatusBlacklisted. 18 * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: 19 (WebCore::GraphicsContext3D::forceContextLost): 20 Force the WebGLRenderingContext to be lost. 21 (WebCore::GraphicsContext3D::drawArrays): Check GPU status after calling drawArrays. 22 (WebCore::GraphicsContext3D::drawElements): Check GPU status after calling drawElements. 23 * WebCore.xcodeproj/project.pbxproj: Add SPI header for iOS. 24 * platform/spi/ios/OpenGLESSPI.h: Added. 25 1 26 2015-02-24 Stephanie Lewis <slewis@apple.com> 2 27 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r180601 r180609 9499 9499 6F995A2F1A70833700A735F4 /* JSWebGLVertexArrayObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLVertexArrayObject.cpp; sourceTree = "<group>"; }; 9500 9500 6F995A301A70833700A735F4 /* JSWebGLVertexArrayObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLVertexArrayObject.h; sourceTree = "<group>"; }; 9501 6FAD4A561A9D0FAE009F7D3C /* OpenGLESSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OpenGLESSPI.h; path = ios/OpenGLESSPI.h; sourceTree = "<group>"; }; 9501 9502 7117445614BC34E200EE5FC8 /* SVGTextMetricsBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextMetricsBuilder.cpp; sourceTree = "<group>"; }; 9502 9503 7117445714BC34E200EE5FC8 /* SVGTextMetricsBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextMetricsBuilder.h; sourceTree = "<group>"; }; … … 18571 18572 CE1252401A16B1B600864480 /* MediaPlayerSPI.h */, 18572 18573 CE1252381A166FA000864480 /* QuickLookSPI.h */, 18574 6FAD4A561A9D0FAE009F7D3C /* OpenGLESSPI.h */, 18573 18575 ); 18574 18576 name = ios; -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r180285 r180609 464 464 m_contextGroup = WebGLContextGroup::create(); 465 465 m_contextGroup->addContext(this); 466 467 m_context->setWebGLContext(this); 466 468 467 469 m_maxViewportDims[0] = m_maxViewportDims[1] = 0; -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r179842 r180609 99 99 class IntRect; 100 100 class IntSize; 101 class WebGLRenderingContextBase; 101 102 #if USE(CAIRO) 102 103 class PlatformContextCairo; … … 781 782 782 783 bool makeContextCurrent(); 784 void setWebGLContext(WebGLRenderingContextBase* base) { m_webglContext = base; } 783 785 784 786 // With multisampling on, blit from multisampleFBO to regular FBO. … … 1129 1131 void markLayerComposited(); 1130 1132 bool layerComposited() const; 1133 void forceContextLost(); 1131 1134 1132 1135 void paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer*); … … 1257 1260 GraphicsContext3D(Attributes, HostWindow*, RenderStyle = RenderOffscreen); 1258 1261 static int numActiveContexts; 1262 static int GPUCheckCounter; 1259 1263 1260 1264 // Helper for packImageData/extractImageData/extractTextureData which implement packing of pixel … … 1271 1275 void validateDepthStencil(const char* packedDepthStencilExtension); 1272 1276 void validateAttributes(); 1277 1278 // Call to make during draw calls to check on the GPU's status. 1279 void checkGPUStatusIfNecessary(); 1273 1280 1274 1281 // Read rendering results into a pixel array with the same format as the … … 1439 1446 friend class GraphicsContext3DPrivate; 1440 1447 std::unique_ptr<GraphicsContext3DPrivate> m_private; 1448 1449 WebGLRenderingContextBase* m_webglContext; 1441 1450 }; 1442 1451 -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
r179398 r180609 283 283 } 284 284 285 void GraphicsContext3D::checkGPUStatusIfNecessary() 286 { 287 } 288 285 289 PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() 286 290 { -
trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
r173112 r180609 184 184 } 185 185 186 void GraphicsContext3D::checkGPUStatusIfNecessary() 187 { 188 } 189 186 190 bool GraphicsContext3D::isGLES2Compliant() const 187 191 { -
trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
r178166 r180609 43 43 #include "ImageBuffer.h" 44 44 #if PLATFORM(IOS) 45 #import "OpenGLESSPI.h" 45 46 #import <OpenGLES/ES2/glext.h> 46 47 #import <OpenGLES/EAGL.h> … … 53 54 #include "WebGLLayer.h" 54 55 #include "WebGLObject.h" 56 #include "WebGLRenderingContextBase.h" 55 57 #include <runtime/ArrayBuffer.h> 56 58 #include <runtime/ArrayBufferView.h> … … 64 66 const int maxActiveContexts = 64; 65 67 int GraphicsContext3D::numActiveContexts = 0; 66 68 const int GPUStatusCheckThreshold = 5; 69 int GraphicsContext3D::GPUCheckCounter = 0; 70 67 71 // FIXME: This class is currently empty on Mac, but will get populated as 68 72 // the restructuring in https://bugs.webkit.org/show_bug.cgi?id=66903 is done … … 146 150 , m_multisampleColorBuffer(0) 147 151 , m_private(std::make_unique<GraphicsContext3DPrivate>(this)) 152 , m_webglContext(0) 148 153 { 149 154 UNUSED_PARAM(hostWindow); … … 197 202 198 203 CGLError err = CGLCreateContext(pixelFormatObj, 0, &m_contextObj); 204 #if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || PLATFORM(IOS)) 205 GLint abortOnBlacklist = 0; 206 #if PLATFORM(MAC) 207 CGLSetParameter(m_contextObj, kCGLCPAbortOnGPURestartStatusBlacklisted, &abortOnBlacklist); 208 #elif PLATFORM(IOS) 209 CGLSetParameter(m_contextObj, kEAGLCPAbortOnGPURestartStatusBlacklisted, &abortOnBlacklist); 210 #endif 211 #endif 212 199 213 CGLDestroyPixelFormat(pixelFormatObj); 200 214 … … 354 368 } 355 369 370 void GraphicsContext3D::checkGPUStatusIfNecessary() 371 { 372 #if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || PLATFORM(IOS)) 373 GPUCheckCounter = (GPUCheckCounter + 1) % GPUStatusCheckThreshold; 374 if (GPUCheckCounter) 375 return; 376 #if PLATFORM(MAC) 377 GLint restartStatus = 0; 378 CGLGetParameter(platformGraphicsContext3D(), kCGLCPGPURestartStatus, &restartStatus); 379 if (restartStatus == kCGLCPGPURestartStatusCaused || restartStatus == kCGLCPGPURestartStatusBlacklisted) { 380 CGLSetCurrentContext(0); 381 CGLDestroyContext(platformGraphicsContext3D()); 382 forceContextLost(); 383 } 384 #elif PLATFORM(IOS) 385 GLint restartStatus = 0; 386 EAGLContext* currentContext = static_cast<EAGLContext*>(PlatformGraphicsContext3D()); 387 [currentContext getParameter:kEAGLCPGPURestartStatus to:&restartStatus]; 388 if (restartStatus == kEAGLCPGPURestartStatusCaused || restartStatus == kEAGLCPGPURestartStatusBlacklisted) { 389 [EAGLContext setCurrentContext:0]; 390 [static_cast<EAGLContext*>(currentContext) release]; 391 forceContextLost(); 392 } 393 #endif 394 #endif 395 } 396 356 397 #if PLATFORM(IOS) 357 398 void GraphicsContext3D::endPaint() -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
r179530 r180609 49 49 #include "Logging.h" 50 50 #include "TemporaryOpenGLSetting.h" 51 #include "WebGLRenderingContextBase.h" 51 52 #include <cstring> 52 53 #include <runtime/ArrayBuffer.h> … … 75 76 #endif 76 77 #endif 78 77 79 78 80 namespace WebCore { … … 684 686 makeContextCurrent(); 685 687 ::glDrawArrays(mode, first, count); 688 checkGPUStatusIfNecessary(); 686 689 } 687 690 … … 690 693 makeContextCurrent(); 691 694 ::glDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset))); 695 checkGPUStatusIfNecessary(); 692 696 } 693 697 … … 1764 1768 } 1765 1769 1770 void GraphicsContext3D::forceContextLost() 1771 { 1772 if (m_webglContext) 1773 m_webglContext->forceLostContext(WebGLRenderingContextBase::RealLostContext); 1774 } 1775 1766 1776 void GraphicsContext3D::texImage2DDirect(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels) 1767 1777 { -
trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DWin.cpp
r178166 r180609 179 179 } 180 180 181 void GraphicsContext3D::checkGPUStatusIfNecessary() 182 { 183 } 184 181 185 PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() 182 186 {
Note: See TracChangeset
for help on using the changeset viewer.