Changeset 267516 in webkit


Ignore:
Timestamp:
Sep 23, 2020, 8:36:48 PM (4 years ago)
Author:
Peng Liu
Message:

Add feature flags for GPU Process features
https://bugs.webkit.org/show_bug.cgi?id=216901

Reviewed by Tim Horton.

Source/WebCore:

Rename useGPUProcessForMedia to useGPUProcessForMediaEnabled.

No new tests since no functional changes.

  • page/Settings.yaml:

Source/WebKit:

Add feature flags for the following GPU Process features:

  • 2D canvas in GPU process
  • WebGL in GPU process
  • DOM rendering in GPU Process

Also, clean up some related feature/function names.

  • FeatureFlags/WebKit.plist:

Add keys for the GPU process features and sort all keys.

  • Shared/WebPreferencesDefaultValues.cpp:

(WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
(WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
(WebKit::defaultUseGPUProcessForMediaEnabled):
(WebKit::defaultUseGPUProcessForWebGLEnabled):
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
(WebKit::defaultCaptureVideoInGPUProcessEnabled):
(WebKit::defaultWebRTCCodecsInGPUProcess):
(WebKit::defaultUseGPUProcessForMedia): Deleted.
(WebKit::defaultRenderCanvasInGPUProcessEnabled): Deleted.

  • Shared/WebPreferencesDefaultValues.h:
  • Shared/WebPreferencesInternal.yaml:

Add preferences and corresponding default values.

  • Shared/WebProcessCreationParameters.h:
  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::platformInitializeWebProcess):
Rename useGPUProcessForMedia to useGPUProcessForMediaEnabled.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::creationParameters):
Use useGPUProcessForCanvasRenderingEnabled instead of renderCanvasInGPUProcessEnabled.

  • WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:

(WebKit::RemoteMediaPlayerManager::updatePreferences):
Use useGPUProcessForMediaEnabled instead of useGPUProcessForMedia.

  • WebProcess/InjectedBundle/InjectedBundle.cpp:

(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Ditto.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::m_limitsNavigationsToAppBoundDomains): Ditto.
(WebKit::WebPage::updatePreferences): Ditto.

Source/WebKitLegacy/mac:

Minor cleanups.

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):
(-[WebPreferences useGPUProcessForMediaEnabled]):
(-[WebPreferences setUseGPUProcessForMediaEnabled:]):
(-[WebPreferences useGPUProcessForMedia]): Deleted.
(-[WebPreferences setUseGPUProcessForMedia:]): Deleted.

  • WebView/WebPreferencesPrivate.h:
  • WebView/WebView.mm:

(-[WebView _preferencesChanged:]):

Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r267515 r267516  
     12020-09-23  Peng Liu  <peng.liu6@apple.com>
     2
     3        Add feature flags for GPU Process features
     4        https://bugs.webkit.org/show_bug.cgi?id=216901
     5
     6        Reviewed by Tim Horton.
     7
     8        Rename useGPUProcessForMedia to useGPUProcessForMediaEnabled.
     9
     10        No new tests since no functional changes.
     11
     12        * page/Settings.yaml:
     13
    1142020-09-23  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebCore/page/Settings.yaml

    r267472 r267516  
    333333  initial: false
    334334  conditional: ENABLE(VIDEO)
    335 useGPUProcessForMedia:
     335useGPUProcessForMediaEnabled:
    336336  initial: false
    337337  conditional: ENABLE(GPU_PROCESS)
  • trunk/Source/WebKit/ChangeLog

    r267504 r267516  
     12020-09-23  Peng Liu  <peng.liu6@apple.com>
     2
     3        Add feature flags for GPU Process features
     4        https://bugs.webkit.org/show_bug.cgi?id=216901
     5
     6        Reviewed by Tim Horton.
     7
     8        Add feature flags for the following GPU Process features:
     9        - 2D canvas in GPU process
     10        - WebGL in GPU process
     11        - DOM rendering in GPU Process
     12
     13        Also, clean up some related feature/function names.
     14
     15        * FeatureFlags/WebKit.plist:
     16        Add keys for the GPU process features and sort all keys.
     17
     18        * Shared/WebPreferencesDefaultValues.cpp:
     19        (WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
     20        (WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
     21        (WebKit::defaultUseGPUProcessForMediaEnabled):
     22        (WebKit::defaultUseGPUProcessForWebGLEnabled):
     23        (WebKit::defaultCaptureAudioInGPUProcessEnabled):
     24        (WebKit::defaultCaptureVideoInGPUProcessEnabled):
     25        (WebKit::defaultWebRTCCodecsInGPUProcess):
     26        (WebKit::defaultUseGPUProcessForMedia): Deleted.
     27        (WebKit::defaultRenderCanvasInGPUProcessEnabled): Deleted.
     28        * Shared/WebPreferencesDefaultValues.h:
     29        * Shared/WebPreferencesInternal.yaml:
     30        Add preferences and corresponding default values.
     31
     32        * Shared/WebProcessCreationParameters.h:
     33        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     34        (WebKit::WebProcessPool::platformInitializeWebProcess):
     35        Rename useGPUProcessForMedia to useGPUProcessForMediaEnabled.
     36
     37        * UIProcess/WebPageProxy.cpp:
     38        (WebKit::WebPageProxy::creationParameters):
     39        Use useGPUProcessForCanvasRenderingEnabled instead of renderCanvasInGPUProcessEnabled.
     40
     41        * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
     42        (WebKit::RemoteMediaPlayerManager::updatePreferences):
     43        Use useGPUProcessForMediaEnabled instead of useGPUProcessForMedia.
     44
     45        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     46        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Ditto.
     47
     48        * WebProcess/WebPage/WebPage.cpp:
     49        (WebKit::m_limitsNavigationsToAppBoundDomains): Ditto.
     50        (WebKit::WebPage::updatePreferences): Ditto.
     51
    1522020-09-23  Chris Dumez  <cdumez@apple.com>
    253
  • trunk/Source/WebKit/FeatureFlags/WebKit.plist

    r265533 r267516  
    88        <true/>
    99    </dict>
    10     <key>canvas_and_media_in_gpu_process</key>
     10    <key>gpu_process_canvas_rendering</key>
     11    <dict>
     12        <key>Enabled</key>
     13        <false/>
     14    </dict>
     15    <key>gpu_process_dom_rendering</key>
     16    <dict>
     17        <key>Enabled</key>
     18        <false/>
     19    </dict>
     20    <key>gpu_process_media</key>
     21    <dict>
     22        <key>Enabled</key>
     23        <false/>
     24    </dict>
     25    <key>gpu_process_webgl</key>
     26    <dict>
     27        <key>Enabled</key>
     28        <false/>
     29    </dict>
     30    <key>gpu_process_webrtc</key>
    1131    <dict>
    1232        <key>Enabled</key>
     
    2848        <false/>
    2949    </dict>
     50        <key>sw_vp9_decoder_on_battery</key>
     51    <dict>
     52        <key>Enabled</key>
     53        <false/>
     54    </dict>
     55        <key>vp9_decoder</key>
     56    <dict>
     57        <key>Enabled</key>
     58        <true/>
     59    </dict>
    3060    <key>WebGL2</key>
    3161    <dict>
     
    4373        <false/>
    4474    </dict>
    45     <key>webrtc_in_gpu_process</key>
    46     <dict>
    47         <key>Enabled</key>
    48         <false/>
    49     </dict>
    50     <key>vp9_decoder</key>
    51     <dict>
    52         <key>Enabled</key>
    53         <true/>
    54     </dict>
    55     <key>sw_vp9_decoder_on_battery</key>
    56     <dict>
    57         <key>Enabled</key>
    58         <false/>
    59     </dict>
    6075    <key>webm_parser</key>
    6176    <dict>
  • trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp

    r267414 r267516  
    113113#if ENABLE(GPU_PROCESS)
    114114
    115 bool defaultUseGPUProcessForMedia()
    116 {
    117 #if HAVE(SYSTEM_FEATURE_FLAGS)
    118     return isFeatureFlagEnabled("canvas_and_media_in_gpu_process");
     115bool defaultUseGPUProcessForCanvasRenderingEnabled()
     116{
     117#if HAVE(SYSTEM_FEATURE_FLAGS)
     118    return isFeatureFlagEnabled("gpu_process_canvas_rendering");
     119#endif
     120
     121    return false;
     122}
     123
     124bool defaultUseGPUProcessForDOMRenderingEnabled()
     125{
     126#if HAVE(SYSTEM_FEATURE_FLAGS)
     127    return isFeatureFlagEnabled("gpu_process_dom_rendering");
     128#endif
     129
     130    return false;
     131}
     132
     133bool defaultUseGPUProcessForMediaEnabled()
     134{
     135#if HAVE(SYSTEM_FEATURE_FLAGS)
     136    return isFeatureFlagEnabled("gpu_process_media");
     137#endif
     138
     139    return false;
     140}
     141
     142bool defaultUseGPUProcessForWebGLEnabled()
     143{
     144#if HAVE(SYSTEM_FEATURE_FLAGS)
     145    return isFeatureFlagEnabled("gpu_process_webgl");
    119146#endif
    120147
     
    124151#endif // ENABLE(GPU_PROCESS)
    125152
    126 bool defaultRenderCanvasInGPUProcessEnabled()
    127 {
    128 #if HAVE(SYSTEM_FEATURE_FLAGS)
    129     return isFeatureFlagEnabled("canvas_and_media_in_gpu_process");
    130 #endif
    131 
    132     return false;
    133 }
    134 
    135153#if ENABLE(MEDIA_STREAM)
    136154
     
    138156{
    139157#if PLATFORM(MAC) && HAVE(SYSTEM_FEATURE_FLAGS)
    140     return isFeatureFlagEnabled("webrtc_in_gpu_process");
     158    return isFeatureFlagEnabled("gpu_process_webrtc");
    141159#endif
    142160
     
    164182{
    165183#if HAVE(SYSTEM_FEATURE_FLAGS)
    166     return isFeatureFlagEnabled("webrtc_in_gpu_process");
     184    return isFeatureFlagEnabled("gpu_process_webrtc");
    167185#endif
    168186
     
    186204{
    187205#if HAVE(SYSTEM_FEATURE_FLAGS)
    188     return isFeatureFlagEnabled("webrtc_in_gpu_process");
     206    return isFeatureFlagEnabled("gpu_process_webrtc");
    189207#endif
    190208
  • trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h

    r267414 r267516  
    336336
    337337#if ENABLE(GPU_PROCESS)
    338 bool defaultUseGPUProcessForMedia();
    339 #endif
    340 
    341 bool defaultRenderCanvasInGPUProcessEnabled();
     338bool defaultUseGPUProcessForCanvasRenderingEnabled();
     339bool defaultUseGPUProcessForDOMRenderingEnabled();
     340bool defaultUseGPUProcessForMediaEnabled();
     341bool defaultUseGPUProcessForWebGLEnabled();
     342#endif
    342343
    343344#if ENABLE(MEDIA_STREAM)
  • trunk/Source/WebKit/Shared/WebPreferencesInternal.yaml

    r267504 r267516  
    331331  condition: ENABLE(LAYOUT_FORMATTING_CONTEXT)
    332332
    333 RenderCanvasInGPUProcessEnabled:
    334   type: bool
    335   defaultValue: defaultRenderCanvasInGPUProcessEnabled()
    336   humanReadableName: "Use GPU Process to render canvas"
    337   humanReadableDescription: "Enable canvas rendering in GPU Process"
    338   webcoreBinding: none
    339 
    340333RestrictedHTTPResponseAccess:
    341334  type: bool
     
    418411  humanReadableDescription: "Remove all non-cookie website data after just 30 seconds of no user interaction when Intelligent Tracking Prevention is enabled"
    419412
    420 UseGPUProcessForMedia:
    421   type: bool
    422   defaultValue: defaultUseGPUProcessForMedia()
     413UseGPUProcessForCanvasRenderingEnabled:
     414  type: bool
     415  defaultValue: defaultUseGPUProcessForCanvasRenderingEnabled()
    423416  condition: ENABLE(GPU_PROCESS)
    424   humanReadableName: "Use GPU Process for media"
     417  humanReadableName: "GPU Process: Canvas Rendering"
     418  humanReadableDescription: "Enable canvas rendering in GPU Process"
     419  webcoreBinding: none
     420
     421UseGPUProcessForDOMRenderingEnabled:
     422  type: bool
     423  defaultValue: defaultUseGPUProcessForDOMRenderingEnabled()
     424  condition: ENABLE(GPU_PROCESS)
     425  humanReadableName: "GPU Process: DOM Rendering"
     426  humanReadableDescription: "Enable DOM rendering in GPU Process"
     427  webcoreBinding: none
     428
     429UseGPUProcessForMediaEnabled:
     430  type: bool
     431  defaultValue: defaultUseGPUProcessForMediaEnabled()
     432  condition: ENABLE(GPU_PROCESS)
     433  humanReadableName: "GPU Process: Media"
    425434  humanReadableDescription: "Do all media loading and playback in the GPU Process"
    426   webcoreName: useGPUProcessForMedia
     435  webcoreName: useGPUProcessForMediaEnabled
     436
     437UseGPUProcessForWebGLEnabled:
     438  type: bool
     439  defaultValue: defaultUseGPUProcessForWebGLEnabled()
     440  condition: ENABLE(GPU_PROCESS)
     441  humanReadableName: "GPU Process: WebGL"
     442  humanReadableDescription: "Enable WebGL in GPU Process"
     443  webcoreBinding: none
    427444
    428445LiveRangeSelectionEnabled:
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r267498 r267516  
    125125    bool memoryCacheDisabled { false };
    126126    bool attrStyleEnabled { false };
    127     bool useGPUProcessForMedia { false };
     127    bool useGPUProcessForMediaEnabled { false };
    128128
    129129#if ENABLE(SERVICE_CONTROLS)
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r267498 r267516  
    452452    parameters.localizedDeviceModel = localizedDeviceModel();
    453453#endif
    454    
     454
    455455    // Allow microphone access if either preference is set because WebRTC requires microphone access.
    456     bool needWebProcessExtensions = !m_defaultPageGroup->preferences().useGPUProcessForMedia()
     456    bool needWebProcessExtensions = !m_defaultPageGroup->preferences().useGPUProcessForMediaEnabled()
    457457        || !m_defaultPageGroup->preferences().captureAudioInGPUProcessEnabled()
    458458        || !m_defaultPageGroup->preferences().captureVideoInGPUProcessEnabled();
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r267431 r267516  
    79297929    parameters.shouldCaptureVideoInUIProcess = preferences().captureVideoInUIProcessEnabled();
    79307930    parameters.shouldCaptureVideoInGPUProcess = preferences().captureVideoInGPUProcessEnabled();
    7931     parameters.shouldRenderCanvasInGPUProcess = preferences().renderCanvasInGPUProcessEnabled();
     7931    parameters.shouldRenderCanvasInGPUProcess = preferences().useGPUProcessForCanvasRenderingEnabled();
    79327932    parameters.shouldEnableVP9Decoder = preferences().vp9DecoderEnabled();
    79337933#if ENABLE(VP9) && PLATFORM(COCOA)
  • trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp

    r262695 r267516  
    266266    };
    267267
    268     RemoteMediaPlayerSupport::setRegisterRemotePlayerCallback(settings.useGPUProcessForMedia() ? WTFMove(registerEngine) : RemoteMediaPlayerSupport::RegisterRemotePlayerCallback());
     268    RemoteMediaPlayerSupport::setRegisterRemotePlayerCallback(settings.useGPUProcessForMediaEnabled() ? WTFMove(registerEngine) : RemoteMediaPlayerSupport::RegisterRemotePlayerCallback());
    269269
    270270#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
    271     if (settings.useGPUProcessForMedia()) {
     271    if (settings.useGPUProcessForMediaEnabled()) {
    272272        WebCore::SampleBufferDisplayLayer::setCreator([](auto& client) {
    273273            return WebProcess::singleton().ensureGPUProcessConnection().sampleBufferDisplayLayerManager().createLayer(client);
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp

    r267188 r267516  
    224224
    225225#if ENABLE(GPU_PROCESS)
    226     if (preference == "WebKitUseGPUProcessForMedia" || preference == "WebKitCaptureAudioInGPUProcessEnabledKey") {
    227         WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::useGPUProcessForMediaKey(), enabled);
    228         for (auto* page : pages)
    229             page->settings().setUseGPUProcessForMedia(enabled);
     226    if (preference == "WebKitUseGPUProcessForMediaEnabled" || preference == "WebKitCaptureAudioInGPUProcessEnabledKey") {
     227        WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::useGPUProcessForMediaEnabledKey(), enabled);
     228        for (auto* page : pages)
     229            page->settings().setUseGPUProcessForMediaEnabled(enabled);
    230230        return;
    231231    }
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r267249 r267516  
    580580
    581581#if PLATFORM(IOS_FAMILY) || ENABLE(ROUTING_ARBITRATION)
    582     if (!m_page->settings().useGPUProcessForMedia())
     582    if (!m_page->settings().useGPUProcessForMediaEnabled())
    583583        DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(true);
    584584#endif
     
    784784
    785785#if ENABLE(GPU_PROCESS)
    786     if (m_page->settings().useGPUProcessForMedia())
     786    if (m_page->settings().useGPUProcessForMediaEnabled())
    787787        WebProcess::singleton().ensureGPUProcessConnection().updateParameters(parameters);
    788788#endif
     
    37853785
    37863786#if ENABLE(GPU_PROCESS)
    3787     // FIXME: useGPUProcessForMedia should be a RuntimeEnabledFeature since it's global.
    3788     static_cast<WebMediaStrategy&>(platformStrategies()->mediaStrategy()).setUseGPUProcess(settings.useGPUProcessForMedia());
     3787    // FIXME: useGPUProcessForMediaEnabled should be a RuntimeEnabledFeature since it's global.
     3788    static_cast<WebMediaStrategy&>(platformStrategies()->mediaStrategy()).setUseGPUProcess(settings.useGPUProcessForMediaEnabled());
    37893789    WebProcess::singleton().supplement<RemoteMediaPlayerManager>()->updatePreferences(settings);
    3790     WebProcess::singleton().setUseGPUProcessForMedia(settings.useGPUProcessForMedia());
     3790    WebProcess::singleton().setUseGPUProcessForMedia(settings.useGPUProcessForMediaEnabled());
    37913791#endif
    37923792}
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r267504 r267516  
     12020-09-23  Peng Liu  <peng.liu6@apple.com>
     2
     3        Add feature flags for GPU Process features
     4        https://bugs.webkit.org/show_bug.cgi?id=216901
     5
     6        Reviewed by Tim Horton.
     7
     8        Minor cleanups.
     9
     10        * WebView/WebPreferenceKeysPrivate.h:
     11        * WebView/WebPreferences.mm:
     12        (+[WebPreferences initialize]):
     13        (-[WebPreferences useGPUProcessForMediaEnabled]):
     14        (-[WebPreferences setUseGPUProcessForMediaEnabled:]):
     15        (-[WebPreferences useGPUProcessForMedia]): Deleted.
     16        (-[WebPreferences setUseGPUProcessForMedia:]): Deleted.
     17        * WebView/WebPreferencesPrivate.h:
     18        * WebView/WebView.mm:
     19        (-[WebView _preferencesChanged:]):
     20
    1212020-09-23  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h

    r267188 r267516  
    264264#define WebKitPictureInPictureAPIEnabledKey @"WebKitPictureInPictureAPIEnabled"
    265265#define WebKitGenericCueAPIEnabledKey @"WebKitGenericCueAPIEnabled"
    266 #define WebKitUseGPUProcessForMediaKey @"WebKitUseGPUProcessForMedia"
     266#define WebKitUseGPUProcessForMediaEnabledKey @"WebKitUseGPUProcessForMediaEnabled"
    267267#define WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey @"WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallback"
    268268#define WebKitInspectorAdditionsEnabledPreferenceKey @"WebKitInspectorAdditionsEnabled"
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm

    r267488 r267516  
    625625
    626626#if ENABLE(GPU_PROCESS)
    627         @NO, WebKitUseGPUProcessForMediaKey,
     627        @NO, WebKitUseGPUProcessForMediaEnabledKey,
    628628#endif
    629629
     
    33243324}
    33253325
    3326 - (BOOL)useGPUProcessForMedia
    3327 {
    3328     return [self _boolValueForKey:WebKitUseGPUProcessForMediaKey];
    3329 }
    3330 
    3331 - (void)setUseGPUProcessForMedia:(BOOL)flag
    3332 {
    3333     [self _setBoolValue:flag forKey:WebKitUseGPUProcessForMediaKey];
     3326- (BOOL)useGPUProcessForMediaEnabled
     3327{
     3328    return [self _boolValueForKey:WebKitUseGPUProcessForMediaEnabledKey];
     3329}
     3330
     3331- (void)setUseGPUProcessForMediaEnabled:(BOOL)flag
     3332{
     3333    [self _setBoolValue:flag forKey:WebKitUseGPUProcessForMediaEnabledKey];
    33343334}
    33353335
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h

    r267222 r267516  
    648648@property (nonatomic) BOOL pictureInPictureAPIEnabled;
    649649@property (nonatomic) BOOL genericCueAPIEnabled;
    650 @property (nonatomic) BOOL useGPUProcessForMedia;
     650@property (nonatomic) BOOL useGPUProcessForMediaEnabled;
    651651@property (nonatomic) BOOL viewportFitEnabled;
    652652@property (nonatomic) BOOL constantPropertiesEnabled;
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r267504 r267516  
    34003400
    34013401#if ENABLE(GPU_PROCESS)
    3402     settings.setUseGPUProcessForMedia(preferences.useGPUProcessForMedia);
     3402    settings.setUseGPUProcessForMediaEnabled(preferences.useGPUProcessForMediaEnabled);
    34033403#endif
    34043404
Note: See TracChangeset for help on using the changeset viewer.