Diff
Modified: branches/safari-612-branch/Source/WebCore/CMakeLists.txt (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/CMakeLists.txt 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/CMakeLists.txt 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1644,9 +1644,9 @@
${WEBCORE_DIR}/platform/graphics/angle
)
list(APPEND WebCore_SOURCES
+ platform/graphics/angle/ANGLEUtilities.cpp
platform/graphics/angle/ExtensionsGLANGLE.cpp
platform/graphics/angle/GraphicsContextGLANGLE.cpp
- platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp
platform/graphics/angle/TemporaryANGLESetting.cpp
)
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1,5 +1,149 @@
2021-10-26 Russell Epstein <[email protected]>
+ Cherry-pick r283703. rdar://problem/84629308
+
+ ScopedEGLDefaultDisplay should be removed
+ https://bugs.webkit.org/show_bug.cgi?id=231011
+
+ Patch by Kimmo Kinnunen <[email protected]> on 2021-10-07
+ Reviewed by Kenneth Russell.
+
+ Source/WebCore:
+
+ Hard-coding the code to EGL_DEFAULT_DISPLAY only and using the scoped
+ holder is making the EGLDisplays harder to use than neccessary. The
+ implementation target, e.g. the ability to call EGLTerminate, was also a bit
+ more convoluted than needed.
+
+ Move the "call EGLTerminate" logic from a bit convoluted refcount mechanism
+ in ScopedEGLDefaultDisplay to the explicit GraphicsContextGLOpenGL::releaseResources().
+ The callers are expected to do the refcounting anyway, as the existing client
+ WebKit::ScopedWebGLRenderingResourcesRequest already did.
+
+ Make GraphicsContextGLOpenGL::releaseResources() available on all platforms.
+ It is implemented on all ANGLE implementations.
+ Platforms can augment the implementation by implementing
+ GraphicsContextGLOpenGL::platformReleaseResources(). For Cocoa, this function
+ resets the currentContext cache that is used to optimize making context current.
+
+ No new tests, refactor.
+
+ * CMakeLists.txt:
+ * Headers.cmake:
+ * PlatformMac.cmake:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/angle/ANGLEUtilities.cpp: Renamed from Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h.
+ (WebCore::platformIsANGLEAvailable):
+ * platform/graphics/angle/ANGLEUtilities.h: Renamed from Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h.
+ Rename GraphicsContextGLANGLEUtilities to simpler and more descriptive ANGLEUtilities.
+ Add the isANGLEAvailable to there.
+
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLOpenGL::releaseResources):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ * platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp: Removed.
+ (WebCore::refDefaultDisplay): Deleted.
+ (WebCore::unrefDefaultDisplayIfNeeded): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::operator=): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::ScopedEGLDefaultDisplay): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::~ScopedEGLDefaultDisplay): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::releaseAllResourcesIfUnused): Deleted.
+ * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+ (WebCore::platformIsANGLEAvailable):
+ (WebCore::initializeEGLDisplay):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ (WebCore::isANGLEAvailable): Deleted.
+ (WebCore::GraphicsContextGLOpenGL::releaseCurrentContext): Deleted.
+ (WebCore::GraphicsContextGLOpenGL::releaseAllResourcesIfUnused): Deleted.
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+ (WebCore::GraphicsContextGLOpenGL::releaseResources):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+ * platform/ios/wak/WebCoreThread.mm:
+
+ Source/WebKit:
+
+ Implement the release of WebGL resources with the amended
+ GraphicsContextGLOpenGL::releaseResources() instead of
+ previous separate function GraphicsContextGLOpenGL::releaseAllResources().
+
+ Use the resource release code path universally, as
+ GraphicsContextGLOpenGL::releaseResources() is now common code.
+
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp:
+ (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
+ (WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources):
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h:
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp: Removed.
+ (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources): Deleted.
+ (WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources): Deleted.
+ * SourcesCocoa.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-07 Kimmo Kinnunen <[email protected]>
+
+ ScopedEGLDefaultDisplay should be removed
+ https://bugs.webkit.org/show_bug.cgi?id=231011
+
+ Reviewed by Kenneth Russell.
+
+ Hard-coding the code to EGL_DEFAULT_DISPLAY only and using the scoped
+ holder is making the EGLDisplays harder to use than neccessary. The
+ implementation target, e.g. the ability to call EGLTerminate, was also a bit
+ more convoluted than needed.
+
+ Move the "call EGLTerminate" logic from a bit convoluted refcount mechanism
+ in ScopedEGLDefaultDisplay to the explicit GraphicsContextGLOpenGL::releaseResources().
+ The callers are expected to do the refcounting anyway, as the existing client
+ WebKit::ScopedWebGLRenderingResourcesRequest already did.
+
+ Make GraphicsContextGLOpenGL::releaseResources() available on all platforms.
+ It is implemented on all ANGLE implementations.
+ Platforms can augment the implementation by implementing
+ GraphicsContextGLOpenGL::platformReleaseResources(). For Cocoa, this function
+ resets the currentContext cache that is used to optimize making context current.
+
+ No new tests, refactor.
+
+ * CMakeLists.txt:
+ * Headers.cmake:
+ * PlatformMac.cmake:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/angle/ANGLEUtilities.cpp: Renamed from Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h.
+ (WebCore::platformIsANGLEAvailable):
+ * platform/graphics/angle/ANGLEUtilities.h: Renamed from Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h.
+ Rename GraphicsContextGLANGLEUtilities to simpler and more descriptive ANGLEUtilities.
+ Add the isANGLEAvailable to there.
+
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLOpenGL::releaseResources):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ * platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp: Removed.
+ (WebCore::refDefaultDisplay): Deleted.
+ (WebCore::unrefDefaultDisplayIfNeeded): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::operator=): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::ScopedEGLDefaultDisplay): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::~ScopedEGLDefaultDisplay): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::releaseAllResourcesIfUnused): Deleted.
+ * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+ (WebCore::platformIsANGLEAvailable):
+ (WebCore::initializeEGLDisplay):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ (WebCore::isANGLEAvailable): Deleted.
+ (WebCore::GraphicsContextGLOpenGL::releaseCurrentContext): Deleted.
+ (WebCore::GraphicsContextGLOpenGL::releaseAllResourcesIfUnused): Deleted.
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+ (WebCore::GraphicsContextGLOpenGL::releaseResources):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+ * platform/ios/wak/WebCoreThread.mm:
+
+2021-10-26 Russell Epstein <[email protected]>
+
Cherry-pick r283301. rdar://problem/84629308
GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
Modified: branches/safari-612-branch/Source/WebCore/Headers.cmake (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/Headers.cmake 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/Headers.cmake 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1357,8 +1357,8 @@
platform/graphics/WindRule.h
platform/graphics/angle/ANGLEHeaders.h
+ platform/graphics/angle/ANGLEUtilities.h
platform/graphics/angle/ExtensionsGLANGLE.h
- platform/graphics/angle/GraphicsContextGLANGLEUtilities.h
platform/graphics/displaylists/DisplayList.h
platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h
Modified: branches/safari-612-branch/Source/WebCore/PlatformMac.cmake (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/PlatformMac.cmake 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/PlatformMac.cmake 2021-10-27 21:06:12 UTC (rev 284953)
@@ -602,7 +602,7 @@
platform/graphics/MIMETypeCache.h
platform/graphics/Model.h
- platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h
+ platform/graphics/angle/ANGLEUtilities.h
platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h
platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h
Modified: branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt 2021-10-27 21:06:12 UTC (rev 284953)
@@ -595,7 +595,7 @@
// The following files aren't unified with others to prevent them from being merged
// with files that use the system OpenGL.
+platform/graphics/angle/ANGLEUtilities.cpp @no-unify
platform/graphics/angle/ExtensionsGLANGLE.cpp @no-unify
platform/graphics/angle/GraphicsContextGLANGLE.cpp @no-unify
-platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp @no-unify
platform/graphics/angle/TemporaryANGLESetting.cpp @no-unify
Modified: branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-10-27 21:06:12 UTC (rev 284953)
@@ -2318,13 +2318,11 @@
7AF9B20F18CFB5F400C64BEF /* JSVTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */; };
7B10339E2549721700C8C1AC /* GraphicsContextGLCV.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B10339D2549720100C8C1AC /* GraphicsContextGLCV.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B10339F2549721E00C8C1AC /* GraphicsContextGLCVANGLE.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B10339C2549720100C8C1AC /* GraphicsContextGLCVANGLE.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 7B45AB5025FB93BE00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B774C6225FB93550091395F /* GraphicsContextGLANGLEEGLUtilities.cpp */; };
- 7B45AB5525FBA9DE00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B45AB5425FBA9DD00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7B6094DD270C44BD0064835C /* ANGLEUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB34A1625345CB200029D08 /* ANGLEUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B6DC81925712E9200380C70 /* GraphicsContextGLIOSurfaceSwapChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B6DC81725712E9200380C70 /* GraphicsContextGLIOSurfaceSwapChain.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B7311FB25C092B7003B2796 /* ScopedHighPerformanceGPURequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B7311FA25C092B7003B2796 /* ScopedHighPerformanceGPURequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B8ED5F026F0C13D008AC023 /* CVUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B8ED5ED26F0C123008AC023 /* CVUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B90417025501142006EEB8C /* RemoteGraphicsContextGLProxyBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B90416E25501109006EEB8C /* RemoteGraphicsContextGLProxyBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 7BB34A1725345CB200029D08 /* GraphicsContextGLANGLEUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB34A1625345CB200029D08 /* GraphicsContextGLANGLEUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
7BB34A48253776CA00029D08 /* GraphicsContextGLImageExtractor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB34A45253776C600029D08 /* GraphicsContextGLImageExtractor.h */; settings = {ATTRIBUTES = (Private, ); }; };
7BB680BA25BA1BE4002B8738 /* GraphicsChecksMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB680B825BA1BE4002B8738 /* GraphicsChecksMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
7BE7427381FA906FBB4F0F2C /* JSSVGGraphicsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */; };
@@ -10463,20 +10461,19 @@
7B10339A2549720000C8C1AC /* GraphicsContextGLCVANGLE.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLCVANGLE.cpp; sourceTree = "<group>"; };
7B10339C2549720100C8C1AC /* GraphicsContextGLCVANGLE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLCVANGLE.h; sourceTree = "<group>"; };
7B10339D2549720100C8C1AC /* GraphicsContextGLCV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLCV.h; sourceTree = "<group>"; };
- 7B45AB5425FBA9DD00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLANGLEEGLUtilities.h; sourceTree = "<group>"; };
7B64C0B4254C3B160006B4AF /* RemoteGraphicsContextGLProxyBaseCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteGraphicsContextGLProxyBaseCocoa.mm; sourceTree = "<group>"; };
7B6DC81525712E9100380C70 /* GraphicsContextGLIOSurfaceSwapChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLIOSurfaceSwapChain.cpp; sourceTree = "<group>"; };
7B6DC81725712E9200380C70 /* GraphicsContextGLIOSurfaceSwapChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLIOSurfaceSwapChain.h; sourceTree = "<group>"; };
7B7311FA25C092B7003B2796 /* ScopedHighPerformanceGPURequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedHighPerformanceGPURequest.h; sourceTree = "<group>"; };
- 7B774C6225FB93550091395F /* GraphicsContextGLANGLEEGLUtilities.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLANGLEEGLUtilities.cpp; sourceTree = "<group>"; };
7B8ED5ED26F0C123008AC023 /* CVUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVUtilities.h; sourceTree = "<group>"; };
7B8ED5EF26F0C123008AC023 /* CVUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CVUtilities.mm; sourceTree = "<group>"; };
7B90416E25501109006EEB8C /* RemoteGraphicsContextGLProxyBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteGraphicsContextGLProxyBase.h; sourceTree = "<group>"; };
- 7BB34A1625345CB200029D08 /* GraphicsContextGLANGLEUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLANGLEUtilities.h; sourceTree = "<group>"; };
+ 7BB34A1625345CB200029D08 /* ANGLEUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEUtilities.h; sourceTree = "<group>"; };
7BB34A45253776C600029D08 /* GraphicsContextGLImageExtractor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLImageExtractor.h; sourceTree = "<group>"; };
7BB34A47253776C700029D08 /* GraphicsContextGLImageExtractor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLImageExtractor.cpp; sourceTree = "<group>"; };
7BB680B725BA1BE3002B8738 /* GraphicsChecksMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsChecksMac.cpp; sourceTree = "<group>"; };
7BB680B825BA1BE4002B8738 /* GraphicsChecksMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsChecksMac.h; sourceTree = "<group>"; };
+ 7BCD42D8270599EF00EB2127 /* ANGLEUtilities.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEUtilities.cpp; sourceTree = "<group>"; };
7BCD42DA2705C94900EB2127 /* ANGLEUtilitiesCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEUtilitiesCocoa.cpp; sourceTree = "<group>"; };
7BCD42DC2705C94900EB2127 /* ANGLEUtilitiesCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANGLEUtilitiesCocoa.h; sourceTree = "<group>"; };
7BE7265B25763B8D00E85D98 /* RemoteGraphicsContextGLProxyBase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteGraphicsContextGLProxyBase.cpp; sourceTree = "<group>"; };
@@ -22288,12 +22285,11 @@
isa = PBXGroup;
children = (
27E3C806257F5E6E00C986AB /* ANGLEHeaders.h */,
+ 7BCD42D8270599EF00EB2127 /* ANGLEUtilities.cpp */,
+ 7BB34A1625345CB200029D08 /* ANGLEUtilities.h */,
6E27F243229C9F8400F1F632 /* ExtensionsGLANGLE.cpp */,
6E27F244229C9F8D00F1F632 /* ExtensionsGLANGLE.h */,
6E27F2422298CE4B00F1F632 /* GraphicsContextGLANGLE.cpp */,
- 7B774C6225FB93550091395F /* GraphicsContextGLANGLEEGLUtilities.cpp */,
- 7B45AB5425FBA9DD00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.h */,
- 7BB34A1625345CB200029D08 /* GraphicsContextGLANGLEUtilities.h */,
6E290861229DB950000986E2 /* TemporaryANGLESetting.cpp */,
6E290863229DB970000986E2 /* TemporaryANGLESetting.h */,
);
@@ -31007,7 +31003,7 @@
E7E0357224D4E196008DFEFB /* AnalyserOptions.h in Headers */,
27E3C808257F5E6E00C986AB /* ANGLEHeaders.h in Headers */,
31A795C71888BCB200382F90 /* ANGLEInstancedArrays.h in Headers */,
- 7BB34A1725345CB200029D08 /* ANGLEUtilities.h in Headers */,
+ 7B6094DD270C44BD0064835C /* ANGLEUtilities.h in Headers */,
49E912AB0EFAC906009D0CAF /* Animation.h in Headers */,
71EFCEDC202B38A900D7C411 /* AnimationEffect.h in Headers */,
71E2C42621C935280024F8C8 /* AnimationEffectPhase.h in Headers */,
@@ -32225,7 +32221,6 @@
B2A015A90AF6CD53006BCE0E /* GraphicsContext.h in Headers */,
934907E4125BBBC8007F23A0 /* GraphicsContextCG.h in Headers */,
313DE87023A96973008FC47B /* GraphicsContextGL.h in Headers */,
- 7B45AB5525FBA9DE00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.h in Headers */,
7C330A021DF8FAC600D3395C /* GraphicsContextGLAttributes.h in Headers */,
7B10339E2549721700C8C1AC /* GraphicsContextGLCV.h in Headers */,
7B10339F2549721E00C8C1AC /* GraphicsContextGLCVANGLE.h in Headers */,
@@ -36068,7 +36063,6 @@
51A9D9E9195B931F001B2B5C /* GamepadManager.cpp in Sources */,
837964CF1F8DB69D00218EA0 /* GeolocationPositionDataIOS.mm in Sources */,
6E72F54E229DCD1000B3E151 /* GraphicsContextGLANGLE.cpp in Sources */,
- 7B45AB5025FB93BE00FD27F4 /* GraphicsContextGLANGLEEGLUtilities.cpp in Sources */,
7C3E510B18DF8F3500C112F7 /* HTMLConverter.mm in Sources */,
A8D06B3A0A265DCD005E7203 /* HTMLNames.cpp in Sources */,
1AC900C31943C0FC008625B5 /* HTTPHeaderNames.cpp in Sources */,
Copied: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/ANGLEUtilities.cpp (from rev 284952, branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h) (0 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/ANGLEUtilities.cpp (rev 0)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/ANGLEUtilities.cpp 2021-10-27 21:06:12 UTC (rev 284953)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ANGLEUtilities.h"
+
+#if ENABLE(WEBGL) && USE(ANGLE)
+
+namespace WebCore {
+
+#if !PLATFORM(COCOA)
+bool platformIsANGLEAvailable()
+{
+ return true;
+}
+#endif
+
+}
+
+#endif
Copied: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/ANGLEUtilities.h (from rev 284952, branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h) (0 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/ANGLEUtilities.h (rev 0)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/ANGLEUtilities.h 2021-10-27 21:06:12 UTC (rev 284953)
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGL) && USE(ANGLE)
+
+#include "ANGLEHeaders.h"
+#include "GraphicsTypesGL.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class ScopedRestoreTextureBinding {
+ WTF_MAKE_NONCOPYABLE(ScopedRestoreTextureBinding);
+public:
+ ScopedRestoreTextureBinding(GLenum bindingPointQuery, GLenum bindingPoint, bool condition = true)
+ {
+ ASSERT(bindingPoint != static_cast<GLenum>(0u));
+ if (condition) {
+ m_bindingPoint = bindingPoint;
+ gl::GetIntegerv(bindingPointQuery, reinterpret_cast<GLint*>(&m_bindingValue));
+ }
+ }
+
+ ~ScopedRestoreTextureBinding()
+ {
+ if (m_bindingPoint)
+ gl::BindTexture(m_bindingPoint, m_bindingValue);
+ }
+
+private:
+ GLenum m_bindingPoint { 0 };
+ GLuint m_bindingValue { 0u };
+};
+
+
+class ScopedBufferBinding {
+ WTF_MAKE_NONCOPYABLE(ScopedBufferBinding);
+public:
+ ScopedBufferBinding(GLenum bindingPoint, GLuint bindingValue, bool condition = true)
+ {
+ if (!condition)
+ return;
+ gl::GetIntegerv(query(bindingPoint), reinterpret_cast<GLint*>(&m_bindingValue));
+ if (bindingValue == m_bindingValue)
+ return;
+ m_bindingPoint = bindingPoint;
+ gl::BindBuffer(m_bindingPoint, bindingValue);
+ }
+
+ ~ScopedBufferBinding()
+ {
+ if (m_bindingPoint)
+ gl::BindBuffer(m_bindingPoint, m_bindingValue);
+ }
+
+private:
+ static constexpr GLenum query(GLenum bindingPoint)
+ {
+ if (bindingPoint == GL_PIXEL_PACK_BUFFER)
+ return GL_PIXEL_PACK_BUFFER_BINDING;
+ ASSERT(bindingPoint == GL_PIXEL_UNPACK_BUFFER);
+ return GL_PIXEL_UNPACK_BUFFER_BINDING;
+ }
+ GLint m_bindingPoint { 0 };
+ GLuint m_bindingValue { 0u };
+};
+class ScopedRestoreReadFramebufferBinding {
+ WTF_MAKE_NONCOPYABLE(ScopedRestoreReadFramebufferBinding);
+public:
+ ScopedRestoreReadFramebufferBinding(bool isForWebGL2, GLuint restoreValue)
+ : m_framebufferTarget(isForWebGL2 ? GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER)
+ , m_bindingValue(restoreValue)
+ {
+ }
+ ScopedRestoreReadFramebufferBinding(bool isForWebGL2, GLuint restoreValue, GLuint value)
+ : m_framebufferTarget(isForWebGL2 ? GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER)
+ , m_bindingValue(restoreValue)
+ {
+ bindFramebuffer(value);
+ }
+ void markBindingChanged()
+ {
+ m_bindingChanged = true;
+ }
+ void bindFramebuffer(GLuint bindingValue)
+ {
+ if (!m_bindingChanged && m_bindingValue == bindingValue)
+ return;
+ gl::BindFramebuffer(m_framebufferTarget, bindingValue);
+ m_bindingChanged = m_bindingValue != bindingValue;
+ }
+ GLuint framebufferTarget() const { return m_framebufferTarget; }
+ ~ScopedRestoreReadFramebufferBinding()
+ {
+ if (m_bindingChanged)
+ gl::BindFramebuffer(m_framebufferTarget, m_bindingValue);
+ }
+private:
+ const GLenum m_framebufferTarget;
+ GLuint m_bindingValue { 0u };
+ bool m_bindingChanged { false };
+};
+
+class ScopedPixelStorageMode {
+ WTF_MAKE_NONCOPYABLE(ScopedPixelStorageMode);
+public:
+ explicit ScopedPixelStorageMode(GLenum name, bool condition = true)
+ : m_name(condition ? name : 0)
+ {
+ if (m_name)
+ gl::GetIntegerv(m_name, &m_originalValue);
+ }
+ ScopedPixelStorageMode(GLenum name, GLint value, bool condition = true)
+ : m_name(condition ? name : 0)
+ {
+ if (m_name) {
+ gl::GetIntegerv(m_name, &m_originalValue);
+ pixelStore(value);
+ }
+ }
+ ~ScopedPixelStorageMode()
+ {
+ if (m_name && m_valueChanged)
+ gl::PixelStorei(m_name, m_originalValue);
+ }
+ void pixelStore(GLint value)
+ {
+ ASSERT(m_name);
+ if (!m_valueChanged && m_originalValue == value)
+ return;
+ gl::PixelStorei(m_name, value);
+ m_valueChanged = m_originalValue != value;
+ }
+ operator GLint() const
+ {
+ ASSERT(m_name && !m_valueChanged);
+ return m_originalValue;
+ }
+private:
+ const GLenum m_name;
+ bool m_valueChanged { false };
+ GLint m_originalValue { 0 };
+};
+
+class ScopedTexture {
+ WTF_MAKE_NONCOPYABLE(ScopedTexture);
+public:
+ ScopedTexture()
+ {
+ gl::GenTextures(1, &m_object);
+ }
+ ~ScopedTexture()
+ {
+ gl::DeleteTextures(1, &m_object);
+ }
+ operator GLuint() const
+ {
+ return m_object;
+ }
+private:
+ GLuint m_object { 0u };
+};
+
+class ScopedFramebuffer {
+ WTF_MAKE_NONCOPYABLE(ScopedFramebuffer);
+public:
+ ScopedFramebuffer()
+ {
+ gl::GenFramebuffers(1, &m_object);
+ }
+ ~ScopedFramebuffer()
+ {
+ gl::DeleteFramebuffers(1, &m_object);
+ }
+ operator GLuint() const
+ {
+ return m_object;
+ }
+private:
+ GLuint m_object { 0 };
+};
+
+class ScopedGLFence {
+ WTF_MAKE_NONCOPYABLE(ScopedGLFence);
+public:
+ ScopedGLFence() = default;
+ ScopedGLFence(ScopedGLFence&& other)
+ : m_object(std::exchange(other.m_object, { }))
+ {
+ }
+ ~ScopedGLFence() { reset(); }
+ ScopedGLFence& operator=(ScopedGLFence&& other)
+ {
+ if (this != &other) {
+ reset();
+ m_object = std::exchange(other.m_object, { });
+ }
+ return *this;
+ }
+ void reset()
+ {
+ if (m_object) {
+ gl::DeleteSync(m_object);
+ m_object = { };
+ }
+ }
+ void abandon() { m_object = { }; }
+ void fenceSync()
+ {
+ reset();
+ m_object = gl::FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ }
+ operator GLsync() const { return m_object; }
+ operator bool() const { return m_object; }
+private:
+ GLsync m_object { };
+};
+
+bool platformIsANGLEAvailable();
+
+}
+
+#endif
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-10-27 21:06:12 UTC (rev 284953)
@@ -30,8 +30,8 @@
#include "GraphicsContextGL.h"
#include "ANGLEHeaders.h"
+#include "ANGLEUtilities.h"
#include "ExtensionsGLANGLE.h"
-#include "GraphicsContextGLANGLEUtilities.h"
#include "GraphicsContextGLOpenGL.h"
#include "ImageBuffer.h"
#include "IntRect.h"
@@ -75,6 +75,49 @@
}
#endif
+bool GraphicsContextGLOpenGL::releaseThreadResources(ReleaseThreadResourceBehavior releaseBehavior)
+{
+ platformReleaseThreadResources();
+
+ if (!platformIsANGLEAvailable())
+ return false;
+
+ // Unset the EGL current context, since the next access might be from another thread, and the
+ // context cannot be current on multiple threads.
+ if (releaseBehavior == ReleaseThreadResourceBehavior::ReleaseCurrentContext) {
+ if (EGL_GetCurrentContext() == EGL_NO_CONTEXT)
+ return true;
+ // At the time of writing, ANGLE does not flush on MakeCurrent. Since we are
+ // potentially switching threads, we should flush.
+ // Note: Here we assume also that ANGLE has only one platform context -- otherwise
+ // we would need to flush each EGL context that has been used.
+ gl::Flush();
+ EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
+ if (display == EGL_NO_DISPLAY)
+ return true;
+ return EGL_MakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ }
+ if (releaseBehavior == ReleaseThreadResourceBehavior::TerminateAndReleaseThreadResources) {
+ EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
+ if (display != EGL_NO_DISPLAY) {
+ if (EGL_GetCurrentContext() != EGL_NO_CONTEXT) {
+ ASSERT_NOT_REACHED(); // All resources must have been destroyed.
+ EGL_MakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ }
+ EGL_Terminate(display);
+ }
+ }
+ // Called when we do not know if we will ever see another call from this thread again.
+ // Unset the EGL current context by releasing whole EGL thread state.
+ return EGL_ReleaseThread();
+}
+
+#if !PLATFORM(COCOA)
+void GraphicsContextGLOpenGL::platformReleaseThreadResources()
+{
+}
+#endif
+
std::optional<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
{
PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB() };
Deleted: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GraphicsContextGLANGLEEGLUtilities.h"
-
-#include "ANGLEHeaders.h"
-#include <wtf/Assertions.h>
-
-#if ENABLE(WEBGL) && USE(ANGLE)
-
-namespace WebCore {
-
-static unsigned defaultDisplayRefCount;
-static void* defaultDisplay = nullptr;
-
-static void refDefaultDisplay(void* display)
-{
- ASSERT(display != nullptr);
- ASSERT(defaultDisplay == display || (!defaultDisplay && !defaultDisplayRefCount));
- defaultDisplayRefCount++;
- defaultDisplay = display;
-}
-
-static void unrefDefaultDisplayIfNeeded(void* display)
-{
- if (!display)
- return;
- ASSERT(defaultDisplay == display);
- ASSERT(defaultDisplayRefCount);
- defaultDisplayRefCount--;
-}
-
-ScopedEGLDefaultDisplay& ScopedEGLDefaultDisplay::operator=(ScopedEGLDefaultDisplay&& other)
-{
- if (this != &other) {
- unrefDefaultDisplayIfNeeded(m_display);
- m_display = std::exchange(other.m_display, nullptr);
- }
- return *this;
-}
-
-ScopedEGLDefaultDisplay::ScopedEGLDefaultDisplay(void* display)
- : m_display(display)
-{
- refDefaultDisplay(m_display);
-}
-
-ScopedEGLDefaultDisplay::~ScopedEGLDefaultDisplay()
-{
- unrefDefaultDisplayIfNeeded(m_display);
-}
-
-void ScopedEGLDefaultDisplay::releaseAllResourcesIfUnused()
-{
- if (defaultDisplayRefCount)
- return;
- if (defaultDisplay == nullptr)
- return;
- bool result = EGL_Terminate(defaultDisplay);
- ASSERT_UNUSED(result, result);
- result = EGL_ReleaseThread();
- ASSERT_UNUSED(result, result);
- defaultDisplay = nullptr;
-}
-
-}
-
-#endif
Deleted: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGL) && USE(ANGLE)
-
-#include <algorithm>
-#include <wtf/Noncopyable.h>
-
-// Currently this not using ANGLE headers since this is exported header and we do not export ANGLE headers.
-
-namespace WebCore {
-
-class ScopedEGLDefaultDisplay {
- WTF_MAKE_NONCOPYABLE(ScopedEGLDefaultDisplay);
-public:
- static ScopedEGLDefaultDisplay adoptInitializedDisplay(void* display)
- {
- ASSERT(display != nullptr);
- return ScopedEGLDefaultDisplay(display);
- }
- ScopedEGLDefaultDisplay() = default;
- ScopedEGLDefaultDisplay(ScopedEGLDefaultDisplay&& other)
- : m_display(std::exchange(other.m_display, nullptr))
- {
- }
- ~ScopedEGLDefaultDisplay();
- ScopedEGLDefaultDisplay& operator=(ScopedEGLDefaultDisplay&&);
- operator void*() const { return m_display; }
- operator bool() const { return m_display != nullptr; }
- static void releaseAllResourcesIfUnused();
-private:
- ScopedEGLDefaultDisplay(void*);
- void* m_display { nullptr };
-};
-
-}
-
-#endif
Deleted: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGL) && USE(ANGLE)
-
-#include "ANGLEHeaders.h"
-#include "GraphicsTypesGL.h"
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-class ScopedRestoreTextureBinding {
- WTF_MAKE_NONCOPYABLE(ScopedRestoreTextureBinding);
-public:
- ScopedRestoreTextureBinding(GLenum bindingPointQuery, GLenum bindingPoint, bool condition = true)
- {
- ASSERT(bindingPoint != static_cast<GLenum>(0u));
- if (condition) {
- m_bindingPoint = bindingPoint;
- gl::GetIntegerv(bindingPointQuery, reinterpret_cast<GLint*>(&m_bindingValue));
- }
- }
-
- ~ScopedRestoreTextureBinding()
- {
- if (m_bindingPoint)
- gl::BindTexture(m_bindingPoint, m_bindingValue);
- }
-
-private:
- GLenum m_bindingPoint { 0 };
- GLuint m_bindingValue { 0u };
-};
-
-
-class ScopedBufferBinding {
- WTF_MAKE_NONCOPYABLE(ScopedBufferBinding);
-public:
- ScopedBufferBinding(GLenum bindingPoint, GLuint bindingValue, bool condition = true)
- {
- if (!condition)
- return;
- gl::GetIntegerv(query(bindingPoint), reinterpret_cast<GLint*>(&m_bindingValue));
- if (bindingValue == m_bindingValue)
- return;
- m_bindingPoint = bindingPoint;
- gl::BindBuffer(m_bindingPoint, bindingValue);
- }
-
- ~ScopedBufferBinding()
- {
- if (m_bindingPoint)
- gl::BindBuffer(m_bindingPoint, m_bindingValue);
- }
-
-private:
- static constexpr GLenum query(GLenum bindingPoint)
- {
- if (bindingPoint == GL_PIXEL_PACK_BUFFER)
- return GL_PIXEL_PACK_BUFFER_BINDING;
- ASSERT(bindingPoint == GL_PIXEL_UNPACK_BUFFER);
- return GL_PIXEL_UNPACK_BUFFER_BINDING;
- }
- GLint m_bindingPoint { 0 };
- GLuint m_bindingValue { 0u };
-};
-class ScopedRestoreReadFramebufferBinding {
- WTF_MAKE_NONCOPYABLE(ScopedRestoreReadFramebufferBinding);
-public:
- ScopedRestoreReadFramebufferBinding(bool isForWebGL2, GLuint restoreValue)
- : m_framebufferTarget(isForWebGL2 ? GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER)
- , m_bindingValue(restoreValue)
- {
- }
- ScopedRestoreReadFramebufferBinding(bool isForWebGL2, GLuint restoreValue, GLuint value)
- : m_framebufferTarget(isForWebGL2 ? GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER)
- , m_bindingValue(restoreValue)
- {
- bindFramebuffer(value);
- }
- void markBindingChanged()
- {
- m_bindingChanged = true;
- }
- void bindFramebuffer(GLuint bindingValue)
- {
- if (!m_bindingChanged && m_bindingValue == bindingValue)
- return;
- gl::BindFramebuffer(m_framebufferTarget, bindingValue);
- m_bindingChanged = m_bindingValue != bindingValue;
- }
- GLuint framebufferTarget() const { return m_framebufferTarget; }
- ~ScopedRestoreReadFramebufferBinding()
- {
- if (m_bindingChanged)
- gl::BindFramebuffer(m_framebufferTarget, m_bindingValue);
- }
-private:
- const GLenum m_framebufferTarget;
- GLuint m_bindingValue { 0u };
- bool m_bindingChanged { false };
-};
-
-class ScopedPixelStorageMode {
- WTF_MAKE_NONCOPYABLE(ScopedPixelStorageMode);
-public:
- explicit ScopedPixelStorageMode(GLenum name, bool condition = true)
- : m_name(condition ? name : 0)
- {
- if (m_name)
- gl::GetIntegerv(m_name, &m_originalValue);
- }
- ScopedPixelStorageMode(GLenum name, GLint value, bool condition = true)
- : m_name(condition ? name : 0)
- {
- if (m_name) {
- gl::GetIntegerv(m_name, &m_originalValue);
- pixelStore(value);
- }
- }
- ~ScopedPixelStorageMode()
- {
- if (m_name && m_valueChanged)
- gl::PixelStorei(m_name, m_originalValue);
- }
- void pixelStore(GLint value)
- {
- ASSERT(m_name);
- if (!m_valueChanged && m_originalValue == value)
- return;
- gl::PixelStorei(m_name, value);
- m_valueChanged = m_originalValue != value;
- }
- operator GLint() const
- {
- ASSERT(m_name && !m_valueChanged);
- return m_originalValue;
- }
-private:
- const GLenum m_name;
- bool m_valueChanged { false };
- GLint m_originalValue { 0 };
-};
-
-class ScopedTexture {
- WTF_MAKE_NONCOPYABLE(ScopedTexture);
-public:
- ScopedTexture()
- {
- gl::GenTextures(1, &m_object);
- }
- ~ScopedTexture()
- {
- gl::DeleteTextures(1, &m_object);
- }
- operator GLuint() const
- {
- return m_object;
- }
-private:
- GLuint m_object { 0u };
-};
-
-class ScopedFramebuffer {
- WTF_MAKE_NONCOPYABLE(ScopedFramebuffer);
-public:
- ScopedFramebuffer()
- {
- gl::GenFramebuffers(1, &m_object);
- }
- ~ScopedFramebuffer()
- {
- gl::DeleteFramebuffers(1, &m_object);
- }
- operator GLuint() const
- {
- return m_object;
- }
-private:
- GLuint m_object { 0 };
-};
-
-class ScopedGLFence {
- WTF_MAKE_NONCOPYABLE(ScopedGLFence);
-public:
- ScopedGLFence() = default;
- ScopedGLFence(ScopedGLFence&& other)
- : m_object(std::exchange(other.m_object, { }))
- {
- }
- ~ScopedGLFence() { reset(); }
- ScopedGLFence& operator=(ScopedGLFence&& other)
- {
- if (this != &other) {
- reset();
- m_object = std::exchange(other.m_object, { });
- }
- return *this;
- }
- void reset()
- {
- if (m_object) {
- gl::DeleteSync(m_object);
- m_object = { };
- }
- }
- void abandon() { m_object = { }; }
- void fenceSync()
- {
- reset();
- m_object = gl::FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
- }
- operator GLsync() const { return m_object; }
- operator bool() const { return m_object; }
-private:
- GLsync m_object { };
-};
-
-}
-
-#endif
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-10-27 21:06:12 UTC (rev 284953)
@@ -28,10 +28,10 @@
#if ENABLE(WEBGL)
#import "GraphicsContextGLOpenGL.h"
+#import "ANGLEUtilities.h"
#import "ANGLEUtilitiesCocoa.h"
#import "CVUtilities.h"
#import "ExtensionsGLANGLE.h"
-#import "GraphicsContextGLANGLEUtilities.h"
#import "GraphicsContextGLIOSurfaceSwapChain.h"
#import "GraphicsContextGLOpenGLManager.h"
#import "Logging.h"
@@ -60,8 +60,10 @@
namespace WebCore {
-static bool isANGLEAvailable()
+bool platformIsANGLEAvailable()
{
+ // The ANGLE is weak linked in full, and the EGL_Initialize is explicitly weak linked above
+ // so that we can detect the case where ANGLE is not present.
return !!EGL_Initialize;
}
@@ -119,11 +121,11 @@
return false;
}
-static ScopedEGLDefaultDisplay initializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
+static EGLDisplay initializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
{
- if (!isANGLEAvailable()) {
+ if (!platformIsANGLEAvailable()) {
WTFLogAlways("Failed to load ANGLE shared library.");
- return { };
+ return EGL_NO_DISPLAY;
}
EGLint majorVersion = 0;
@@ -166,7 +168,7 @@
if (EGL_Initialize(display, &majorVersion, &minorVersion) == EGL_FALSE) {
LOG(WebGL, "EGLDisplay Initialization failed.");
- return { };
+ return EGL_NO_DISPLAY;
}
LOG(WebGL, "ANGLE initialised Major: %d Minor: %d", majorVersion, minorVersion);
if (shouldInitializeWithVolatileContextSupport) {
@@ -175,7 +177,7 @@
ASSERT(checkVolatileContextSupportIfDeviceExists(display, "EGL_ANGLE_platform_device_context_volatile_eagl", "EGL_ANGLE_device_eagl", EGL_EAGL_CONTEXT_ANGLE));
ASSERT(checkVolatileContextSupportIfDeviceExists(display, "EGL_ANGLE_platform_device_context_volatile_cgl", "EGL_ANGLE_device_cgl", EGL_CGL_CONTEXT_ANGLE));
}
- return ScopedEGLDefaultDisplay::adoptInitializedDisplay(display);
+ return display;
}
static const unsigned statusCheckThreshold = 5;
@@ -509,45 +511,6 @@
return true;
}
-#if PLATFORM(IOS_FAMILY)
-bool GraphicsContextGLOpenGL::releaseCurrentContext(ReleaseBehavior releaseBehavior)
-{
- if (!isANGLEAvailable())
- return true;
-
- // At the moment this function is relevant only when web thread lock owns the GraphicsContextGLOpenGL current context.
- ASSERT(!isCurrentContextPredictable());
-
- if (!EGL_BindAPI(EGL_OPENGL_ES_API))
- return false;
- if (EGL_GetCurrentContext() == EGL_NO_CONTEXT)
- return true;
-
- // At the time of writing, ANGLE does not flush on MakeCurrent. Since we are
- // potentially switching threads, we should flush.
- // Note: Here we assume also that ANGLE has only one platform context -- otherwise
- // we would need to flush each EGL context that has been used.
- gl::Flush();
-
- // Unset the EGL current context, since the next access might be from another thread, and the
- // context cannot be current on multiple threads.
-
- if (releaseBehavior == ReleaseBehavior::ReleaseThreadResources) {
- // Called when we do not know if we will ever see another call from this thread again.
- // Unset the EGL current context by releasing whole EGL thread state.
- // Theoretically ReleaseThread can reset the bound API, so the rest of the code mentions BindAPI/QueryAPI.
- return EGL_ReleaseThread();
- }
- // On WebKit owned threads, WebKit is able to choose the time for the EGL cleanup.
- // This is why we only unset the context.
- // Note: At the time of writing the EGL cleanup is chosen to be not done at all.
- EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
- if (display == EGL_NO_DISPLAY)
- return false;
- return EGL_MakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-}
-#endif
-
void GraphicsContextGLOpenGL::checkGPUStatus()
{
if (m_failNextStatusCheck) {
@@ -830,11 +793,6 @@
return result;
}
-void GraphicsContextGLOpenGL::releaseAllResourcesIfUnused()
-{
- ScopedEGLDefaultDisplay::releaseAllResourcesIfUnused();
-}
-
#if ENABLE(MEDIA_STREAM)
RefPtr<MediaSample> GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample()
{
@@ -850,6 +808,12 @@
return MediaSampleAVFObjC::createImageSample(WTFMove(*pixelBuffer), MediaSampleAVFObjC::VideoRotation::UpsideDown, true);
}
#endif
+
+void GraphicsContextGLOpenGL::platformReleaseThreadResources()
+{
+ currentContext = nullptr;
}
+}
+
#endif // ENABLE(WEBGL)
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2021-10-27 21:06:12 UTC (rev 284953)
@@ -76,6 +76,16 @@
}
#if !USE(ANGLE)
+bool GraphicsContextGLOpenGL::releaseThreadResources(ReleaseThreadResourceBehavior)
+{
+}
+
+void GraphicsContextGLOpenGL::platformReleaseThreadResources()
+{
+}
+#endif
+
+#if !USE(ANGLE)
bool GraphicsContextGLOpenGL::texImage2DResourceSafe(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, GCGLint unpackAlignment)
{
ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2021-10-27 21:06:12 UTC (rev 284953)
@@ -37,7 +37,6 @@
#include <wtf/UniqueRef.h>
#if PLATFORM(COCOA)
-#include "GraphicsContextGLANGLEEGLUtilities.h"
#include "IOSurface.h"
#endif
@@ -46,7 +45,7 @@
#endif
#if USE(ANGLE)
-#include "GraphicsContextGLANGLEUtilities.h"
+#include "ANGLEUtilities.h"
#else
#include "ANGLEWebKitBridge.h"
#include "ExtensionsGLOpenGLCommon.h"
@@ -119,17 +118,16 @@
#if USE(ANGLE)
static GCGLenum drawingBufferTextureTarget();
#endif
-
-#if PLATFORM(IOS_FAMILY)
- enum class ReleaseBehavior {
- PreserveThreadResources,
- ReleaseThreadResources
+ enum class ReleaseThreadResourceBehavior {
+ // Releases current context after GraphicsContextGLOpenGL calls done in the thread.
+ ReleaseCurrentContext,
+ // Releases all thread resources after GraphicsContextGLOpenGL calls done in the thread.
+ ReleaseThreadResources,
+ // Releases all global state. Should be used only after all depending objects have
+ // been released.
+ TerminateAndReleaseThreadResources
};
- static bool releaseCurrentContext(ReleaseBehavior);
-#endif
-#if PLATFORM(COCOA)
- static void releaseAllResourcesIfUnused();
-#endif
+ static bool releaseThreadResources(ReleaseThreadResourceBehavior);
// With multisampling on, blit from multisampleFBO to regular FBO.
void prepareTexture();
@@ -587,12 +585,15 @@
// Returns false if context should be lost due to timeout.
bool waitAndUpdateOldestFrame() WARN_UNUSED_RETURN;
#endif
+ // Platform specific behavior for releaseResources();
+ static void platformReleaseThreadResources();
+
#if PLATFORM(COCOA)
GraphicsContextGLIOSurfaceSwapChain* m_swapChain { nullptr };
// TODO: this should be removed once the context draws to a image buffer. See https://bugs.webkit.org/show_bug.cgi?id=218179 .
RetainPtr<WebGLLayer> m_webGLLayer;
- ScopedEGLDefaultDisplay m_displayObj;
+ EGLDisplay m_displayObj { nullptr };
PlatformGraphicsContextGL m_contextObj { nullptr };
PlatformGraphicsContextGLConfig m_configObj { nullptr };
#endif // PLATFORM(COCOA)
Modified: branches/safari-612-branch/Source/WebCore/platform/ios/wak/WebCoreThread.mm (284952 => 284953)
--- branches/safari-612-branch/Source/WebCore/platform/ios/wak/WebCoreThread.mm 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebCore/platform/ios/wak/WebCoreThread.mm 2021-10-27 21:06:12 UTC (rev 284953)
@@ -70,17 +70,20 @@
// as any client thread that calls into WebKit.
void ReleaseWebThreadGlobalState()
{
- // GraphicsContextGLOpenGL current context is owned by the web thread lock. Release the context
+ // ANGLE maintains thread global state for its current context.
+ // This is conceptually owned by the web thread lock. Release the context
// before the lock is released.
// In single-threaded environments we do not need to unset the context, as there should not be access from
// multiple threads.
ASSERT(WebThreadIsEnabled());
- using ReleaseBehavior = WebCore::GraphicsContextGLOpenGL::ReleaseBehavior;
- // For non-web threads, we don't know if we ever see another call from the thread.
- ReleaseBehavior releaseBehavior =
- WebThreadIsCurrent() ? ReleaseBehavior::PreserveThreadResources : ReleaseBehavior::ReleaseThreadResources;
- WebCore::GraphicsContextGLOpenGL::releaseCurrentContext(releaseBehavior);
+ using ReleaseThreadResourceBehavior = WebCore::GraphicsContextGLOpenGL::ReleaseThreadResourceBehavior;
+ // For web thread, just release the context as we know we will see calls to it again.
+ // For non-web threads, e.g. third-party client threads, we don't know if we ever see another call from the
+ // thread, so we also release the thread resources.
+ ReleaseThreadResourceBehavior releaseBehavior =
+ WebThreadIsCurrent() ? ReleaseThreadResourceBehavior::ReleaseCurrentContext : ReleaseThreadResourceBehavior::ReleaseThreadResources;
+ WebCore::GraphicsContextGLOpenGL::releaseThreadResources(releaseBehavior);
}
}
Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (284952 => 284953)
--- branches/safari-612-branch/Source/WebKit/ChangeLog 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1,3 +1,112 @@
+2021-10-26 Russell Epstein <[email protected]>
+
+ Cherry-pick r283703. rdar://problem/84629308
+
+ ScopedEGLDefaultDisplay should be removed
+ https://bugs.webkit.org/show_bug.cgi?id=231011
+
+ Patch by Kimmo Kinnunen <[email protected]> on 2021-10-07
+ Reviewed by Kenneth Russell.
+
+ Source/WebCore:
+
+ Hard-coding the code to EGL_DEFAULT_DISPLAY only and using the scoped
+ holder is making the EGLDisplays harder to use than neccessary. The
+ implementation target, e.g. the ability to call EGLTerminate, was also a bit
+ more convoluted than needed.
+
+ Move the "call EGLTerminate" logic from a bit convoluted refcount mechanism
+ in ScopedEGLDefaultDisplay to the explicit GraphicsContextGLOpenGL::releaseResources().
+ The callers are expected to do the refcounting anyway, as the existing client
+ WebKit::ScopedWebGLRenderingResourcesRequest already did.
+
+ Make GraphicsContextGLOpenGL::releaseResources() available on all platforms.
+ It is implemented on all ANGLE implementations.
+ Platforms can augment the implementation by implementing
+ GraphicsContextGLOpenGL::platformReleaseResources(). For Cocoa, this function
+ resets the currentContext cache that is used to optimize making context current.
+
+ No new tests, refactor.
+
+ * CMakeLists.txt:
+ * Headers.cmake:
+ * PlatformMac.cmake:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/angle/ANGLEUtilities.cpp: Renamed from Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.h.
+ (WebCore::platformIsANGLEAvailable):
+ * platform/graphics/angle/ANGLEUtilities.h: Renamed from Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h.
+ Rename GraphicsContextGLANGLEUtilities to simpler and more descriptive ANGLEUtilities.
+ Add the isANGLEAvailable to there.
+
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLOpenGL::releaseResources):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ * platform/graphics/angle/GraphicsContextGLANGLEEGLUtilities.cpp: Removed.
+ (WebCore::refDefaultDisplay): Deleted.
+ (WebCore::unrefDefaultDisplayIfNeeded): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::operator=): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::ScopedEGLDefaultDisplay): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::~ScopedEGLDefaultDisplay): Deleted.
+ (WebCore::ScopedEGLDefaultDisplay::releaseAllResourcesIfUnused): Deleted.
+ * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+ (WebCore::platformIsANGLEAvailable):
+ (WebCore::initializeEGLDisplay):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ (WebCore::isANGLEAvailable): Deleted.
+ (WebCore::GraphicsContextGLOpenGL::releaseCurrentContext): Deleted.
+ (WebCore::GraphicsContextGLOpenGL::releaseAllResourcesIfUnused): Deleted.
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+ (WebCore::GraphicsContextGLOpenGL::releaseResources):
+ (WebCore::GraphicsContextGLOpenGL::platformReleaseResources):
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+ * platform/ios/wak/WebCoreThread.mm:
+
+ Source/WebKit:
+
+ Implement the release of WebGL resources with the amended
+ GraphicsContextGLOpenGL::releaseResources() instead of
+ previous separate function GraphicsContextGLOpenGL::releaseAllResources().
+
+ Use the resource release code path universally, as
+ GraphicsContextGLOpenGL::releaseResources() is now common code.
+
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp:
+ (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
+ (WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources):
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h:
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp: Removed.
+ (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources): Deleted.
+ (WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources): Deleted.
+ * SourcesCocoa.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-07 Kimmo Kinnunen <[email protected]>
+
+ ScopedEGLDefaultDisplay should be removed
+ https://bugs.webkit.org/show_bug.cgi?id=231011
+
+ Reviewed by Kenneth Russell.
+
+ Implement the release of WebGL resources with the amended
+ GraphicsContextGLOpenGL::releaseResources() instead of
+ previous separate function GraphicsContextGLOpenGL::releaseAllResources().
+
+ Use the resource release code path universally, as
+ GraphicsContextGLOpenGL::releaseResources() is now common code.
+
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp:
+ (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
+ (WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources):
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h:
+ * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp: Removed.
+ (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources): Deleted.
+ (WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources): Deleted.
+ * SourcesCocoa.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+
2021-10-26 Alan Coon <[email protected]>
Cherry-pick r284344. rdar://problem/84625558
Modified: branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp (284952 => 284953)
--- branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp 2021-10-27 21:06:12 UTC (rev 284953)
@@ -26,20 +26,38 @@
#include "config.h"
#include "ScopedWebGLRenderingResourcesRequest.h"
+#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL)
+
+#include "RemoteGraphicsContextGL.h"
+#include "StreamConnectionWorkQueue.h"
+#include <WebCore/GraphicsContextGL.h>
+#include <wtf/RunLoop.h>
+#include <wtf/Seconds.h>
+
namespace WebKit {
std::atomic<unsigned> ScopedWebGLRenderingResourcesRequest::s_requests;
+static constexpr Seconds freeWebGLRenderingResourcesTimeout = 1_s;
+static bool didScheduleFreeWebGLRenderingResources;
-#if !PLATFORM(COCOA)
-
void ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources()
{
+ if (didScheduleFreeWebGLRenderingResources)
+ return;
+ RunLoop::main().dispatchAfter(freeWebGLRenderingResourcesTimeout, freeWebGLRenderingResources);
+ didScheduleFreeWebGLRenderingResources = true;
}
void ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources()
{
+ didScheduleFreeWebGLRenderingResources = false;
+ if (s_requests)
+ return;
+ remoteGraphicsContextGLStreamWorkQueue().dispatch([] {
+ WebCore::GraphicsContextGLOpenGL::releaseThreadResources(WebCore::GraphicsContextGLOpenGL::ReleaseThreadResourceBehavior::TerminateAndReleaseThreadResources);
+ });
}
+}
+
#endif
-
-}
Modified: branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h (284952 => 284953)
--- branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h 2021-10-27 21:06:12 UTC (rev 284953)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL)
+
#include "ScopedRenderingResourcesRequest.h"
#include <atomic>
#include <wtf/StdLibExtras.h>
@@ -82,3 +84,5 @@
};
}
+
+#endif
Deleted: branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp (284952 => 284953)
--- branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp 2021-10-27 21:06:12 UTC (rev 284953)
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScopedWebGLRenderingResourcesRequest.h"
-
-#if PLATFORM(COCOA)
-
-#include "RemoteGraphicsContextGL.h"
-#include "StreamConnectionWorkQueue.h"
-#include <WebCore/GraphicsContextGL.h>
-#include <wtf/RunLoop.h>
-#include <wtf/Seconds.h>
-
-namespace WebKit {
-
-static constexpr Seconds freeWebGLRenderingResourcesTimeout = 1_s;
-static bool didScheduleFreeWebGLRenderingResources;
-
-void ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources()
-{
- if (didScheduleFreeWebGLRenderingResources)
- return;
- RunLoop::main().dispatchAfter(freeWebGLRenderingResourcesTimeout, freeWebGLRenderingResources);
- didScheduleFreeWebGLRenderingResources = true;
-}
-
-void ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources()
-{
- didScheduleFreeWebGLRenderingResources = false;
- if (s_requests)
- return;
- remoteGraphicsContextGLStreamWorkQueue().dispatch(GraphicsContextGLOpenGL::releaseAllResourcesIfUnused);
-}
-
-}
-
-#endif
Modified: branches/safari-612-branch/Source/WebKit/SourcesCocoa.txt (284952 => 284953)
--- branches/safari-612-branch/Source/WebKit/SourcesCocoa.txt 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebKit/SourcesCocoa.txt 2021-10-27 21:06:12 UTC (rev 284953)
@@ -62,7 +62,6 @@
GPUProcess/cocoa/GPUProcessCocoa.mm
GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp
GPUProcess/graphics/ScopedRenderingResourcesRequestCocoa.mm @no-unify
-GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp
GPUProcess/ios/GPUProcessIOS.mm
GPUProcess/mac/GPUProcessMac.mm
GPUProcess/mac/LocalAudioSessionRoutingArbitrator.cpp
Modified: branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (284952 => 284953)
--- branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-10-27 21:06:06 UTC (rev 284952)
+++ branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-10-27 21:06:12 UTC (rev 284953)
@@ -4714,7 +4714,6 @@
7BCF70CC2614935F00E4FB70 /* ScopedWebGLRenderingResourcesRequest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScopedWebGLRenderingResourcesRequest.cpp; sourceTree = "<group>"; };
7BCF70CD2614935F00E4FB70 /* ScopedRenderingResourcesRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScopedRenderingResourcesRequest.h; sourceTree = "<group>"; };
7BCF70CE2614935F00E4FB70 /* ScopedWebGLRenderingResourcesRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScopedWebGLRenderingResourcesRequest.h; sourceTree = "<group>"; };
- 7BCF70CF261497E600E4FB70 /* ScopedWebGLRenderingResourcesRequestCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScopedWebGLRenderingResourcesRequestCocoa.cpp; sourceTree = "<group>"; };
7BE726572574F67200E85D98 /* RemoteGraphicsContextGLProxyFunctionsGenerated.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteGraphicsContextGLProxyFunctionsGenerated.cpp; sourceTree = "<group>"; };
7BE72668257680EF00E85D98 /* RemoteGraphicsContextGLCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteGraphicsContextGLCocoa.cpp; sourceTree = "<group>"; };
7C065F291C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerDataTypes.cpp; sourceTree = "<group>"; };
@@ -9052,7 +9051,6 @@
7BCF70CB2614935E00E4FB70 /* ScopedRenderingResourcesRequestCocoa.mm */,
7BCF70CC2614935F00E4FB70 /* ScopedWebGLRenderingResourcesRequest.cpp */,
7BCF70CE2614935F00E4FB70 /* ScopedWebGLRenderingResourcesRequest.h */,
- 7BCF70CF261497E600E4FB70 /* ScopedWebGLRenderingResourcesRequestCocoa.cpp */,
);
path = graphics;
sourceTree = "<group>";