Diff
Modified: trunk/Source/WTF/ChangeLog (236772 => 236773)
--- trunk/Source/WTF/ChangeLog 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WTF/ChangeLog 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1,3 +1,15 @@
+2018-10-01 Dean Jackson <d...@apple.com>
+
+ [macOS] Switching to discrete GPU should be done in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=189361
+ <rdar://problem/43949622>
+
+ Reviewed by Simon Fraser.
+
+ Define GL_SILENCE_DEPRECATION to avoid deprecation warnings for OpenGL.
+
+ * wtf/Platform.h:
+
2018-10-02 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r236624 and r236671.
Modified: trunk/Source/WTF/wtf/Platform.h (236772 => 236773)
--- trunk/Source/WTF/wtf/Platform.h 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WTF/wtf/Platform.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1079,7 +1079,12 @@
#define USE_OPENGL 0
#define USE_OPENGL_ES 1
#endif
+#if PLATFORM(COCOA)
+#ifndef GL_SILENCE_DEPRECATION
+#define GL_SILENCE_DEPRECATION 1
#endif
+#endif
+#endif
#define USE_METAL 1
Modified: trunk/Source/WebCore/ChangeLog (236772 => 236773)
--- trunk/Source/WebCore/ChangeLog 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/ChangeLog 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1,3 +1,62 @@
+2018-10-01 Dean Jackson <d...@apple.com>
+
+ [macOS] Switching to discrete GPU should be done in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=189361
+ <rdar://problem/43949622>
+
+ Reviewed by Simon Fraser.
+
+ Based on an earlier patch by Per Arne Vollan.
+
+ Due to the fact we can't talk to the Window Server, the Web Process can
+ no longer muxing to the discrete GPU directly. Instead we have to get the
+ UI Process to process the change. Do this by adding a new Chrome client
+ called GPUClient, that will have implementations provided by both WebKit
+ and legacy WebKit.
+
+ Unfortunately this can't be tested by a regular WKTR since:
+ - it requires specific hardware
+ - swapping to/from the discrete GPU takes about 20 seconds
+ - running concurrent tests could confuse the tests into thinking
+ the wrong GPU is active
+
+ Instead we'll write a specific test for this functionality and
+ run it on a separate bot.
+
+ * WebCore.xcodeproj/project.pbxproj: Add GPUClient files.
+
+ * page/Chrome.cpp: Drive by clean-up.
+ (WebCore::Chrome::windowScreenDidChange):
+
+ * platform/graphics/GraphicsContext3D.h: We need to keep track of
+ whether we've muxed for this context, in order to not respond to
+ the screen change notifications (they are misleading in the case
+ of muxing).
+
+ * platform/graphics/GraphicsContext3DManager.cpp: Rather than try
+ to mux directly, call into GPUClient.
+ (WebCore::GraphicsContext3DManager::displayWasReconfigured):
+ (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
+ (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
+ (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
+ * platform/graphics/GraphicsContext3DManager.h:
+
+ * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: Only reconfigure
+ the virtual display if it didn't happen from muxing.
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ (WebCore::GraphicsContext3D::updateCGLContext):
+ (WebCore::GraphicsContext3D::screenDidChange):
+
+ * platform/graphics/mac/SwitchingGPUClient.cpp: Added.
+ (WebCore::SwitchingGPUClient::singleton):
+ (WebCore::SwitchingGPUClient::setSingleton):
+ * platform/graphics/mac/SwitchingGPUClient.h: Added.
+
+ * testing/Internals.cpp: Testing helper.
+ (WebCore::Internals::hasMuxableGPU):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2018-10-02 Chris Dumez <cdu...@apple.com>
Image.__proto__ should be Function.prototype, not HTMLElement.prototype
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (236772 => 236773)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-02 23:42:38 UTC (rev 236773)
@@ -3902,6 +3902,8 @@
C0C054CD1118C8E400CE2636 /* IDLParser.pm in Headers */ = {isa = PBXBuildFile; fileRef = 14813BF309EDF88E00F757E1 /* IDLParser.pm */; settings = {ATTRIBUTES = (Private, ); }; };
C0F2A44113869AAB0066C534 /* preprocessor.pm in Headers */ = {isa = PBXBuildFile; fileRef = C0F2A43F13869A280066C534 /* preprocessor.pm */; settings = {ATTRIBUTES = (Private, ); }; };
C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; };
+ C11A9ECE21403A5C00CFB20A /* SwitchingGPUClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C11A9ECD21403A5C00CFB20A /* SwitchingGPUClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ C11A9ED32140578B00CFB20A /* SwitchingGPUClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C11A9ED22140578B00CFB20A /* SwitchingGPUClient.cpp */; };
C1E1D236203DF15400584665 /* ScreenProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E1D235203DF15400584665 /* ScreenProperties.h */; settings = {ATTRIBUTES = (Private, ); }; };
C2015C0A1BE6FEB200822389 /* FontVariantBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */; };
C21DF2EA1D9E4E9900F5B24C /* CSSFontVariationValue.h in Headers */ = {isa = PBXBuildFile; fileRef = C21DF2E81D9E4E9900F5B24C /* CSSFontVariationValue.h */; };
@@ -13088,6 +13090,8 @@
C0F2A43F13869A280066C534 /* preprocessor.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = preprocessor.pm; path = scripts/preprocessor.pm; sourceTree = "<group>"; };
C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingDetectorICU.cpp; sourceTree = "<group>"; };
C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEncodingDetector.h; sourceTree = "<group>"; };
+ C11A9ECD21403A5C00CFB20A /* SwitchingGPUClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwitchingGPUClient.h; sourceTree = "<group>"; };
+ C11A9ED22140578B00CFB20A /* SwitchingGPUClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SwitchingGPUClient.cpp; sourceTree = "<group>"; };
C1E1D235203DF15400584665 /* ScreenProperties.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScreenProperties.h; sourceTree = "<group>"; };
C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontVariantBuilder.h; sourceTree = "<group>"; };
C21DF2E71D9E4E9900F5B24C /* CSSFontVariationValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontVariationValue.cpp; sourceTree = "<group>"; };
@@ -23646,6 +23650,8 @@
B27535510B053814002CE64F /* IntSizeMac.mm */,
2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */,
163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */,
+ C11A9ED22140578B00CFB20A /* SwitchingGPUClient.cpp */,
+ C11A9ECD21403A5C00CFB20A /* SwitchingGPUClient.h */,
7A22731F20C9F9DA00DB1DEF /* WebKitNSImageExtras.h */,
7A22731E20C9F9D900DB1DEF /* WebKitNSImageExtras.mm */,
0FCF332B0F2B9A25004B6795 /* WebLayer.h */,
@@ -30780,6 +30786,7 @@
B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */,
46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */,
+ C11A9ECE21403A5C00CFB20A /* SwitchingGPUClient.h in Headers */,
4151E5BB1FBA4C7A00E47E2D /* SWOriginStore.h in Headers */,
517A52F01F47535B00DCDC0A /* SWServer.h in Headers */,
8311C0031FAA2E9500E3C8E5 /* SWServerJobQueue.h in Headers */,
@@ -31709,6 +31716,7 @@
538F10A81F9022A4005102CE /* SoftLinkLibxslt.cpp in Sources */,
CDC8B5AA18047FF10016E685 /* SourceBufferPrivateAVFObjC.mm in Sources */,
A833C7CA0A2CF06B00D57664 /* SVGNames.cpp in Sources */,
+ C11A9ED32140578B00CFB20A /* SwitchingGPUClient.cpp in Sources */,
9759E93F14EF1CF80026A2DD /* TextTrack.cpp in Sources */,
9759E94214EF1CF80026A2DD /* TextTrackCue.cpp in Sources */,
071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */,
Modified: trunk/Source/WebCore/page/Chrome.cpp (236772 => 236773)
--- trunk/Source/WebCore/page/Chrome.cpp 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/page/Chrome.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -527,11 +527,8 @@
#if PLATFORM(MAC) && ENABLE(GRAPHICS_CONTEXT_3D)
GraphicsContext3DManager::sharedManager().screenDidChange(displayID, this);
#endif
-
}
-// --------
-
#if ENABLE(DASHBOARD_SUPPORT)
void ChromeClient::annotatedRegionsChanged()
{
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (236772 => 236773)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1519,6 +1519,10 @@
#if USE(CAIRO)
Platform3DObject m_vao { 0 };
#endif
+
+#if PLATFORM(MAC)
+ bool m_hasSwitchedToHighPerformanceGPU { false };
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp (236772 => 236773)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -36,6 +36,7 @@
#endif
#if PLATFORM(MAC)
+#include "SwitchingGPUClient.h"
#include <OpenGL/OpenGL.h>
#endif
@@ -109,7 +110,7 @@
return result;
}
-bool hasMuxableGPU()
+bool hasLowAndHighPowerGPUs()
{
static bool canMux = hasMuxCapability();
return canMux;
@@ -125,6 +126,7 @@
#if PLATFORM(MAC)
void GraphicsContext3DManager::displayWasReconfigured(CGDirectDisplayID, CGDisplayChangeSummaryFlags flags, void*)
{
+ LOG(WebGL, "GraphicsContext3DManager::displayWasReconfigured");
if (flags & kCGDisplaySetModeFlag)
GraphicsContext3DManager::sharedManager().updateAllContexts();
}
@@ -216,7 +218,7 @@
void GraphicsContext3DManager::updateHighPerformanceState()
{
#if PLATFORM(MAC)
- if (!hasMuxableGPU())
+ if (!hasLowAndHighPowerGPUs())
return;
if (m_contextsRequiringHighPerformance.size()) {
@@ -225,21 +227,21 @@
LOG(WebGL, "Cancel pending timer for turning off high-performance GPU.");
m_disableHighPerformanceGPUTimer.stop();
}
-
- if (!m_pixelFormatObj) {
- LOG(WebGL, "Turning on high-performance GPU.");
-
- CGLPixelFormatAttribute attributes[] = { kCGLPFAAccelerated, kCGLPFAColorSize, static_cast<CGLPixelFormatAttribute>(32), static_cast<CGLPixelFormatAttribute>(0) };
- GLint numPixelFormats = 0;
- CGLChoosePixelFormat(attributes, &m_pixelFormatObj, &numPixelFormats);
+
+ if (!m_requestingHighPerformance) {
+ LOG(WebGL, "Request the high-performance GPU.");
+ m_requestingHighPerformance = true;
+#if PLATFORM(MAC)
+ SwitchingGPUClient::singleton().requestHighPerformanceGPU();
+#endif
}
- } else if (m_pixelFormatObj) {
+ } else {
// Don't immediately turn off the high-performance GPU. The user might be
// swapping back and forth between tabs or windows, and we don't want to cause
// churn if we can avoid it.
if (!m_disableHighPerformanceGPUTimer.isActive()) {
- LOG(WebGL, "Set a timer to turn off high-performance GPU.");
+ LOG(WebGL, "Set a timer to release the high-performance GPU.");
// FIXME: Expose this value as a Setting, which would require this class
// to reference a frame, page or document.
static const Seconds timeToKeepHighPerformanceGPUAlive { 10_s };
@@ -251,12 +253,12 @@
void GraphicsContext3DManager::disableHighPerformanceGPUTimerFired()
{
+ if (m_contextsRequiringHighPerformance.size())
+ return;
+
+ m_requestingHighPerformance = false;
#if PLATFORM(MAC)
- if (!m_contextsRequiringHighPerformance.size() && m_pixelFormatObj) {
- LOG(WebGL, "Turning off high-performance GPU.");
- CGLReleasePixelFormat(m_pixelFormatObj);
- m_pixelFormatObj = nullptr;
- }
+ SwitchingGPUClient::singleton().releaseHighPerformanceGPU();
#endif
}
@@ -263,7 +265,7 @@
void GraphicsContext3DManager::recycleContextIfNecessary()
{
if (hasTooManyContexts()) {
- LOG(WebGL, "Manager recycled context (%p).", m_contexts[0]);
+ LOG(WebGL, "GraphicsContext3DManager recycled context (%p).", m_contexts[0]);
m_contexts[0]->recycleContext();
}
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.h (236772 => 236773)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.h 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -44,10 +44,11 @@
using PlatformDisplayID = uint32_t;
#if HAVE(APPLE_GRAPHICS_CONTROL)
-bool hasMuxableGPU();
+WEBCORE_EXPORT bool hasLowAndHighPowerGPUs();
#endif
class GraphicsContext3DManager {
+ friend NeverDestroyed<GraphicsContext3DManager>;
public:
static GraphicsContext3DManager& sharedManager();
@@ -70,8 +71,6 @@
#endif
private:
- friend NeverDestroyed<GraphicsContext3DManager>;
-
GraphicsContext3DManager()
: m_disableHighPerformanceGPUTimer(*this, &GraphicsContext3DManager::disableHighPerformanceGPUTimerFired)
{
@@ -85,10 +84,7 @@
HashSet<GraphicsContext3D*> m_contextsRequiringHighPerformance;
Timer m_disableHighPerformanceGPUTimer;
-
-#if PLATFORM(MAC)
- CGLPixelFormatObj m_pixelFormatObj { nullptr };
-#endif
+ bool m_requestingHighPerformance { false };
};
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm (236772 => 236773)
--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm 2018-10-02 23:42:38 UTC (rev 236773)
@@ -289,7 +289,7 @@
bool useMultisampling = m_attrs.antialias;
#if HAVE(APPLE_GRAPHICS_CONTROL)
- m_powerPreferenceUsedForCreation = (hasMuxableGPU() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
+ m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
#else
m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
#endif
@@ -335,7 +335,7 @@
#else
UNUSED_PARAM(hostWindow);
-#endif // !PLATFORM(MAC)
+#endif
CGLDestroyPixelFormat(pixelFormatObj);
@@ -347,7 +347,6 @@
m_isForWebGL2 = attrs.isWebGL2;
- // Set the current context to the one given to us.
CGLSetCurrentContext(m_contextObj);
// WebGL 2 expects ES 3-only PRIMITIVE_RESTART_FIXED_INDEX to be enabled; we must emulate this on non-ES 3 systems.
@@ -603,6 +602,7 @@
makeContextCurrent();
CGLUpdateContext(m_contextObj);
+ m_hasSwitchedToHighPerformanceGPU = true;
}
void GraphicsContext3D::setContextVisibility(bool isVisible)
@@ -648,7 +648,7 @@
#endif
#if HAVE(APPLE_GRAPHICS_CONTROL)
- if (hasMuxableGPU())
+ if (hasLowAndHighPowerGPUs())
return true;
#endif
@@ -661,7 +661,8 @@
if (!m_contextObj)
return;
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
- setGPUByRegistryID(m_contextObj, CGLGetPixelFormat(m_contextObj), gpuIDForDisplay(displayID));
+ if (!m_hasSwitchedToHighPerformanceGPU)
+ setGPUByRegistryID(m_contextObj, CGLGetPixelFormat(m_contextObj), gpuIDForDisplay(displayID));
#else
setGPUByDisplayMask(m_contextObj, CGLGetPixelFormat(m_contextObj), displayMaskForDisplay(displayID));
#endif
Added: trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.cpp (0 => 236773)
--- trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 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 "SwitchingGPUClient.h"
+
+namespace WebCore {
+
+SwitchingGPUClient* SwitchingGPUClient::m_singleton = nullptr;
+
+SwitchingGPUClient& SwitchingGPUClient::singleton()
+{
+ ASSERT(m_singleton);
+ return *m_singleton;
+}
+
+void SwitchingGPUClient::setSingleton(SwitchingGPUClient& singleton)
+{
+ m_singleton = &singleton;
+}
+
+}
Property changes on: trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.cpp
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Added: trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.h (0 => 236773)
--- trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 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
+
+namespace WebCore {
+
+class SwitchingGPUClient {
+public:
+ WEBCORE_EXPORT static SwitchingGPUClient& singleton();
+ WEBCORE_EXPORT static void setSingleton(SwitchingGPUClient&);
+
+ virtual ~SwitchingGPUClient() = default;
+
+ virtual void requestHighPerformanceGPU() = 0;
+ virtual void releaseHighPerformanceGPU() = 0;
+
+private:
+ static SwitchingGPUClient* m_singleton;
+};
+
+}
Property changes on: trunk/Source/WebCore/platform/graphics/mac/SwitchingGPUClient.h
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Modified: trunk/Source/WebCore/testing/Internals.cpp (236772 => 236773)
--- trunk/Source/WebCore/testing/Internals.cpp 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/testing/Internals.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -272,6 +272,10 @@
#include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h>
#endif
+#if PLATFORM(MAC)
+#include "GraphicsContext3DManager.h"
+#endif
+
using JSC::CallData;
using JSC::CallType;
using JSC::CodeBlock;
@@ -4355,7 +4359,16 @@
{
context.setFailNextGPUStatusCheck();
}
+
+bool Internals::hasLowAndHighPowerGPUs()
+{
+#if PLATFORM(MAC)
+ return WebCore::hasLowAndHighPowerGPUs();
+#else
+ return false;
#endif
+}
+#endif
void Internals::setPageVisibility(bool isVisible)
{
Modified: trunk/Source/WebCore/testing/Internals.h (236772 => 236773)
--- trunk/Source/WebCore/testing/Internals.h 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/testing/Internals.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -653,6 +653,7 @@
#if ENABLE(WEBGL)
void simulateWebGLContextChanged(WebGLRenderingContext&);
void failNextGPUStatusCheck(WebGLRenderingContext&);
+ bool hasLowAndHighPowerGPUs();
#endif
void setPageVisibility(bool isVisible);
Modified: trunk/Source/WebCore/testing/Internals.idl (236772 => 236773)
--- trunk/Source/WebCore/testing/Internals.idl 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebCore/testing/Internals.idl 2018-10-02 23:42:38 UTC (rev 236773)
@@ -642,6 +642,7 @@
[Conditional=WEBGL] void simulateWebGLContextChanged(WebGLRenderingContext context);
[Conditional=WEBGL] void failNextGPUStatusCheck(WebGLRenderingContext context);
+ [Conditional=WEBGL] boolean hasLowAndHighPowerGPUs();
void setPageVisibility(boolean isVisible);
void setPageIsFocusedAndActive(boolean isFocused);
Modified: trunk/Source/WebKit/ChangeLog (236772 => 236773)
--- trunk/Source/WebKit/ChangeLog 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/ChangeLog 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1,3 +1,49 @@
+2018-10-01 Dean Jackson <d...@apple.com>
+
+ [macOS] Switching to discrete GPU should be done in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=189361
+ <rdar://problem/43949622>
+
+ Reviewed by Simon Fraser.
+
+ Implement the UI-side process for triggering a GPU mux.
+
+ * Platform/Logging.h: Add a WebGL logging channel.
+
+ * SourcesCocoa.txt: Add the new files: WebSwitchingGPUClient and HighPerformanceGPUManager.
+
+ * UIProcess/Cocoa/WebProcessProxyCocoa.mm: UI process calls that use HighPerformanceGPUManager
+ to keep track of whether or not this process needs the high-performance GPU.
+ (WebKit::WebProcessProxy::requestHighPerformanceGPU):
+ (WebKit::WebProcessProxy::releaseHighPerformanceGPU):
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::~WebProcessProxy): Make sure to unregister with the HighPerformanceGPUManager
+ as the process disappears without manually removing itself (e.g. crashes).
+ * UIProcess/WebProcessProxy.h:
+ * UIProcess/WebProcessProxy.messages.in: New messages.
+
+ * UIProcess/mac/HighPerformanceGPUManager.cpp: New class that copies most of what used
+ to live in GraphicsContext3DManager. It creates a CGLPixelFormat object when it sees
+ that at least one process needs the high-performance GPU.
+ (WebKit::HighPerformanceGPUManager::singleton):
+ (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
+ (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
+ (WebKit::HighPerformanceGPUManager::updateState):
+ * UIProcess/mac/HighPerformanceGPUManager.h: Added.
+
+ * WebKit.xcodeproj/project.pbxproj: Add new files.
+
+ * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: Implementation of the SwitchingGPUClient for
+ WebCore, which sends messages to the UI process.
+ (WebKit::WebSwitchingGPUClient::singleton):
+ (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU):
+ (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU):
+ * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: Added.
+
+ * WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient.
+ (WebKit::WebProcess::platformInitializeProcess):
+
2018-10-02 Sihui Liu <sihui_...@apple.com>
Fix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins
Modified: trunk/Source/WebKit/Platform/Logging.h (236772 => 236773)
--- trunk/Source/WebKit/Platform/Logging.h 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/Platform/Logging.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -81,6 +81,7 @@
M(ViewState) \
M(VirtualMemory) \
M(VisibleRects) \
+ M(WebGL) \
M(WebRTC) \
WEBKIT2_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
Modified: trunk/Source/WebKit/SourcesCocoa.txt (236772 => 236773)
--- trunk/Source/WebKit/SourcesCocoa.txt 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2018-10-02 23:42:38 UTC (rev 236773)
@@ -401,6 +401,7 @@
UIProcess/mac/CorrectionPanel.mm
UIProcess/mac/DisplayLink.cpp
+UIProcess/mac/HighPerformanceGPUManager.cpp
UIProcess/mac/LegacySessionStateCoding.cpp
UIProcess/mac/PageClientImplMac.mm
UIProcess/mac/RemoteWebInspectorProxyMac.mm
@@ -532,6 +533,7 @@
WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
+WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp
WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
WebProcess/WebPage/ViewGestureGeometryCollector.cpp
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (236772 => 236773)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2018-10-02 23:42:38 UTC (rev 236773)
@@ -26,6 +26,8 @@
#import "config.h"
#import "WebProcessProxy.h"
+#import "HighPerformanceGPUManager.h"
+#import "Logging.h"
#import "ObjCObjectGraph.h"
#import "SandboxUtilities.h"
#import "WKBrowsingContextControllerInternal.h"
@@ -179,4 +181,18 @@
return mediaTypeCache();
}
+#if PLATFORM(MAC)
+void WebProcessProxy::requestHighPerformanceGPU()
+{
+ LOG(WebGL, "WebProcessProxy::requestHighPerformanceGPU()");
+ HighPerformanceGPUManager::singleton().addProcessRequiringHighPerformance(this);
}
+
+void WebProcessProxy::releaseHighPerformanceGPU()
+{
+ LOG(WebGL, "WebProcessProxy::releaseHighPerformanceGPU()");
+ HighPerformanceGPUManager::singleton().removeProcessRequiringHighPerformance(this);
+}
+#endif
+
+}
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (236772 => 236773)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -70,6 +70,10 @@
#include "VersionChecks.h"
#endif
+#if PLATFORM(MAC)
+#include "HighPerformanceGPUManager.h"
+#endif
+
#if ENABLE(SEC_ITEM_SHIM)
#include "SecItemShimProxy.h"
#endif
@@ -165,6 +169,10 @@
for (auto& callback : m_localPortActivityCompletionHandlers.values())
callback(MessagePortChannelProvider::HasActivity::No);
+
+#if PLATFORM(MAC)
+ HighPerformanceGPUManager::singleton().removeProcessRequiringHighPerformance(this);
+#endif
}
void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (236772 => 236773)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -224,6 +224,11 @@
void cacheMediaMIMETypes(const Vector<String>&);
#endif
+#if PLATFORM(MAC)
+ void requestHighPerformanceGPU();
+ void releaseHighPerformanceGPU();
+#endif
+
// Called when the web process has crashed or we know that it will terminate soon.
// Will potentially cause the WebProcessProxy object to be freed.
void shutDown();
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (236772 => 236773)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in 2018-10-02 23:42:38 UTC (rev 236773)
@@ -67,4 +67,9 @@
#if PLATFORM(COCOA)
CacheMediaMIMETypes(Vector<String> types)
#endif
+
+#if PLATFORM(MAC)
+ RequestHighPerformanceGPU()
+ ReleaseHighPerformanceGPU()
+#endif
}
Added: trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.cpp (0 => 236773)
--- trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2018 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 "HighPerformanceGPUManager.h"
+
+#if PLATFORM(MAC)
+
+#include "Logging.h"
+#include <OpenGL/CGLTypes.h>
+#include <OpenGL/OpenGL.h>
+#include <WebCore/GraphicsContext3DManager.h>
+
+namespace WebKit {
+
+// FIXME: This class is using OpenGL to control the muxing of GPUs. Ultimately
+// we want to use Metal, but currently there isn't a way to "release" a
+// discrete MTLDevice, such that the process muxes back to an integrated GPU.
+
+HighPerformanceGPUManager& HighPerformanceGPUManager::singleton()
+{
+ static NeverDestroyed<HighPerformanceGPUManager> sharedManager;
+ return sharedManager;
+}
+
+void HighPerformanceGPUManager::addProcessRequiringHighPerformance(WebProcessProxy* process)
+{
+ if (!WebCore::hasLowAndHighPowerGPUs())
+ return;
+
+ if (m_processesRequiringHighPerformance.add(process)) {
+ LOG(WebGL, "HighPerformanceGPUManager::addProcessRequiringHighPerformance() - adding process %p", process);
+ updateState();
+ return;
+ }
+
+ LOG(WebGL, "HighPerformanceGPUManager::addProcessRequiringHighPerformance() - process %p was already requesting high performance", process);
+}
+
+void HighPerformanceGPUManager::removeProcessRequiringHighPerformance(WebProcessProxy* process)
+{
+ if (!WebCore::hasLowAndHighPowerGPUs())
+ return;
+
+ if (m_processesRequiringHighPerformance.remove(process)) {
+ LOG(WebGL, "HighPerformanceGPUManager::removeProcessRequiringHighPerformance() - removing process %p", process);
+ updateState();
+ return;
+ }
+
+ LOG(WebGL, "HighPerformanceGPUManager::removeProcessRequiringHighPerformance() - process %p was not requesting high performance", process);
+}
+
+void HighPerformanceGPUManager::updateState()
+{
+ if (m_processesRequiringHighPerformance.size()) {
+ if (!m_pixelFormatObj) {
+ LOG(WebGL, "HighPerformanceGPUManager - turning on high-performance GPU.");
+
+ CGLPixelFormatAttribute attributes[] = { kCGLPFAAccelerated, kCGLPFAColorSize, static_cast<CGLPixelFormatAttribute>(32), static_cast<CGLPixelFormatAttribute>(0) };
+ GLint numPixelFormats = 0;
+ CGLChoosePixelFormat(attributes, &m_pixelFormatObj, &numPixelFormats);
+
+ LOG(WebGL, "HighPerformanceGPUManager - CGLPixelFormatObj is %p", m_pixelFormatObj);
+ }
+ } else if (m_pixelFormatObj) {
+ LOG(WebGL, "HighPerformanceGPUManager - turning off high-performance GPU.");
+ CGLReleasePixelFormat(m_pixelFormatObj);
+ m_pixelFormatObj = nullptr;
+ }
+}
+
+}
+#endif
+
Property changes on: trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.cpp
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Added: trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.h (0 => 236773)
--- trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2018 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
+
+#if PLATFORM(MAC)
+
+#include <OpenGL/CGLTypes.h>
+#include <wtf/HashSet.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+class WebProcessProxy;
+
+class HighPerformanceGPUManager {
+ friend NeverDestroyed<HighPerformanceGPUManager>;
+public:
+ static HighPerformanceGPUManager& singleton();
+
+ void addProcessRequiringHighPerformance(WebProcessProxy*);
+ void removeProcessRequiringHighPerformance(WebProcessProxy*);
+
+private:
+ HighPerformanceGPUManager() = default;
+ ~HighPerformanceGPUManager();
+
+ void updateState();
+
+ HashSet<WebProcessProxy*> m_processesRequiringHighPerformance;
+ CGLPixelFormatObj m_pixelFormatObj { nullptr };
+};
+
+}
+#endif
Property changes on: trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.h
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (236772 => 236773)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-10-02 23:42:38 UTC (rev 236773)
@@ -733,6 +733,7 @@
2F8336861FA139DF00C6E080 /* TouchBarMenuData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2FD43B911FA006A10083F51C /* TouchBarMenuData.h */; };
310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31099968146C71F50029DEB9 /* WebNotificationClient.h */; };
312C0C4A146DDC8A0016C911 /* WKNotificationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 312C0C49146DDC8A0016C911 /* WKNotificationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 312CC9F2215B06F100DE40CA /* HighPerformanceGPUManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 31ABA79C215AF9E000C90E31 /* HighPerformanceGPUManager.h */; };
3131261F148FF82C00BA2A39 /* NotificationPermissionRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3131261A148FF82B00BA2A39 /* NotificationPermissionRequestManager.h */; };
31312621148FF82C00BA2A39 /* WebNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3131261C148FF82B00BA2A39 /* WebNotificationManager.h */; };
3157135F2040A9B20084F9CF /* SystemPreviewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3157135D2040A9B20084F9CF /* SystemPreviewController.h */; };
@@ -1486,6 +1487,7 @@
C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */; };
C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */; };
C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; };
+ C11A9ECC214035F800CFB20A /* WebSwitchingGPUClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C11A9ECB214035F800CFB20A /* WebSwitchingGPUClient.h */; };
C11E1694212B87C500985FF6 /* WKMockDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11E1692212B87C500985FF6 /* WKMockDisplay.h */; settings = {ATTRIBUTES = (Private, ); }; };
C18173612058424700DFDA65 /* DisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = C18173602058424700DFDA65 /* DisplayLink.h */; };
C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E123B920A11572002646F4 /* PDFContextMenu.h */; };
@@ -2820,6 +2822,8 @@
31A505F81680025500A930EB /* WebContextClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextClient.h; sourceTree = "<group>"; };
31A67E0A165B2A99006CBA66 /* PlugInAutoStartProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlugInAutoStartProvider.cpp; sourceTree = "<group>"; };
31A67E0B165B2A99006CBA66 /* PlugInAutoStartProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlugInAutoStartProvider.h; sourceTree = "<group>"; };
+ 31ABA79C215AF9E000C90E31 /* HighPerformanceGPUManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HighPerformanceGPUManager.h; sourceTree = "<group>"; };
+ 31ABA79D215AF9E000C90E31 /* HighPerformanceGPUManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HighPerformanceGPUManager.cpp; sourceTree = "<group>"; };
31B3628E2141EA4D007BFA53 /* APIInternalDebugFeature.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIInternalDebugFeature.h; sourceTree = "<group>"; };
31B362902141EABC007BFA53 /* APIInternalDebugFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIInternalDebugFeature.cpp; sourceTree = "<group>"; };
31B362922141EBAC007BFA53 /* _WKInternalDebugFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInternalDebugFeature.mm; sourceTree = "<group>"; };
@@ -4231,6 +4235,8 @@
C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
C0E3AA481209E45000A49D01 /* ModuleCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleCF.cpp; sourceTree = "<group>"; };
+ C11A9ECB214035F800CFB20A /* WebSwitchingGPUClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebSwitchingGPUClient.h; sourceTree = "<group>"; };
+ C11A9ED021403B4000CFB20A /* WebSwitchingGPUClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebSwitchingGPUClient.cpp; sourceTree = "<group>"; };
C11E1692212B87C500985FF6 /* WKMockDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMockDisplay.h; sourceTree = "<group>"; };
C11E1693212B87C500985FF6 /* WKMockDisplay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMockDisplay.cpp; sourceTree = "<group>"; };
C181735E205839F600DFDA65 /* DrawingAreaMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaMac.cpp; sourceTree = "<group>"; };
@@ -7584,6 +7590,8 @@
9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */,
9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */,
BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */,
+ C11A9ED021403B4000CFB20A /* WebSwitchingGPUClient.cpp */,
+ C11A9ECB214035F800CFB20A /* WebSwitchingGPUClient.h */,
);
path = mac;
sourceTree = "<group>";
@@ -8021,6 +8029,8 @@
B878B614133428DC006888E9 /* CorrectionPanel.mm */,
C1817362205844A900DFDA65 /* DisplayLink.cpp */,
C18173602058424700DFDA65 /* DisplayLink.h */,
+ 31ABA79D215AF9E000C90E31 /* HighPerformanceGPUManager.cpp */,
+ 31ABA79C215AF9E000C90E31 /* HighPerformanceGPUManager.h */,
1AFDE65B1954E8D500C48FFA /* LegacySessionStateCoding.cpp */,
0FCB4E5818BBE3D9000FCFC9 /* PageClientImplMac.h */,
0FCB4E5918BBE3D9000FCFC9 /* PageClientImplMac.mm */,
@@ -8894,6 +8904,7 @@
C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */,
1AC75A1B1B3368270056745B /* HangDetectionDisabler.h in Headers */,
2DD5A72B1EBF09A7009BA597 /* HiddenPageThrottlingAutoIncreasesCounter.h in Headers */,
+ 312CC9F2215B06F100DE40CA /* HighPerformanceGPUManager.h in Headers */,
839A2F321E2067450039057E /* HighPerformanceGraphicsUsageSampler.h in Headers */,
37F90DE31376560E0051CF68 /* HTTPCookieAcceptPolicy.h in Headers */,
51C0C9741DDD76000032CAD3 /* IconLoadingDelegate.h in Headers */,
@@ -9384,6 +9395,7 @@
517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */,
466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */,
460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */,
+ C11A9ECC214035F800CFB20A /* WebSwitchingGPUClient.h in Headers */,
9356F2DE2152B71000E6D5DF /* WebSWOriginStore.h in Headers */,
83F1A07A1F96E7790045B94E /* WebSWOriginTable.h in Headers */,
9356F2DD2152B6F600E6D5DF /* WebSWServerConnection.h in Headers */,
Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp (0 => 236773)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 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 "WebSwitchingGPUClient.h"
+
+#if PLATFORM(MAC)
+
+#include "Logging.h"
+#include "WebProcess.h"
+#include "WebProcessProxyMessages.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+WebSwitchingGPUClient& WebSwitchingGPUClient::singleton()
+{
+ static NeverDestroyed<WebSwitchingGPUClient> client;
+ return client;
+}
+
+void WebSwitchingGPUClient::requestHighPerformanceGPU()
+{
+ LOG(WebGL, "WebSwitchingGPUClient::requestHighPerformanceGPU() from WebProcess");
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::RequestHighPerformanceGPU(), 0);
+}
+
+void WebSwitchingGPUClient::releaseHighPerformanceGPU()
+{
+ LOG(WebGL, "WebSwitchingGPUClient::releaseHighPerformanceGPU() from WebProcess");
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::ReleaseHighPerformanceGPU(), 0);
+}
+
+}
+
+#endif
Property changes on: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h (0 => 236773)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 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/SwitchingGPUClient.h>
+
+namespace WebKit {
+
+class WebSwitchingGPUClient : public WebCore::SwitchingGPUClient {
+public:
+ static WebSwitchingGPUClient& singleton();
+
+ void requestHighPerformanceGPU() override;
+ void releaseHighPerformanceGPU() override;
+};
+
+}
Property changes on: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (236772 => 236773)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2018-10-02 23:42:38 UTC (rev 236773)
@@ -89,6 +89,7 @@
#if PLATFORM(MAC)
#import "WKAccessibilityWebPageObjectMac.h"
+#import "WebSwitchingGPUClient.h"
#import <WebCore/GraphicsContext3DManager.h>
#import <WebCore/ScrollbarThemeMac.h>
#import <pal/spi/mac/NSScrollerImpSPI.h>
@@ -330,6 +331,8 @@
RELEASE_ASSERT(retval == kCGErrorSuccess);
// Make sure that we close any WindowServer connections after checking in with Launch Services.
CGSShutdownServerConnections();
+
+ SwitchingGPUClient::setSingleton(WebSwitchingGPUClient::singleton());
#else
if (![NSApp isRunning]) {
// This call is needed when the WebProcess is not running the NSApplication event loop.
Modified: trunk/Source/WebKitLegacy/ChangeLog (236772 => 236773)
--- trunk/Source/WebKitLegacy/ChangeLog 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKitLegacy/ChangeLog 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1,3 +1,13 @@
+2018-10-01 Dean Jackson <d...@apple.com>
+
+ [macOS] Switching to discrete GPU should be done in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=189361
+ <rdar://problem/43949622>
+
+ Reviewed by Simon Fraser.
+
+ * WebKitLegacy.xcodeproj/project.pbxproj: Add new files.
+
2018-09-05 David Kilzer <ddkil...@apple.com>
REGRESSION (r235585): WebDownloadInternal.h is missing from WebKitLegacy Xcode project
Modified: trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (236772 => 236773)
--- trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2018-10-02 23:42:38 UTC (rev 236773)
@@ -772,6 +772,8 @@
C0B88E8B10A08F3D00FBB3F5 /* WebFrameLoadDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = C0B88E8A10A08F3D00FBB3F5 /* WebFrameLoadDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0C5B3EE1177A4A0002B0AEF /* WebUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = C0C5B3EC1177A4A0002B0AEF /* WebUserContentURLPattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0C5B3EF1177A4A0002B0AEF /* WebUserContentURLPattern.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5B3ED1177A4A0002B0AEF /* WebUserContentURLPattern.mm */; };
+ C11EBF4121419CCE00D659E7 /* WebSwitchingGPUClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C11EBF3F21419CCE00D659E7 /* WebSwitchingGPUClient.cpp */; };
+ C11EBF4221419CCE00D659E7 /* WebSwitchingGPUClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C11EBF4021419CCE00D659E7 /* WebSwitchingGPUClient.h */; };
C1D81128202CD80000EE74F9 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1D81127202CD80000EE74F9 /* WebVideoFullscreenController.mm */; };
C1D8112B202CDCC400EE74F9 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1D81129202CDCC200EE74F9 /* WebVideoFullscreenHUDWindowController.mm */; };
C1D8112E202CED0800EE74F9 /* WebWindowAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1D8112D202CED0700EE74F9 /* WebWindowAnimation.mm */; };
@@ -1525,6 +1527,8 @@
C0B88E8A10A08F3D00FBB3F5 /* WebFrameLoadDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameLoadDelegatePrivate.h; sourceTree = "<group>"; };
C0C5B3EC1177A4A0002B0AEF /* WebUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentURLPattern.h; sourceTree = "<group>"; };
C0C5B3ED1177A4A0002B0AEF /* WebUserContentURLPattern.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebUserContentURLPattern.mm; sourceTree = "<group>"; };
+ C11EBF3F21419CCE00D659E7 /* WebSwitchingGPUClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebSwitchingGPUClient.cpp; sourceTree = "<group>"; };
+ C11EBF4021419CCE00D659E7 /* WebSwitchingGPUClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebSwitchingGPUClient.h; sourceTree = "<group>"; };
C1D81126202CD7FE00EE74F9 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; };
C1D81127202CD80000EE74F9 /* WebVideoFullscreenController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenController.mm; sourceTree = "<group>"; };
C1D81129202CDCC200EE74F9 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; };
@@ -2613,6 +2617,8 @@
A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */,
2DD632C019E5D1F0002E9C7B /* WebSelectionServiceController.h */,
2DD632C119E5D1F0002E9C7B /* WebSelectionServiceController.mm */,
+ C11EBF3F21419CCE00D659E7 /* WebSwitchingGPUClient.cpp */,
+ C11EBF4021419CCE00D659E7 /* WebSwitchingGPUClient.h */,
4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */,
4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */,
1430C12A1B2C5DF700DEA01D /* WebViewGroup.cpp */,
@@ -3157,6 +3163,7 @@
1A591D461A2E91BB000907C4 /* WebStorageNamespaceProvider.h in Headers */,
3ABB3C7A1309C3B500E93D94 /* WebStorageTrackerClient.h in Headers */,
939810270824BF01008DF038 /* WebStringTruncator.h in Headers */,
+ C11EBF4221419CCE00D659E7 /* WebSwitchingGPUClient.h in Headers */,
936A2DEA0FD2D08400D312DB /* WebTextCompletionController.h in Headers */,
1A74A28E0F4F75400082E228 /* WebTextInputWindowController.h in Headers */,
F834AAD70E64B1C700E2737C /* WebTextIterator.h in Headers */,
@@ -3674,6 +3681,7 @@
1A591D451A2E91BB000907C4 /* WebStorageNamespaceProvider.cpp in Sources */,
3ABB3C7B1309C3B500E93D94 /* WebStorageTrackerClient.mm in Sources */,
939810CC0824BF01008DF038 /* WebStringTruncator.mm in Sources */,
+ C11EBF4121419CCE00D659E7 /* WebSwitchingGPUClient.cpp in Sources */,
936A2DE80FD2D08000D312DB /* WebTextCompletionController.mm in Sources */,
1A74A28F0F4F75400082E228 /* WebTextInputWindowController.m in Sources */,
F834AAD80E64B1C700E2737C /* WebTextIterator.mm in Sources */,
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (236772 => 236773)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-10-02 23:42:38 UTC (rev 236773)
@@ -1,3 +1,20 @@
+2018-10-01 Dean Jackson <d...@apple.com>
+
+ [macOS] Switching to discrete GPU should be done in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=189361
+ <rdar://problem/43949622>
+
+ Reviewed by Simon Fraser.
+
+ Implement a no-op SwitchingGPUClient instance in legacy WebKit. We will
+ not support swapping to the discrete GPU in this configuration.
+
+ * WebCoreSupport/WebSwitchingGPUClient.cpp: Added.
+ (WebKit::WebSwitchingGPUClient::singleton):
+ * WebCoreSupport/WebSwitchingGPUClient.h: Added.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+
2018-10-02 Alex Christensen <achristen...@webkit.org>
Remove ParsedURLString
Added: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.cpp (0 => 236773)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.cpp (rev 0)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.cpp 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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 "WebSwitchingGPUClient.h"
+
+#if PLATFORM(MAC)
+
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+WebSwitchingGPUClient& WebSwitchingGPUClient::singleton()
+{
+ static NeverDestroyed<WebSwitchingGPUClient> client;
+ return client;
+}
+
+}
+
+#endif
Property changes on: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.cpp
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Added: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.h (0 => 236773)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.h (rev 0)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.h 2018-10-02 23:42:38 UTC (rev 236773)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 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/SwitchingGPUClient.h>
+
+namespace WebKit {
+
+class WebSwitchingGPUClient : public WebCore::SwitchingGPUClient {
+public:
+ static WebSwitchingGPUClient& singleton();
+ virtual ~WebSwitchingGPUClient() = default;
+
+ void requestHighPerformanceGPU() override { };
+ void releaseHighPerformanceGPU() override { };
+};
+
+}
Property changes on: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSwitchingGPUClient.h
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (236772 => 236773)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2018-10-02 23:02:39 UTC (rev 236772)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2018-10-02 23:42:38 UTC (rev 236773)
@@ -248,6 +248,7 @@
#import "WebNSPasteboardExtras.h"
#import "WebNSPrintOperationExtras.h"
#import "WebPDFView.h"
+#import "WebSwitchingGPUClient.h"
#import "WebVideoFullscreenController.h"
#import <WebCore/TextIndicator.h>
#import <WebCore/TextIndicatorWindow.h>
@@ -1406,7 +1407,9 @@
#if ENABLE(GAMEPAD)
WebKitInitializeGamepadProviderIfNecessary();
#endif
-
+#if PLATFORM(MAC)
+ WebCore::SwitchingGPUClient::setSingleton(WebKit::WebSwitchingGPUClient::singleton());
+#endif
DeprecatedGlobalSettings::setShouldRespectPriorityInCSSAttributeSetters(shouldRespectPriorityInCSSAttributeSetters());
#if PLATFORM(IOS)