Title: [286978] trunk/Source
Revision
286978
Author
commit-qu...@webkit.org
Date
2021-12-13 13:16:28 -0800 (Mon, 13 Dec 2021)

Log Message

[GTK] Fix ANGLE compilation
https://bugs.webkit.org/show_bug.cgi?id=233327

Patch by Alejandro G. Castro <a...@igalia.com> on 2021-12-13
Reviewed by Kenneth Russell.

Source/ThirdParty/ANGLE:

There is a define with a typo in the name and activating EGL and
X11 does not work at the same time.

* PlatformGTK.cmake:

Source/WebCore:

No tests required.

Fixed the issues to make the engine work with -DUSE_ANGLE_WEBGL=ON
defined.

* platform/graphics/GLContext.cpp:
(WebCore::initializeOpenGLShimsIfNeeded): In case of GTK and WPE
initially we are going to keep TextureMapper using system GL
libraries, even when we are using ANGLE for WebGL, so we need the
shims definitions.
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
(Nicosia::GCGLLayer::swapBuffersIfNeeded): We need to allocate and
update the layer buffer in the compositor thread to make sure it
is handled in just one thread.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (286977 => 286978)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-12-13 21:16:28 UTC (rev 286978)
@@ -1,3 +1,15 @@
+2021-12-13  Alejandro G. Castro  <a...@igalia.com>
+
+        [GTK] Fix ANGLE compilation
+        https://bugs.webkit.org/show_bug.cgi?id=233327
+
+        Reviewed by Kenneth Russell.
+
+        There is a define with a typo in the name and activating EGL and
+        X11 does not work at the same time.
+
+        * PlatformGTK.cmake:
+
 2021-12-13  Kyle Piddington  <kpidding...@apple.com>
 
         [MacCatalyst] fix iOSMac after refactor in r286899

Modified: trunk/Source/ThirdParty/ANGLE/PlatformGTK.cmake (286977 => 286978)


--- trunk/Source/ThirdParty/ANGLE/PlatformGTK.cmake	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/ThirdParty/ANGLE/PlatformGTK.cmake	2021-12-13 21:16:28 UTC (rev 286978)
@@ -48,10 +48,6 @@
         list(APPEND GTK_ANGLE_DEFINITIONS ANGLE_USE_X11)
     endif ()
 
-    if (ENABLE_WAYLAND_TARGET)
-        list(APPEND GKT_ANGLE_DEFINITIONS WL_EGL_PLATFORM)
-    endif ()
-
     # Allow building ANGLE on platforms which may not provide X11 headers.
     if (NOT GTK_ANGLE_DEFINITIONS)
         list(APPEND GTK_ANGLE_DEFINITIONS USE_SYSTEM_EGL)

Modified: trunk/Source/WebCore/ChangeLog (286977 => 286978)


--- trunk/Source/WebCore/ChangeLog	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/WebCore/ChangeLog	2021-12-13 21:16:28 UTC (rev 286978)
@@ -1,3 +1,25 @@
+2021-12-13  Alejandro G. Castro  <a...@igalia.com>
+
+        [GTK] Fix ANGLE compilation
+        https://bugs.webkit.org/show_bug.cgi?id=233327
+
+        Reviewed by Kenneth Russell.
+
+        No tests required.
+
+        Fixed the issues to make the engine work with -DUSE_ANGLE_WEBGL=ON
+        defined.
+
+        * platform/graphics/GLContext.cpp:
+        (WebCore::initializeOpenGLShimsIfNeeded): In case of GTK and WPE
+        initially we are going to keep TextureMapper using system GL
+        libraries, even when we are using ANGLE for WebGL, so we need the
+        shims definitions.
+        * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
+        (Nicosia::GCGLLayer::swapBuffersIfNeeded): We need to allocate and
+        update the layer buffer in the compositor thread to make sure it
+        is handled in just one thread.
+
 2021-12-13  Antti Koivisto  <an...@apple.com>
 
         [CSS Cascade Layers] Layers specified in import rules can not be reordered on media query evaluation

Modified: trunk/Source/WebCore/platform/graphics/GLContext.cpp (286977 => 286978)


--- trunk/Source/WebCore/platform/graphics/GLContext.cpp	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/WebCore/platform/graphics/GLContext.cpp	2021-12-13 21:16:28 UTC (rev 286978)
@@ -58,7 +58,7 @@
 
 static bool initializeOpenGLShimsIfNeeded()
 {
-#if USE(OPENGL_ES) || USE(LIBEPOXY) || USE(ANGLE)
+#if USE(OPENGL_ES) || USE(LIBEPOXY) || (USE(ANGLE) && !(PLATFORM(GTK) || PLATFORM(WPE)))
     return true;
 #else
     static bool initialized = false;

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


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2021-12-13 21:16:28 UTC (rev 286978)
@@ -42,6 +42,7 @@
 
 #if USE(NICOSIA)
 namespace Nicosia {
+class GCGLANGLELayer;
 class GCGLLayer;
 }
 #endif
@@ -445,7 +446,7 @@
     GCGLuint m_intermediateTexture { 0 };
 #endif
 #if USE(NICOSIA)
-    std::unique_ptr<Nicosia::GCGLLayer> m_nicosiaLayer;
+    std::unique_ptr<Nicosia::GCGLANGLELayer> m_nicosiaLayer;
 #elif USE(TEXTURE_MAPPER)
     std::unique_ptr<TextureMapperGCGLPlatformLayer> m_texmapLayer;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp (286977 => 286978)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp	2021-12-13 21:16:28 UTC (rev 286978)
@@ -144,7 +144,7 @@
 GCGLANGLELayer::ANGLEContext::~ANGLEContext()
 {
     if (m_context) {
-        gl::BindFramebuffer(GL_FRAMEBUFFER, 0);
+        GL_BindFramebuffer(GL_FRAMEBUFFER, 0);
         EGL_MakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
         EGL_DestroyContext(m_display, m_context);
     }

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp (286977 => 286978)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp	2021-12-13 20:57:05 UTC (rev 286977)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp	2021-12-13 21:16:28 UTC (rev 286978)
@@ -86,9 +86,6 @@
         return;
 
     m_context.paintRenderingResultsToCanvas(*imageBuffer.get());
-    RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
-    if (!image)
-        return;
 #else
     flags |= TextureMapperGL::ShouldFlipTexture;
 #endif
@@ -96,17 +93,34 @@
     {
         auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy();
 #if USE(ANGLE)
-        std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer;
-        layerBuffer = proxy.getAvailableBuffer(textureSize, m_context.m_internalColorFormat);
-        if (!layerBuffer) {
-            auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get(), flags, m_context.m_internalColorFormat);
-            static_cast<BitmapTextureGL&>(texture.get()).setPendingContents(WTFMove(image));
-            layerBuffer = makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(texture), flags);
-        } else
-            layerBuffer->textureGL().setPendingContents(WTFMove(image));
+        auto proxyOperation =
+            [this, textureSize, flags, imageBuffer = WTFMove(imageBuffer)] () {
+                RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
+                if (!image)
+                    return;
 
-        Locker locker { proxy.lock() };
-        proxy.pushNextBuffer(WTFMove(layerBuffer));
+                std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer;
+                auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy();
+                Locker locker { proxy.lock() };
+                layerBuffer = proxy.getAvailableBuffer(textureSize, m_context.m_internalColorFormat);
+
+                if (!layerBuffer) {
+                    auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get(), flags, m_context.m_internalColorFormat);
+                    static_cast<BitmapTextureGL&>(texture.get()).setPendingContents(WTFMove(image));
+                    layerBuffer = makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(texture), flags);
+                } else
+                    layerBuffer->textureGL().setPendingContents(WTFMove(image));
+
+                proxy.pushNextBuffer(WTFMove(layerBuffer));
+
+                m_context.markLayerComposited();
+            };
+
+        proxy.scheduleUpdateOnCompositorThread([proxyOperation] {
+            proxyOperation();
+        });
+
+        return;
 #else
         Locker locker { proxy.lock() };
         proxy.pushNextBuffer(makeUnique<TextureMapperPlatformLayerBuffer>(m_context.m_compositorTexture, textureSize, flags, m_context.m_internalColorFormat));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to