Title: [287144] trunk/Source/WebCore
Revision
287144
Author
[email protected]
Date
2021-12-16 10:14:30 -0800 (Thu, 16 Dec 2021)

Log Message

[GPUP] Create WebGL context with task id token
https://bugs.webkit.org/show_bug.cgi?id=234138

Patch by John Cunningham <[email protected]> on 2021-12-16
Reviewed by Kimmo Kinnunen.

No new tests.

Use EGL_ANGLE_metal_create_context_ownership_identity to create
a WebGL context when GPUP and WebGL in GPUP is enabled.

* platform/graphics/angle/GraphicsContextGLANGLE.h:
* platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::GraphicsContextGLCocoa::GraphicsContextGLCocoa):
(WebCore::GraphicsContextGLANGLE::GraphicsContextGLANGLE):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287143 => 287144)


--- trunk/Source/WebCore/ChangeLog	2021-12-16 17:51:47 UTC (rev 287143)
+++ trunk/Source/WebCore/ChangeLog	2021-12-16 18:14:30 UTC (rev 287144)
@@ -1,3 +1,20 @@
+2021-12-16  John Cunningham  <[email protected]>
+
+        [GPUP] Create WebGL context with task id token
+        https://bugs.webkit.org/show_bug.cgi?id=234138
+
+        Reviewed by Kimmo Kinnunen.
+
+        No new tests.
+
+        Use EGL_ANGLE_metal_create_context_ownership_identity to create
+        a WebGL context when GPUP and WebGL in GPUP is enabled.
+
+        * platform/graphics/angle/GraphicsContextGLANGLE.h:
+        * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
+        (WebCore::GraphicsContextGLCocoa::GraphicsContextGLCocoa):
+        (WebCore::GraphicsContextGLANGLE::GraphicsContextGLANGLE):
+
 2021-12-16  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Simple RTL content may need visual reordering

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (287143 => 287144)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2021-12-16 17:51:47 UTC (rev 287143)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2021-12-16 18:14:30 UTC (rev 287144)
@@ -364,7 +364,11 @@
 #endif
 
 protected:
+#if PLATFORM(COCOA) && HAVE(TASK_IDENTITY_TOKEN)
+    GraphicsContextGLANGLE(GraphicsContextGLAttributes, const ProcessIdentity&);
+#else
     GraphicsContextGLANGLE(GraphicsContextGLAttributes);
+#endif
     // Called once by all the public entry points that eventually call OpenGL.
     // Called once by all the public entry points of ExtensionsGL that eventually call OpenGL.
     bool makeContextCurrent() WARN_UNUSED_RETURN;

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm (287143 => 287144)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm	2021-12-16 17:51:47 UTC (rev 287143)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm	2021-12-16 18:14:30 UTC (rev 287144)
@@ -202,7 +202,12 @@
 }
 
 GraphicsContextGLCocoa::GraphicsContextGLCocoa(GraphicsContextGLAttributes&& creationAttributes, ProcessIdentity&& resourceOwner)
-    : GraphicsContextGLANGLE(WTFMove(creationAttributes))
+    :
+#if PLATFORM(COCOA) && HAVE(TASK_IDENTITY_TOKEN)
+    GraphicsContextGLANGLE(WTFMove(creationAttributes), resourceOwner)
+#else
+    GraphicsContextGLANGLE(WTFMove(creationAttributes))
+#endif
 {
     if (!isValid())
         return;
@@ -230,7 +235,11 @@
 
 // FIXME: Below is functionality that should be moved to GraphicsContextGLCocoa to simplify the base class.
 
+#if PLATFORM(COCOA) && HAVE(TASK_IDENTITY_TOKEN)
+GraphicsContextGLANGLE::GraphicsContextGLANGLE(GraphicsContextGLAttributes attrs, const ProcessIdentity& resourceOwner)
+#else
 GraphicsContextGLANGLE::GraphicsContextGLANGLE(GraphicsContextGLAttributes attrs)
+#endif
     : GraphicsContextGL(attrs)
 {
     m_isForWebGL2 = attrs.webGLVersion == GraphicsContextGLWebGLVersion::WebGL2;
@@ -323,6 +332,16 @@
     eglContextAttributes.append(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM);
     eglContextAttributes.append(EGL_FALSE);
 
+#if PLATFORM(COCOA) && HAVE(TASK_IDENTITY_TOKEN)
+    auto displayExtensions = EGL_QueryString(m_displayObj, EGL_EXTENSIONS);
+    bool supportsOwnershipIdentity = strstr(displayExtensions, "EGL_ANGLE_metal_create_context_ownership_identity");
+    // FIXME: Use m_resourceOwner once it moves to GraphicsContextGLCocoa.
+    if (attrs.useMetal && resourceOwner && supportsOwnershipIdentity) {
+        eglContextAttributes.append(EGL_CONTEXT_METAL_OWNERSHIP_IDENTITY_ANGLE);
+        eglContextAttributes.append(resourceOwner.taskIdToken());
+    }
+#endif
+
     eglContextAttributes.append(EGL_NONE);
 
     m_contextObj = EGL_CreateContext(m_displayObj, m_configObj, EGL_NO_CONTEXT, eglContextAttributes.data());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to