Diff
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285437 => 285438)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-08 23:30:20 UTC (rev 285438)
@@ -885,89 +885,6 @@
2021-10-26 Russell Epstein <[email protected]>
- Cherry-pick r284669. rdar://problem/83971417
-
- WebGL low-power and high-performance contexts should use different ANGLE Metal EGLDisplays
- https://bugs.webkit.org/show_bug.cgi?id=231012
- <rdar://problem/83971417>
-
- Patch by Kimmo Kinnunen <[email protected]> on 2021-10-22
- Reviewed by Dean Jackson.
-
- Source/WebCore:
-
- Use per-power preference EGLDisplay when creating Metal
- contexts.
-
- Adds a new API test.
-
- * platform/RuntimeApplicationChecks.cpp:
- (WebCore::setAuxiliaryProcessTypeForTesting):
- * platform/RuntimeApplicationChecks.h:
- Add a test function to reset the process type after test has set a specific type and then
- run to completion. process for the duration of the test. The volatile context flag in
- GraphicsContextGLOpenGL depends on condition isWebProcess || isGPUProcess.
- * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
- (WebCore::GraphicsContextGLOpenGL::releaseThreadResources):
- * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
- (WebCore::initializeEGLDisplay):
- (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
- (WebCore::GraphicsContextGLOpenGL::setContextVisibility):
- (WebCore::GraphicsContextGLOpenGL::displayWasReconfigured):
- * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
-
- Tools:
-
- Add a API test to test GraphicsContextGLOpenGL
- Cocoa implementation regarding the bug where
- the GraphicsContextGLOpenGL instances would use
- the GPU that was selected by the first instance.
-
- * TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
- * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
- * TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm: Added.
- (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::create):
- (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::TestedGraphicsContextGLOpenGL):
- (TestWebKitAPI::hasMultipleGPUs):
- (TestWebKitAPI::TEST):
- * TestWebKitAPI/WebCoreUtilities.h: Added.
- (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::ScopedSetAuxiliaryProcessTypeForTesting):
- (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::~ScopedSetAuxiliaryProcessTypeForTesting):
- Add a utility state setter to set the process type for the
- duration of a test.
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2021-10-22 Kimmo Kinnunen <[email protected]>
-
- WebGL low-power and high-performance contexts should use different ANGLE Metal EGLDisplays
- https://bugs.webkit.org/show_bug.cgi?id=231012
- <rdar://problem/83971417>
-
- Reviewed by Dean Jackson.
-
- Use per-power preference EGLDisplay when creating Metal
- contexts.
-
- Adds a new API test.
-
- * platform/RuntimeApplicationChecks.cpp:
- (WebCore::setAuxiliaryProcessTypeForTesting):
- * platform/RuntimeApplicationChecks.h:
- Add a test function to reset the process type after test has set a specific type and then
- run to completion. process for the duration of the test. The volatile context flag in
- GraphicsContextGLOpenGL depends on condition isWebProcess || isGPUProcess.
- * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
- (WebCore::GraphicsContextGLOpenGL::releaseThreadResources):
- * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
- (WebCore::initializeEGLDisplay):
- (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
- (WebCore::GraphicsContextGLOpenGL::setContextVisibility):
- (WebCore::GraphicsContextGLOpenGL::displayWasReconfigured):
- * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
-
-2021-10-26 Russell Epstein <[email protected]>
-
Cherry-pick r283703. rdar://problem/84629308
ScopedEGLDefaultDisplay should be removed
Modified: branches/safari-612-branch/Source/WebCore/platform/RuntimeApplicationChecks.cpp (285437 => 285438)
--- branches/safari-612-branch/Source/WebCore/platform/RuntimeApplicationChecks.cpp 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Source/WebCore/platform/RuntimeApplicationChecks.cpp 2021-11-08 23:30:20 UTC (rev 285438)
@@ -75,11 +75,6 @@
auxiliaryProcessType() = type;
}
-void setAuxiliaryProcessTypeForTesting(std::optional<AuxiliaryProcessType> type)
-{
- auxiliaryProcessType() = type;
-}
-
bool checkAuxiliaryProcessType(AuxiliaryProcessType type)
{
auto currentType = auxiliaryProcessType();
Modified: branches/safari-612-branch/Source/WebCore/platform/RuntimeApplicationChecks.h (285437 => 285438)
--- branches/safari-612-branch/Source/WebCore/platform/RuntimeApplicationChecks.h 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Source/WebCore/platform/RuntimeApplicationChecks.h 2021-11-08 23:30:20 UTC (rev 285438)
@@ -45,7 +45,6 @@
};
WEBCORE_EXPORT void setAuxiliaryProcessType(AuxiliaryProcessType);
-WEBCORE_EXPORT void setAuxiliaryProcessTypeForTesting(std::optional<AuxiliaryProcessType>);
WEBCORE_EXPORT bool checkAuxiliaryProcessType(AuxiliaryProcessType);
bool isInAuxiliaryProcess();
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (285437 => 285438)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-11-08 23:30:20 UTC (rev 285438)
@@ -85,8 +85,7 @@
// 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) {
- EGLDisplay display = EGL_GetCurrentDisplay();
- if (display == EGL_NO_DISPLAY)
+ 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.
@@ -93,26 +92,20 @@
// 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 currentDisplay = EGL_GetCurrentDisplay();
- if (currentDisplay != EGL_NO_DISPLAY) {
- ASSERT_NOT_REACHED(); // All resources must have been destroyed.
- EGL_MakeCurrent(currentDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ 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);
}
- constexpr EGLNativeDisplayType nativeDisplays[] = {
- defaultDisplay,
-#if PLATFORM(COCOA)
- lowPowerDisplay,
- highPerformanceDisplay
-#endif
- };
- for (auto nativeDisplay : nativeDisplays) {
- EGLDisplay display = EGL_GetDisplay(nativeDisplay);
- if (display != EGL_NO_DISPLAY)
- 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.
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (285437 => 285438)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-11-08 23:30:20 UTC (rev 285438)
@@ -147,25 +147,24 @@
}
LOG(WebGL, "Attempting to use ANGLE's %s backend.", attrs.useMetal ? "Metal" : "OpenGL");
- EGLNativeDisplayType nativeDisplay = GraphicsContextGLOpenGL::defaultDisplay;
if (attrs.useMetal) {
displayAttributes.append(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
displayAttributes.append(EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE);
- // These properties are defined for EGL_ANGLE_power_preference as EGLContext attributes,
- // but Metal backend uses EGLDisplay attributes.
- auto powerPreference = attrs.forceRequestForHighPerformanceGPU ? GraphicsContextGLAttributes::PowerPreference::HighPerformance : attrs.powerPreference;
- if (powerPreference == GraphicsContextGLAttributes::PowerPreference::LowPower) {
- displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
+ }
+
+ if (attrs.powerPreference != GraphicsContextGLAttributes::PowerPreference::Default || attrs.forceRequestForHighPerformanceGPU) {
+ displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
+ if (attrs.powerPreference == GraphicsContextGLAttributes::PowerPreference::LowPower && !attrs.forceRequestForHighPerformanceGPU) {
+ LOG(WebGL, "Requesting low power GPU.");
displayAttributes.append(EGL_LOW_POWER_ANGLE);
- nativeDisplay = GraphicsContextGLOpenGL::lowPowerDisplay;
- } else if (powerPreference == GraphicsContextGLAttributes::PowerPreference::HighPerformance) {
- displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
+ } else {
+ ASSERT(attrs.powerPreference == GraphicsContextGLAttributes::PowerPreference::HighPerformance || attrs.forceRequestForHighPerformanceGPU);
+ LOG(WebGL, "Requesting high power GPU if available.");
displayAttributes.append(EGL_HIGH_POWER_ANGLE);
- nativeDisplay = GraphicsContextGLOpenGL::highPerformanceDisplay;
}
}
displayAttributes.append(EGL_NONE);
- display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(nativeDisplay), displayAttributes.data());
+ display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(EGL_DEFAULT_DISPLAY), displayAttributes.data());
if (EGL_Initialize(display, &majorVersion, &minorVersion) == EGL_FALSE) {
LOG(WebGL, "EGLDisplay Initialization failed.");
@@ -174,7 +173,7 @@
LOG(WebGL, "ANGLE initialised Major: %d Minor: %d", majorVersion, minorVersion);
if (shouldInitializeWithVolatileContextSupport) {
// After initialization, EGL_DEFAULT_DISPLAY will return the platform-customized display.
- ASSERT(display == EGL_GetDisplay(nativeDisplay));
+ ASSERT(display == EGL_GetDisplay(EGL_DEFAULT_DISPLAY));
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));
}
@@ -242,25 +241,16 @@
if (!m_displayObj)
return;
+ bool supportsPowerPreference = false;
#if PLATFORM(MAC)
- if (!attrs.useMetal) {
- // For OpenGL, EGL_ANGLE_power_preference is used. The context is initialized with the
- // default, low-power device. For high-performance contexts, we request the high-performance
- // GPU in setContextVisibility. When the request is fullfilled by the system, we get the
- // display reconfiguration callback. Upon this, we update the CGL contexts inside ANGLE.
- const char *displayExtensions = EGL_QueryString(m_displayObj, EGL_EXTENSIONS);
- bool supportsPowerPreference = strstr(displayExtensions, "EGL_ANGLE_power_preference");
- if (supportsPowerPreference) {
- m_switchesGPUOnDisplayReconfiguration = attrs.powerPreference == GraphicsContextGLPowerPreference::HighPerformance
- || attrs.forceRequestForHighPerformanceGPU;
- } else {
- if (attrs.powerPreference == GraphicsContextGLPowerPreference::HighPerformance) {
- attrs.powerPreference = GraphicsContextGLPowerPreference::Default;
- setContextAttributes(attrs);
- }
- }
+ const char *displayExtensions = EGL_QueryString(m_displayObj, EGL_EXTENSIONS);
+ m_supportsPowerPreference = strstr(displayExtensions, "EGL_ANGLE_power_preference");
+ supportsPowerPreference = m_supportsPowerPreference;
+#endif
+ if (!supportsPowerPreference && attrs.powerPreference == GraphicsContextGLPowerPreference::HighPerformance) {
+ attrs.powerPreference = GraphicsContextGLPowerPreference::Default;
+ setContextAttributes(attrs);
}
-#endif
EGLint configAttributes[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -545,7 +535,7 @@
void GraphicsContextGLOpenGL::setContextVisibility(bool isVisible)
{
#if PLATFORM(MAC)
- if (!m_switchesGPUOnDisplayReconfiguration)
+ if (contextAttributes().powerPreference != GraphicsContextGLPowerPreference::HighPerformance)
return;
if (isVisible)
m_highPerformanceGPURequest = ScopedHighPerformanceGPURequest::acquire();
@@ -559,7 +549,7 @@
void GraphicsContextGLOpenGL::displayWasReconfigured()
{
#if PLATFORM(MAC)
- if (m_switchesGPUOnDisplayReconfiguration)
+ if (m_supportsPowerPreference)
EGL_HandleGPUSwitchANGLE(m_displayObj);
#endif
dispatchContextChangedNotification();
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (285437 => 285438)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2021-11-08 23:30:20 UTC (rev 285438)
@@ -542,16 +542,7 @@
#endif
#endif
-#if USE(ANGLE)
- constexpr static EGLNativeDisplayType defaultDisplay = EGL_DEFAULT_DISPLAY;
-#if PLATFORM(COCOA)
- constexpr static EGLNativeDisplayType lowPowerDisplay = EGL_CAST(EGLNativeDisplayType, -1);
- constexpr static EGLNativeDisplayType highPerformanceDisplay = EGL_CAST(EGLNativeDisplayType, -2);
-#endif
-#endif
-
private:
-
#if PLATFORM(COCOA)
GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, GraphicsContextGLIOSurfaceSwapChain* = nullptr);
#else
@@ -804,7 +795,7 @@
void* m_displayBufferPbuffer { nullptr };
#endif
#if PLATFORM(MAC)
- bool m_switchesGPUOnDisplayReconfiguration { false };
+ bool m_supportsPowerPreference { false };
ScopedHighPerformanceGPURequest m_highPerformanceGPURequest;
#endif
#if ENABLE(VIDEO) && USE(AVFOUNDATION)
Modified: branches/safari-612-branch/Tools/ChangeLog (285437 => 285438)
--- branches/safari-612-branch/Tools/ChangeLog 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Tools/ChangeLog 2021-11-08 23:30:20 UTC (rev 285438)
@@ -316,87 +316,6 @@
* TestWebKitAPI/Tests/WTF/cocoa/TypeCastsNS.mm: Add.
(TestWebKitAPI::TEST): Add tests for <wtf/TypeCastsNS.h>.
-2021-10-26 Russell Epstein <[email protected]>
-
- Cherry-pick r284669. rdar://problem/83971417
-
- WebGL low-power and high-performance contexts should use different ANGLE Metal EGLDisplays
- https://bugs.webkit.org/show_bug.cgi?id=231012
- <rdar://problem/83971417>
-
- Patch by Kimmo Kinnunen <[email protected]> on 2021-10-22
- Reviewed by Dean Jackson.
-
- Source/WebCore:
-
- Use per-power preference EGLDisplay when creating Metal
- contexts.
-
- Adds a new API test.
-
- * platform/RuntimeApplicationChecks.cpp:
- (WebCore::setAuxiliaryProcessTypeForTesting):
- * platform/RuntimeApplicationChecks.h:
- Add a test function to reset the process type after test has set a specific type and then
- run to completion. process for the duration of the test. The volatile context flag in
- GraphicsContextGLOpenGL depends on condition isWebProcess || isGPUProcess.
- * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
- (WebCore::GraphicsContextGLOpenGL::releaseThreadResources):
- * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
- (WebCore::initializeEGLDisplay):
- (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
- (WebCore::GraphicsContextGLOpenGL::setContextVisibility):
- (WebCore::GraphicsContextGLOpenGL::displayWasReconfigured):
- * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
-
- Tools:
-
- Add a API test to test GraphicsContextGLOpenGL
- Cocoa implementation regarding the bug where
- the GraphicsContextGLOpenGL instances would use
- the GPU that was selected by the first instance.
-
- * TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
- * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
- * TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm: Added.
- (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::create):
- (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::TestedGraphicsContextGLOpenGL):
- (TestWebKitAPI::hasMultipleGPUs):
- (TestWebKitAPI::TEST):
- * TestWebKitAPI/WebCoreUtilities.h: Added.
- (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::ScopedSetAuxiliaryProcessTypeForTesting):
- (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::~ScopedSetAuxiliaryProcessTypeForTesting):
- Add a utility state setter to set the process type for the
- duration of a test.
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2021-10-22 Kimmo Kinnunen <[email protected]>
-
- WebGL low-power and high-performance contexts should use different ANGLE Metal EGLDisplays
- https://bugs.webkit.org/show_bug.cgi?id=231012
- <rdar://problem/83971417>
-
- Reviewed by Dean Jackson.
-
- Add a API test to test GraphicsContextGLOpenGL
- Cocoa implementation regarding the bug where
- the GraphicsContextGLOpenGL instances would use
- the GPU that was selected by the first instance.
-
- * TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
- * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
- * TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm: Added.
- (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::create):
- (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::TestedGraphicsContextGLOpenGL):
- (TestWebKitAPI::hasMultipleGPUs):
- (TestWebKitAPI::TEST):
- * TestWebKitAPI/WebCoreUtilities.h: Added.
- (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::ScopedSetAuxiliaryProcessTypeForTesting):
- (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::~ScopedSetAuxiliaryProcessTypeForTesting):
- Add a utility state setter to set the process type for the
- duration of a test.
-
2021-10-25 Null <[email protected]>
Cherry-pick r284532. rdar://problem/84625267
Modified: branches/safari-612-branch/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig (285437 => 285438)
--- branches/safari-612-branch/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig 2021-11-08 23:30:20 UTC (rev 285438)
@@ -86,7 +86,7 @@
OTHER_CPLUSPLUSFLAGS = $(inherited) -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders;
-OTHER_LDFLAGS = $(inherited) -lgtest -force_load $(BUILT_PRODUCTS_DIR)/libTestWebKitAPI.a -framework _javascript_Core -framework WebKit -lWebCoreTestSupport -framework Metal $(WK_AUTHKIT_LDFLAGS) -framework Network $(WK_HID_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SYSTEM_LDFLAGS) $(WK_UIKITMACHELPER_LDFLAGS) $(WK_VISIONKITCORE_LDFLAGS) $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH));
+OTHER_LDFLAGS = $(inherited) -lgtest -force_load $(BUILT_PRODUCTS_DIR)/libTestWebKitAPI.a -framework _javascript_Core -framework WebKit -lWebCoreTestSupport $(WK_AUTHKIT_LDFLAGS) -framework Network $(WK_HID_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SYSTEM_LDFLAGS) $(WK_UIKITMACHELPER_LDFLAGS) $(WK_VISIONKITCORE_LDFLAGS) $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH));
OTHER_LDFLAGS_PLATFORM_ = -framework Cocoa -framework Carbon;
// FIXME: This should not be built on iOS. Instead we should create and use a TestWebKitAPI application.
Modified: branches/safari-612-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (285437 => 285438)
--- branches/safari-612-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-11-08 23:30:20 UTC (rev 285438)
@@ -601,7 +601,6 @@
7B2739F32632AB640040F182 /* ThreadAssertionsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B2739F22632AB640040F182 /* ThreadAssertionsTest.cpp */; };
7B774906267CCE72009873B4 /* TestRunnerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B774904267CCE68009873B4 /* TestRunnerTests.cpp */; };
7B7D096A2519F8F90017A078 /* WebGLNoCrashOnOtherThreadAccess.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7B7D09692519F8F90017A078 /* WebGLNoCrashOnOtherThreadAccess.mm */; };
- 7BA3936C271EDFCA0015911C /* TestGraphicsContextGLOpenGLCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7BA3936B271EDFCA0015911C /* TestGraphicsContextGLOpenGLCocoa.mm */; };
7C1AF7951E8DCBAB002645B9 /* PrepareForMoveToWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C1AF7931E8DCBAB002645B9 /* PrepareForMoveToWindow.mm */; };
7C3965061CDD74F90094DBB8 /* ColorTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3965051CDD74F90094DBB8 /* ColorTests.cpp */; };
7C3DB8E41D12129B00AE8CC3 /* CommandBackForward.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */; };
@@ -2483,8 +2482,6 @@
7B2739F22632AB640040F182 /* ThreadAssertionsTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadAssertionsTest.cpp; sourceTree = "<group>"; };
7B774904267CCE68009873B4 /* TestRunnerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRunnerTests.cpp; sourceTree = "<group>"; };
7B7D09692519F8F90017A078 /* WebGLNoCrashOnOtherThreadAccess.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLNoCrashOnOtherThreadAccess.mm; sourceTree = "<group>"; };
- 7BA3936B271EDFCA0015911C /* TestGraphicsContextGLOpenGLCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestGraphicsContextGLOpenGLCocoa.mm; sourceTree = "<group>"; };
- 7BA3936D271EEC530015911C /* WebCoreUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreUtilities.h; sourceTree = "<group>"; };
7C1AF7931E8DCBAB002645B9 /* PrepareForMoveToWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrepareForMoveToWindow.mm; sourceTree = "<group>"; };
7C3965051CDD74F90094DBB8 /* ColorTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorTests.cpp; sourceTree = "<group>"; };
7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CommandBackForward.mm; sourceTree = "<group>"; };
@@ -3278,7 +3275,6 @@
BC131AA8117131FC00B69727 /* TestsController.cpp */,
BCB9E7C711234E3A00A137E0 /* TestsController.h */,
7C83E0361D0A5F7000FEBCF3 /* Utilities.h */,
- 7BA3936D271EEC530015911C /* WebCoreUtilities.h */,
7CBD5A2222DE42A6004A9E32 /* WTFStringUtilities.cpp */,
44A622C114A0E2B60048515B /* WTFStringUtilities.h */,
);
@@ -4931,7 +4927,6 @@
57F1C91025DDD51900E8F6EA /* PrivateClickMeasurementCocoa.mm */,
5769C50A1D9B0001000847FB /* SerializedCryptoKeyWrap.mm */,
A17991861E1C994E00A505ED /* SharedBuffer.mm */,
- 7BA3936B271EDFCA0015911C /* TestGraphicsContextGLOpenGLCocoa.mm */,
CD89D0381C4EDB2A00040A04 /* WebCoreNSURLSession.mm */,
);
path = cocoa;
@@ -5848,7 +5843,6 @@
F46128CB211D475100D9FADB /* TestDraggingInfo.mm in Sources */,
F4E0A2B82122847400AF7C7F /* TestFilePromiseReceiver.mm in Sources */,
F4F5BB5221667BAA002D06B9 /* TestFontOptions.mm in Sources */,
- 7BA3936C271EDFCA0015911C /* TestGraphicsContextGLOpenGLCocoa.mm in Sources */,
F45E15762112CE6200307E82 /* TestInputDelegate.mm in Sources */,
F45D3891215A7B4B002A2979 /* TestInspectorBar.mm in Sources */,
516281252325C18000BB7E42 /* TestPDFDocument.mm in Sources */,
Deleted: branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm (285437 => 285438)
--- branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm 2021-11-08 23:30:20 UTC (rev 285438)
@@ -1,96 +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.
- */
-
-#import "config.h"
-#import "Test.h"
-
-#if PLATFORM(COCOA) && ENABLE(WEBGL)
-#import "WebCoreUtilities.h"
-#import <Metal/Metal.h>
-#import <WebCore/GraphicsContextGLOpenGL.h>
-
-namespace TestWebKitAPI {
-using namespace WebCore;
-
-namespace {
-class TestedGraphicsContextGLOpenGL : public GraphicsContextGLOpenGL {
-public:
- static RefPtr<TestedGraphicsContextGLOpenGL> create(GraphicsContextGLAttributes attributes)
- {
- auto context = adoptRef(*new TestedGraphicsContextGLOpenGL(WTFMove(attributes)));
- return context;
- }
-private:
- TestedGraphicsContextGLOpenGL(GraphicsContextGLAttributes attributes)
- : GraphicsContextGLOpenGL(WTFMove(attributes))
- {
- }
-};
-}
-
-static bool hasMultipleGPUs()
-{
-#if (PLATFORM(MAC) || PLATFORM(MACCATALYST))
- auto devices = adoptNS(MTLCopyAllDevices());
- return [devices count] > 1;
-#else
- return false;
-#endif
-}
-
-#if HAVE(WEBGL_COMPATIBLE_METAL) && (PLATFORM(MAC) || PLATFORM(MACCATALYST))
-#define MAYBE_MultipleGPUsDifferentPowerPreferenceMetal MultipleGPUsDifferentPowerPreferenceMetal
-#else
-#define MAYBE_MultipleGPUsDifferentPowerPreferenceMetal DISABLED_MultipleGPUsDifferentPowerPreferenceMetal
-#endif
-// Tests for a bug where high-performance context would use low-power GPU if low-power or default
-// context was created first. Test is applicable only for Metal, since GPU selection for OpenGL is
-// very different.
-TEST(GraphicsContextGLOpenGLCocoaTest, MAYBE_MultipleGPUsDifferentPowerPreferenceMetal)
-{
- if (!hasMultipleGPUs())
- return;
- ScopedSetAuxiliaryProcessTypeForTesting scopedProcessType { AuxiliaryProcessType::GPU };
-
- GraphicsContextGLAttributes attributes;
- attributes.useMetal = true;
- EXPECT_EQ(attributes.powerPreference, GraphicsContextGLPowerPreference::Default);
- auto defaultContext = TestedGraphicsContextGLOpenGL::create(attributes);
- EXPECT_NE(defaultContext, nullptr);
-
- attributes.powerPreference = GraphicsContextGLPowerPreference::LowPower;
- auto lowPowerContext = TestedGraphicsContextGLOpenGL::create(attributes);
- EXPECT_NE(lowPowerContext, nullptr);
-
- attributes.powerPreference = GraphicsContextGLPowerPreference::HighPerformance;
- auto highPerformanceContext = TestedGraphicsContextGLOpenGL::create(attributes);
- EXPECT_NE(highPerformanceContext, nullptr);
-
- EXPECT_NE(lowPowerContext->getString(GraphicsContextGL::RENDERER), highPerformanceContext->getString(GraphicsContextGL::RENDERER));
- EXPECT_EQ(defaultContext->getString(GraphicsContextGL::RENDERER), lowPowerContext->getString(GraphicsContextGL::RENDERER));
-}
-
-}
-#endif
Deleted: branches/safari-612-branch/Tools/TestWebKitAPI/WebCoreUtilities.h (285437 => 285438)
--- branches/safari-612-branch/Tools/TestWebKitAPI/WebCoreUtilities.h 2021-11-08 23:30:14 UTC (rev 285437)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/WebCoreUtilities.h 2021-11-08 23:30:20 UTC (rev 285438)
@@ -1,47 +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.
- */
-
-#pragma once
-
-#include <WebCore/RuntimeApplicationChecks.h>
-
-namespace TestWebKitAPI {
-
-class ScopedSetAuxiliaryProcessTypeForTesting {
-public:
- explicit ScopedSetAuxiliaryProcessTypeForTesting(WebCore::AuxiliaryProcessType type)
- : m_oldType(WebCore::processType())
- {
- setAuxiliaryProcessTypeForTesting(type);
- }
- ~ScopedSetAuxiliaryProcessTypeForTesting()
- {
- setAuxiliaryProcessTypeForTesting(m_oldType);
- }
-private:
- std::optional<WebCore::AuxiliaryProcessType> m_oldType;
-};
-
-} // namespace TestWebKitAPI