Title: [285468] branches/safari-612-branch/Source/WebKit
Revision
285468
Author
[email protected]
Date
2021-11-08 17:09:24 -0800 (Mon, 08 Nov 2021)

Log Message

Cherry-pick r285219. rdar://problem/84686676

    [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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/ChangeLog	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog	2021-11-09 01:09:24 UTC (rev 285468)
@@ -1,5 +1,64 @@
 2021-11-08  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r285219. rdar://problem/84686676
+
+    [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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-03  Jer Noble  <[email protected]>
+
+            [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-08  Kocsen Chung  <[email protected]>
+
         Cherry-pick r285208. rdar://problem/84824703
 
     [iOS] Need API for marking file requests as non-app-initiated

Modified: branches/safari-612-branch/Source/WebKit/GPUProcess/GPUProcess.h (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/GPUProcess/GPUProcess.h	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/GPUProcess/GPUProcess.h	2021-11-09 01:09:24 UTC (rev 285468)
@@ -45,6 +45,7 @@
 namespace WebCore {
 class NowPlayingManager;
 struct MockMediaDevice;
+struct ScreenProperties;
 struct SecurityOriginData;
 }
 
@@ -137,6 +138,7 @@
 #endif
 #if PLATFORM(MAC)
     void displayConfigurationChanged(CGDirectDisplayID, CGDisplayChangeSummaryFlags);
+    void setScreenProperties(const WebCore::ScreenProperties&);
 #endif
 
 #if USE(OS_STATE)

Modified: branches/safari-612-branch/Source/WebKit/GPUProcess/GPUProcess.messages.in (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/GPUProcess/GPUProcess.messages.in	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/GPUProcess/GPUProcess.messages.in	2021-11-09 01:09:24 UTC (rev 285468)
@@ -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: branches/safari-612-branch/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm	2021-11-09 01:09:24 UTC (rev 285468)
@@ -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: branches/safari-612-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-11-09 01:09:24 UTC (rev 285468)
@@ -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>
@@ -551,6 +552,11 @@
 {
     send(Messages::GPUProcess::DisplayConfigurationChanged { displayID, flags }, 0);
 }
+
+void GPUProcessProxy::setScreenProperties(const ScreenProperties& properties)
+{
+    send(Messages::GPUProcess::SetScreenProperties { properties }, 0);
+}
 #endif
 
 void GPUProcessProxy::updatePreferences()
@@ -614,6 +620,10 @@
 #if ENABLE(VORBIS)
     send(Messages::GPUProcess::SetVorbisDecoderEnabled(hasEnabledVorbis), 0);
 #endif
+
+#if PLATFORM(MAC)
+    setScreenProperties(WebCore::collectScreenProperties());
+#endif
 }
 
 void GPUProcessProxy::didBecomeUnresponsive()

Modified: branches/safari-612-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2021-11-09 01:09:24 UTC (rev 285468)
@@ -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: branches/safari-612-branch/Source/WebKit/UIProcess/WebProcessPool.cpp (285467 => 285468)


--- branches/safari-612-branch/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-11-09 01:09:20 UTC (rev 285467)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-11-09 01:09:24 UTC (rev 285468)
@@ -408,7 +408,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)
@@ -645,8 +650,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to