Title: [283308] trunk/Source/WebCore
Revision
283308
Author
[email protected]
Date
2021-09-30 05:47:13 -0700 (Thu, 30 Sep 2021)

Log Message

GraphicsContextGLAttributes::hasFenceSync should be a property of GraphicsContextGLOpenGL
https://bugs.webkit.org/show_bug.cgi?id=230939

Patch by Kimmo Kinnunen <[email protected]> on 2021-09-30
Reviewed by Antti Koivisto.

Move hasFenceSync from GraphicsContextGLAttributes to GraphicsContextGLOpenGL.

No new tests, a refactor.

* platform/graphics/GraphicsContextGLAttributes.h:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283307 => 283308)


--- trunk/Source/WebCore/ChangeLog	2021-09-30 11:20:49 UTC (rev 283307)
+++ trunk/Source/WebCore/ChangeLog	2021-09-30 12:47:13 UTC (rev 283308)
@@ -1,3 +1,20 @@
+2021-09-30  Kimmo Kinnunen  <[email protected]>
+
+        GraphicsContextGLAttributes::hasFenceSync should be a property of GraphicsContextGLOpenGL
+        https://bugs.webkit.org/show_bug.cgi?id=230939
+
+        Reviewed by Antti Koivisto.
+
+        Move hasFenceSync from GraphicsContextGLAttributes to GraphicsContextGLOpenGL.
+
+        No new tests, a refactor.
+
+        * platform/graphics/GraphicsContextGLAttributes.h:
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+        (WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+
 2021-09-30  Youenn Fablet  <[email protected]>
 
         Layout Test imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html is a flaky failure

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h (283307 => 283308)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h	2021-09-30 11:20:49 UTC (rev 283307)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h	2021-09-30 12:47:13 UTC (rev 283308)
@@ -64,7 +64,6 @@
     bool forceRequestForHighPerformanceGPU { false };
 #if PLATFORM(COCOA)
     bool useMetal { true };
-    bool hasFenceSync { false };
 #endif
 #if ENABLE(WEBXR)
     bool xrCompatible { false };

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (283307 => 283308)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-09-30 11:20:49 UTC (rev 283307)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-09-30 12:47:13 UTC (rev 283308)
@@ -356,12 +356,13 @@
         extensions.ensureEnabled(extension);
     }
     if (contextAttributes().useMetal) {
-        // The implementation uses GLsync objects. Enable the functionality for WebGL 1.0 contexts
-        // that use OpenGL ES 2.0.
+        // GraphicsContextGLOpenGL uses sync objects to throttle display on Metal implementations.
+        // OpenGL sync objects are not signaling upon completion on Catalina-era drivers, so
+        // OpenGL cannot use this method of throttling. OpenGL drivers typically implement
+        // some sort of internal throttling.
         if (extensions.supports("GL_ARB_sync"_s)) {
-            attrs.hasFenceSync = true;
+            m_useFenceSyncForDisplayRateLimit = true;
             extensions.ensureEnabled("GL_ARB_sync"_s);
-            setContextAttributes(attrs);
         }
     }
     validateAttributes();
@@ -838,9 +839,7 @@
 
     markLayerComposited();
 
-    if (contextAttributes().useMetal && contextAttributes().hasFenceSync) {
-        // OpenGL sync objects are not signaling upon completion on Catalina-era drivers.
-        // OpenGL drivers typically implement some sort of internal throttling.
+    if (m_useFenceSyncForDisplayRateLimit) {
         bool success = waitAndUpdateOldestFrame();
         UNUSED_VARIABLE(success); // FIXME: implement context lost.
     }

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (283307 => 283308)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2021-09-30 11:20:49 UTC (rev 283307)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2021-09-30 12:47:13 UTC (rev 283308)
@@ -796,6 +796,7 @@
     std::unique_ptr<GraphicsContextGLCV> m_cv;
 #endif
 #if USE(ANGLE)
+    bool m_useFenceSyncForDisplayRateLimit = false;
     static constexpr size_t maxPendingFrames = 3;
     size_t m_oldestFrameCompletionFence { 0 };
     ScopedGLFence m_frameCompletionFences[maxPendingFrames];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to