WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-235182-20220113154506.patch (text/plain), 43.74 KB, created by
Chris Lord
on 2022-01-13 07:45:07 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Lord
Created:
2022-01-13 07:45:07 PST
Size:
43.74 KB
patch
obsolete
>Subversion Revision: 287834 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 041b620b84cacab0555114cabb8aec5542f243b3..a8160fb12ee8d90507c1e96ef6fdc0794d7bc5aa 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,42 @@ >+2022-01-13 Chris Lord <clord@igalia.com> >+ >+ [GTK][WPE] Share code between NicosiaGCGLLayer+ANGLE and NicosiaImageBufferPipe >+ https://bugs.webkit.org/show_bug.cgi?id=235182 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rename NicosiaGCGLANGLELayer to NicosiaGCGLANGLEPipe and have it >+ inherit from NicosiaImageBufferPipe instead of NicosiaGCGLLayer. >+ >+ No new tests, no change in behaviour. >+ >+ * platform/TextureMapper.cmake: >+ * platform/graphics/angle/GraphicsContextGLANGLE.h: >+ * platform/graphics/nicosia/NicosiaImageBufferPipe.cpp: >+ (Nicosia::NicosiaImageBufferPipe::NicosiaImageBufferPipe): >+ (Nicosia::NicosiaImageBufferPipe::source const): >+ (Nicosia::NicosiaImageBufferPipe::layerContentsDisplayDelegate): >+ (): Deleted. >+ (Nicosia::WebCore::NicosiaImageBufferPipeSource::NicosiaImageBufferPipeSource): Deleted. >+ (Nicosia::WebCore::NicosiaImageBufferPipeSource::~NicosiaImageBufferPipeSource): Deleted. >+ (Nicosia::WebCore::NicosiaImageBufferPipeSource::handle): Deleted. >+ (Nicosia::WebCore::NicosiaImageBufferPipeSource::swapBuffersIfNeeded): Deleted. >+ * platform/graphics/nicosia/NicosiaImageBufferPipe.h: Added. >+ (Nicosia::NicosiaImageBufferPipeSource::platformLayer const): >+ * platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp. >+ * platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h. >+ * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp: >+ (Nicosia::GCGLLayer::GCGLLayer): >+ (Nicosia::GCGLLayer::swapBuffersIfNeeded): >+ * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h: >+ * platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp: >+ (WebCore::GraphicsContextGLTextureMapper::GraphicsContextGLTextureMapper): >+ * platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp: >+ (WebCore::GraphicsContextGLANGLE::GraphicsContextGLANGLE): >+ (WebCore::GraphicsContextGLANGLE::platformDisplay const): >+ (WebCore::GraphicsContextGLANGLE::platformConfig const): >+ (WebCore::GraphicsContextGLANGLE::makeContextCurrent): >+ > 2022-01-12 Chris Lord <clord@igalia.com> > > [WPE] Fix building WebXR with ANGLE enabled >diff --git a/Source/WebCore/platform/TextureMapper.cmake b/Source/WebCore/platform/TextureMapper.cmake >index 424a6e3c82e4e1a7d1453adaacc55736e9e2fd1d..6c467f2fb568481aef36ae5be024e4f8d59a78ac 100644 >--- a/Source/WebCore/platform/TextureMapper.cmake >+++ b/Source/WebCore/platform/TextureMapper.cmake >@@ -126,6 +126,6 @@ endif () > > if (USE_ANGLE_WEBGL) > list(APPEND WebCore_SOURCES >- platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp >+ platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.cpp > ) > endif () >diff --git a/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h b/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h >index f89b99e13cb1ec491cf7f1d1d0b0ec9360a64a61..ca872ae58cda51a165921bc5092b57c210338d48 100644 >--- a/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h >+++ b/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h >@@ -42,7 +42,7 @@ > > #if USE(NICOSIA) > namespace Nicosia { >-class GCGLANGLELayer; >+class GCGLANGLEPipe; > class GCGLLayer; > } > #endif >@@ -450,7 +450,11 @@ protected: > GCGLuint m_intermediateTexture { 0 }; > #endif > #if USE(NICOSIA) >- std::unique_ptr<Nicosia::GCGLANGLELayer> m_nicosiaLayer; >+#if USE(ANGLE) >+ std::unique_ptr<Nicosia::GCGLANGLEPipe> m_nicosiaPipe; >+#else >+ std::unique_ptr<Nicosia::GCGLLayer> m_nicosiaLayer; >+#endif > #elif USE(TEXTURE_MAPPER) > std::unique_ptr<TextureMapperGCGLPlatformLayer> m_texmapLayer; > #endif >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp b/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp >index 2f74d0ebadb7d82e920d428cd9e19cf6dde3604f..638463fb3f25e5bdbdaf9789e4af90714a656961 100644 >--- a/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp >@@ -25,11 +25,10 @@ > */ > > #include "config.h" >-#include "ImageBuffer.h" >+#include "NicosiaImageBufferPipe.h" > >-#include "ImageBufferPipe.h" >+#include "ImageBuffer.h" > #include "NativeImage.h" >-#include "NicosiaContentLayerTextureMapperImpl.h" > #include "NicosiaPlatformLayer.h" > #include "TextureMapperPlatformLayerBuffer.h" > #include "TextureMapperPlatformLayerProxy.h" >@@ -44,60 +43,6 @@ namespace Nicosia { > > using namespace WebCore; > >-namespace { >-class NicosiaImageBufferPipeSource final : public ImageBufferPipe::Source, public ContentLayerTextureMapperImpl::Client { >-public: >- NicosiaImageBufferPipeSource(); >- virtual ~NicosiaImageBufferPipeSource(); >- >- // ImageBufferPipe::Source overrides. >- void handle(RefPtr<ImageBuffer>&&) final; >- >- ContentLayer* platformLayer() const { return m_nicosiaLayer.get(); } >-private: >- // ContentLayerTextureMapperImpl::Client overrides. >- void swapBuffersIfNeeded() override; >- >- RefPtr<ContentLayer> m_nicosiaLayer; >- >- mutable Lock m_imageBufferLock; >- RefPtr<ImageBuffer> m_imageBuffer; >-}; >- >-class PipeSourceDisplayDelegate final : public GraphicsLayerContentsDisplayDelegate { >-public: >- static Ref<PipeSourceDisplayDelegate> create(RefPtr<ContentLayer>&& nicosiaLayer) >- { >- return adoptRef(*new PipeSourceDisplayDelegate(WTFMove(nicosiaLayer))); >- } >- >- // GraphicsLayerContentsDisplayDelegate overrides. >- PlatformLayer* platformLayer() const final { return m_nicosiaLayer.get(); } >-private: >- PipeSourceDisplayDelegate(RefPtr<ContentLayer>&& nicosiaLayer) >- : m_nicosiaLayer(WTFMove(nicosiaLayer)) >- { >- } >- >- RefPtr<ContentLayer> m_nicosiaLayer; >-}; >- >-class NicosiaImageBufferPipe final : public ImageBufferPipe { >-public: >- NicosiaImageBufferPipe() >- : m_source(adoptRef(*new NicosiaImageBufferPipeSource)) >- , m_layerContentsDisplayDelegate(PipeSourceDisplayDelegate::create(m_source->platformLayer())) >- { >- } >- >- // ImageBufferPipe overrides. >- RefPtr<ImageBufferPipe::Source> source() const final { return m_source.ptr(); } >- RefPtr<GraphicsLayerContentsDisplayDelegate> layerContentsDisplayDelegate() final { return m_layerContentsDisplayDelegate.ptr(); } >-private: >- Ref<NicosiaImageBufferPipeSource> m_source; >- Ref<PipeSourceDisplayDelegate> m_layerContentsDisplayDelegate; >-}; >- > NicosiaImageBufferPipeSource::NicosiaImageBufferPipeSource() > { > m_nicosiaLayer = Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)); >@@ -163,6 +108,20 @@ void NicosiaImageBufferPipeSource::swapBuffersIfNeeded() > { > } > >+NicosiaImageBufferPipe::NicosiaImageBufferPipe() >+ : m_source(adoptRef(*new NicosiaImageBufferPipeSource)) >+ , m_layerContentsDisplayDelegate(NicosiaImageBufferPipeSourceDisplayDelegate::create(m_source->platformLayer())) >+{ >+} >+ >+RefPtr<ImageBufferPipe::Source> NicosiaImageBufferPipe::source() const >+{ >+ return m_source.ptr(); >+} >+ >+RefPtr<GraphicsLayerContentsDisplayDelegate> NicosiaImageBufferPipe::layerContentsDisplayDelegate() >+{ >+ return m_layerContentsDisplayDelegate.ptr(); > } > > } // namespace Nicosia >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h b/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0805c4789485aaa8302c10a1227d5612df9a74a1 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h >@@ -0,0 +1,83 @@ >+/* >+ * Copyright (C) 2020,2022 Igalia S.L >+ * Copyright (C) 2020,2022 Metrological Group B.V. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ImageBufferPipe.h" >+#include "NicosiaContentLayerTextureMapperImpl.h" >+ >+namespace Nicosia { >+ >+class NicosiaImageBufferPipeSourceDisplayDelegate final : public WebCore::GraphicsLayerContentsDisplayDelegate { >+public: >+ static Ref<NicosiaImageBufferPipeSourceDisplayDelegate> create(RefPtr<ContentLayer>&& nicosiaLayer) >+ { >+ return adoptRef(*new NicosiaImageBufferPipeSourceDisplayDelegate(WTFMove(nicosiaLayer))); >+ } >+ >+ // GraphicsLayerContentsDisplayDelegate overrides. >+ PlatformLayer* platformLayer() const final { return m_nicosiaLayer.get(); } >+private: >+ NicosiaImageBufferPipeSourceDisplayDelegate(RefPtr<ContentLayer>&& nicosiaLayer) >+ : m_nicosiaLayer(WTFMove(nicosiaLayer)) >+ { >+ } >+ >+ RefPtr<ContentLayer> m_nicosiaLayer; >+}; >+ >+class NicosiaImageBufferPipeSource : public WebCore::ImageBufferPipe::Source, public ContentLayerTextureMapperImpl::Client { >+public: >+ NicosiaImageBufferPipeSource(); >+ virtual ~NicosiaImageBufferPipeSource(); >+ >+ // ImageBufferPipe::Source overrides. >+ void handle(RefPtr<WebCore::ImageBuffer>&&) final; >+ >+ // ContentLayerTextureMapperImpl::Client overrides. >+ void swapBuffersIfNeeded() override; >+ >+ ContentLayer* platformLayer() const { return m_nicosiaLayer.get(); } >+private: >+ RefPtr<ContentLayer> m_nicosiaLayer; >+ >+ mutable Lock m_imageBufferLock; >+ RefPtr<WebCore::ImageBuffer> m_imageBuffer; >+}; >+ >+class NicosiaImageBufferPipe final : public WebCore::ImageBufferPipe { >+public: >+ NicosiaImageBufferPipe(); >+ >+ // ImageBufferPipe overrides. >+ RefPtr<WebCore::ImageBufferPipe::Source> source() const final; >+ RefPtr<WebCore::GraphicsLayerContentsDisplayDelegate> layerContentsDisplayDelegate() final; >+private: >+ Ref<NicosiaImageBufferPipeSource> m_source; >+ Ref<NicosiaImageBufferPipeSourceDisplayDelegate> m_layerContentsDisplayDelegate; >+}; >+ >+} >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp >deleted file mode 100644 >index 2bff6e4f0bcf5ae936568968dc33a4008f17ebd3..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp >+++ /dev/null >@@ -1,217 +0,0 @@ >-/* >- * Copyright (C) 2018 Metrological Group B.V. >- * Copyright (C) 2018, 2019 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following >- * disclaimer in the documentation and/or other materials provided >- * with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "NicosiaGCGLANGLELayer.h" >- >-#if USE(NICOSIA) && USE(TEXTURE_MAPPER) >- >-#include "ANGLEHeaders.h" >-#include "Logging.h" >- >-namespace Nicosia { >- >-using namespace WebCore; >- >-const char* GCGLANGLELayer::ANGLEContext::errorString(int statusCode) >-{ >- static_assert(sizeof(int) >= sizeof(EGLint), "EGLint must not be wider than int"); >- switch (statusCode) { >-#define CASE_RETURN_STRING(name) case name: return #name >- // https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglGetError.xhtml >- CASE_RETURN_STRING(EGL_SUCCESS); >- CASE_RETURN_STRING(EGL_NOT_INITIALIZED); >- CASE_RETURN_STRING(EGL_BAD_ACCESS); >- CASE_RETURN_STRING(EGL_BAD_ALLOC); >- CASE_RETURN_STRING(EGL_BAD_ATTRIBUTE); >- CASE_RETURN_STRING(EGL_BAD_CONTEXT); >- CASE_RETURN_STRING(EGL_BAD_CONFIG); >- CASE_RETURN_STRING(EGL_BAD_CURRENT_SURFACE); >- CASE_RETURN_STRING(EGL_BAD_DISPLAY); >- CASE_RETURN_STRING(EGL_BAD_SURFACE); >- CASE_RETURN_STRING(EGL_BAD_MATCH); >- CASE_RETURN_STRING(EGL_BAD_PARAMETER); >- CASE_RETURN_STRING(EGL_BAD_NATIVE_PIXMAP); >- CASE_RETURN_STRING(EGL_BAD_NATIVE_WINDOW); >- CASE_RETURN_STRING(EGL_CONTEXT_LOST); >-#undef CASE_RETURN_STRING >- default: return "Unknown EGL error"; >- } >-} >- >-const char* GCGLANGLELayer::ANGLEContext::lastErrorString() >-{ >- return errorString(EGL_GetError()); >-} >- >-std::unique_ptr<GCGLANGLELayer::ANGLEContext> GCGLANGLELayer::ANGLEContext::createContext() >-{ >- EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY); >- if (display == EGL_NO_DISPLAY) >- return nullptr; >- >- EGLint majorVersion, minorVersion; >- if (EGL_Initialize(display, &majorVersion, &minorVersion) == EGL_FALSE) { >- LOG(WebGL, "EGLDisplay Initialization failed."); >- return nullptr; >- } >- LOG(WebGL, "ANGLE initialised Major: %d Minor: %d", majorVersion, minorVersion); >- >- const char* displayExtensions = EGL_QueryString(display, EGL_EXTENSIONS); >- LOG(WebGL, "Extensions: %s", displayExtensions); >- >- EGLConfig config; >- EGLint configAttributes[] = { >- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, >- EGL_RED_SIZE, 8, >- EGL_GREEN_SIZE, 8, >- EGL_BLUE_SIZE, 8, >- EGL_ALPHA_SIZE, 8, >- EGL_NONE >- }; >- EGLint numberConfigsReturned = 0; >- EGL_ChooseConfig(display, configAttributes, &config, 1, &numberConfigsReturned); >- if (numberConfigsReturned != 1) { >- LOG(WebGL, "EGLConfig Initialization failed."); >- return nullptr; >- } >- LOG(WebGL, "Got EGLConfig"); >- >- EGL_BindAPI(EGL_OPENGL_ES_API); >- if (EGL_GetError() != EGL_SUCCESS) { >- LOG(WebGL, "Unable to bind to OPENGL_ES_API"); >- return nullptr; >- } >- >- std::vector<EGLint> contextAttributes; >- contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION); >- contextAttributes.push_back(2); >- contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE); >- contextAttributes.push_back(EGL_TRUE); >- contextAttributes.push_back(EGL_EXTENSIONS_ENABLED_ANGLE); >- contextAttributes.push_back(EGL_TRUE); >- if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) { >- contextAttributes.push_back(EGL_POWER_PREFERENCE_ANGLE); >- // EGL_LOW_POWER_ANGLE is the default. Change to >- // EGL_HIGH_POWER_ANGLE if desired. >- contextAttributes.push_back(EGL_LOW_POWER_ANGLE); >- } >- contextAttributes.push_back(EGL_NONE); >- >- EGLContext context = EGL_CreateContext(display, config, EGL_NO_CONTEXT, contextAttributes.data()); >- if (context == EGL_NO_CONTEXT) { >- LOG(WebGL, "EGLContext Initialization failed."); >- return nullptr; >- } >- LOG(WebGL, "Got EGLContext"); >- >- return std::unique_ptr<ANGLEContext>(new ANGLEContext(display, config, context, EGL_NO_SURFACE)); >-} >- >-GCGLANGLELayer::ANGLEContext::ANGLEContext(EGLDisplay display, EGLConfig config, EGLContext context, EGLSurface surface) >- : m_display(display) >- , m_config(config) >- , m_context(context) >- , m_surface(surface) >-{ >-} >- >-GCGLANGLELayer::ANGLEContext::~ANGLEContext() >-{ >- if (m_context) { >- GL_BindFramebuffer(GL_FRAMEBUFFER, 0); >- EGL_MakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); >- EGL_DestroyContext(m_display, m_context); >- } >- >- if (m_surface) >- EGL_DestroySurface(m_display, m_surface); >-} >- >-bool GCGLANGLELayer::ANGLEContext::makeContextCurrent() >-{ >- ASSERT(m_context); >- >- if (EGL_GetCurrentContext() != m_context) >- return EGL_MakeCurrent(m_display, m_surface, m_surface, m_context); >- return true; >-} >- >-PlatformGraphicsContextGL GCGLANGLELayer::ANGLEContext::platformContext() const >-{ >- return m_context; >-} >- >-PlatformGraphicsContextGLDisplay GCGLANGLELayer::ANGLEContext::platformDisplay() const >-{ >- return m_display; >-} >- >-PlatformGraphicsContextGLConfig GCGLANGLELayer::ANGLEContext::platformConfig() const >-{ >- return m_config; >-} >- >-GCGLANGLELayer::GCGLANGLELayer(GraphicsContextGLANGLE& context) >- : GCGLLayer(context) >- , m_angleContext(ANGLEContext::createContext()) >-{ >-} >- >-GCGLANGLELayer::~GCGLANGLELayer() >-{ >-} >- >-bool GCGLANGLELayer::makeContextCurrent() >-{ >- ASSERT(m_angleContext); >- return m_angleContext->makeContextCurrent(); >- >-} >- >-PlatformGraphicsContextGL GCGLANGLELayer::platformContext() const >-{ >- ASSERT(m_angleContext); >- return m_angleContext->platformContext(); >-} >- >-PlatformGraphicsContextGLDisplay GCGLANGLELayer::platformDisplay() const >-{ >- ASSERT(m_angleContext); >- return m_angleContext->platformDisplay(); >-} >- >-PlatformGraphicsContextGLConfig GCGLANGLELayer::platformConfig() const >-{ >- ASSERT(m_angleContext); >- return m_angleContext->platformContext(); >-} >- >-} // namespace Nicosia >- >-#endif // USE(NICOSIA) && USE(TEXTURE_MAPPER) >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h >deleted file mode 100644 >index 7873782c3fd22c50a575005aade0f4f000f2b1ae..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h >+++ /dev/null >@@ -1,92 +0,0 @@ >-/* >- * Copyright (C) 2018 Metrological Group B.V. >- * Copyright (C) 2018, 2019 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following >- * disclaimer in the documentation and/or other materials provided >- * with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if USE(NICOSIA) && USE(TEXTURE_MAPPER) >- >-#include "GLContext.h" >-#include "GraphicsContextGLOpenGL.h" >-#include "NicosiaGCGLLayer.h" >-#include <memory> >- >-typedef void *EGLConfig; >-typedef void *EGLContext; >-typedef void *EGLDisplay; >-typedef void *EGLSurface; >- >-namespace WebCore { >-class IntSize; >-class GLContext; >-class PlatformDisplay; >-} >- >-namespace Nicosia { >- >-class GCGLANGLELayer final : public GCGLLayer { >- WTF_MAKE_FAST_ALLOCATED; >-public: >- class ANGLEContext { >- WTF_MAKE_NONCOPYABLE(ANGLEContext); >- public: >- static const char* errorString(int statusCode); >- static const char* lastErrorString(); >- >- static std::unique_ptr<ANGLEContext> createContext(); >- virtual ~ANGLEContext(); >- >- bool makeContextCurrent(); >-#if ENABLE(WEBGL) >- PlatformGraphicsContextGL platformContext() const; >- PlatformGraphicsContextGLDisplay platformDisplay() const; >- PlatformGraphicsContextGLConfig platformConfig() const; >-#endif >- >- private: >- ANGLEContext(EGLDisplay, EGLConfig, EGLContext, EGLSurface); >- >- EGLDisplay m_display { nullptr }; >- EGLConfig m_config { nullptr }; >- EGLContext m_context { nullptr }; >- EGLSurface m_surface { nullptr }; >- }; >- >- GCGLANGLELayer(WebCore::GraphicsContextGLANGLE&); >- virtual ~GCGLANGLELayer(); >- >- bool makeContextCurrent() override; >- PlatformGraphicsContextGL platformContext() const override; >- PlatformGraphicsContextGLDisplay platformDisplay() const; >- PlatformGraphicsContextGLConfig platformConfig() const; >-private: >- std::unique_ptr<ANGLEContext> m_angleContext; >-}; >- >-} // namespace Nicosia >- >-#endif // USE(NICOSIA) && USE(TEXTURE_MAPPER) >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.cpp b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..5a39d3daa681db9eccd0c6f6d9376628410e21fd >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.cpp >@@ -0,0 +1,258 @@ >+/* >+ * Copyright (C) 2018 Metrological Group B.V. >+ * Copyright (C) 2018, 2019 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer in the documentation and/or other materials provided >+ * with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "NicosiaGCGLANGLEPipe.h" >+ >+#if USE(NICOSIA) && USE(TEXTURE_MAPPER) >+ >+#include "ANGLEHeaders.h" >+#include "ImageBuffer.h" >+#include "Logging.h" >+#include "TextureMapperGL.h" >+#include "TextureMapperPlatformLayerBuffer.h" >+#include "TextureMapperPlatformLayerProxy.h" >+ >+namespace Nicosia { >+ >+using namespace WebCore; >+ >+GCGLANGLEPipeSource::GCGLANGLEPipeSource(WebCore::GraphicsContextGLANGLE& context) >+ : m_context(context) >+{ >+} >+ >+GCGLANGLEPipeSource::~GCGLANGLEPipeSource() >+{ >+} >+ >+void GCGLANGLEPipeSource::swapBuffersIfNeeded() >+{ >+ if (m_context.layerComposited()) >+ return; >+ >+ m_context.prepareTexture(); >+ RefPtr<WebCore::ImageBuffer> imageBuffer = ImageBuffer::create(m_context.getInternalFramebufferSize(), RenderingMode::Unaccelerated, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8); >+ if (!imageBuffer) >+ return; >+ >+ m_context.paintRenderingResultsToCanvas(*imageBuffer.get()); >+ >+ handle(WTFMove(imageBuffer)); >+ >+ m_context.markLayerComposited(); >+} >+ >+const char* GCGLANGLEPipe::ANGLEContext::errorString(int statusCode) >+{ >+ static_assert(sizeof(int) >= sizeof(EGLint), "EGLint must not be wider than int"); >+ switch (statusCode) { >+#define CASE_RETURN_STRING(name) case name: return #name >+ // https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglGetError.xhtml >+ CASE_RETURN_STRING(EGL_SUCCESS); >+ CASE_RETURN_STRING(EGL_NOT_INITIALIZED); >+ CASE_RETURN_STRING(EGL_BAD_ACCESS); >+ CASE_RETURN_STRING(EGL_BAD_ALLOC); >+ CASE_RETURN_STRING(EGL_BAD_ATTRIBUTE); >+ CASE_RETURN_STRING(EGL_BAD_CONTEXT); >+ CASE_RETURN_STRING(EGL_BAD_CONFIG); >+ CASE_RETURN_STRING(EGL_BAD_CURRENT_SURFACE); >+ CASE_RETURN_STRING(EGL_BAD_DISPLAY); >+ CASE_RETURN_STRING(EGL_BAD_SURFACE); >+ CASE_RETURN_STRING(EGL_BAD_MATCH); >+ CASE_RETURN_STRING(EGL_BAD_PARAMETER); >+ CASE_RETURN_STRING(EGL_BAD_NATIVE_PIXMAP); >+ CASE_RETURN_STRING(EGL_BAD_NATIVE_WINDOW); >+ CASE_RETURN_STRING(EGL_CONTEXT_LOST); >+#undef CASE_RETURN_STRING >+ default: return "Unknown EGL error"; >+ } >+} >+ >+const char* GCGLANGLEPipe::ANGLEContext::lastErrorString() >+{ >+ return errorString(EGL_GetError()); >+} >+ >+std::unique_ptr<GCGLANGLEPipe::ANGLEContext> GCGLANGLEPipe::ANGLEContext::createContext() >+{ >+ EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY); >+ if (display == EGL_NO_DISPLAY) >+ return nullptr; >+ >+ EGLint majorVersion, minorVersion; >+ if (EGL_Initialize(display, &majorVersion, &minorVersion) == EGL_FALSE) { >+ LOG(WebGL, "EGLDisplay Initialization failed."); >+ return nullptr; >+ } >+ LOG(WebGL, "ANGLE initialised Major: %d Minor: %d", majorVersion, minorVersion); >+ >+ const char* displayExtensions = EGL_QueryString(display, EGL_EXTENSIONS); >+ LOG(WebGL, "Extensions: %s", displayExtensions); >+ >+ EGLConfig config; >+ EGLint configAttributes[] = { >+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, >+ EGL_RED_SIZE, 8, >+ EGL_GREEN_SIZE, 8, >+ EGL_BLUE_SIZE, 8, >+ EGL_ALPHA_SIZE, 8, >+ EGL_NONE >+ }; >+ EGLint numberConfigsReturned = 0; >+ EGL_ChooseConfig(display, configAttributes, &config, 1, &numberConfigsReturned); >+ if (numberConfigsReturned != 1) { >+ LOG(WebGL, "EGLConfig Initialization failed."); >+ return nullptr; >+ } >+ LOG(WebGL, "Got EGLConfig"); >+ >+ EGL_BindAPI(EGL_OPENGL_ES_API); >+ if (EGL_GetError() != EGL_SUCCESS) { >+ LOG(WebGL, "Unable to bind to OPENGL_ES_API"); >+ return nullptr; >+ } >+ >+ std::vector<EGLint> contextAttributes; >+ contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION); >+ contextAttributes.push_back(2); >+ contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE); >+ contextAttributes.push_back(EGL_TRUE); >+ contextAttributes.push_back(EGL_EXTENSIONS_ENABLED_ANGLE); >+ contextAttributes.push_back(EGL_TRUE); >+ if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) { >+ contextAttributes.push_back(EGL_POWER_PREFERENCE_ANGLE); >+ // EGL_LOW_POWER_ANGLE is the default. Change to >+ // EGL_HIGH_POWER_ANGLE if desired. >+ contextAttributes.push_back(EGL_LOW_POWER_ANGLE); >+ } >+ contextAttributes.push_back(EGL_NONE); >+ >+ EGLContext context = EGL_CreateContext(display, config, EGL_NO_CONTEXT, contextAttributes.data()); >+ if (context == EGL_NO_CONTEXT) { >+ LOG(WebGL, "EGLContext Initialization failed."); >+ return nullptr; >+ } >+ LOG(WebGL, "Got EGLContext"); >+ >+ return std::unique_ptr<ANGLEContext>(new ANGLEContext(display, config, context, EGL_NO_SURFACE)); >+} >+ >+GCGLANGLEPipe::ANGLEContext::ANGLEContext(EGLDisplay display, EGLConfig config, EGLContext context, EGLSurface surface) >+ : m_display(display) >+ , m_config(config) >+ , m_context(context) >+ , m_surface(surface) >+{ >+} >+ >+GCGLANGLEPipe::ANGLEContext::~ANGLEContext() >+{ >+ if (m_context) { >+ GL_BindFramebuffer(GL_FRAMEBUFFER, 0); >+ EGL_MakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); >+ EGL_DestroyContext(m_display, m_context); >+ } >+ >+ if (m_surface) >+ EGL_DestroySurface(m_display, m_surface); >+} >+ >+bool GCGLANGLEPipe::ANGLEContext::makeContextCurrent() >+{ >+ ASSERT(m_context); >+ >+ if (EGL_GetCurrentContext() != m_context) >+ return EGL_MakeCurrent(m_display, m_surface, m_surface, m_context); >+ return true; >+} >+ >+PlatformGraphicsContextGL GCGLANGLEPipe::ANGLEContext::platformContext() const >+{ >+ return m_context; >+} >+ >+PlatformGraphicsContextGLDisplay GCGLANGLEPipe::ANGLEContext::platformDisplay() const >+{ >+ return m_display; >+} >+ >+PlatformGraphicsContextGLConfig GCGLANGLEPipe::ANGLEContext::platformConfig() const >+{ >+ return m_config; >+} >+ >+GCGLANGLEPipe::GCGLANGLEPipe(GraphicsContextGLANGLE& context) >+ : m_angleContext(ANGLEContext::createContext()) >+ , m_source(adoptRef(*new GCGLANGLEPipeSource(context))) >+ , m_layerContentsDisplayDelegate(NicosiaImageBufferPipeSourceDisplayDelegate::create(m_source->platformLayer())) >+{ >+} >+ >+GCGLANGLEPipe::~GCGLANGLEPipe() >+{ >+} >+ >+bool GCGLANGLEPipe::makeContextCurrent() >+{ >+ ASSERT(m_angleContext); >+ return m_angleContext->makeContextCurrent(); >+ >+} >+ >+PlatformGraphicsContextGL GCGLANGLEPipe::platformContext() const >+{ >+ ASSERT(m_angleContext); >+ return m_angleContext->platformContext(); >+} >+ >+PlatformGraphicsContextGLDisplay GCGLANGLEPipe::platformDisplay() const >+{ >+ ASSERT(m_angleContext); >+ return m_angleContext->platformDisplay(); >+} >+ >+PlatformGraphicsContextGLConfig GCGLANGLEPipe::platformConfig() const >+{ >+ ASSERT(m_angleContext); >+ return m_angleContext->platformContext(); >+} >+ >+RefPtr<ImageBufferPipe::Source> GCGLANGLEPipe::source() const >+{ >+ return m_source.ptr(); >+} >+ >+RefPtr<GraphicsLayerContentsDisplayDelegate> GCGLANGLEPipe::layerContentsDisplayDelegate() >+{ >+ return m_layerContentsDisplayDelegate.ptr(); >+} >+ >+} // namespace Nicosia >+ >+#endif // USE(NICOSIA) && USE(TEXTURE_MAPPER) >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.h b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.h >new file mode 100644 >index 0000000000000000000000000000000000000000..86137e0d6c357f0345cf95e19b3c777f944f3532 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLEPipe.h >@@ -0,0 +1,111 @@ >+/* >+ * Copyright (C) 2018 Metrological Group B.V. >+ * Copyright (C) 2018, 2019 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer in the documentation and/or other materials provided >+ * with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if USE(NICOSIA) && USE(TEXTURE_MAPPER) >+ >+#include "GLContext.h" >+#include "GraphicsContextGLANGLE.h" >+#include "NicosiaImageBufferPipe.h" >+#include <memory> >+ >+typedef void *EGLConfig; >+typedef void *EGLContext; >+typedef void *EGLDisplay; >+typedef void *EGLSurface; >+ >+namespace WebCore { >+class IntSize; >+class GLContext; >+class PlatformDisplay; >+} >+ >+namespace Nicosia { >+ >+class GCGLANGLEPipeSource; >+class GCGLANGLEPipeSource : public NicosiaImageBufferPipeSource { >+public: >+ GCGLANGLEPipeSource(WebCore::GraphicsContextGLANGLE&); >+ virtual ~GCGLANGLEPipeSource(); >+ >+ // ContentLayerTextureMapperImpl::Client overrides. >+ void swapBuffersIfNeeded() final; >+private: >+ WebCore::GraphicsContextGLANGLE& m_context; >+}; >+ >+class GCGLANGLEPipe final : public WebCore::ImageBufferPipe { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ class ANGLEContext { >+ WTF_MAKE_NONCOPYABLE(ANGLEContext); >+ public: >+ static const char* errorString(int statusCode); >+ static const char* lastErrorString(); >+ >+ static std::unique_ptr<ANGLEContext> createContext(); >+ virtual ~ANGLEContext(); >+ >+ bool makeContextCurrent(); >+#if ENABLE(WEBGL) >+ PlatformGraphicsContextGL platformContext() const; >+ PlatformGraphicsContextGLDisplay platformDisplay() const; >+ PlatformGraphicsContextGLConfig platformConfig() const; >+#endif >+ >+ private: >+ ANGLEContext(EGLDisplay, EGLConfig, EGLContext, EGLSurface); >+ >+ EGLDisplay m_display { nullptr }; >+ EGLConfig m_config { nullptr }; >+ EGLContext m_context { nullptr }; >+ EGLSurface m_surface { nullptr }; >+ }; >+ >+ GCGLANGLEPipe(WebCore::GraphicsContextGLANGLE&); >+ virtual ~GCGLANGLEPipe(); >+ >+ bool makeContextCurrent(); >+ PlatformGraphicsContextGL platformContext() const; >+ PlatformGraphicsContextGLDisplay platformDisplay() const; >+ PlatformGraphicsContextGLConfig platformConfig() const; >+ >+ // ImageBufferPipe overrides. >+ RefPtr<WebCore::ImageBufferPipe::Source> source() const final; >+ RefPtr<WebCore::GraphicsLayerContentsDisplayDelegate> layerContentsDisplayDelegate() final; >+ >+private: >+ std::unique_ptr<ANGLEContext> m_angleContext; >+ Ref<GCGLANGLEPipeSource> m_source; >+ Ref<NicosiaImageBufferPipeSourceDisplayDelegate> m_layerContentsDisplayDelegate; >+}; >+ >+} // namespace Nicosia >+ >+#endif // USE(NICOSIA) && USE(TEXTURE_MAPPER) >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp >index 2ce247c6ddf4b36d70c3e6a6479cf606c796e205..4e4a2b3be52dc365700c7b59c955322adee86606 100644 >--- a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp >+++ b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp >@@ -29,7 +29,7 @@ > #include "config.h" > #include "NicosiaGCGLLayer.h" > >-#if ENABLE(WEBGL) && USE(NICOSIA) && USE(TEXTURE_MAPPER) >+#if ENABLE(WEBGL) && USE(NICOSIA) && USE(TEXTURE_MAPPER) && !USE(ANGLE) > > #if USE(COORDINATED_GRAPHICS) > #include "TextureMapperGL.h" >@@ -37,20 +37,13 @@ > #include "TextureMapperPlatformLayerProxy.h" > #endif > >-#if USE(ANGLE) >-#include "ImageBuffer.h" >-#if USE(CAIRO) >-#include <cairo.h> >-#endif >-#endif >- > #include "GLContext.h" > > namespace Nicosia { > > using namespace WebCore; > >-GCGLLayer::GCGLLayer(GraphicsContextGLType& context) >+GCGLLayer::GCGLLayer(GraphicsContextGLOpenGL& context) > : m_context(context) > , m_contentLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this))) > { >@@ -82,64 +75,15 @@ void GCGLLayer::swapBuffersIfNeeded() > > m_context.prepareTexture(); > IntSize textureSize(m_context.m_currentWidth, m_context.m_currentHeight); >-#if USE(ANGLE) >- RefPtr<WebCore::ImageBuffer> imageBuffer = ImageBuffer::create(textureSize, RenderingMode::Unaccelerated, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8); >- if (!imageBuffer) >- return; > >- m_context.paintRenderingResultsToCanvas(*imageBuffer.get()); >-#else > TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture; > if (m_context.contextAttributes().alpha) > flags |= TextureMapperGL::ShouldBlend; >-#endif > > { > auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy(); >-#if USE(ANGLE) >- // FIXME: This is duplicated from NicosiaImageBufferPipe, but should be shared somehow. >- auto proxyOperation = >- [this, imageBuffer = WTFMove(imageBuffer)] () mutable { >- auto nativeImage = ImageBuffer::sinkIntoNativeImage(WTFMove(imageBuffer)); >- if (!nativeImage) >- return; >- >- auto size = nativeImage->size(); >- auto flags = nativeImage->hasAlpha() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag; >- >- auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy(); >- Locker locker { proxy.lock() }; >- >- std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer = proxy.getAvailableBuffer(size, flags); >- >- if (!layerBuffer) { >- auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get()); >- texture->reset(size, flags); >- layerBuffer = makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(texture), nativeImage->hasAlpha() ? TextureMapperGL::ShouldBlend : TextureMapperGL::NoFlag); >- } >- >-#if USE(CAIRO) >- auto* surface = nativeImage->platformImage().get(); >- auto* imageData = cairo_image_surface_get_data(surface); >- layerBuffer->textureGL().updateContents(imageData, IntRect(IntPoint(), size), IntPoint(), cairo_image_surface_get_stride(surface)); >-#else >- notImplemented(); >-#endif >- >- proxy.pushNextBuffer(WTFMove(layerBuffer)); >- >- m_context.markLayerComposited(); >- }; >- >- proxy.scheduleUpdateOnCompositorThread([proxyOperation] () mutable { >- proxyOperation(); >- }); >- >- return; >-#else > Locker locker { proxy.lock() }; > proxy.pushNextBuffer(makeUnique<TextureMapperPlatformLayerBuffer>(m_context.m_compositorTexture, textureSize, flags, m_context.m_internalColorFormat)); >-#endif > } > > m_context.markLayerComposited(); >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h >index 3c0a0234a4e6ffc9cd518ac36a664256e818e7dc..1966c79fcbbadee36d70ad5f0a4f70ed7f31dc37 100644 >--- a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h >+++ b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h >@@ -28,17 +28,12 @@ > > #pragma once > >-#if ENABLE(WEBGL) && USE(NICOSIA) && USE(TEXTURE_MAPPER) >+#if ENABLE(WEBGL) && USE(NICOSIA) && USE(TEXTURE_MAPPER) && !USE(ANGLE) > >+#include "GraphicsContextGLOpenGL.h" > #include "NicosiaContentLayerTextureMapperImpl.h" > #include <memory> > >-#if USE(ANGLE) >-#include "GraphicsContextGLANGLE.h" >-#else >-#include "GraphicsContextGLOpenGL.h" >-#endif >- > namespace WebCore { > class GLContext; > } >@@ -48,12 +43,7 @@ namespace Nicosia { > class GCGLLayer : public ContentLayerTextureMapperImpl::Client { > WTF_MAKE_FAST_ALLOCATED; > public: >-#if USE(ANGLE) >- using GraphicsContextGLType = WebCore::GraphicsContextGLANGLE; >-#else >- using GraphicsContextGLType = WebCore::GraphicsContextGLOpenGL; >-#endif >- explicit GCGLLayer(GraphicsContextGLType&); >+ explicit GCGLLayer(WebCore::GraphicsContextGLOpenGL&); > > virtual ~GCGLLayer(); > >@@ -64,7 +54,7 @@ public: > void swapBuffersIfNeeded() override; > > private: >- GraphicsContextGLType& m_context; >+ WebCore::GraphicsContextGLOpenGL& m_context; > std::unique_ptr<WebCore::GLContext> m_glContext; > > Ref<ContentLayer> m_contentLayer; >diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp >index 750a84af6382c54130cf36e86d9bc8c7604cfbcb..53ed74addaff4a792fe60c095594cc60bd81cf5a 100644 >--- a/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp >+++ b/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp >@@ -60,7 +60,7 @@ > > #if USE(NICOSIA) > #if USE(ANGLE) >-#include "NicosiaGCGLANGLELayer.h" >+#include "NicosiaGCGLANGLEPipe.h" > #else > #include "NicosiaGCGLLayer.h" > #endif >@@ -116,7 +116,11 @@ GraphicsContextGLTextureMapper::~GraphicsContextGLTextureMapper() = default; > GraphicsContextGLTextureMapper::GraphicsContextGLTextureMapper(GraphicsContextGLAttributes&& attributes) > : GraphicsContextGLTextureMapperBase(WTFMove(attributes)) > #if USE(NICOSIA) >+#if USE(ANGLE) >+ , m_layerContentsDisplayDelegate(*m_nicosiaPipe->layerContentsDisplayDelegate()) >+#else > , m_layerContentsDisplayDelegate(PlatformLayerDisplayDelegate::create(&m_nicosiaLayer->contentLayer())) >+#endif > #else > , m_layerContentsDisplayDelegate(PlatformLayerDisplayDelegate::create(m_texmapLayer.get())) > #endif >diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp >index cfad8438e84595012ef1933ff6bf837f25246a75..a1e1e844993f0d34e1373df4b53b7611d4b9386b 100644 >--- a/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp >+++ b/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp >@@ -36,7 +36,7 @@ > #include "PixelBuffer.h" > > #if USE(NICOSIA) >-#include "NicosiaGCGLANGLELayer.h" >+#include "NicosiaGCGLANGLEPipe.h" > #else > #include "TextureMapperGCGLPlatformLayer.h" > #endif >@@ -50,7 +50,7 @@ GraphicsContextGLANGLE::GraphicsContextGLANGLE(GraphicsContextGLAttributes attri > m_isForWebGL2 = attributes.webGLVersion == GraphicsContextGLWebGLVersion::WebGL2; > #endif > #if USE(NICOSIA) >- m_nicosiaLayer = makeUnique<Nicosia::GCGLANGLELayer>(*this); >+ m_nicosiaPipe = makeUnique<Nicosia::GCGLANGLEPipe>(*this); > #else > m_texmapLayer = makeUnique<TextureMapperGCGLPlatformLayer>(*this); > #endif >@@ -144,7 +144,7 @@ GraphicsContextGLANGLE::~GraphicsContextGLANGLE() > PlatformGraphicsContextGLDisplay GraphicsContextGLANGLE::platformDisplay() const > { > #if USE(NICOSIA) >- return m_nicosiaLayer->platformDisplay(); >+ return m_nicosiaPipe->platformDisplay(); > #else > return m_texmapLayer->platformDisplay(); > #endif >@@ -153,7 +153,7 @@ PlatformGraphicsContextGLDisplay GraphicsContextGLANGLE::platformDisplay() const > PlatformGraphicsContextGLConfig GraphicsContextGLANGLE::platformConfig() const > { > #if USE(NICOSIA) >- return m_nicosiaLayer->platformConfig(); >+ return m_nicosiaPipe->platformConfig(); > #else > return m_texmapLayer->platformConfig(); > #endif >@@ -162,7 +162,7 @@ PlatformGraphicsContextGLConfig GraphicsContextGLANGLE::platformConfig() const > bool GraphicsContextGLANGLE::makeContextCurrent() > { > #if USE(NICOSIA) >- return m_nicosiaLayer->makeContextCurrent(); >+ return m_nicosiaPipe->makeContextCurrent(); > #else > return m_texmapLayer->makeContextCurrent(); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 235182
:
449058
|
449159