Changeset 279497 in webkit
- Timestamp:
- Jul 1, 2021, 11:01:51 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/ANGLE/ChangeLog
r279466 r279497 1 2021-07-01 Ben Nham <nham@apple.com> 2 3 Unreviewed, reverting r279172. 4 5 Broke WebGL context construction on some devices. 6 7 Reverted changeset: 8 9 "rAF driven WebGL submits excessive amount of GPU work when frames are slow" 10 https://bugs.webkit.org/show_bug.cgi?id=227059 11 https://commits.webkit.org/r279172 12 1 13 2021-07-01 Kyle Piddington <kpiddington@apple.com> 2 14 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm
r279327 r279497 885 885 // GL_OES_EGL_sync 886 886 mNativeExtensions.eglSyncOES = true; 887 888 // GL_ARB_sync889 mNativeExtensions.glSyncARB = true;890 887 } 891 888 } -
trunk/Source/WebCore/ChangeLog
r279492 r279497 1 2021-07-01 Ben Nham <nham@apple.com> 2 3 Unreviewed, reverting r279172. 4 5 Broke WebGL context construction on some devices. 6 7 Reverted changeset: 8 9 "rAF driven WebGL submits excessive amount of GPU work when frames are slow" 10 https://bugs.webkit.org/show_bug.cgi?id=227059 11 https://commits.webkit.org/r279172 12 1 13 2021-07-01 Jean-Yves Avenard <jya@apple.com> 2 14 -
trunk/Source/WebCore/Headers.cmake
r279355 r279497 1331 1331 platform/graphics/angle/ANGLEHeaders.h 1332 1332 platform/graphics/angle/ExtensionsGLANGLE.h 1333 platform/graphics/angle/GraphicsContextGLANGLEUtilities.h1334 1333 1335 1334 platform/graphics/displaylists/DisplayList.h -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r279451 r279497 716 716 26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */; }; 717 717 26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 718 27E3C808257F5E6E00C986AB /* ANGLEHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E3C806257F5E6E00C986AB /* ANGLEHeaders.h */; settings = {ATTRIBUTES = (Private, ); };};718 27E3C808257F5E6E00C986AB /* ANGLEHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E3C806257F5E6E00C986AB /* ANGLEHeaders.h */; }; 719 719 2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */; }; 720 720 2936BF5C21D69E4B004A8FC9 /* AccessibilityObjectInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2936BF5A21D6999E004A8FC9 /* AccessibilityObjectInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2324 2324 7B7311FB25C092B7003B2796 /* ScopedHighPerformanceGPURequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B7311FA25C092B7003B2796 /* ScopedHighPerformanceGPURequest.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2325 2325 7B90417025501142006EEB8C /* RemoteGraphicsContextGLProxyBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B90416E25501109006EEB8C /* RemoteGraphicsContextGLProxyBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2326 7BB34A1725345CB200029D08 /* GraphicsContextGLANGLEUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB34A1625345CB200029D08 /* GraphicsContextGLANGLEUtilities.h */; settings = {ATTRIBUTES = (Private, ); };};2326 7BB34A1725345CB200029D08 /* GraphicsContextGLANGLEUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB34A1625345CB200029D08 /* GraphicsContextGLANGLEUtilities.h */; }; 2327 2327 7BB34A48253776CA00029D08 /* GraphicsContextGLImageExtractor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB34A45253776C600029D08 /* GraphicsContextGLImageExtractor.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2328 2328 7BB680BA25BA1BE4002B8738 /* GraphicsChecksMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB680B825BA1BE4002B8738 /* GraphicsChecksMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; -
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
r279172 r279497 45 45 #include <cstring> 46 46 #include <wtf/HexNumber.h> 47 #include <wtf/Seconds.h>48 47 #include <wtf/ThreadSpecific.h> 49 48 #include <wtf/text/CString.h> … … 63 62 static const char* packedDepthStencilExtensionName = "GL_OES_packed_depth_stencil"; 64 63 65 static Seconds maxFrameDuration = 5_s; 64 namespace { 65 66 67 } // namespace anonymous 66 68 67 69 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY) … … 2845 2847 #endif 2846 2848 2847 bool GraphicsContextGLOpenGL::waitAndUpdateOldestFrame()2848 {2849 size_t oldestFrameCompletionFence = m_oldestFrameCompletionFence++ % maxPendingFrames;2850 bool success = true;2851 if (ScopedGLFence fence = WTFMove(m_frameCompletionFences[oldestFrameCompletionFence])) {2852 // Wait so that rendering does not get more than maxPendingFrames frames ahead.2853 GLbitfield flags = GL_SYNC_FLUSH_COMMANDS_BIT;2854 #if PLATFORM(COCOA)2855 // Avoid using the GL_SYNC_FLUSH_COMMANDS_BIT because each each frame is ended with a flush2856 // due to external IOSurface access. This particular fence is maxPendingFrames behind.2857 // This means the creation of this fence has already been flushed.2858 flags = 0;2859 #endif2860 GLenum result = gl::ClientWaitSync(fence, flags, maxFrameDuration.nanosecondsAs<GLuint64>());2861 ASSERT(result != GL_WAIT_FAILED);2862 success = result != GL_WAIT_FAILED && result != GL_TIMEOUT_EXPIRED;2863 }2864 m_frameCompletionFences[oldestFrameCompletionFence].fenceSync();2865 return success;2866 }2867 2868 2849 } 2869 2850 -
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h
r279172 r279497 205 205 }; 206 206 207 class ScopedGLFence {208 WTF_MAKE_NONCOPYABLE(ScopedGLFence);209 public:210 ScopedGLFence() = default;211 ScopedGLFence(ScopedGLFence&& other)212 : m_object(std::exchange(other.m_object, { }))213 {214 }215 ~ScopedGLFence() { reset(); }216 ScopedGLFence& operator=(ScopedGLFence&& other)217 {218 if (this != &other) {219 reset();220 m_object = std::exchange(other.m_object, { });221 }222 return *this;223 }224 void reset()225 {226 if (m_object) {227 gl::DeleteSync(m_object);228 m_object = { };229 }230 }231 void abandon() { m_object = { }; }232 void fenceSync()233 {234 reset();235 m_object = gl::FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);236 }237 operator GLsync() const { return m_object; }238 operator bool() const { return m_object; }239 private:240 GLsync m_object { };241 };242 243 207 } 244 208 -
trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm
r279308 r279497 117 117 displayAttributes.append(EGL_TRUE); 118 118 } 119 if (attrs.useMetal) { 119 bool canUseMetal = platformSupportsMetal(); 120 if (attrs.useMetal && canUseMetal) { 120 121 displayAttributes.append(EGL_PLATFORM_ANGLE_TYPE_ANGLE); 121 122 displayAttributes.append(EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE); 122 123 } 123 LOG(WebGL, "Attempting to use ANGLE's %s backend.\n", attrs.useMetal ? "Metal" : "OpenGL"); 124 125 LOG(WebGL, "Attempting to use ANGLE's %s backend.\n", attrs.useMetal && canUseMetal ? "Metal" : "OpenGL"); 124 126 if (attrs.powerPreference != GraphicsContextGLAttributes::PowerPreference::Default) { 125 127 displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE); … … 131 133 } 132 134 } 135 133 136 displayAttributes.append(EGL_NONE); 134 137 display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(EGL_DEFAULT_DISPLAY), displayAttributes.data()); … … 208 211 { 209 212 m_isForWebGL2 = attrs.webGLVersion == GraphicsContextGLWebGLVersion::WebGL2; 210 if (attrs.useMetal && !platformSupportsMetal()) {211 attrs.useMetal = false;212 setContextAttributes(attrs);213 }214 213 215 214 m_displayObj = InitializeEGLDisplay(attrs); … … 298 297 // For WebGL 2.0 occlusion queries to work. 299 298 requiredExtensions.append("GL_EXT_occlusion_query_boolean"_s); 300 } else {301 if (contextAttributes().useMetal) {302 // The implementation uses GLsync objects. Enable the functionality for WebGL 1.0 contexts303 // that use OpenGL ES 2.0.304 requiredExtensions.append("GL_ARB_sync"_s);305 }306 299 } 307 300 #if PLATFORM(MAC) || PLATFORM(MACCATALYST) … … 311 304 // For creating the EGL surface from an IOSurface. 312 305 requiredExtensions.append("GL_EXT_texture_format_BGRA8888"_s); 313 } 306 } 307 314 308 #endif // PLATFORM(MAC) || PLATFORM(MACCATALYST) 315 309 ExtensionsGL& extensions = getExtensions(); … … 402 396 if (m_preserveDrawingBufferFBO) 403 397 gl::DeleteFramebuffers(1, &m_preserveDrawingBufferFBO); 404 for (auto& fence : m_frameCompletionFences)405 fence.reset();406 } else {407 for (auto& fence : m_frameCompletionFences)408 fence.abandon();409 398 } 410 399 if (m_displayBufferPbuffer) { … … 789 778 if (!hasNewBacking) 790 779 allocateAndBindDisplayBufferBacking(); 780 791 781 markLayerComposited(); 792 793 if (contextAttributes().useMetal) {794 // OpenGL sync objects are not signaling upon completion on Catalina-era drivers.795 // OpenGL drivers typically implement some sort of internal throttling.796 bool success = waitAndUpdateOldestFrame();797 UNUSED_VARIABLE(success); // FIXME: implement context lost.798 }799 782 } 800 783 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h
r279308 r279497 46 46 #endif 47 47 48 #if USE(ANGLE) 49 #include "GraphicsContextGLANGLEUtilities.h" 50 #else 48 #if !USE(ANGLE) 51 49 #include "ANGLEWebKitBridge.h" 52 50 #include "ExtensionsGLOpenGLCommon.h" 53 #endif54 55 #if PLATFORM(MAC)56 #include "ScopedHighPerformanceGPURequest.h"57 51 #endif 58 52 … … 77 71 class GCGLLayer; 78 72 } 73 #endif 74 75 #if PLATFORM(MAC) 76 #include "ScopedHighPerformanceGPURequest.h" 79 77 #endif 80 78 … … 581 579 bool bindDisplayBufferBacking(std::unique_ptr<IOSurface> backing, void* pbuffer); 582 580 #endif 583 #if USE(ANGLE)584 // Returns false if context should be lost due to timeout.585 bool waitAndUpdateOldestFrame() WARN_UNUSED_RETURN;586 #endif587 581 588 582 #if PLATFORM(COCOA) … … 798 792 std::unique_ptr<GraphicsContextGLCV> m_cv; 799 793 #endif 800 #if USE(ANGLE)801 static constexpr size_t maxPendingFrames = 3;802 size_t m_oldestFrameCompletionFence { 0 };803 ScopedGLFence m_frameCompletionFences[maxPendingFrames];804 #endif805 794 }; 806 795
Note:
See TracChangeset
for help on using the changeset viewer.