Title: [232375] trunk/Source
Revision
232375
Author
pvol...@apple.com
Date
2018-05-31 16:43:13 -0700 (Thu, 31 May 2018)

Log Message

Add OpenGL display mask to WebPage creation parameters.
https://bugs.webkit.org/show_bug.cgi?id=186163
<rdar://problem/40634504>

Reviewed by Brent Fulgham.

To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
on some hardware configurations.
Source/WebCore:

 
No new tests, since it is not trivial to test whether OpenGL rendering is hardware accelerated.

* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::displayID):

Source/WebKit:


* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_credentialsMessenger):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232374 => 232375)


--- trunk/Source/WebCore/ChangeLog	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebCore/ChangeLog	2018-05-31 23:43:13 UTC (rev 232375)
@@ -1,3 +1,22 @@
+2018-05-31  Per Arne Vollan  <pvol...@apple.com>
+
+        Add OpenGL display mask to WebPage creation parameters.
+        https://bugs.webkit.org/show_bug.cgi?id=186163
+        <rdar://problem/40634504>
+
+        Reviewed by Brent Fulgham.
+
+        To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
+        The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
+        early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
+        on some hardware configurations.
+ 
+        No new tests, since it is not trivial to test whether OpenGL rendering is hardware accelerated.
+
+        * platform/PlatformScreen.h:
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::displayID):
+
 2018-05-31  Megan Gardner  <megan_gard...@apple.com>
 
         Add setting to allow override screen size to be disabled.

Modified: trunk/Source/WebCore/platform/PlatformScreen.h (232374 => 232375)


--- trunk/Source/WebCore/platform/PlatformScreen.h	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebCore/platform/PlatformScreen.h	2018-05-31 23:43:13 UTC (rev 232375)
@@ -81,7 +81,9 @@
 #if PLATFORM(MAC)
 struct ScreenProperties;
 
-NSScreen *screen(NSWindow *);
+WEBCORE_EXPORT PlatformDisplayID displayID(NSScreen *);
+
+WEBCORE_EXPORT NSScreen *screen(NSWindow *);
 NSScreen *screen(PlatformDisplayID);
 
 FloatRect screenRectForDisplay(PlatformDisplayID);

Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (232374 => 232375)


--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2018-05-31 23:43:13 UTC (rev 232375)
@@ -46,7 +46,7 @@
 // These functions scale between screen and page coordinates because _javascript_/DOM operations
 // assume that the screen and the page share the same coordinate system.
 
-static PlatformDisplayID displayID(NSScreen *screen)
+PlatformDisplayID displayID(NSScreen *screen)
 {
     ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     return [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];

Modified: trunk/Source/WebKit/ChangeLog (232374 => 232375)


--- trunk/Source/WebKit/ChangeLog	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebKit/ChangeLog	2018-05-31 23:43:13 UTC (rev 232375)
@@ -1,3 +1,25 @@
+2018-05-31  Per Arne Vollan  <pvol...@apple.com>
+
+        Add OpenGL display mask to WebPage creation parameters.
+        https://bugs.webkit.org/show_bug.cgi?id=186163
+        <rdar://problem/40634504>
+
+        Reviewed by Brent Fulgham.
+
+        To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
+        The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
+        early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
+        on some hardware configurations.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_credentialsMessenger):
+
 2018-05-31  Brent Fulgham  <bfulg...@apple.com>
 
         Add a rule to allow reading files with prefix /private/var/db/CVMS/cvmsCodeSignObj

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (232374 => 232375)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2018-05-31 23:43:13 UTC (rev 232375)
@@ -119,6 +119,9 @@
 #if ENABLE(CONTENT_EXTENSIONS)
     encoder << contentRuleLists;
 #endif
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    encoder << displayMask;
+#endif
 }
 
 std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder)
@@ -343,6 +346,11 @@
     parameters.contentRuleLists = WTFMove(*contentRuleLists);
 #endif
 
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    if (!decoder.decode(parameters.displayMask))
+        return std::nullopt;
+#endif
+
     return WTFMove(parameters);
 }
 

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (232374 => 232375)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2018-05-31 23:43:13 UTC (rev 232375)
@@ -185,6 +185,10 @@
 #if ENABLE(CONTENT_EXTENSIONS)
     Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
 #endif
+    
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    CGOpenGLDisplayMask displayMask { 0 };
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (232374 => 232375)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-05-31 23:43:13 UTC (rev 232375)
@@ -6150,6 +6150,12 @@
     parameters.applicationManifest = m_configuration->applicationManifest() ? std::optional<WebCore::ApplicationManifest>(m_configuration->applicationManifest()->applicationManifest()) : std::nullopt;
 #endif
 
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    auto screen = WebCore::screen(m_pageClient.platformWindow());
+    auto displayID = WebCore::displayID(screen);
+    parameters.displayMask = CGDisplayIDToOpenGLDisplayMask(displayID);
+#endif
+
     m_process->addWebUserContentControllerProxy(m_userContentController, parameters);
 
     return parameters;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (232374 => 232375)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-05-31 22:02:39 UTC (rev 232374)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-05-31 23:43:13 UTC (rev 232375)
@@ -156,6 +156,7 @@
 #include <WebCore/FrameLoadRequest.h>
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/FrameView.h>
+#include <WebCore/GraphicsContext3D.h>
 #include <WebCore/HTMLAttachmentElement.h>
 #include <WebCore/HTMLFormElement.h>
 #include <WebCore/HTMLImageElement.h>
@@ -617,6 +618,10 @@
     setViewportConfigurationViewLayoutSize(parameters.viewportConfigurationViewLayoutSize);
     setMaximumUnobscuredSize(parameters.maximumUnobscuredSize);
 #endif
+    
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    GraphicsContext3D::setOpenGLDisplayMask(parameters.displayMask);
+#endif
 }
 
 #if ENABLE(WEB_RTC)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to