Title: [285219] trunk/Source/WebKit
Revision
285219
Author
jer.no...@apple.com
Date
2021-11-03 13:09:01 -0700 (Wed, 03 Nov 2021)

Log Message

[Catalina] HLS streams will not select HDR variants when GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=232671
<rdar://84686676>

Reviewed by Eric Carlson.

Tested manually.

In Catalina, fall back to a MediaToolbox API for setting a global HDR override in the GPU
process which instructs all AVPlayer instances whether HDR playback is supported for the
current set of displays. Pass the required data across from the UIProcess to the GPU process
at process start up and when the displays are reconfigured.

* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* GPUProcess/mac/GPUProcessMac.mm:
(WebKit::GPUProcess::setScreenProperties):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::setScreenProperties):
(WebKit::GPUProcessProxy::updatePreferences):
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::screenPropertiesStateChanged):
(WebKit::displayReconfigurationCallBack):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (285218 => 285219)


--- trunk/Source/WebKit/ChangeLog	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/ChangeLog	2021-11-03 20:09:01 UTC (rev 285219)
@@ -1,3 +1,30 @@
+2021-11-03  Jer Noble  <jer.no...@apple.com>
+
+        [Catalina] HLS streams will not select HDR variants when GPU Process is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=232671
+        <rdar://84686676>
+
+        Reviewed by Eric Carlson.
+
+        Tested manually.
+
+        In Catalina, fall back to a MediaToolbox API for setting a global HDR override in the GPU
+        process which instructs all AVPlayer instances whether HDR playback is supported for the
+        current set of displays. Pass the required data across from the UIProcess to the GPU process
+        at process start up and when the displays are reconfigured.
+
+        * GPUProcess/GPUProcess.h:
+        * GPUProcess/GPUProcess.messages.in:
+        * GPUProcess/mac/GPUProcessMac.mm:
+        (WebKit::GPUProcess::setScreenProperties):
+        * UIProcess/GPU/GPUProcessProxy.cpp:
+        (WebKit::GPUProcessProxy::setScreenProperties):
+        (WebKit::GPUProcessProxy::updatePreferences):
+        * UIProcess/GPU/GPUProcessProxy.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::screenPropertiesStateChanged):
+        (WebKit::displayReconfigurationCallBack):
+
 2021-11-03  David Kilzer  <ddkil...@apple.com>
 
         Leak of UUID in WebKit::ModelElementController::modelElementDidCreatePreview()

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.h (285218 => 285219)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.h	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.h	2021-11-03 20:09:01 UTC (rev 285219)
@@ -49,6 +49,7 @@
 namespace WebCore {
 class NowPlayingManager;
 struct MockMediaDevice;
+struct ScreenProperties;
 struct SecurityOriginData;
 }
 
@@ -147,6 +148,7 @@
 #endif
 #if PLATFORM(MAC)
     void displayConfigurationChanged(CGDirectDisplayID, CGDisplayChangeSummaryFlags);
+    void setScreenProperties(const WebCore::ScreenProperties&);
 #endif
 
 #if USE(OS_STATE)

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in (285218 => 285219)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2021-11-03 20:09:01 UTC (rev 285219)
@@ -47,8 +47,11 @@
 #endif
 #if PLATFORM(MAC)
     DisplayConfigurationChanged(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags)
+    SetScreenProperties(struct WebCore::ScreenProperties screenProperties)
 #endif
 
+#endif
+
 #if ENABLE(MEDIA_SOURCE)
     SetWebMParserEnabled(bool enabled);
 #endif

Modified: trunk/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm (285218 => 285219)


--- trunk/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm	2021-11-03 20:09:01 UTC (rev 285219)
@@ -32,10 +32,13 @@
 #import "SandboxInitializationParameters.h"
 #import "WKFoundation.h"
 #import <WebCore/LocalizedStrings.h>
+#import <WebCore/PlatformScreen.h>
+#import <WebCore/ScreenProperties.h>
 #import <pal/spi/cocoa/LaunchServicesSPI.h>
 #import <pal/spi/mac/HIServicesSPI.h>
 #import <sysexits.h>
 #import <wtf/MemoryPressureHandler.h>
+#import <wtf/ProcessPrivilege.h>
 #import <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -76,6 +79,28 @@
     AuxiliaryProcess::initializeSandbox(parameters, sandboxParameters);
 }
 
+#if PLATFORM(MAC)
+void GPUProcess::setScreenProperties(const ScreenProperties& screenProperties)
+{
+#if !HAVE(AVPLAYER_VIDEORANGEOVERRIDE)
+    // Only override HDR support at the MediaToolbox level if AVPlayer.videoRangeOverride support is
+    // not present, as the MediaToolbox override functionality is both duplicative and process global.
+
+    // This override is not necessary if AVFoundation is allowed to communicate
+    // with the window server to query for HDR support.
+    if (hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer)) {
+        setShouldOverrideScreenSupportsHighDynamicRange(false, false);
+        return;
+    }
+
+    bool allScreensAreHDR = allOf(screenProperties.screenDataMap.values(), [] (auto& screenData) {
+        return screenData.screenSupportsHighDynamicRange;
+    });
+    setShouldOverrideScreenSupportsHighDynamicRange(true, allScreensAreHDR);
+#endif
+}
+#endif
+
 } // namespace WebKit
 
 #endif // ENABLE(GPU_PROCESS) && (PLATFORM(MAC) || PLATFORM(MACCATALYST))

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (285218 => 285219)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-11-03 20:09:01 UTC (rev 285219)
@@ -48,6 +48,7 @@
 #include <WebCore/LogInitialization.h>
 #include <WebCore/MockRealtimeMediaSourceCenter.h>
 #include <WebCore/RuntimeApplicationChecks.h>
+#include <WebCore/ScreenProperties.h>
 #include <wtf/CompletionHandler.h>
 #include <wtf/LogInitialization.h>
 #include <wtf/TranslatedProcess.h>
@@ -573,6 +574,11 @@
 {
     send(Messages::GPUProcess::DisplayConfigurationChanged { displayID, flags }, 0);
 }
+
+void GPUProcessProxy::setScreenProperties(const ScreenProperties& properties)
+{
+    send(Messages::GPUProcess::SetScreenProperties { properties }, 0);
+}
 #endif
 
 void GPUProcessProxy::updatePreferences()
@@ -636,6 +642,10 @@
 #if ENABLE(VORBIS)
     send(Messages::GPUProcess::SetVorbisDecoderEnabled(hasEnabledVorbis), 0);
 #endif
+
+#if PLATFORM(MAC)
+    setScreenProperties(WebCore::collectScreenProperties());
+#endif
 }
 
 void GPUProcessProxy::didBecomeUnresponsive()

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (285218 => 285219)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2021-11-03 20:09:01 UTC (rev 285219)
@@ -49,6 +49,7 @@
 
 namespace WebCore {
 struct MockMediaDevice;
+struct ScreenProperties;
 struct SecurityOriginData;
 }
 
@@ -89,6 +90,7 @@
 
 #if PLATFORM(MAC)
     void displayConfigurationChanged(CGDirectDisplayID, CGDisplayChangeSummaryFlags);
+    void setScreenProperties(const WebCore::ScreenProperties&);
 #endif
 
     void updatePreferences();

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (285218 => 285219)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-11-03 18:40:36 UTC (rev 285218)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-11-03 20:09:01 UTC (rev 285219)
@@ -404,7 +404,12 @@
 #if PLATFORM(COCOA)
     auto screenProperties = WebCore::collectScreenProperties();
     sendToAllProcesses(Messages::WebProcess::SetScreenProperties(screenProperties));
+
+#if PLATFORM(MAC)
+    if (auto process = gpuProcess())
+        process->setScreenProperties(screenProperties);
 #endif
+#endif
 }
 
 void WebProcessPool::networkProcessDidTerminate(NetworkProcessProxy& networkProcessProxy, NetworkProcessProxy::TerminationReason reason)
@@ -652,8 +657,10 @@
     for (auto& processPool : WebProcessPool::allProcessPools()) {
         processPool->sendToAllProcesses(Messages::WebProcess::SetScreenProperties(screenProperties));
         processPool->sendToAllProcesses(Messages::WebProcess::DisplayConfigurationChanged(display, flags));
-        if (auto gpuProcess = processPool->gpuProcess())
+        if (auto gpuProcess = processPool->gpuProcess()) {
             gpuProcess->displayConfigurationChanged(display, flags);
+            gpuProcess->setScreenProperties(screenProperties);
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to