Title: [285410] trunk/Source
Revision
285410
Author
[email protected]
Date
2021-11-08 09:57:56 -0800 (Mon, 08 Nov 2021)

Log Message

Enabling "media source inline painting" by default should work when using GPU Process for media
https://bugs.webkit.org/show_bug.cgi?id=232802

Reviewed by Eric Carlson.

Source/WebCore:

See WebKit/ChangeLog for more details.

* page/RuntimeEnabledFeatures.h:

Source/WebKit:

Propagate the bit for `MediaSourceInlinePaintingEnabled` over to the GPU process when updating preferences in
GPUProcessProxy.

* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::setMediaSourceInlinePaintingEnabled):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::updatePreferences):

Also, add a couple of FIXMEs here. Note that due to the latter FIXME, this change *still* doesn't allow us to
turn on media source inline painting when using GPU process for media by simply toggling the feature in user
defaults or through UI. This is because preferences on WebPageGroups are not modified when changing experimental
feature user defaults, so logic that iterates through all page groups and looks at preferences will still only
get the default value of each feature flag (as defined in the yaml file).

Source/WTF:

Clean up this experimental feature -- since it's backed by a global RuntimeEnabledFeature, we should:
1. Add `webcoreBinding: RuntimeEnabledFeatures`, and also:
2. Not be adding the corresponding page-scoped WebCore setting as well.

This adjustment makes it possible to enable this experimental feature when the GPU process is disabled, since
we now actually call into RuntimeEnabledFeatures to set the value (instead of just setting the WebCore setting
which wasn't consulted by anything).

* Scripts/Preferences/WebPreferencesExperimental.yaml:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (285409 => 285410)


--- trunk/Source/WTF/ChangeLog	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WTF/ChangeLog	2021-11-08 17:57:56 UTC (rev 285410)
@@ -1,3 +1,20 @@
+2021-11-08  Wenson Hsieh  <[email protected]>
+
+        Enabling "media source inline painting" by default should work when using GPU Process for media
+        https://bugs.webkit.org/show_bug.cgi?id=232802
+
+        Reviewed by Eric Carlson.
+
+        Clean up this experimental feature -- since it's backed by a global RuntimeEnabledFeature, we should:
+        1. Add `webcoreBinding: RuntimeEnabledFeatures`, and also:
+        2. Not be adding the corresponding page-scoped WebCore setting as well.
+
+        This adjustment makes it possible to enable this experimental feature when the GPU process is disabled, since
+        we now actually call into RuntimeEnabledFeatures to set the value (instead of just setting the WebCore setting
+        which wasn't consulted by anything).
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
 2021-11-08  Yusuke Suzuki  <[email protected]>
 
         [libpas] Enable libpas on macOS

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (285409 => 285410)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2021-11-08 17:57:56 UTC (rev 285410)
@@ -889,13 +889,12 @@
   humanReadableName: "Experimental MediaSource Inline Painting"
   humanReadableDescription: "Experimental MediaSource Inline Painting"
   condition: ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+  webcoreBinding: RuntimeEnabledFeatures
   defaultValue:
     WebKitLegacy:
       default: false
     WebKit:
       default: false
-    WebCore:
-      default: false
 
 ModelElementEnabled:
   type: bool

Modified: trunk/Source/WebCore/ChangeLog (285409 => 285410)


--- trunk/Source/WebCore/ChangeLog	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebCore/ChangeLog	2021-11-08 17:57:56 UTC (rev 285410)
@@ -1,3 +1,14 @@
+2021-11-08  Wenson Hsieh  <[email protected]>
+
+        Enabling "media source inline painting" by default should work when using GPU Process for media
+        https://bugs.webkit.org/show_bug.cgi?id=232802
+
+        Reviewed by Eric Carlson.
+
+        See WebKit/ChangeLog for more details.
+
+        * page/RuntimeEnabledFeatures.h:
+
 2021-11-08  Antti Koivisto  <[email protected]>
 
         [CSS Cascade Layers] Support 'revert-layer' value

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (285409 => 285410)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2021-11-08 17:57:56 UTC (rev 285410)
@@ -252,7 +252,7 @@
 #endif
 
 #if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-    void setMediaSourceInlinePaintingEnabled(bool);
+    WEBCORE_EXPORT void setMediaSourceInlinePaintingEnabled(bool);
     bool mediaSourceInlinePaintingEnabled() const { return m_mediaSourceInlinePaintingEnabled; }
 #endif
 

Modified: trunk/Source/WebKit/ChangeLog (285409 => 285410)


--- trunk/Source/WebKit/ChangeLog	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebKit/ChangeLog	2021-11-08 17:57:56 UTC (rev 285410)
@@ -1,3 +1,26 @@
+2021-11-08  Wenson Hsieh  <[email protected]>
+
+        Enabling "media source inline painting" by default should work when using GPU Process for media
+        https://bugs.webkit.org/show_bug.cgi?id=232802
+
+        Reviewed by Eric Carlson.
+
+        Propagate the bit for `MediaSourceInlinePaintingEnabled` over to the GPU process when updating preferences in
+        GPUProcessProxy.
+
+        * GPUProcess/GPUProcess.cpp:
+        (WebKit::GPUProcess::setMediaSourceInlinePaintingEnabled):
+        * GPUProcess/GPUProcess.h:
+        * GPUProcess/GPUProcess.messages.in:
+        * UIProcess/GPU/GPUProcessProxy.cpp:
+        (WebKit::GPUProcessProxy::updatePreferences):
+
+        Also, add a couple of FIXMEs here. Note that due to the latter FIXME, this change *still* doesn't allow us to
+        turn on media source inline painting when using GPU process for media by simply toggling the feature in user
+        defaults or through UI. This is because preferences on WebPageGroups are not modified when changing experimental
+        feature user defaults, so logic that iterates through all page groups and looks at preferences will still only
+        get the default value of each feature flag (as defined in the yaml file).
+
 2021-11-08  Kate Cheney  <[email protected]>
 
         trustd network connections occasionally omitted from App Privacy report

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (285409 => 285410)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2021-11-08 17:57:56 UTC (rev 285410)
@@ -497,6 +497,16 @@
 }
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+void GPUProcess::setMediaSourceInlinePaintingEnabled(bool enabled)
+{
+    if (m_mediaSourceInlinePaintingEnabled == enabled)
+        return;
+    m_mediaSourceInlinePaintingEnabled = enabled;
+    WebCore::RuntimeEnabledFeatures::sharedFeatures().setMediaSourceInlinePaintingEnabled(m_mediaSourceInlinePaintingEnabled);
+}
+#endif
+
 void GPUProcess::webProcessConnectionCountForTesting(CompletionHandler<void(uint64_t)>&& completionHandler)
 {
     completionHandler(GPUConnectionToWebProcess::objectCountForTesting());

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.h (285409 => 285410)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.h	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.h	2021-11-08 17:57:56 UTC (rev 285410)
@@ -171,6 +171,10 @@
     void setVorbisDecoderEnabled(bool);
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    void setMediaSourceInlinePaintingEnabled(bool);
+#endif
+
 #if ENABLE(CFPREFS_DIRECT_MODE)
     void notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue);
     void dispatchSimulatedNotificationsForPreferenceChange(const String& key) final;
@@ -229,6 +233,9 @@
 #if ENABLE(VORBIS)
     bool m_vorbisEnabled { false };
 #endif
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    bool m_mediaSourceInlinePaintingEnabled { false };
+#endif
     String m_applicationVisibleName;
 };
 

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in (285409 => 285410)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2021-11-08 17:57:56 UTC (rev 285410)
@@ -68,6 +68,10 @@
     SetVorbisDecoderEnabled(bool enabled);
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    SetMediaSourceInlinePaintingEnabled(bool enabled);
+#endif
+
 #if ENABLE(CFPREFS_DIRECT_MODE)
     NotifyPreferencesChanged(String domain, String key, std::optional<String> encodedValue)
 #endif

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (285409 => 285410)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-11-08 17:56:01 UTC (rev 285409)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-11-08 17:57:56 UTC (rev 285410)
@@ -602,6 +602,20 @@
     bool hasEnabledVorbis = false;
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    bool hasEnabledMediaSourceInlinePainting = false;
+#endif
+
+    // FIXME: We should consider consolidating these into a single struct and propagating it to the GPU process as a single IPC message,
+    // instead of sending one message for each preference.
+    //
+    // FIXME: Additionally, it seems wrong to consult preferences on WebPageGroup rather than WebPreferences corresponding to each page.
+    // This effectively means that each of the below preferences will always be set to the default value and cannot be toggled through the
+    // develop menu or user defaults, since the defaults for each group are prefixed with a unique identifier.
+    //
+    // Since each of these features apply to the entire GPU process at once (i.e. they affect all web pages using the GPU process), we
+    // could instead refactor this so that we iterate through all web pages' preferences when initializing the GPU process for the first
+    // time, and then update these flags when creating new web pages.
     WebPageGroup::forEach([&] (auto& group) mutable {
         if (!group.preferences().useGPUProcessForMediaEnabled())
             return;
@@ -625,6 +639,11 @@
         if (group.preferences().webMParserEnabled())
             hasEnabledWebMParser = true;
 #endif
+
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+        if (group.preferences().mediaSourceInlinePaintingEnabled())
+            hasEnabledMediaSourceInlinePainting = true;
+#endif
     });
 
 #if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
@@ -643,6 +662,10 @@
     send(Messages::GPUProcess::SetVorbisDecoderEnabled(hasEnabledVorbis), 0);
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    send(Messages::GPUProcess::SetMediaSourceInlinePaintingEnabled(hasEnabledMediaSourceInlinePainting), 0);
+#endif
+
 #if PLATFORM(MAC)
     setScreenProperties(WebCore::collectScreenProperties());
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to