commit | e3b57f0bb504f8eb4349cd7631ae803b0e9ce0e3 | [log] [tgz] |
---|---|---|
author | dino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Oct 02 23:42:38 2018 +0000 |
committer | dino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Oct 02 23:42:38 2018 +0000 |
tree | 42b823da385c729e75fdbcd8f00fae82bd23570a | |
parent | a9e7839213050d3b3e06250a7201ee3050320e86 [diff] |
[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. Source/WebCore: 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/GPUClient.cpp: Added. (WebCore::GPUClient::singleton): (WebCore::GPUClient::setSingleton): * platform/graphics/mac/GPUClient.h: Added. * testing/Internals.cpp: Testing helper. (WebCore::Internals::hasMuxableGPU): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: Implement the UI-side process for triggering a GPU mux. * Platform/Logging.h: Add a WebGL logging channel. * SourcesCocoa.txt: Add the new files: WebGPUClient 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/WebGPUClient.cpp: Implementation of the GPUClient for WebCore, which sends messages to the UI process. (WebKit::WebGPUClient::singleton): (WebKit::WebGPUClient::requestHighPerformanceGPU): (WebKit::WebGPUClient::releaseHighPerformanceGPU): * WebProcess/WebCoreSupport/mac/WebGPUClient.h: Added. * WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient. (WebKit::WebProcess::platformInitializeProcess): Source/WebKitLegacy: * WebKitLegacy.xcodeproj/project.pbxproj: Add new files. Source/WebKitLegacy/mac: Implement a no-op GPUClient instance in legacy WebKit. We will not support swapping to the discrete GPU in this configuration. * WebCoreSupport/WebGPUClient.cpp: Added. (WebKit::WebGPUClient::singleton): * WebCoreSupport/WebGPUClient.h: Added. * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WTF: Define GL_SILENCE_DEPRECATION to avoid deprecation warnings for OpenGL. * wtf/Platform.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@236773 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator.
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.