WebKit Bugzilla
Attachment 346623 Details for
Bug 188344
: [Nicosia] Add the TextureMapper-specific ContentLayer::Impl derivative
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188344-20180806132320.patch (text/plain), 9.01 KB, created by
Zan Dobersek
on 2018-08-06 04:23:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2018-08-06 04:23:22 PDT
Size:
9.01 KB
patch
obsolete
>Subversion Revision: 234595 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1bf4f8bcaf991713011fab34eeb35152d542ddfa..ce0d9e86a67554b7ceeeef05ecc6a0f157649a02 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2018-08-06 Zan Dobersek <zdobersek@igalia.com> >+ >+ [Nicosia] Add the TextureMapper-specific ContentLayer::Impl derivative >+ https://bugs.webkit.org/show_bug.cgi?id=188344 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add Nicosia::ContentLayerTextureMapperImpl class, providing the >+ TextureMapper-specific implementation that derives from the >+ ContentLayer::Impl class and which can be used by the >+ Nicosia::ContentLayer instances. >+ >+ Internally a TextureMapperPlatformLayerProxy is created, and is >+ accessible to others through a getter. This way the content producers >+ can push new buffers into this proxy object, and the scene compositor >+ can take these buffers for display purposes. >+ >+ Nicosia::ContentLayerTextureMapperImpl::swapBuffersIfNeeded() will be >+ called during layer flushes, and the call will cause the content layer >+ clients to take their texture, wrap it into a buffer, and push it into >+ the TextureMapperPlatformLayerProxy object. At the moment this operation >+ is required by the ImageBuffer and GraphicsContext3D producers. >+ >+ The Client object is managed under its own lock. While the producers >+ will only live on the main thread, the thread-safe check in the >+ destructor is necessary in case the ContentLayerTextureMapperImpl object >+ ends up being destroyed on some other thread. >+ >+ The patch only adds the class implementation. It will be integrated into >+ the layer tree later, once all the other pieces of the puzzle land. >+ >+ * platform/TextureMapper.cmake: >+ * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp: Added. >+ (Nicosia::ContentLayerTextureMapperImpl::createFactory): >+ (Nicosia::ContentLayerTextureMapperImpl::ContentLayerTextureMapperImpl): >+ (Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl): >+ (Nicosia::ContentLayerTextureMapperImpl::invalidateClient): >+ (Nicosia::ContentLayerTextureMapperImpl::swapBuffersIfNeeded): >+ * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h: Added. >+ > 2018-08-06 Zan Dobersek <zdobersek@igalia.com> > > Unreviewed follow-up to r234594. >diff --git a/Source/WebCore/platform/TextureMapper.cmake b/Source/WebCore/platform/TextureMapper.cmake >index dbec3883ecf1aa50bffd9d5590b35278e12c2c0e..0e15657c17ab74b4883d3d0209823990bf195788 100644 >--- a/Source/WebCore/platform/TextureMapper.cmake >+++ b/Source/WebCore/platform/TextureMapper.cmake >@@ -56,6 +56,8 @@ if (USE_COORDINATED_GRAPHICS) > > platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp > platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp >+ >+ platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp > ) > else () > list(APPEND WebCore_SOURCES >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..63943261928b9cadbe97c247527baec4396be707 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp >@@ -0,0 +1,77 @@ >+/* >+ * Copyright (C) 2018 Metrological Group B.V. >+ * Copyright (C) 2018 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 "NicosiaContentLayerTextureMapperImpl.h" >+ >+#if USE(TEXTURE_MAPPER) >+ >+#include "TextureMapperPlatformLayerProxy.h" >+ >+namespace Nicosia { >+ >+auto ContentLayerTextureMapperImpl::createFactory(Client& client) -> Factory >+{ >+ return Factory( >+ [&client](ContentLayer&) { >+ return std::make_unique<ContentLayerTextureMapperImpl>(client); >+ }); >+} >+ >+ContentLayerTextureMapperImpl::ContentLayerTextureMapperImpl(Client& client) >+ : m_proxy(adoptRef(*new WebCore::TextureMapperPlatformLayerProxy)) >+ , m_client { { }, &client } >+{ >+} >+ >+ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl() >+{ >+#if !ASSERT_DISABLED >+ LockHolder locker(m_client.lock); >+ ASSERT(!m_client.object); >+#endif >+} >+ >+void ContentLayerTextureMapperImpl::invalidateClient() >+{ >+ LockHolder locker(m_client.lock); >+ m_client.object = nullptr; >+} >+ >+void ContentLayerTextureMapperImpl::swapBuffersIfNeeded() >+{ >+ LockHolder locker(m_client.lock); >+ if (m_client.object) >+ m_client.object->swapBuffersIfNeeded(); >+} >+ >+ContentLayerTextureMapperImpl::Client::~Client() = default; >+ >+} // namespace Nicosia >+ >+#endif // USE(TEXTURE_MAPPER) >diff --git a/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8103573a3aa171b20b9aa33a66719d5513ec0e07 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2018 Metrological Group B.V. >+ * Copyright (C) 2018 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(TEXTURE_MAPPER) >+ >+#include "NicosiaPlatformLayer.h" >+#include <wtf/Lock.h> >+#include <wtf/Ref.h> >+ >+namespace WebCore { >+class TextureMapperPlatformLayerProxy; >+} >+ >+namespace Nicosia { >+ >+class ContentLayerTextureMapperImpl final : public ContentLayer::Impl { >+public: >+ class Client { >+ public: >+ virtual ~Client(); >+ virtual void swapBuffersIfNeeded() = 0; >+ }; >+ >+ static Factory createFactory(Client&); >+ >+ ContentLayerTextureMapperImpl(Client&); >+ virtual ~ContentLayerTextureMapperImpl(); >+ bool isTextureMapperImpl() const override { return true; } >+ >+ void invalidateClient(); >+ >+ const Ref<WebCore::TextureMapperPlatformLayerProxy>& proxy() const { return m_proxy; } >+ void swapBuffersIfNeeded(); >+ >+private: >+ Ref<WebCore::TextureMapperPlatformLayerProxy> m_proxy; >+ struct { >+ Lock lock; >+ Client* object { nullptr }; >+ } m_client; >+}; >+ >+} // namespace Nicosia >+ >+SPECIALIZE_TYPE_TRAITS_NICOSIA_CONTENTLAYER_IMPL(ContentLayerTextureMapperImpl, isTextureMapperImpl()); >+ >+#endif // USE(TEXTURE_MAPPER)
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 188344
:
346623
|
346698